//
// PlayLayer::addObject from 0x10007f4f0 to 0x10007ffea (2810 bytes)
//
// 4 xrefs:
// > PlayLayer::processCreateObjectsFromSetup @ 0x10007af27
// > PlayLayer::setupHasCompleted @ 0x10007bd9e
// > PlayLayer::addObject @ 0x10007fa31
// > PlayLayer::addLiveStartPosObject @ 0x10008c1b7
//
// 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:20:01 +0000
//
void __fastcall PlayLayer::addObject(float *a1, __int64 a2)
{
_BYTE *v4; // rsi
__int64 v5; // rdx
__int64 v6; // rcx
int v7; // eax
__int64 BallFrame; // rax
__int64 v9; // r15
__int64 v10; // rsi
float TeleportXOff; // xmm0_4
_BYTE *v12; // r15
unsigned __int8 v13; // al
float v14; // xmm0_4
__int64 v15; // rax
__int16 v16; // cx
char v17; // al
__int64 v18; // rax
__int64 v19; // rdi
unsigned __int8 v20; // r15
int v21; // eax
const char *v22; // rdi
__int64 v23; // r12
__int64 v24; // rax
unsigned __int8 v25; // al
unsigned __int8 v26; // al
int v27; // [rsp-44h] [rbp-44h] BYREF
float v28; // [rsp-3Ch] [rbp-3Ch]
float v29[14]; // [rsp-38h] [rbp-38h] BYREF
if ( !a2 )
return;
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1800LL))(a2) == 25 )
GameObject::determineSlopeDirection(a2);
else
GameObject::updateIsOriented(a2);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 344LL))(a2, 0);
(*(void (__fastcall **)(float *, __int64))(*(_QWORD *)a2 + 1816LL))(v29, a2);
if ( v29[0] > a1[3580] )
{
(*(void (__fastcall **)(float *, __int64))(*(_QWORD *)a2 + 1816LL))(v29, a2);
a1[3580] = v29[0];
}
if ( (unsigned __int8)GameObject::isSettingsObject(a2)
|| (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1800LL))(a2) == 20
&& (*(_DWORD *)(a2 + 1248) != 1 || !*(_BYTE *)(a2 + 1472))
&& *(_DWORD *)(a2 + 1028) != 2063 )
{
*(_DWORD *)(a2 + 628) = -1;
if ( *(_DWORD *)(a2 + 1028) != 3663 )
goto LABEL_10;
goto LABEL_9;
}
(*(void (__fastcall **)(float *, __int64))(*(_QWORD *)a1 + 1344LL))(a1, a2);
if ( *(_DWORD *)(a2 + 1028) == 3663 )
LABEL_9:
*((_BYTE *)a1 + 14576) = 1;
LABEL_10:
sub_1007FEBF0(*((_QWORD *)a1 + 410), a2);
GJBaseGameLayer::addToGroups(a1, a2, 1);
if ( *(_DWORD *)(a2 + 1028) == 1615 )
{
GJBaseGameLayer::addObjectCounter(a1, a2);
}
else if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1800LL))(a2) == 30
|| (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1800LL))(a2) == 31 )
{
sub_1007FEBF0(*((_QWORD *)a1 + 1788), a2);
}
v4 = (_BYTE *)*(unsigned int *)(a2 + 656);
GameObject::getActiveColorForMode(a2, v4, 1);
if ( (unsigned __int8)GameObject::hasSecondaryColor(a2) )
{
v4 = (_BYTE *)*(unsigned int *)(a2 + 660);
GameObject::getActiveColorForMode(a2, v4, 0);
}
if ( *(_BYTE *)(a2 + 1252) == 1
&& *(_DWORD *)(a2 + 1248) == 1
&& (!*(_BYTE *)(a2 + 1472) && *(_BYTE *)(a2 + 1473) != 1
|| (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1688LL))(a2)) )
{
v4 = (_BYTE *)a2;
sub_1007FEBF0(*((_QWORD *)a1 + 413), a2);
}
if ( *((_BYTE *)a1 + 12238) == 1 )
{
*(_BYTE *)(a2 + 708) = 0;
v7 = *(_DWORD *)(a2 + 1028);
if ( v7 != 747 )
{
LABEL_31:
if ( v7 <= 743 )
goto LABEL_32;
goto LABEL_41;
}
}
else
{
v7 = *(_DWORD *)(a2 + 1028);
if ( v7 != 747 )
goto LABEL_31;
}
v10 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 192LL))(a2);
sub_1002782D0(v29, v10);
v29[1] = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 192LL))(a2) + 4) + *(float *)(a2 + 1860);
TeleportXOff = TeleportPortalObject::getTeleportXOff(a2, *((_QWORD *)a1 + 317));
v29[0] = TeleportXOff + v29[0];
v12 = (_BYTE *)TeleportPortalObject::create("portal_16_front_001.png", 0);
*(_QWORD *)(a2 + 1848) = v12;
*((_DWORD *)v12 + 257) = 749;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v12 + 1264LL))(v12);
sub_1002782D0(&v27, v29);
(*(void (__fastcall **)(_BYTE *, int *))(*(_QWORD *)v12 + 1368LL))(v12, &v27);
v12[1052] = 1;
*((_DWORD *)v12 + 282) = *(_DWORD *)(a2 + 1128);
*((_DWORD *)v12 + 262) = *(_DWORD *)(a2 + 1048);
v13 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1424LL))(a2);
(*(void (__fastcall **)(_BYTE *, _QWORD))(*(_QWORD *)v12 + 1240LL))(v12, v13 ^ 1u);
v12[996] = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1424LL))(a2) ^ 1;
v12[1042] = *(_BYTE *)(a2 + 1042);
v12[1043] = *(_BYTE *)(a2 + 1043);
v12[1044] = *(_BYTE *)(a2 + 1044);
v28 = (*(float (__fastcall **)(__int64))(*(_QWORD *)a2 + 368LL))(a2);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v12 + 360LL))(v12);
v14 = v28;
*((float *)v12 + 243) = v28;
*((float *)v12 + 244) = v14;
GameObject::copyGroups(v12, a2);
GameObject::updateCustomScaleX(v12);
GameObject::updateCustomScaleY(v12, *(float *)(a2 + 1156));
*((_QWORD *)v12 + 165) = *(_QWORD *)(a2 + 1320);
if ( *(_BYTE *)(a2 + 1294) == 1 )
v12[1294] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v12 + 1616LL))(v12);
v4 = v12;
PlayLayer::addObject(a1, v12);
v7 = *(_DWORD *)(a2 + 1028);
if ( v7 <= 743 )
{
LABEL_32:
v6 = (unsigned int)(v7 - 10);
switch ( v7 )
{
case 10:
case 11:
case 12:
case 13:
case 45:
case 46:
case 47:
case 99:
case 101:
case 111:
goto LABEL_74;
case 14:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 32:
case 33:
case 34:
case 35:
case 37:
case 38:
case 39:
case 40:
case 41:
case 42:
case 43:
case 44:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
case 64:
case 65:
case 66:
case 67:
case 68:
case 69:
case 70:
case 71:
case 72:
case 73:
case 74:
case 75:
case 76:
case 77:
case 78:
case 79:
case 80:
case 81:
case 82:
case 83:
case 85:
case 86:
case 87:
case 88:
case 89:
case 90:
case 91:
case 92:
case 93:
case 94:
case 95:
case 96:
case 97:
case 98:
case 100:
case 102:
case 103:
case 104:
case 106:
case 107:
case 108:
case 109:
case 110:
case 112:
case 113:
case 114:
case 115:
case 116:
case 117:
case 118:
case 119:
case 120:
case 121:
case 122:
case 123:
case 124:
case 125:
case 126:
case 127:
case 128:
case 129:
case 130:
case 131:
case 132:
case 133:
case 134:
case 135:
case 136:
case 137:
case 138:
case 139:
case 140:
goto LABEL_107;
case 15:
case 16:
case 17:
BallFrame = GameObject::getBallFrame(*((unsigned int *)a1 + 3579), v4, v5, v6);
v9 = GameObject::createWithFrame(BallFrame);
*(_DWORD *)(v9 + 1028) = 37;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v9 + 1264LL))(v9);
if ( *(_DWORD *)(a2 + 656) != 1004 )
GameObject::setMainColorMode(v9);
GameObject::setDefaultMainColorMode(a2, 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a2 + 1616LL))(a2);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v9 + 1616LL))(v9);
*(_QWORD *)(a2 + 1320) = 0;
*(_QWORD *)(v9 + 1320) = 0;
sub_100278250(&v27, *(float *)(a2 + 432) * 0.5, *(float *)(a2 + 436) + 10.0);
cocos2d::CCNode::convertToWorldSpace(v29, a2, &v27);
cocos2d::CCNode::convertToNodeSpace(&v27, *((_QWORD *)a1 + 318), v29);
(*(void (__fastcall **)(__int64, int *))(*(_QWORD *)v9 + 1368LL))(v9, &v27);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v9 + 160LL))(v9, 0.1);
(*(void (__fastcall **)(float *, __int64))(*(_QWORD *)a1 + 1344LL))(a1, v9);
sub_1007FEBF0(*((_QWORD *)a1 + 410), v9);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v9 + 344LL))(v9, 0);
GameObject::copyGroups(v9, a2);
GJBaseGameLayer::addToGroups(a1, v9, 1);
if ( !(unsigned __int8)GameObject::isSpeedObject(a2) )
goto LABEL_121;
goto LABEL_120;
case 29:
case 30:
case 105:
goto LABEL_53;
case 31:
v19 = *((_QWORD *)a1 + 1555);
goto LABEL_106;
case 36:
case 84:
case 141:
goto LABEL_70;
default:
v6 = (unsigned int)(v7 - 286);
if ( (unsigned int)v6 >= 2 && v7 != 660 )
goto LABEL_107;
goto LABEL_74;
}
}
LABEL_41:
if ( v7 <= 1329 )
{
v6 = (unsigned int)(v7 - 744);
switch ( v7 )
{
case 744:
goto LABEL_53;
case 745:
case 747:
case 749:
goto LABEL_74;
case 746:
case 748:
goto LABEL_107;
default:
v6 = (unsigned int)(v7 - 899);
if ( (unsigned int)v6 > 0x10 || (v5 = 65539, !_bittest((const int *)&v5, v6)) )
{
if ( v7 == 1022 )
goto LABEL_70;
goto LABEL_107;
}
LABEL_53:
if ( *(_BYTE *)(a2 + 1485) == 1 )
{
v15 = *((_QWORD *)a1 + 407);
v16 = *(_WORD *)(v15 + 2602);
v17 = *(_BYTE *)(v15 + 2604);
}
else
{
if ( *(_BYTE *)(a2 + 1486) != 1 )
goto LABEL_107;
v18 = *((_QWORD *)a1 + 407);
v16 = *(_WORD *)(v18 + 2605);
v17 = *(_BYTE *)(v18 + 2607);
}
*(_BYTE *)(a2 + 1450) = v17;
*(_WORD *)(a2 + 1448) = v16;
if ( !(unsigned __int8)GameObject::isSpeedObject(a2) )
goto LABEL_121;
goto LABEL_120;
}
}
if ( v7 > 1932 )
{
if ( v7 > 2901 )
{
if ( v7 == 2902 || v7 == 2926 )
goto LABEL_74;
}
else if ( v7 == 1933 || v7 == 2064 )
{
goto LABEL_74;
}
goto LABEL_107;
}
if ( v7 > 1332 )
{
if ( v7 == 1333 )
{
LABEL_70:
GJBaseGameLayer::addGuideArt(a1, a2, v5, v6);
if ( (unsigned __int8)GameObject::isSpeedObject(a2) )
goto LABEL_120;
goto LABEL_121;
}
if ( v7 == 1816 && *(_BYTE *)(a2 + 1677) == 1 )
{
v19 = *((_QWORD *)a1 + 411);
LABEL_106:
sub_1007FEBF0(v19, a2);
}
LABEL_107:
if ( !(unsigned __int8)GameObject::isSpeedObject(a2) )
goto LABEL_121;
LABEL_120:
if ( *(_BYTE *)(a2 + 1768) )
{
LABEL_124:
EffectGameObject::updateSpeedModType(a2);
sub_1007FEBF0(*((_QWORD *)a1 + 1782), a2);
return;
}
goto LABEL_121;
}
if ( v7 == 1330 )
goto LABEL_70;
if ( v7 != 1331 )
goto LABEL_107;
LABEL_74:
if ( *(_BYTE *)(a2 + 1294) )
goto LABEL_107;
v20 = GJBaseGameLayer::addGuideArt(a1, a2, v5, v6);
v21 = *(_DWORD *)(a2 + 1028);
v22 = "portal_01_back_001.png";
if ( v21 <= 286 )
{
if ( v21 > 98 )
{
if ( v21 > 110 )
{
if ( v21 == 111 )
{
v22 = "portal_10_back_001.png";
}
else if ( v21 == 286 )
{
v22 = "portal_11_back_001.png";
}
}
else if ( v21 == 99 )
{
v22 = "portal_08_back_001.png";
}
else if ( v21 == 101 )
{
v22 = "portal_09_back_001.png";
}
}
else
{
switch ( v21 )
{
case 11:
v22 = "portal_02_back_001.png";
break;
case 12:
v22 = "portal_03_back_001.png";
break;
case 13:
v22 = "portal_04_back_001.png";
break;
case 45:
v22 = "portal_05_back_001.png";
break;
case 46:
v22 = "portal_06_back_001.png";
break;
case 47:
v22 = "portal_07_back_001.png";
break;
default:
goto LABEL_119;
}
}
goto LABEL_119;
}
if ( v21 > 1330 )
{
if ( v21 <= 2063 )
{
if ( v21 == 1331 )
{
v22 = "portal_17_back_001.png";
}
else if ( v21 == 1933 )
{
v22 = "portal_18_back_001.png";
}
}
else
{
switch ( v21 )
{
case 2064:
goto LABEL_104;
case 2902:
LABEL_103:
v22 = "portal_15_back_001.png";
break;
case 2926:
v22 = "portal_19_back_001.png";
break;
}
}
}
else
{
if ( v21 > 744 )
{
if ( v21 == 745 )
{
v22 = "portal_14_back_001.png";
goto LABEL_119;
}
if ( v21 != 747 )
{
if ( v21 != 749 )
goto LABEL_119;
LABEL_104:
v22 = "portal_16_back_001.png";
goto LABEL_119;
}
goto LABEL_103;
}
if ( v21 == 287 )
{
v22 = "portal_12_back_001.png";
}
else if ( v21 == 660 )
{
v22 = "portal_13_back_001.png";
}
}
LABEL_119:
v23 = GameObject::createWithFrame(v22);
*(_DWORD *)(v23 + 1028) = 38;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v23 + 1808LL))(v23, 7);
*(_BYTE *)(v23 + 1290) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v23 + 1264LL))(v23);
v24 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 192LL))(a2);
sub_1002782D0(v29, v24);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v23 + 1368LL))(v23, v29);
*(_BYTE *)(v23 + 1052) = 1;
*(_DWORD *)(v23 + 1116) = 4;
*(_DWORD *)(v23 + 1048) = v20 + (unsigned int)GameObject::getObjectZOrder(a2) - 100;
v25 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1424LL))(a2);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v23 + 1240LL))(v23, v25);
v26 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1432LL))(a2);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v23 + 1248LL))(v23, v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a2 + 384LL))(a2);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v23 + 376LL))(v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a2 + 400LL))(a2);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v23 + 392LL))(v23);
*(_QWORD *)(v23 + 972) = *(_QWORD *)(a2 + 972);
*(_BYTE *)(v23 + 996) = *(_BYTE *)(a2 + 996);
*(_BYTE *)(v23 + 997) = *(_BYTE *)(a2 + 997);
GameObject::updateCustomScaleX(v23);
GameObject::updateCustomScaleY(v23, *(float *)(a2 + 1156));
*(_QWORD *)(v23 + 980) = *(_QWORD *)(a2 + 980);
*(_BYTE *)(v23 + 1042) = *(_BYTE *)(a2 + 1042);
*(_BYTE *)(v23 + 1043) = *(_BYTE *)(a2 + 1043);
*(_BYTE *)(v23 + 1044) = *(_BYTE *)(a2 + 1044);
(*(void (__fastcall **)(float *, __int64))(*(_QWORD *)a1 + 1344LL))(a1, v23);
sub_1007FEBF0(*((_QWORD *)a1 + 410), v23);
GameObject::copyGroups(v23, a2);
GJBaseGameLayer::addToGroups(a1, v23, 1);
*(_BYTE *)(a2 + 1052) = 1;
*(_DWORD *)(a2 + 1048) = v20 | 0xC;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v23 + 1616LL))(v23);
*(_QWORD *)(v23 + 1320) = *(_QWORD *)(a2 + 1320);
if ( (unsigned __int8)GameObject::isSpeedObject(a2) )
goto LABEL_120;
LABEL_121:
if ( *(_DWORD *)(a2 + 1248) == 1 && *(_BYTE *)(a2 + 1780) == 1 && *(_BYTE *)(a2 + 1768) == 1 )
goto LABEL_124;
}