//
// GameObject::addColorSpriteToParent from 0x76f930 to 0x76fb2c (508 bytes)
//
// 4 xrefs:
// > PlayLayer::updateVisibility @ 0x701258
// > GameObject::activateObject @ 0x76fbd8
// > LevelEditorLayer::updateVisibility @ 0x78e3e0
// > ??> @ 0x62e78
//
// This function is hookable on this platform (idp: arm, 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:53:12 +0000
//
__int64 __fastcall GameObject::addColorSpriteToParent(__int64 this, unsigned __int8 a2)
{
int v2; // w21
_QWORD **v3; // x19
int v4; // w22
int ObjectZLayer; // w1
_QWORD *v6; // x20
void (__fastcall *v7)(_QWORD *); // x23
_QWORD *v8; // x20
void (__fastcall *v9)(_QWORD *); // x23
_QWORD *v10; // x20
void (__fastcall *v11)(_QWORD *); // x23
_QWORD *v12; // x20
void (__fastcall *v13)(_QWORD *); // x23
int ParentMode; // w0
__int64 v15; // x20
__int64 (__fastcall *v16)(__int64, _QWORD, _QWORD); // x21
unsigned int v17; // w0
_QWORD *v18; // x20
_QWORD **v19; // x0
__int64 (__fastcall *v20)(_QWORD **); // x1
__int64 (__fastcall *v21)(_QWORD *, __int64); // x19
__int64 v22; // x0
GameObject *v23; // x0
__int64 (__fastcall *v24)(__int64, _QWORD, _QWORD); // x19
unsigned int ObjectZOrder; // w0
int v26; // [xsp+48h] [xbp+48h]
int v27[2]; // [xsp+48h] [xbp+48h]
int v28[2]; // [xsp+48h] [xbp+48h]
v2 = a2;
v3 = (_QWORD **)this;
if ( *(_QWORD *)(this + 888) && !*(_BYTE *)(this + 652) )
{
if ( *(unsigned __int8 *)(this + 884) == *(unsigned __int8 *)(this + 885) )
{
return GameObject::addColorSpriteToSelf((GameObject *)this);
}
else
{
v4 = *(unsigned __int8 *)(this + 866);
*(_BYTE *)(this + 866) = 0;
ObjectZLayer = GameObject::getObjectZLayer((GameObject *)this);
if ( *((_BYTE *)v3 + 885) && *((_BYTE *)v3 + 1053) )
++ObjectZLayer;
v6 = v3[111];
v26 = ObjectZLayer;
v7 = *(void (__fastcall **)(_QWORD *))(*v6 + 128LL);
((void (__fastcall *)(_QWORD **))(*v3)[17])(v3);
v7(v6);
v8 = v3[111];
v9 = *(void (__fastcall **)(_QWORD *))(*v8 + 144LL);
((void (__fastcall *)(_QWORD **))(*v3)[19])(v3);
v9(v8);
v10 = v3[111];
v11 = *(void (__fastcall **)(_QWORD *))(*v10 + 376LL);
((void (__fastcall *)(_QWORD **))(*v3)[48])(v3);
v11(v10);
v12 = v3[111];
v13 = *(void (__fastcall **)(_QWORD *))(*v12 + 392LL);
((void (__fastcall *)(_QWORD **))(*v3)[50])(v3);
v13(v12);
LOBYTE(v12) = *((_BYTE *)v3 + 885);
ParentMode = GameObject::getParentMode((GameObject *)v3);
v15 = GameObject::parentForZLayer((GameObject *)v3, v26, (bool)v12, ParentMode);
this = (*(__int64 (__fastcall **)(_QWORD *))(*v3[111] + 512LL))(v3[111]);
if ( v15 == this )
{
if ( v2 )
{
v23 = (GameObject *)v3;
*(_QWORD *)v28 = v3[111];
v24 = *(__int64 (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)v15 + 592LL);
ObjectZOrder = GameObject::getObjectZOrder(v23);
return v24(v15, *(_QWORD *)v28, ObjectZOrder);
}
}
else
{
(*(void (__fastcall **)(_QWORD *, _QWORD))(*v3[111] + 528LL))(v3[111], 0);
*(_QWORD *)v27 = v3[111];
v16 = *(__int64 (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)v15 + 464LL);
v17 = GameObject::getObjectZOrder((GameObject *)v3);
this = v16(v15, *(_QWORD *)v27, v17);
if ( v4 )
{
v18 = v3[111];
v19 = v3;
v20 = (__int64 (__fastcall *)(_QWORD **))(*v3)[24];
v21 = *(__int64 (__fastcall **)(_QWORD *, __int64))(*v18 + 184LL);
v22 = v20(v19);
return v21(v18, v22);
}
}
}
}
return this;
}