//
// GameObject::addColorSpriteToParent from 0x140299030 to 0x140299212 (482 bytes)
//
// 7 xrefs:
// > GameObject::activateObject @ 0x14028dd75
// > LevelEditorLayer::updateVisibility @ 0x1403f67c8
// > PlayLayer::updateVisibility @ 0x14050e7fc
// > AnimatedGameObject::activateObject @ 0x1406458e3
// > ??> @ 0x1408af530
// > ??> @ 0x1408af56c
// > ??> @ 0x14091d690
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:29:11 +0000
//
void __fastcall GameObject::addColorSpriteToParent(__int64 a1, char a2)
{
__int64 *v2; // rdi
char v5; // al
int v6; // ebp
char v7; // r15
__int64 v8; // rbx
__int64 *v9; // rdi
__int64 v10; // rbx
__int64 *v11; // rdi
__int64 v12; // rbx
__int64 *v13; // rdi
__int64 v14; // rbx
int ParentMode; // eax
unsigned __int8 v16; // r10
__int64 v17; // rbx
__int64 *v18; // rdi
__int64 v19; // rbx
__int64 v20; // rax
v2 = *(__int64 **)(a1 + 896);
if ( v2 && !*(_BYTE *)(a1 + 656) )
{
v5 = *(_BYTE *)(a1 + 893);
if ( *(_BYTE *)(a1 + 892) == v5 )
{
GameObject::addColorSpriteToSelf(a1);
}
else
{
v6 = *(_DWORD *)(a1 + 1132);
v7 = *(_BYTE *)(a1 + 874);
*(_BYTE *)(a1 + 874) = 0;
if ( !v6 )
v6 = *(_DWORD *)(a1 + 1124);
if ( v5 && *(_BYTE *)(a1 + 1061) )
++v6;
v8 = *v2;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 128LL))(a1);
(*(void (__fastcall **)(__int64 *))(v8 + 120))(v2);
v9 = *(__int64 **)(a1 + 896);
v10 = *v9;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 144LL))(a1);
(*(void (__fastcall **)(__int64 *))(v10 + 136))(v9);
v11 = *(__int64 **)(a1 + 896);
v12 = *v11;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 376LL))(a1);
(*(void (__fastcall **)(__int64 *))(v12 + 368))(v11);
v13 = *(__int64 **)(a1 + 896);
v14 = *v13;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 392LL))(a1);
(*(void (__fastcall **)(__int64 *))(v14 + 384))(v13);
ParentMode = GameObject::getParentMode(a1);
v17 = GameObject::parentForZLayer(a1, v6, v16, ParentMode);
if ( (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 896) + 504LL))(*(_QWORD *)(a1 + 896)) == v17 )
{
if ( a2 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v17 + 584LL))(v17, *(_QWORD *)(a1 + 896));
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 896) + 520LL))(*(_QWORD *)(a1 + 896), 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v17 + 456LL))(v17, *(_QWORD *)(a1 + 896));
if ( v7 )
{
v18 = *(__int64 **)(a1 + 896);
v19 = *v18;
v20 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 200LL))(a1);
(*(void (__fastcall **)(__int64 *, __int64))(v19 + 184))(v18, v20);
}
}
}
}
}