//
// LevelEditorLayer::removeSpecial from 0x1000e2250 to 0x1000e26be (1134 bytes)
//
// 9 xrefs:
// > EditorUI::onCreateObject @ 0x100035180
// > EditorUI::createNewKeyframeAnim @ 0x100045643
// > LevelEditorLayer::removeObject @ 0x1000e2231
// > LevelEditorLayer::removeSpecial @ 0x1000e23cf
// > LevelEditorLayer::removeAllObjects @ 0x1000e275a
// > LevelEditorLayer::removeAllObjectsOfType @ 0x1000e29c5
// > LevelEditorLayer::handleAction @ 0x1000e2c53
// > LevelEditorLayer::handleAction @ 0x1000e2d7f
// > LevelEditorLayer::refreshSpecial @ 0x1000ea8dd
//
// 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::removeSpecial(LevelEditorLayer *a1, GameObject *a2)
{
int v3; // r15d
int v4; // eax
int m_objectID; // eax
int v6; // r15d
int v7; // eax
cocos2d::CCArray *m_particleObjects; // rdi
GameObject *v9; // r15
int v10; // eax
cocos2d::CCArray *m_pulseTriggers; // rdi
DrawGridLayer *m_drawGridLayer; // r15
std::unordered_map *p_m_audioLineObjects; // rdi
EffectGameObject *m_playbackObject; // rax
_BYTE v15[4]; // [rsp+4h] [rbp-2Ch] BYREF
float v16; // [rsp+8h] [rbp-28h]
int v17[2]; // [rsp+Ch] [rbp-24h] BYREF
float v18; // [rsp+14h] [rbp-1Ch]
if ( !a2->m_isStartPos )
{
v3 = a1->m_objectCount.random + ~a1->m_objectCount.seed;
a1->m_objectCount.value = v3;
v4 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0);
a1->m_objectCount.seed = v4;
a1->m_objectCount.random = v4 + v3;
}
m_objectID = a2->m_objectID;
if ( m_objectID > 2064 )
{
if ( m_objectID == 2065 )
{
m_particleObjects = a1->m_particleObjects;
}
else
{
if ( m_objectID != 3032 )
goto LABEL_16;
GJBaseGameLayer::removeKeyframe(a1, (KeyframeGameObject *)a2);
m_particleObjects = a1->m_keyframeObjects;
}
sub_100720220(m_particleObjects, a2, 1);
}
else if ( m_objectID == 747 )
{
v9 = *(GameObject **)&a2[1].m_sQuad.bl.vertices.y;
if ( v9 )
{
cocos2d::CCObject::retain(*(cocos2d::CCObject **)&a2[1].m_sQuad.bl.vertices.y);
((void (__fastcall *)(int *, GameObject *))v9->getStartPos)(v17, v9);
v18 = *(float *)&v17[1];
((void (__fastcall *)(_BYTE *, GameObject *))a2->getStartPos)(v15, a2);
a2[1].m_sQuad.bl.texCoords.u = v18 - v16;
if ( !a1->m_removingAll )
{
((void (__fastcall *)(GameObject *, __int64))v9->deactivateObject)(v9, 1);
GJBaseGameLayer::removeObjectFromSection(a1, v9);
LevelEditorLayer::removeSpecial(a1, v9);
a1->m_unk3b22 = 1;
}
*(_QWORD *)&a2[1].m_sQuad.bl.vertices.y = 0;
cocos2d::CCObject::release(v9);
}
}
else if ( m_objectID == 1329 )
{
v6 = a1->m_coinCount.random + ~a1->m_coinCount.seed;
a1->m_coinCount.value = v6;
v7 = (int)(float)((float)((float)rand() * 4.6566129e-10) * 1000.0);
a1->m_coinCount.seed = v7;
a1->m_coinCount.random = v7 + v6;
}
LABEL_16:
if ( a2->m_dontIgnoreDuration )
{
sub_10028CC90();
if ( !a2->m_isTrigger )
{
LABEL_18:
if ( a2->m_classType != Effect )
goto LABEL_19;
goto LABEL_27;
}
}
else if ( !a2->m_isTrigger )
{
goto LABEL_18;
}
m_drawGridLayer = a1->m_drawGridLayer;
sub_100720220(m_drawGridLayer->m_effectGameObjects, a2, 1);
m_drawGridLayer->m_sortEffects = 1;
if ( a2->m_classType != Effect )
{
LABEL_19:
v10 = a2->m_objectID;
if ( v10 <= 1911 )
goto LABEL_20;
goto LABEL_28;
}
LABEL_27:
LevelEditorLayer::tryUpdateSpeedObject(a1, (EffectGameObject *)a2, 1);
v10 = a2->m_objectID;
if ( v10 <= 1911 )
{
LABEL_20:
if ( v10 <= 1267 )
{
if ( v10 != 901 )
{
if ( v10 == 1006 )
{
m_pulseTriggers = a1->m_pulseTriggers;
goto LABEL_50;
}
if ( v10 == 1007 )
{
m_pulseTriggers = a1->m_alphaTriggers;
goto LABEL_50;
}
goto LABEL_36;
}
LABEL_43:
m_pulseTriggers = a1->m_moveTriggers;
goto LABEL_50;
}
if ( (unsigned int)(v10 - 1346) < 2 )
goto LABEL_43;
if ( v10 != 1268 )
{
if ( v10 == 1814 )
goto LABEL_43;
goto LABEL_36;
}
goto LABEL_44;
}
LABEL_28:
if ( v10 <= 2067 )
{
if ( v10 != 1912 )
{
if ( v10 == 2016 )
{
m_pulseTriggers = a1->m_cameraGuideTriggers;
goto LABEL_50;
}
if ( v10 == 2067 )
goto LABEL_43;
LABEL_36:
if ( !GameObject::isColorTrigger(a2) )
{
if ( a2->m_isSpawnOrderTrigger )
goto LABEL_51;
goto LABEL_38;
}
m_pulseTriggers = a1->m_colorTriggers;
LABEL_50:
sub_100720220(m_pulseTriggers, a2, 1);
if ( a2->m_isSpawnOrderTrigger )
goto LABEL_51;
LABEL_38:
if ( a2->m_activateTriggerInEditor )
goto LABEL_56;
goto LABEL_52;
}
LABEL_44:
m_pulseTriggers = a1->m_spawnTriggers;
goto LABEL_50;
}
if ( v10 == 2068 )
goto LABEL_44;
if ( v10 != 3642 )
{
if ( v10 == 3016 )
goto LABEL_43;
goto LABEL_36;
}
p_m_audioLineObjects = &a1->m_drawGridLayer->m_audioLineObjects;
v17[0] = a2->m_uniqueID;
sub_1000569A0(p_m_audioLineObjects, v17);
if ( !a2->m_isSpawnOrderTrigger )
goto LABEL_38;
LABEL_51:
sub_100720220(a1->m_spawnOrderObjects, a2, 1);
a1->m_spawnOrderObjectsChanged = 1;
if ( a2->m_activateTriggerInEditor )
goto LABEL_56;
LABEL_52:
if ( !((unsigned __int8 (__fastcall *)(GameObject *))a2->isSpecialSpawnObject)(a2) )
{
if ( !a2->m_dontIgnoreDuration )
goto LABEL_54;
LABEL_57:
sub_100720220(a1->m_durationObjects, a2, 1);
m_playbackObject = a1->m_playbackObject;
if ( !m_playbackObject )
goto LABEL_60;
goto LABEL_58;
}
LABEL_56:
sub_100720220(a1->m_playtestTriggers, a2, 1);
if ( a2->m_dontIgnoreDuration )
goto LABEL_57;
LABEL_54:
m_playbackObject = a1->m_playbackObject;
if ( !m_playbackObject )
goto LABEL_60;
LABEL_58:
if ( m_playbackObject->m_uniqueID == a2->m_uniqueID )
a1->m_playbackObject = nullptr;
LABEL_60:
sub_100720220(a1->m_objects, a2, 1);
GJBaseGameLayer::removeFromGroupParents(a1, a2);
GJBaseGameLayer::removeFromGroups(a1, a2);
GJBaseGameLayer::removeFromStickyGroup(a1, a2);
a1->m_unk3b22 = 1;
}