//
// GameObject::commonSetup from 0x45afe8 to 0x45b140 (344 bytes)
//
// 2 xrefs:
// > GameObject::init @ 0x45b16e
// > GameObject::initWithTexture @ 0x45b2fe
//
// 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:48 +0000
//
int __fastcall GameObject::commonSetup(GameObject *this, unsigned int a2)
{
GameManager *v3; // r0
GameManager *v4; // r0
int v5; // r0
unsigned __int8 *v6; // r0
int v7; // r3
GameManager *v8; // r0
_DWORD *v9; // r3
int v10; // r0
int v11; // r2
signed int v12; // r2
int result; // r0
unsigned int v14[2]; // [sp+0h] [bp-8h] BYREF
v14[0] = (unsigned int)this;
v14[1] = a2;
v3 = (GameManager *)GameObject::assignUniqueID((int)this);
v4 = (GameManager *)GameManager::sharedState(v3);
if ( *((_DWORD *)v4 + 101) )
{
v5 = GameManager::sharedState(v4);
v14[0] = *((_DWORD *)this + 195);
v4 = (GameManager *)std::unordered_map::operator[](*(_DWORD *)(v5 + 404) + 11668, v14);
*(_DWORD *)v4 = this;
}
v6 = (unsigned __int8 *)GameManager::sharedState(v4);
v7 = v6[506];
*((_BYTE *)this + 549) = v7;
if ( !v7 )
{
v8 = (GameManager *)GameManager::sharedState((GameManager *)v6);
if ( *((_DWORD *)v8 + 101) )
*((_DWORD *)this + 276) = *(_DWORD *)(*(_DWORD *)(GameManager::sharedState(v8) + 404) + 1524);
}
GameObject::createSpriteColor(this, 1);
v9 = *((_DWORD **)this + 240);
v9[1] = 1004;
*v9 = 0;
v10 = dword_D2B880;
*((_DWORD *)this + 228) = 2;
*((_WORD *)this + 436) = -1;
*((_WORD *)this + 437) = -1;
v11 = dword_D2B884;
*((_DWORD *)this + 235) = 1065353216;
*((_BYTE *)this + 880) = 1;
*((_DWORD *)this + 193) = 1065353216;
*((_DWORD *)this + 194) = 1065353216;
*((_DWORD *)this + 211) = 1065353216;
*((_DWORD *)this + 212) = 1065353216;
*(_QWORD *)&dword_D2B880 = 214013 * __PAIR64__(v11, v10) + 2531011;
v12 = HIWORD(dword_D2B880) & 0x7FFF;
*((_WORD *)this + 434) = (int)(float)((float)((float)v12 / 32767.0) * 1900.0);
*((_DWORD *)this + 162) = *((_DWORD *)this + 86);
*((_DWORD *)this + 163) = *((_DWORD *)this + 87);
*((_DWORD *)this + 209) = 0;
*((_DWORD *)this + 210) = 0;
(*(void (__fastcall **)(GameObject *, int, signed int))(*(_DWORD *)this + 64))(this, 1065353216, v12);
result = (*(int (__fastcall **)(GameObject *, int))(*(_DWORD *)this + 72))(this, 1065353216);
*((_BYTE *)this + 657) = 0;
*((_BYTE *)this + 708) = 1;
*((_BYTE *)this + 732) = 1;
return result;
}