//
// PlayLayer::addObject from 0x400228 to 0x400a80 (2136 bytes)
//
// 4 xrefs:
// > PlayLayer::addObject @ 0x4004ee
// > PlayLayer::addLiveStartPosObject @ 0x406778
// > PlayLayer::setupHasCompleted @ 0x40a798
// > PlayLayer::processCreateObjectsFromSetup @ 0x40ad7e
//
// 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:47:24 +0000
//
int __fastcall PlayLayer::addObject(int this, GameObject *a2)
{
int v2; // r6
int v4; // r1
const cocos2d::CCPoint *v5; // r0
int v6; // r0
cocos2d::CCNode *v7; // r1
float v8; // r0
bool v9; // r2
_DWORD *v10; // r0
_BYTE *v11; // r5
void (__fastcall *v12)(_BYTE *, float *); // r10
void (__fastcall *v13)(_BYTE *, int); // r9
unsigned __int8 v14; // r0
int v15; // r9
int v16; // r5
cocos2d::CCArray *v17; // r0
bool v18; // zf
bool v19; // zf
int v20; // r3
_BYTE *v21; // r3
char v22; // r1
char v23; // r2
char v24; // r3
_BYTE *v25; // r3
GameObject *BallFrame; // r0
const char *v27; // r1
GameObject *v28; // r0
GameObject *v29; // r5
int v30; // r1
void (__fastcall *v31)(GameObject *, float *); // r11
int v32; // r0
const char *v33; // r1
int v34; // r5
int v35; // r9
char *v36; // r0
_DWORD *v37; // r0
_DWORD *v38; // r5
int v39; // r3
void (__fastcall *v40)(_DWORD *, float *); // r11
const cocos2d::CCPoint *v41; // r0
int ObjectZOrder; // r0
int v43; // r3
void (__fastcall *v44)(_DWORD *, int); // r7
int v45; // r0
void (__fastcall *v46)(_DWORD *, int); // r7
int v47; // r0
void (__fastcall *v48)(_DWORD *, int); // r7
int v49; // r0
void (__fastcall *v50)(_DWORD *, int); // r7
int v51; // r0
float v52[2]; // [sp+4h] [bp-18h] BYREF
float v53[2]; // [sp+Ch] [bp-10h] BYREF
v2 = this;
if ( !a2 )
return this;
if ( (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 900))(a2) == 25 )
GameObject::determineSlopeDirection(a2);
else
GameObject::updateIsOriented(a2);
(*(void (__fastcall **)(GameObject *, _DWORD))(*(_DWORD *)a2 + 172))(a2, 0);
(*(void (__fastcall **)(float *, GameObject *))(*(_DWORD *)a2 + 908))(v53, a2);
if ( v53[0] > *(float *)(v2 + 11896) )
{
(*(void (__fastcall **)(float *, GameObject *))(*(_DWORD *)a2 + 908))(v53, a2);
*(float *)(v2 + 11896) = v53[0];
}
if ( !GameObject::isSettingsObject(a2)
&& ((*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 900))(a2) != 20
|| *((_DWORD *)a2 + 271) == 1 && *((_BYTE *)a2 + 1292)
|| *((_DWORD *)a2 + 223) == 2063) )
{
(*(void (__fastcall **)(int, GameObject *))(*(_DWORD *)v2 + 672))(v2, a2);
}
else
{
*((_DWORD *)a2 + 132) = -1;
}
if ( *((_DWORD *)a2 + 223) == 3663 )
*(_BYTE *)(v2 + 12060) = 1;
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v2 + 2088), a2);
GJBaseGameLayer::addToGroups((GJBaseGameLayer *)v2, a2, 1);
if ( *((_DWORD *)a2 + 223) == 1615 )
{
GJBaseGameLayer::addObjectCounter((GJBaseGameLayer *)v2, a2);
}
else if ( (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 900))(a2) == 30
|| (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 900))(a2) == 31 )
{
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v2 + 11884), a2);
}
GameObject::getActiveColorForMode(a2, *((_DWORD *)a2 + 139), 1);
if ( GameObject::hasSecondaryColor(a2) )
GameObject::getActiveColorForMode(a2, *((_DWORD *)a2 + 140), 0);
if ( *((_BYTE *)a2 + 1088)
&& *((_DWORD *)a2 + 271) == 1
&& (!*((_BYTE *)a2 + 1292) && !*((_BYTE *)a2 + 1293)
|| (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 844))(a2)) )
{
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v2 + 2100), a2);
}
if ( *(_BYTE *)(v2 + 10614) )
*((_BYTE *)a2 + 608) = 0;
if ( *((_DWORD *)a2 + 223) == 747 )
{
v5 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 96))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, v5);
v6 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 96))(a2);
v7 = *(cocos2d::CCNode **)(v2 + 1716);
v52[1] = *(float *)(v6 + 4) + *((float *)a2 + 415);
v8 = COERCE_FLOAT(TeleportPortalObject::getTeleportXOff(a2, v7));
v52[0] = v52[0] + v8;
v10 = (_DWORD *)TeleportPortalObject::create((TeleportPortalObject *)"portal_16_front_001.png", nullptr, v9);
*((_DWORD *)a2 + 413) = v10;
v11 = v10;
v10[223] = 749;
(*(void (__fastcall **)(_DWORD *))(*v10 + 632))(v10);
v12 = *(void (__fastcall **)(_BYTE *, float *))(*(_DWORD *)v11 + 684);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, (const cocos2d::CCPoint *)v52);
v12(v11, v53);
v11[916] = 1;
*((_DWORD *)v11 + 246) = *((_DWORD *)a2 + 246);
*((_DWORD *)v11 + 228) = *((_DWORD *)a2 + 228);
v13 = *(void (__fastcall **)(_BYTE *, int))(*(_DWORD *)v11 + 620);
v14 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 712))(a2);
v13(v11, v14 ^ 1);
v11[860] = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 712))(a2) ^ 1;
v11[906] = *((_BYTE *)a2 + 906);
v11[907] = *((_BYTE *)a2 + 907);
v11[908] = *((_BYTE *)a2 + 908);
v15 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 184))(a2);
(*(void (__fastcall **)(_BYTE *, int))(*(_DWORD *)v11 + 180))(v11, v15);
*((_DWORD *)v11 + 209) = v15;
*((_DWORD *)v11 + 210) = v15;
GameObject::copyGroups((GameObject *)v11, a2);
GameObject::updateCustomScaleX((GameObject *)v11, *((float *)a2 + 252));
GameObject::updateCustomScaleY((GameObject *)v11, *((float *)a2 + 253));
*((_DWORD *)v11 + 285) = *((_DWORD *)a2 + 285);
*((_DWORD *)v11 + 286) = *((_DWORD *)a2 + 286);
if ( *((_BYTE *)a2 + 1114) )
v11[1114] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_DWORD *)v11 + 808))(v11);
PlayLayer::addObject((PlayLayer *)v2, (GameObject *)v11);
}
v16 = *((_DWORD *)a2 + 223);
if ( v16 >= 288 )
{
if ( v16 == 1022 )
goto LABEL_142;
if ( v16 > 1022 )
{
if ( v16 == 1816 )
{
if ( !*((_BYTE *)a2 + 1497) )
goto LABEL_143;
v17 = *(cocos2d::CCArray **)(v2 + 2092);
goto LABEL_141;
}
if ( v16 <= 1816 )
{
if ( v16 == 1331 )
goto LABEL_90;
if ( v16 == 1333 )
goto LABEL_142;
v18 = v16 == 1330;
goto LABEL_54;
}
if ( v16 == 2064 )
goto LABEL_90;
if ( v16 > 2064 )
{
if ( v16 == 2902 )
goto LABEL_90;
v20 = 2926;
}
else
{
v20 = 1933;
}
}
else
{
if ( v16 == 747 )
goto LABEL_90;
if ( v16 < 748 )
{
if ( v16 == 744 )
goto LABEL_82;
if ( v16 == 745 )
goto LABEL_90;
v19 = v16 == 660;
goto LABEL_79;
}
if ( v16 > 900 )
{
if ( v16 != 915 )
goto LABEL_143;
goto LABEL_82;
}
if ( v16 >= 899 )
{
LABEL_82:
if ( *((_BYTE *)a2 + 1305) )
{
v21 = *(_BYTE **)(v2 + 2076);
v22 = v21[2106];
v23 = v21[2107];
v24 = v21[2108];
}
else
{
if ( !*((_BYTE *)a2 + 1306) )
goto LABEL_143;
v25 = *(_BYTE **)(v2 + 2076);
v22 = v25[2109];
v23 = v25[2110];
v24 = v25[2111];
}
*((_BYTE *)a2 + 1268) = v22;
*((_BYTE *)a2 + 1269) = v23;
*((_BYTE *)a2 + 1270) = v24;
goto LABEL_143;
}
v20 = 749;
}
v19 = v16 == v20;
goto LABEL_79;
}
if ( v16 >= 286 )
goto LABEL_90;
if ( v16 == 36 )
goto LABEL_142;
if ( v16 > 36 )
{
if ( v16 == 99 )
goto LABEL_90;
if ( v16 <= 99 )
{
if ( v16 < 45 )
goto LABEL_143;
if ( v16 <= 47 )
{
LABEL_90:
if ( *((_BYTE *)a2 + 1114) )
goto LABEL_143;
v32 = GJBaseGameLayer::addGuideArt((GJBaseGameLayer *)v2, a2);
v34 = *((_DWORD *)a2 + 223);
v35 = v32;
if ( v34 == 286 )
{
v36 = "portal_11_back_001.png";
goto LABEL_138;
}
if ( v34 <= 286 )
{
if ( v34 == 46 )
{
v36 = "portal_06_back_001.png";
goto LABEL_138;
}
if ( v34 > 46 )
{
if ( v34 == 99 )
{
v36 = "portal_08_back_001.png";
goto LABEL_138;
}
if ( v34 > 99 )
{
if ( v34 == 101 )
{
v36 = "portal_09_back_001.png";
goto LABEL_138;
}
if ( v34 == 111 )
{
v36 = "portal_10_back_001.png";
goto LABEL_138;
}
}
else if ( v34 == 47 )
{
v36 = "portal_07_back_001.png";
goto LABEL_138;
}
}
else
{
if ( v34 == 12 )
{
v36 = "portal_03_back_001.png";
goto LABEL_138;
}
if ( v34 > 12 )
{
if ( v34 == 13 )
{
v36 = "portal_04_back_001.png";
goto LABEL_138;
}
if ( v34 == 45 )
{
v36 = "portal_05_back_001.png";
goto LABEL_138;
}
}
else if ( v34 == 11 )
{
v36 = "portal_02_back_001.png";
LABEL_138:
v37 = (_DWORD *)GameObject::createWithFrame((GameObject *)v36, v33);
v37[223] = 38;
v38 = v37;
(*(void (__fastcall **)(_DWORD *, int))(*v37 + 904))(v37, 7);
v39 = *v38;
*((_BYTE *)v38 + 1110) = 1;
(*(void (__fastcall **)(_DWORD *))(v39 + 632))(v38);
v40 = *(void (__fastcall **)(_DWORD *, float *))(*v38 + 684);
v41 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 96))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, v41);
v40(v38, v53);
*((_BYTE *)v38 + 916) = 1;
v38[243] = 4;
ObjectZOrder = GameObject::getObjectZOrder(a2);
v43 = *v38;
v38[228] = ObjectZOrder - 100 + v35;
v44 = *(void (__fastcall **)(_DWORD *, int))(v43 + 620);
v45 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 712))(a2);
v44(v38, v45);
v46 = *(void (__fastcall **)(_DWORD *, int))(*v38 + 624);
v47 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 716))(a2);
v46(v38, v47);
v48 = *(void (__fastcall **)(_DWORD *, int))(*v38 + 188);
v49 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 192))(a2);
v48(v38, v49);
v50 = *(void (__fastcall **)(_DWORD *, int))(*v38 + 196);
v51 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 200))(a2);
v50(v38, v51);
v38[209] = *((_DWORD *)a2 + 209);
v38[210] = *((_DWORD *)a2 + 210);
*((_BYTE *)v38 + 860) = *((_BYTE *)a2 + 860);
*((_BYTE *)v38 + 861) = *((_BYTE *)a2 + 861);
GameObject::updateCustomScaleX((GameObject *)v38, *((float *)a2 + 252));
GameObject::updateCustomScaleY((GameObject *)v38, *((float *)a2 + 253));
v38[211] = *((_DWORD *)a2 + 211);
v38[212] = *((_DWORD *)a2 + 212);
*((_BYTE *)v38 + 906) = *((_BYTE *)a2 + 906);
*((_BYTE *)v38 + 907) = *((_BYTE *)a2 + 907);
*((_BYTE *)v38 + 908) = *((_BYTE *)a2 + 908);
(*(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v2 + 672))(v2, v38);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v2 + 2088), (cocos2d::CCObject *)v38);
GameObject::copyGroups((GameObject *)v38, a2);
GJBaseGameLayer::addToGroups((GJBaseGameLayer *)v2, (GameObject *)v38, 1);
*((_BYTE *)a2 + 916) = 1;
*((_DWORD *)a2 + 228) = v35 + 12;
(*(void (__fastcall **)(_DWORD *))(*v38 + 808))(v38);
v38[285] = *((_DWORD *)a2 + 285);
v38[286] = *((_DWORD *)a2 + 286);
goto LABEL_143;
}
}
LABEL_137:
v36 = "portal_01_back_001.png";
goto LABEL_138;
}
if ( v34 != 749 )
{
if ( v34 <= 749 )
{
if ( v34 == 660 )
{
v36 = "portal_13_back_001.png";
goto LABEL_138;
}
if ( v34 <= 660 )
{
if ( v34 == 287 )
{
v36 = "portal_12_back_001.png";
goto LABEL_138;
}
goto LABEL_137;
}
if ( v34 == 745 )
{
v36 = "portal_14_back_001.png";
goto LABEL_138;
}
if ( v34 != 747 )
goto LABEL_137;
LABEL_134:
v36 = "portal_15_back_001.png";
goto LABEL_138;
}
if ( v34 != 2064 )
{
if ( v34 <= 2064 )
{
if ( v34 == 1331 )
{
v36 = "portal_17_back_001.png";
goto LABEL_138;
}
if ( v34 == 1933 )
{
v36 = "portal_18_back_001.png";
goto LABEL_138;
}
goto LABEL_137;
}
if ( v34 != 2902 )
{
if ( v34 == 2926 )
{
v36 = "portal_19_back_001.png";
goto LABEL_138;
}
goto LABEL_137;
}
goto LABEL_134;
}
}
v36 = "portal_16_back_001.png";
goto LABEL_138;
}
v18 = v16 == 84;
LABEL_54:
if ( !v18 )
goto LABEL_143;
LABEL_142:
GJBaseGameLayer::addGuideArt((GJBaseGameLayer *)v2, a2);
goto LABEL_143;
}
if ( v16 == 105 )
goto LABEL_82;
if ( v16 > 105 )
{
if ( v16 == 111 )
goto LABEL_90;
v18 = v16 == 141;
goto LABEL_54;
}
v19 = v16 == 101;
LABEL_79:
if ( v19 )
goto LABEL_90;
goto LABEL_143;
}
if ( v16 > 17 )
{
if ( v16 < 29 )
goto LABEL_143;
if ( v16 > 30 )
{
if ( v16 != 31 )
goto LABEL_143;
v17 = *(cocos2d::CCArray **)(v2 + 10724);
LABEL_141:
cocos2d::CCArray::addObject(v17, a2);
goto LABEL_143;
}
goto LABEL_82;
}
if ( v16 >= 15 )
{
BallFrame = (GameObject *)GameObject::getBallFrame(*(GameObject **)(v2 + 11892), v4);
v28 = (GameObject *)GameObject::createWithFrame(BallFrame, v27);
*((_DWORD *)v28 + 223) = 37;
v29 = v28;
(*(void (__fastcall **)(GameObject *))(*(_DWORD *)v28 + 632))(v28);
v30 = *((_DWORD *)a2 + 139);
if ( v30 != 1004 )
GameObject::setMainColorMode(v29, v30);
GameObject::setDefaultMainColorMode(a2, 0);
(*(void (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 808))(a2);
(*(void (__fastcall **)(GameObject *))(*(_DWORD *)v29 + 808))(v29);
*((_DWORD *)a2 + 285) = 0;
*((_DWORD *)a2 + 286) = 0;
*((_DWORD *)v29 + 285) = 0;
*((_DWORD *)v29 + 286) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, *((float *)a2 + 86) * 0.5, *((float *)a2 + 87) + 10.0);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v52, a2);
v31 = *(void (__fastcall **)(GameObject *, float *))(*(_DWORD *)v29 + 684);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v53, *(const cocos2d::CCPoint **)(v2 + 1720));
v31(v29, v53);
(*(void (__fastcall **)(GameObject *, int))(*(_DWORD *)v29 + 80))(v29, 1036831949);
(*(void (__fastcall **)(int, GameObject *))(*(_DWORD *)v2 + 672))(v2, v29);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v2 + 2088), v29);
(*(void (__fastcall **)(GameObject *, _DWORD))(*(_DWORD *)v29 + 172))(v29, 0);
GameObject::copyGroups(v29, a2);
GJBaseGameLayer::addToGroups((GJBaseGameLayer *)v2, v29, 1);
goto LABEL_143;
}
if ( (unsigned int)(v16 - 10) <= 3 )
goto LABEL_90;
LABEL_143:
this = GameObject::isSpeedObject(a2);
if ( this && *((_BYTE *)a2 + 1584) || *((_DWORD *)a2 + 271) == 1 && *((_BYTE *)a2 + 1596) && *((_BYTE *)a2 + 1584) )
{
EffectGameObject::updateSpeedModType(a2);
return cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v2 + 11852), a2);
}
return this;
}