//
// LevelEditorLayer::addSpecial from 0x1403f4b80 to 0x1403f5281 (1793 bytes)
//
// 13 xrefs:
// > EditorUI::onCreateObject @ 0x1401b2da8
// > EditorUI::createNewKeyframeAnim @ 0x1401b92ea
// > EditorUI::createLoop @ 0x1401b9691
// > EditorUI::createLoop @ 0x1401b99d5
// > EditorUI::createGradientFromSelection @ 0x1401b9fd4
// > LevelEditorLayer::createObjectsFromSetup @ 0x1403eff80
// > LevelEditorLayer::createObjectsFromString @ 0x1403f06cd
// > LevelEditorLayer::createObject @ 0x1403f0a8e
// > LevelEditorLayer::handleAction @ 0x1403f265a
// > LevelEditorLayer::handleAction @ 0x1403f27b9
// > ??> @ 0x1408c5e8c
// > ??> @ 0x1408c5e9c
// > ??> @ 0x1409254b4
//
// 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 11:31:49 +0000
//
struct cocos2d::CCObject *__fastcall LevelEditorLayer::addSpecial(__int64 a1, __int64 a2)
{
char v4; // al
int v5; // eax
int v6; // ebx
float v7; // xmm0_4
int *v8; // r14
struct cocos2d::CCObject *v9; // rbp
int v10; // eax
int v11; // ebx
float v12; // xmm0_4
const struct cocos2d::CCPoint *v13; // rax
float v14; // xmm1_4
float v15; // xmm0_4
const struct cocos2d::CCPoint *v16; // rax
char *Object; // r14
__int64 v18; // rdx
__int64 v19; // rbx
int v20; // r12d
__int64 v21; // r15
unsigned __int64 v22; // rbx
__int64 v23; // rax
__int64 v24; // rdx
int v25; // ecx
int v26; // r12d
__int64 v27; // r15
unsigned __int64 v28; // rbx
__int64 v29; // rax
__int64 v30; // rdx
__int64 v31; // rbx
int v32; // ecx
bool v33; // zf
int v34; // ecx
int v35; // ecx
cocos2d::CCArray *v36; // rcx
int v37; // ecx
int v38; // ecx
_QWORD *v39; // rcx
__int64 v40; // rax
char shouldLockX; // al
float *v42; // rbx
unsigned int v43; // edx
__int64 v44; // rcx
_QWORD *v45; // r9
struct cocos2d::CCObject *result; // rax
struct cocos2d::CCObject *v47; // rcx
int v48; // ebp
_BYTE v49[56]; // [rsp+20h] [rbp-38h] BYREF
float v50; // [rsp+60h] [rbp+8h] BYREF
float v51; // [rsp+64h] [rbp+Ch]
char v52; // [rsp+68h] [rbp+10h] BYREF
if ( *(_BYTE *)(a1 + 2212) )
{
v4 = 1;
}
else
{
v5 = *(_DWORD *)(a2 + 928);
if ( !v5 || (v33 = ((v5 - 21) & 0xFFFFFFFB) == 0, v4 = 1, v33) )
v4 = *(_BYTE *)(a2 + 1222);
}
*(_BYTE *)(a2 + 876) = v4;
if ( *(_BYTE *)(a2 + 877) != *(_BYTE *)(a1 + 2213) )
*(_BYTE *)(a2 + 872) = 1;
v33 = *(_BYTE *)(a2 + 1266) == 0;
*(_BYTE *)(a2 + 877) = *(_BYTE *)(a1 + 2213);
if ( v33 )
{
v6 = *(_DWORD *)(a1 + 14928) - *(_DWORD *)(a1 + 14932) + 1;
*(_DWORD *)(a1 + 14936) = v6;
v7 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(a1 + 14932) = (int)v7;
*(_DWORD *)(a1 + 14928) = v6 + (int)v7;
}
LevelEditorLayer::updateObjectLabel(a2);
v8 = (int *)(a2 + 1036);
v9 = nullptr;
v10 = *(_DWORD *)(a2 + 1036);
switch ( v10 )
{
case 747:
v13 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 200LL))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v50, v13);
v14 = *(float *)(a2 + 1876);
if ( v14 == 0.0 )
v15 = v51 + 100.0;
else
v15 = v51 + v14;
v51 = v15;
v50 = v50 + -10.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, (const struct cocos2d::CCPoint *)&v50);
Object = LevelEditorLayer::createObject(a1, 749, v16, 1);
LOBYTE(v18) = (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1272LL))(a2) == 0;
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)Object + 1088LL))(Object, v18);
v19 = *(_QWORD *)Object;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a2 + 360LL))(a2);
(*(void (__fastcall **)(char *))(v19 + 1712))(Object);
if ( *(__int16 *)(a2 + 1176) > 0 )
{
v20 = 0;
v21 = 0;
v22 = 0;
do
{
if ( v22 <= 9 && (v23 = *(_QWORD *)(a2 + 1168)) != 0 )
v24 = (unsigned int)*(__int16 *)(v21 + v23);
else
v24 = 0;
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)Object + 1448LL))(Object, v24);
v25 = *(__int16 *)(a2 + 1176);
++v20;
++v22;
v21 += 2;
}
while ( v20 < v25 );
if ( (__int16)v25 > 0 )
{
v26 = 0;
v27 = 0;
v28 = 0;
do
{
if ( v28 <= 9 && (v29 = *(_QWORD *)(a2 + 1168)) != 0 )
v30 = (unsigned int)*(__int16 *)(v27 + v29);
else
v30 = 0;
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)Object + 1720LL))(Object, v30);
++v26;
++v28;
v27 += 2;
}
while ( v26 < *(__int16 *)(a2 + 1176) );
}
}
*(_QWORD *)(a2 + 1864) = Object;
Object[1872] = 1;
v8 = (int *)(a2 + 1036);
break;
case 1329:
v11 = *(_DWORD *)(a1 + 14812) - *(_DWORD *)(a1 + 14816) + 1;
*(_DWORD *)(a1 + 14820) = v11;
v12 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(a1 + 14816) = (int)v12;
*(_DWORD *)(a1 + 14812) = v11 + (int)v12;
break;
case 2065:
LevelEditorLayer::updatePreviewParticle(a1, a2);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14744), (struct cocos2d::CCObject *)a2);
break;
case 3032:
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14752), (struct cocos2d::CCObject *)a2);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1392LL))(a1, a2);
break;
}
if ( *v8 == 1049 )
EffectGameObject::updateSpecialColor(a2);
if ( *(_BYTE *)(a2 + 1260) )
{
v31 = *(_QWORD *)(a1 + 14944);
if ( !cocos2d::CCArray::containsObject(*(cocos2d::CCArray **)(v31 + 576), (struct cocos2d::CCObject *)a2) )
{
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(v31 + 576), (struct cocos2d::CCObject *)a2);
*(_BYTE *)(v31 + 516) = 1;
v8 = (int *)(a2 + 1036);
}
}
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1648LL))(a2) == 25 )
GameObject::determineSlopeDirection(a2);
if ( *(_DWORD *)(a2 + 1256) == 1 )
{
LevelEditorLayer::tryUpdateSpeedObject(a1, a2, 0);
v8 = (int *)(a2 + 1036);
}
v32 = *v8;
if ( *v8 <= 1814 )
{
if ( v32 != 1814 )
{
if ( v32 <= 1268 )
{
if ( v32 != 1268 )
{
if ( v32 != 901 )
{
if ( v32 == 1006 )
{
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14696), (struct cocos2d::CCObject *)a2);
*(_BYTE *)(a1 + 14826) = 1;
goto LABEL_78;
}
if ( v32 == 1007 )
{
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14712), (struct cocos2d::CCObject *)a2);
*(_BYTE *)(a1 + 14827) = 1;
goto LABEL_78;
}
goto LABEL_69;
}
goto LABEL_76;
}
LABEL_66:
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14720), (struct cocos2d::CCObject *)a2);
*(_BYTE *)(a1 + 14828) = 1;
goto LABEL_78;
}
if ( v32 != 1346 )
{
v33 = v32 == 1347;
LABEL_55:
if ( !v33 )
goto LABEL_56;
goto LABEL_76;
}
}
goto LABEL_76;
}
if ( v32 <= 2068 )
{
if ( v32 == 2068 || v32 == 1912 )
goto LABEL_66;
if ( v32 == 2016 )
{
v36 = *(cocos2d::CCArray **)(a1 + 14736);
LABEL_77:
cocos2d::CCArray::addObject(v36, (struct cocos2d::CCObject *)a2);
goto LABEL_78;
}
v33 = v32 == 2067;
goto LABEL_55;
}
if ( v32 == 3016 )
{
LABEL_76:
v36 = *(cocos2d::CCArray **)(a1 + 14728);
goto LABEL_77;
}
if ( v32 == 3642 )
{
v39 = (_QWORD *)(*(_QWORD *)(a1 + 14944) + 432LL);
v50 = *(float *)(a2 + 924);
*(_QWORD *)(*(_QWORD *)sub_1400677E0(v39, (__int64)v49, (unsigned __int8 *)&v50) + 24LL) = a2;
goto LABEL_78;
}
LABEL_69:
if ( v32 <= 744 )
{
if ( v32 != 744 )
{
v37 = v32 - 29;
if ( v37 )
{
v38 = v37 - 1;
if ( v38 )
{
if ( v38 != 75 )
goto LABEL_78;
}
}
}
LABEL_59:
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14704), (struct cocos2d::CCObject *)a2);
*(_BYTE *)(a1 + 14825) = 1;
goto LABEL_78;
}
LABEL_56:
v34 = v32 - 899;
if ( !v34 )
goto LABEL_59;
v35 = v34 - 1;
if ( !v35 || v35 == 15 )
goto LABEL_59;
LABEL_78:
if ( *(_BYTE *)(a2 + 1261) )
{
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14832), (struct cocos2d::CCObject *)a2);
*(_BYTE *)(a1 + 14840) = 1;
}
if ( *(_BYTE *)(a2 + 1265) || (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)a2 + 1536LL))(a2) )
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14768), (struct cocos2d::CCObject *)a2);
if ( *(_BYTE *)(a2 + 1263) )
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14688), (struct cocos2d::CCObject *)a2);
v40 = *(_QWORD *)(a1 + 3528);
if ( v40 && *(_BYTE *)(v40 + 341) )
shouldLockX = 0;
else
shouldLockX = GameObject::shouldLockX(a2);
*(_BYTE *)(a2 + 712) = shouldLockX;
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 3536), (struct cocos2d::CCObject *)a2);
GJBaseGameLayer::addToGroups(a1, a2, 0);
GJBaseGameLayer::addToGroupParents(a1, a2);
v42 = (float *)(a2 + 924);
v43 = *(_DWORD *)(a2 + 924);
v44 = *(_QWORD *)(a1 + 14280);
v45 = (_QWORD *)(a1 + 14256);
result = *(struct cocos2d::CCObject **)(v44
+ 16
* (*(_QWORD *)(a1 + 14304)
& (0x100000001B3LL
* (((unsigned __int64)v43 >> 24)
^ (0x100000001B3LL
* (BYTE2(v43)
^ (0x100000001B3LL
* ((0x100000001B3LL * ((unsigned __int8)v43 ^ 0xCBF29CE484222325uLL))
^ BYTE1(v43))))))))
+ 8);
if ( result != *(struct cocos2d::CCObject **)(a1 + 14264) )
{
v47 = *(struct cocos2d::CCObject **)(v44
+ 16
* (*(_QWORD *)(a1 + 14304)
& (0x100000001B3LL
* (((unsigned __int64)*(unsigned int *)(a2 + 924) >> 24)
^ (0x100000001B3LL
* ((unsigned __int8)BYTE2(*(_DWORD *)(a2 + 924))
^ (0x100000001B3LL
* ((0x100000001B3LL * ((unsigned __int8)v43 ^ 0xCBF29CE484222325uLL))
^ (unsigned __int8)BYTE1(*(_DWORD *)(a2 + 924))))))))));
if ( v43 == *((_DWORD *)result + 4) )
{
LABEL_94:
v9 = result;
}
else
{
while ( result != v47 )
{
result = *((struct cocos2d::CCObject **)result + 1);
if ( v43 == *((_DWORD *)result + 4) )
{
v45 = (_QWORD *)(a1 + 14256);
v42 = (float *)(a2 + 924);
goto LABEL_94;
}
}
v45 = (_QWORD *)(a1 + 14256);
v42 = (float *)(a2 + 924);
}
}
if ( v9 )
{
if ( !*(_DWORD *)(a2 + 880) )
{
v50 = *(float *)(a2 + 924);
v48 = *(_DWORD *)(*(_QWORD *)sub_1402749A0(v45, (__int64)v49, (unsigned __int8 *)&v50) + 20LL);
result = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 4256), v48);
if ( result )
{
cocos2d::CCArray::addObject(result, (struct cocos2d::CCObject *)a2);
v50 = *v42;
*(_DWORD *)(a2 + 880) = v48;
result = (struct cocos2d::CCObject *)sub_140066A60((_QWORD *)(a1 + 14256), (unsigned __int8 *)&v50);
}
}
}
*(_BYTE *)(a1 + 15666) = 1;
return result;
}