//
// GameObject::addColorSpriteToParent from 0x10067b7c0 to 0x10067b9c6 (518 bytes)
//
// 3 xrefs:
// > PlayLayer::updateVisibility @ 0x1000851e8
// > LevelEditorLayer::updateVisibility @ 0x1000bdda9
// > GameObject::activateObject @ 0x10067b739
//
// 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 12:35:03 +0000
//
__int64 __fastcall GameObject::addColorSpriteToParent(__int64 a1, char a2)
{
__int64 result; // rax
__int64 v3; // r15
char v4; // al
int v5; // ebx
__int64 v7; // r15
__int64 v8; // r15
__int64 v9; // r15
unsigned int ParentMode; // r12d
__int64 v11; // r13
__int64 v12; // rax
__int64 v13; // rbx
__int64 v14; // rbx
__int64 v15; // rax
char v16; // [rsp+7h] [rbp-29h]
v3 = *(_QWORD *)(a1 + 888);
if ( v3 && !*(_BYTE *)(a1 + 652) )
{
v4 = *(_BYTE *)(a1 + 885);
if ( *(_BYTE *)(a1 + 884) == v4 )
{
return GameObject::addColorSpriteToSelf(a1);
}
else
{
v16 = *(_BYTE *)(a1 + 866);
*(_BYTE *)(a1 + 866) = 0;
v5 = *(_DWORD *)(a1 + 1124);
if ( !v5 )
v5 = *(_DWORD *)(a1 + 1116);
if ( v4 )
v5 += *(unsigned __int8 *)(a1 + 1053);
(*(void (**)(void))(*(_QWORD *)a1 + 136LL))();
(*(void (__fastcall **)(__int64))(*(_QWORD *)v3 + 128LL))(v3);
v7 = *(_QWORD *)(a1 + 888);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 152LL))(a1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v7 + 144LL))(v7);
v8 = *(_QWORD *)(a1 + 888);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 384LL))(a1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v8 + 376LL))(v8);
v9 = *(_QWORD *)(a1 + 888);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 400LL))(a1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v9 + 392LL))(v9);
LOBYTE(v9) = *(_BYTE *)(a1 + 885);
ParentMode = GameObject::getParentMode(a1);
v11 = *(unsigned __int8 *)(a1 + 649);
v12 = GameManager::sharedState();
v13 = GJBaseGameLayer::parentForZLayer(
*(_QWORD *)(v12 + 8 * v11 + 544),
v5,
v9,
ParentMode,
*(unsigned __int8 *)(a1 + 1345));
result = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 888) + 512LL))(*(_QWORD *)(a1 + 888));
if ( result == v13 )
{
if ( a2 )
return (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v13 + 592LL))(v13, *(_QWORD *)(a1 + 888));
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 888) + 528LL))(*(_QWORD *)(a1 + 888), 0);
result = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v13 + 464LL))(v13, *(_QWORD *)(a1 + 888));
if ( v16 )
{
v14 = *(_QWORD *)(a1 + 888);
v15 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 192LL))(a1);
return (*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)v14 + 184LL))(v14, v15);
}
}
}
}
return result;
}