//
// LevelEditorLayer::handleAction from 0x1000e2b90 to 0x1000e31f2 (1634 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::handleAction @ 0x1000e31d7
// > LevelEditorLayer::redoLastAction @ 0x1000e343e
// > LevelEditorLayer::undoLastAction @ 0x1000e3461
//
// 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::handleAction(LevelEditorLayer *a1, bool a2, cocos2d::CCArray *a3)
{
cocos2d::CCArray *v3; // r15
__int64 v5; // r14
int v6; // eax
UndoObject *v7; // r13
GameObject *v8; // r14
__int64 v9; // r12
cocos2d::CCArray *v10; // r13
unsigned int v11; // r15d
GameObjectCopy *v12; // r14
GameObjectCopy *v13; // rax
__int64 v14; // r12
unsigned int v15; // r15d
GameObject *v16; // r14
cocos2d::CCArray *v17; // r12
__int64 v18; // r13
unsigned int v19; // r15d
GameObject *v20; // r14
GameObject *v21; // r15
EditorUI *m_editorUI; // r14
cocos2d::CCArray *v23; // rax
EditorUI *v24; // rdi
cocos2d::CCArray *SelectedObjects; // r15
cocos2d::CCObject *v26; // rdi
unsigned int v27; // r14d
cocos2d::CCObject *v28; // r14
bool v29; // al
__int64 v30; // rcx
EditorUI *v31; // r14
__int128 v32; // xmm0
EditorUI *v33; // r14
__int128 v34; // xmm1
unsigned int v35; // r14d
bool v36; // [rsp+4h] [rbp-3Ch]
cocos2d::CCArray *v37; // [rsp+8h] [rbp-38h]
cocos2d::CCArray *v38; // [rsp+8h] [rbp-38h]
__int64 v39; // [rsp+10h] [rbp-30h]
v3 = a3;
if ( (unsigned int)sub_100720070(a3) )
{
v5 = sub_1007200E0(v3);
cocos2d::CCObject::retain((cocos2d::CCObject *)v5);
sub_100720200(v3, 1);
v6 = *(_DWORD *)(v5 + 64);
v39 = v5;
if ( a2 )
{
v7 = (UndoObject *)v5;
v36 = a2;
switch ( v6 )
{
case 1:
goto LABEL_26;
case 2:
goto LABEL_6;
case 3:
goto LABEL_14;
case 4:
goto LABEL_19;
case 5:
goto LABEL_8;
case 6:
goto LABEL_29;
default:
goto LABEL_37;
}
}
v7 = (UndoObject *)v5;
v36 = 0;
switch ( v6 )
{
case 1:
LABEL_6:
v8 = *(GameObject **)(*(_QWORD *)(v5 + 56) + 56LL);
GJBaseGameLayer::removeObjectFromSection(a1, v8);
LevelEditorLayer::removeSpecial(a1, v8);
v8->m_wasSelected = v8->m_isSelected;
EditorUI::deselectObject(a1->m_editorUI, v8);
((void (__fastcall *)(GameObject *, __int64))v8->deactivateObject)(v8, 1);
v7 = (UndoObject *)v39;
if ( v36 )
goto LABEL_37;
goto LABEL_48;
case 2:
LABEL_26:
v38 = v3;
v21 = *(GameObject **)(*(_QWORD *)(v5 + 56) + 56LL);
((void (__fastcall *)(LevelEditorLayer *, GameObject *))a1->addToSection)(a1, v21);
LevelEditorLayer::addSpecial(a1, v21);
if ( v21->m_wasSelected )
{
m_editorUI = a1->m_editorUI;
v23 = (cocos2d::CCArray *)sub_10071FA80(v21);
v24 = m_editorUI;
v5 = v39;
EditorUI::selectObjects(v24, v23, 1);
}
GameObject::assignUniqueID(v21);
goto LABEL_35;
case 3:
LABEL_19:
v38 = v3;
v17 = (cocos2d::CCArray *)sub_10071F9E0(v3, 1);
v18 = *(_QWORD *)(v5 + 72);
if ( (unsigned int)sub_100720070(v18) )
{
v19 = 0;
do
{
v20 = (GameObject *)sub_1007200C0(v18, v19);
((void (__fastcall *)(LevelEditorLayer *, GameObject *))a1->addToSection)(a1, v20);
LevelEditorLayer::addSpecial(a1, v20);
if ( v20->m_wasSelected )
sub_10071FCD0(v17, v20);
GameObject::assignUniqueID(v20);
++v19;
}
while ( v19 < (unsigned int)sub_100720070(v18) );
}
v5 = v39;
v7 = (UndoObject *)v39;
if ( !(unsigned int)sub_100720070(v17) )
goto LABEL_36;
EditorUI::selectObjects(a1->m_editorUI, v17, 1);
goto LABEL_35;
case 4:
LABEL_14:
v38 = v3;
v14 = *(_QWORD *)(v5 + 72);
v7 = (UndoObject *)v5;
if ( !(unsigned int)sub_100720070(v14) )
goto LABEL_36;
v15 = 0;
do
{
v16 = (GameObject *)sub_1007200C0(v14, v15);
GJBaseGameLayer::removeObjectFromSection(a1, v16);
LevelEditorLayer::removeSpecial(a1, v16);
v16->m_wasSelected = v16->m_isSelected;
EditorUI::deselectObject(a1->m_editorUI, v16);
((void (__fastcall *)(GameObject *, __int64))v16->deactivateObject)(v16, 1);
++v15;
}
while ( v15 < (unsigned int)sub_100720070(v14) );
v7 = (UndoObject *)v39;
v3 = v38;
if ( !v36 )
goto LABEL_48;
goto LABEL_37;
case 5:
LABEL_8:
v37 = v3;
v9 = *(_QWORD *)(v5 + 72);
if ( v9 )
{
v10 = (cocos2d::CCArray *)sub_10071F9E0(v3, 1);
if ( (unsigned int)sub_100720070(v9) )
{
v11 = 0;
do
{
v12 = (GameObjectCopy *)sub_1007200C0(v9, v11);
v13 = GameObjectCopy::create(v12->m_object);
sub_10071FCD0(v10, v13);
GameObjectCopy::resetObject(v12);
GJBaseGameLayer::reorderObjectSection(a1, v12->m_object);
++v11;
}
while ( v11 < (unsigned int)sub_100720070(v9) );
}
v7 = UndoObject::createWithArray(v10, Transform);
v5 = v39;
if ( *(_BYTE *)(v39 + 81) != 1 )
{
LABEL_47:
v7->m_redo = *(_BYTE *)(v5 + 80);
v3 = v37;
if ( v36 )
{
LABEL_37:
v27 = 200;
if ( a1->m_increaseMaxUndoRedo )
v27 = 1000;
if ( (unsigned int)sub_100720070(a1->m_redoObjects) >= v27 )
sub_100720230(a1->m_redoObjects, 0, 1);
sub_10071FCD0(a1->m_redoObjects, v7);
v28 = (cocos2d::CCObject *)v39;
if ( !(unsigned int)sub_100720070(v3) || *(_BYTE *)(sub_1007200E0(v3) + 80) != 1 )
goto LABEL_56;
v29 = 1;
v30 = 13944;
}
else
{
LABEL_48:
v35 = 200;
if ( a1->m_increaseMaxUndoRedo )
v35 = 1000;
if ( (unsigned int)sub_100720070(a1->m_undoObjects) >= v35 )
sub_100720230(a1->m_undoObjects, 0, 1);
sub_10071FCD0(a1->m_undoObjects, v7);
v28 = (cocos2d::CCObject *)v39;
if ( !(unsigned int)sub_100720070(v3) || !*(_BYTE *)(v39 + 80) )
goto LABEL_56;
v30 = 13952;
v29 = 0;
}
LevelEditorLayer::handleAction(
a1,
v29,
*(cocos2d::CCArray **)((char *)&a1->GJBaseGameLayer::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable
+ v30));
LABEL_56:
cocos2d::CCObject::release(v28);
return;
}
}
else
{
v7 = UndoObject::create(*(GameObject **)(*(_QWORD *)(v5 + 56) + 56LL), Transform);
GameObjectCopy::resetObject(*(GameObjectCopy **)(v5 + 56));
GJBaseGameLayer::reorderObjectSection(a1, *(GameObject **)(*(_QWORD *)(v5 + 56) + 56LL));
if ( *(_BYTE *)(v5 + 81) != 1 )
goto LABEL_47;
}
if ( ((unsigned __int8 (__fastcall *)(GJTransformControl *))a1->m_editorUI->m_transformControl->isVisible)(a1->m_editorUI->m_transformControl) )
{
v31 = a1->m_editorUI;
*(_QWORD *)&v7->m_transformState.m_transformRotationX = *(_QWORD *)&v31->m_transformState.m_transformRotationX;
v32 = *(_OWORD *)&v31->m_transformState.m_scaleX;
*(_OWORD *)&v7->m_transformState.m_skewX = *(_OWORD *)&v31->m_transformState.m_skewX;
*(_OWORD *)&v7->m_transformState.m_scaleX = v32;
sub_10028CC90();
sub_10028CC90();
sub_10028CC90();
*(_QWORD *)&v7->m_transformState.m_transformScaleX = *(_QWORD *)&v31->m_transformState.m_transformScaleX;
v7->m_undoTransform = 1;
v33 = a1->m_editorUI;
v34 = *(_OWORD *)(v39 + 100);
*(_OWORD *)&v33->m_transformState.m_scaleX = *(_OWORD *)(v39 + 84);
*(_OWORD *)&v33->m_transformState.m_skewX = v34;
*(_QWORD *)&v33->m_transformState.m_transformRotationX = *(_QWORD *)(v39 + 116);
sub_10028CC90();
sub_10028CC90();
sub_10028CC90();
*(_QWORD *)&v33->m_transformState.m_transformScaleX = *(_QWORD *)(v39 + 148);
v5 = v39;
GJTransformControl::loadFromState(a1->m_editorUI->m_transformControl, (GJTransformState *)(v39 + 84));
GJTransformControl::refreshControl(a1->m_editorUI->m_transformControl);
}
goto LABEL_47;
case 6:
LABEL_29:
v38 = v3;
SelectedObjects = EditorUI::getSelectedObjects(a1->m_editorUI);
EditorUI::changeSelectedObjects(a1->m_editorUI, *(cocos2d::CCArray **)(v5 + 72), 1);
v26 = *(cocos2d::CCObject **)(v5 + 72);
v7 = (UndoObject *)v5;
if ( v26 == SelectedObjects )
goto LABEL_36;
if ( SelectedObjects )
{
cocos2d::CCObject::retain(SelectedObjects);
v26 = *(cocos2d::CCObject **)(v5 + 72);
}
if ( v26 )
cocos2d::CCObject::release(v26);
*(_QWORD *)(v5 + 72) = SelectedObjects;
LABEL_35:
v7 = (UndoObject *)v5;
LABEL_36:
v3 = v38;
if ( v36 )
goto LABEL_37;
goto LABEL_48;
default:
goto LABEL_48;
}
}
}