//
// GameObject::addMainSpriteToParent from 0x44d8be to 0x44d974 (182 bytes)
//
// 2 xrefs:
// > ParticleGameObject::addMainSpriteToParent @ 0x4e65fc
// > LabelGameObject::addMainSpriteToParent @ 0x4e6960
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:48:35 +0000
//
int __fastcall GameObject::addMainSpriteToParent(GJSpriteColor **this, int a2)
{
int v4; // r8
int ObjectZLayer; // r0
char v6; // r6
int v7; // r5
int ParentMode; // r0
int v9; // r6
int result; // r0
int v11; // r5
int (__fastcall *v12)(int, GJSpriteColor **, int); // r5
int v13; // r0
int (__fastcall *v14)(int, GJSpriteColor **, int); // r6
int ObjectZOrder; // r0
int v16; // r3
int v17; // r2
GameObject::updateBlendMode(this);
v4 = (int)*(this + 189);
ObjectZLayer = GameObject::getObjectZLayer((GameObject *)this);
v6 = *((_BYTE *)this + 752);
v7 = ObjectZLayer;
if ( v6 && v4 && !*((_BYTE *)this + 753) && !*((_BYTE *)this + 917) )
v7 = ObjectZLayer + 1;
ParentMode = GameObject::getParentMode((GameObject *)this);
v9 = GameObject::parentForZLayer((GameObject *)this, v7, v6, ParentMode);
result = (*((int (__fastcall **)(GJSpriteColor **))*this + 64))(this);
v11 = result;
if ( result == v9 )
{
if ( a2 )
{
v14 = *(int (__fastcall **)(int, GJSpriteColor **, int))(*(_DWORD *)result + 296);
ObjectZOrder = GameObject::getObjectZOrder((GameObject *)this);
result = v14(v11, this, ObjectZOrder);
}
}
else
{
(*((void (__fastcall **)(GJSpriteColor **, _DWORD))*this + 66))(this, 0);
v12 = *(int (__fastcall **)(int, GJSpriteColor **, int))(*(_DWORD *)v9 + 232);
v13 = GameObject::getObjectZOrder((GameObject *)this);
result = v12(v9, this, v13);
}
v16 = *((unsigned __int8 *)this + 752);
v17 = *((unsigned __int8 *)this + 968);
if ( !*((_BYTE *)this + 752) )
v16 = *((unsigned __int8 *)this + 753);
*((_BYTE *)this + 968) = v16;
if ( v16 != v17 )
return (*((int (__fastcall **)(GJSpriteColor **))*this + 205))(this);
return result;
}