//
// LevelEditorLayer::addSpecial from 0x46e314 to 0x46e69a (902 bytes)
//
// 7 xrefs:
// > LevelEditorLayer::addObjectFromVector @ 0x46e6fc
// > LevelEditorLayer::createObject @ 0x46ebcc
// > LevelEditorLayer::handleAction @ 0x46ef4e
// > LevelEditorLayer::handleAction @ 0x46f032
// > LevelEditorLayer::refreshSpecial @ 0x46f49e
// > EditorUI::createNewKeyframeAnim @ 0x483120
// > EditorUI::onCreateObject @ 0x4874bc
//
// 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:49:02 +0000
//
int __fastcall LevelEditorLayer::addSpecial(LevelEditorLayer *this, GameObject *a2)
{
GameObject *v4; // r1
int v5; // r3
int v6; // r6
int v7; // s15
const cocos2d::CCPoint *v8; // r0
float v9; // s14
_BYTE *Object; // r6
void (__fastcall *v11)(_BYTE *, int); // r8
unsigned __int8 v12; // r0
void (__fastcall *v13)(_BYTE *, int); // r8
int v14; // r0
signed int v15; // r8
unsigned int v16; // r1
void (__fastcall *v17)(_BYTE *, int); // r9
int GroupID; // r0
int v19; // r3
int v20; // r3
int v21; // r3
int v22; // r3
int result; // r0
float v24; // [sp+4h] [bp-18h] BYREF
float v25; // [sp+8h] [bp-14h]
_BYTE v26[8]; // [sp+Ch] [bp-10h] BYREF
GJBaseGameLayer::applyLevelSettings(this, a2);
if ( !*((_BYTE *)a2 + 1094) )
LevelEditorLayer::setObjectCount(this, *((_DWORD *)this + 2967) - *((_DWORD *)this + 2968) + 1);
LevelEditorLayer::updateObjectLabel((int)a2, v4);
v5 = *((_DWORD *)a2 + 223);
if ( v5 == 1329 )
{
v6 = *((_DWORD *)this + 2947) - *((_DWORD *)this + 2948) + 1;
*((_DWORD *)this + 2949) = v6;
v7 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*((_DWORD *)this + 2948) = v7;
*((_DWORD *)this + 2947) = v7 + v6;
}
else if ( v5 > 1329 )
{
if ( v5 == 2065 )
{
LevelEditorLayer::updatePreviewParticle(this, a2);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2938), a2);
}
else if ( v5 == 3032 )
{
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2939), a2);
(*(void (__fastcall **)(LevelEditorLayer *, GameObject *))(*(_DWORD *)this + 772))(this, a2);
}
}
else if ( v5 == 747 )
{
v8 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 96))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v24, v8);
v9 = *((float *)a2 + 415);
if ( v9 == 0.0 )
v9 = 100.0;
v25 = v25 + v9;
v24 = v24 - 10.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v26, (const cocos2d::CCPoint *)&v24);
Object = (_BYTE *)LevelEditorLayer::createObject(this, 749, v26, 1);
v11 = *(void (__fastcall **)(_BYTE *, int))(*(_DWORD *)Object + 620);
v12 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 712))(a2);
v11(Object, v12 ^ 1);
v13 = *(void (__fastcall **)(_BYTE *, int))(*(_DWORD *)Object + 932);
v14 = (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 184))(a2);
v13(Object, v14);
GameObject::copyGroups((int)Object, a2);
if ( *((__int16 *)a2 + 510) > 0 )
{
v15 = 0;
while ( v15 < *((__int16 *)a2 + 510) )
{
v16 = v15++;
v17 = *(void (__fastcall **)(_BYTE *, int))(*(_DWORD *)Object + 936);
GroupID = GameObject::getGroupID(a2, v16);
v17(Object, GroupID);
}
}
*((_DWORD *)a2 + 413) = Object;
Object[1656] = 1;
}
if ( *((_DWORD *)a2 + 223) == 1049 )
EffectGameObject::updateSpecialColor(a2);
if ( *((_BYTE *)a2 + 1088) )
DrawGridLayer::addToEffects(*((cocos2d::CCArray ***)this + 2970), a2);
if ( (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 900))(a2) == 25 )
GameObject::determineSlopeDirection(a2);
if ( *((_DWORD *)a2 + 271) == 1 )
LevelEditorLayer::tryUpdateSpeedObject(this, a2, 0);
v19 = *((_DWORD *)a2 + 223);
if ( v19 == 1814 )
goto LABEL_47;
if ( v19 > 1814 )
{
if ( v19 == 2067 )
goto LABEL_47;
if ( v19 > 2067 )
{
if ( v19 == 3016 )
goto LABEL_47;
if ( v19 == 3642 )
{
DrawGridLayer::addAudioLineObject(*((DrawGridLayer **)this + 2970), a2, 0xE3Au);
goto LABEL_55;
}
if ( v19 != 2068 )
goto LABEL_52;
}
else if ( v19 != 1912 )
{
if ( v19 != 2016 )
goto LABEL_52;
v21 = 11748;
LABEL_50:
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)((char *)this + v21), a2);
goto LABEL_55;
}
LABEL_49:
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2935), a2);
v20 = 11804;
goto LABEL_54;
}
if ( v19 == 1007 )
{
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2934), a2);
v20 = 11803;
goto LABEL_54;
}
if ( v19 >= 1008 )
{
if ( v19 != 1268 )
{
if ( v19 < 1268 || (unsigned int)(v19 - 1346) > 1 )
goto LABEL_52;
goto LABEL_47;
}
goto LABEL_49;
}
if ( v19 == 901 )
{
LABEL_47:
v21 = 11744;
goto LABEL_50;
}
if ( v19 == 1006 )
{
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2932), a2);
v20 = 11802;
goto LABEL_54;
}
LABEL_52:
if ( !GameObject::isColorTrigger(a2) )
goto LABEL_55;
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2933), a2);
v20 = 11801;
LABEL_54:
*((_BYTE *)this + v20) = 1;
LABEL_55:
if ( *((_BYTE *)a2 + 1089) )
{
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2952), a2);
*((_BYTE *)this + 11812) = 1;
}
if ( *((_BYTE *)a2 + 1093) || (*(int (__fastcall **)(GameObject *))(*(_DWORD *)a2 + 844))(a2) )
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2941), a2);
if ( *((_BYTE *)a2 + 1091) )
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 2931), a2);
v22 = *((_DWORD *)this + 521);
*((_BYTE *)a2 + 608) = (!v22 || !*(_BYTE *)(v22 + 281)) && GameObject::shouldLockX(a2);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 522), a2);
GJBaseGameLayer::addToGroups(this, a2, 0);
GJBaseGameLayer::addToGroupParents(this, a2);
result = GJBaseGameLayer::reAddToStickyGroup(this, a2);
*((_BYTE *)this + 12278) = 1;
return result;
}