//
// LevelEditorLayer::addSpecial from 0x100359c14 to 0x10035a0ac (1176 bytes)
//
// 7 xrefs:
// > LevelEditorLayer::addObjectFromVector @ 0x10035971c
// > LevelEditorLayer::createObject @ 0x10035a23c
// > LevelEditorLayer::handleAction @ 0x10035be34
// > LevelEditorLayer::handleAction @ 0x10035bf80
// > LevelEditorLayer::refreshSpecial @ 0x10035e5dc
// > EditorUI::onCreateObject @ 0x1003eb620
// > EditorUI::createNewKeyframeAnim @ 0x1003f3648
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall LevelEditorLayer::addSpecial(LevelEditorLayer *a1, GameObject *a2)
{
int v4; // w21
float v5; // s0
int m_objectID; // w8
int v7; // w21
float v8; // s0
__int64 *v9; // x0
float u; // s0
GameObject *Object; // x21
int v17; // w0
int v18; // w22
__int64 GroupID; // x0
int v20; // w8
cocos2d::CCArray *m_moveTriggers; // x0
DrawGridLayer *m_drawGridLayer; // x8
LevelSettingsObject *m_levelSettings; // x8
bool v24; // w0
__int64 v25; // [xsp+Ch] [xbp-44h] BYREF
__int64 *v26; // [xsp+18h] [xbp-38h] BYREF
cocos2d::CCPoint v27; // 0:s0.4,4:s1.4
GJBaseGameLayer::applyLevelSettings(a1, a2);
if ( !a2->m_isStartPos )
{
v4 = a1->m_objectCount.random - a1->m_objectCount.seed + 1;
a1->m_objectCount.value = v4;
v5 = vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0;
a1->m_objectCount.seed = (int)v5;
a1->m_objectCount.random = v4 + (int)v5;
}
LevelEditorLayer::updateObjectLabel(a2);
m_objectID = a2->m_objectID;
if ( m_objectID > 2064 )
{
if ( m_objectID == 3032 )
{
sub_10024A2D0((__int64)a1->m_keyframeObjects);
((void (__fastcall *)(LevelEditorLayer *, GameObject *))a1->addKeyframe)(a1, a2);
}
else
{
if ( m_objectID != 2065 )
goto LABEL_18;
LevelEditorLayer::updatePreviewParticle(a1, (ParticleGameObject *)a2);
sub_10024A2D0((__int64)a1->m_particleObjects);
}
}
else if ( m_objectID == 747 )
{
v9 = (__int64 *)((__int64 (__fastcall *)(GameObject *))a2->getPosition)(a2);
sub_1000229B8((__int64 *)&v26, v9);
u = a2[1].m_sQuad.bl.texCoords.u;
if ( u == 0.0 )
u = 100.0;
__asm { FMOV V2.2S, #-10.0 }
_D2.f32[1] = u;
v26 = (__int64 *)vadd_f32(_D2, (float32x2_t)v26);
v27.x = sub_1000229B8(&v25, (__int64 *)&v26);
Object = LevelEditorLayer::createObject(a1, 749, v27, (bool)&v25);
v17 = ((__int64 (__fastcall *)(GameObject *))a2->isFlipX)(a2);
((void (__fastcall *)(GameObject *, _QWORD))Object->setFlipX)(Object, v17 ^ 1u);
((void (__fastcall *)(GameObject *))a2->getRotation)(a2);
((void (__fastcall *)(GameObject *))Object->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable[1].update)(Object);
GameObject::copyGroups(Object);
if ( a2->m_groupCount >= 1 )
{
v18 = 0;
do
{
GroupID = GameObject::getGroupID(a2, v18);
((void (__fastcall *)(GameObject *, __int64))Object->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable[1].encodeWithCoder)(
Object,
GroupID);
++v18;
}
while ( v18 < a2->m_groupCount );
}
*(_QWORD *)&a2[1].m_sQuad.bl.vertices.y = Object;
Object[1].m_sQuad.bl.colors.r = 1;
}
else
{
if ( m_objectID != 1329 )
goto LABEL_18;
v7 = a1->m_coinCount.random - a1->m_coinCount.seed + 1;
a1->m_coinCount.value = v7;
v8 = vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0;
a1->m_coinCount.seed = (int)v8;
a1->m_coinCount.random = v7 + (int)v8;
}
m_objectID = a2->m_objectID;
LABEL_18:
if ( m_objectID == 1049 )
EffectGameObject::updateSpecialColor((EffectGameObject *)a2);
if ( a2->m_isTrigger )
DrawGridLayer::addToEffects(a1->m_drawGridLayer, (EffectGameObject *)a2);
if ( ((unsigned int (__fastcall *)(GameObject *))a2->getType)(a2) == 25 )
GameObject::determineSlopeDirection(a2);
if ( a2->m_classType == Effect )
LevelEditorLayer::tryUpdateSpeedObject(a1, (EffectGameObject *)a2, 0);
v20 = a2->m_objectID;
if ( v20 <= 1911 )
{
if ( v20 <= 1267 )
{
if ( v20 != 901 )
{
if ( v20 == 1006 )
{
sub_10024A2D0((__int64)a1->m_pulseTriggers);
a1->m_pulseTriggersChanged = 1;
goto LABEL_51;
}
if ( v20 == 1007 )
{
sub_10024A2D0((__int64)a1->m_alphaTriggers);
a1->m_alphaTriggersChanged = 1;
goto LABEL_51;
}
goto LABEL_40;
}
goto LABEL_45;
}
if ( (unsigned int)(v20 - 1346) < 2 )
goto LABEL_45;
if ( v20 != 1268 )
{
if ( v20 != 1814 )
goto LABEL_40;
LABEL_45:
m_moveTriggers = a1->m_moveTriggers;
LABEL_46:
sub_10024A2D0((__int64)m_moveTriggers);
goto LABEL_51;
}
LABEL_47:
sub_10024A2D0((__int64)a1->m_spawnTriggers);
a1->m_spawnTriggersChanged = 1;
goto LABEL_51;
}
if ( v20 > 2067 )
{
switch ( v20 )
{
case 2068:
goto LABEL_47;
case 3642:
m_drawGridLayer = a1->m_drawGridLayer;
LODWORD(v25) = a2->m_uniqueID;
v26 = &v25;
sub_100019F24(
(unsigned __int64)&m_drawGridLayer->m_audioLineObjects,
(int *)&v25,
(__int64)&unk_100645700,
(_DWORD **)&v26)[3] = a2;
goto LABEL_51;
case 3016:
goto LABEL_45;
}
}
else
{
switch ( v20 )
{
case 1912:
goto LABEL_47;
case 2016:
m_moveTriggers = a1->m_cameraGuideTriggers;
goto LABEL_46;
case 2067:
goto LABEL_45;
}
}
LABEL_40:
if ( GameObject::isColorTrigger(a2) )
{
sub_10024A2D0((__int64)a1->m_colorTriggers);
a1->m_colorTriggersChanged = 1;
}
LABEL_51:
if ( a2->m_isSpawnOrderTrigger )
{
sub_10024A2D0((__int64)a1->m_spawnOrderObjects);
a1->m_spawnOrderObjectsChanged = 1;
}
if ( a2->m_activateTriggerInEditor || ((unsigned int (__fastcall *)(GameObject *))a2->isSpecialSpawnObject)(a2) )
sub_10024A2D0((__int64)a1->m_playtestTriggers);
if ( a2->m_dontIgnoreDuration )
sub_10024A2D0((__int64)a1->m_durationObjects);
m_levelSettings = a1->m_levelSettings;
v24 = (!m_levelSettings || !m_levelSettings->m_platformerMode) && GameObject::shouldLockX(a2);
a2->m_tempOffsetXRelated = v24;
sub_10024A2D0((__int64)a1->m_objects);
GJBaseGameLayer::addToGroups(a1, a2, 0);
GJBaseGameLayer::addToGroupParents(a1, a2);
GJBaseGameLayer::reAddToStickyGroup(a1, a2);
a1->m_unk3b22 = 1;
}