//
// LevelEditorLayer::handleAction from 0x6724ac to 0x672a50 (1444 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::redoLastAction @ 0x672a58
// > LevelEditorLayer::undoLastAction @ 0x672a64
// > ??> @ 0x2dc00
//
// 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 LevelEditorLayer::handleAction(LevelEditorLayer *a1, bool a2, cocos2d::CCArray *a3)
{
_BOOL4 v5; // w24
__int64 Object; // x22
cocos2d::CCArray *v7; // x0
cocos2d::CCArray *v8; // x25
unsigned int v9; // w20
cocos2d::CCArray *v10; // x26
unsigned int v11; // w1
GameObjectCopy *v12; // x23
GameObjectCopy *v13; // x0
UndoObject *v14; // x20
cocos2d::CCArray *SelectedObjects; // x23
GameObject *v16; // x23
EditorUI *v17; // x0
GameObject *v18; // x20
cocos2d::CCObject *v19; // x1
GameObject *v20; // x0
cocos2d::CCArray *v21; // x25
unsigned int v22; // w23
unsigned int v23; // w1
GameObject *v24; // x20
EditorUI *v25; // x0
unsigned int v26; // w23
cocos2d::CCArray *v27; // x26
cocos2d::CCArray *v28; // x25
GameObject *v29; // x20
EditorUI *m_editorUI; // x23
cocos2d::CCArray *v31; // x0
float v32; // s0
float v33; // s1
EditorUI *v34; // x27
GJTransformState *p_m_transformState; // x25
float m_scaleX; // w11
float m_scaleY; // w9
float m_angleX; // w8
float m_angleY; // w7
float m_skewX; // w6
float m_skewY; // w5
float m_transformRotation; // w4
float m_transformRotationX; // w3
float m_transformRotationY; // w2
float v45; // s0
float v46; // s1
float v47; // s0
float v48; // s1
EditorUI *v49; // x27
char v50; // w10
float m_transformScaleX; // w0
float v52; // w11
float v53; // w9
float v54; // w8
float v55; // w7
float v56; // w6
float v57; // w5
float v58; // w4
float v59; // w3
float v60; // w2
float v61; // s0
float v62; // s1
float v63; // s0
float v64; // s1
float v65; // s0
float v66; // s1
float v67; // w2
GJTransformControl *m_transformControl; // x0
v5 = a2;
if ( (unsigned int)cocos2d::CCArray::count(a3) )
{
Object = cocos2d::CCArray::lastObject(a3);
cocos2d::CCObject::retain((cocos2d::CCObject *)Object);
cocos2d::CCArray::removeLastObject(a3, 1);
v7 = (cocos2d::CCArray *)(unsigned int)(*(_DWORD *)(Object + 64) - 1);
if ( !v5 )
{
switch ( *(_DWORD *)(Object + 64) )
{
case 1:
goto LABEL_18;
case 2:
goto LABEL_19;
case 3:
goto LABEL_26;
case 4:
goto LABEL_22;
default:
switch ( *(_DWORD *)(Object + 64) )
{
case 1:
goto LABEL_19;
case 2:
goto LABEL_18;
case 3:
goto LABEL_22;
case 4:
goto LABEL_26;
case 5:
goto LABEL_5;
case 6:
goto LABEL_17;
default:
v14 = (UndoObject *)Object;
goto LABEL_34;
}
}
}
switch ( *(_DWORD *)(Object + 64) )
{
case 1:
LABEL_19:
v18 = *(GameObject **)(*(_QWORD *)(Object + 56) + 56LL);
a1->addToSection(a1, v18);
LevelEditorLayer::addSpecial(a1, v18);
if ( v18->m_wasSelected )
{
m_editorUI = a1->m_editorUI;
v31 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject((cocos2d::CCArray *)v18, v19);
EditorUI::selectObjects(m_editorUI, v31, 1);
}
v20 = v18;
v14 = (UndoObject *)Object;
GameObject::assignUniqueID(v20);
goto LABEL_12;
case 2:
LABEL_18:
v14 = (UndoObject *)Object;
v16 = *(GameObject **)(*(_QWORD *)(Object + 56) + 56LL);
GJBaseGameLayer::removeObjectFromSection(a1, v16);
LevelEditorLayer::removeSpecial(a1, v16);
v17 = a1->m_editorUI;
v16->m_wasSelected = v16->m_isSelected;
EditorUI::deselectObject(v17);
v16->deactivateObject(v16, 1);
goto LABEL_12;
case 3:
LABEL_22:
v21 = *(cocos2d::CCArray **)(Object + 72);
v22 = 0;
while ( v22 < (unsigned int)cocos2d::CCArray::count(v21) )
{
v23 = v22++;
v24 = (GameObject *)cocos2d::CCArray::objectAtIndex(v21, v23);
GJBaseGameLayer::removeObjectFromSection(a1, v24);
LevelEditorLayer::removeSpecial(a1, v24);
v25 = a1->m_editorUI;
v24->m_wasSelected = v24->m_isSelected;
EditorUI::deselectObject(v25);
v24->deactivateObject(v24, 1);
}
v14 = (UndoObject *)Object;
goto LABEL_12;
case 4:
LABEL_26:
v26 = 0;
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
v28 = *(cocos2d::CCArray **)(Object + 72);
while ( v26 < (unsigned int)cocos2d::CCArray::count(v28) )
{
v29 = (GameObject *)cocos2d::CCArray::objectAtIndex(v28, v26);
a1->addToSection(a1, v29);
LevelEditorLayer::addSpecial(a1, v29);
if ( v29->m_wasSelected )
cocos2d::CCArray::addObject(v27, v29);
++v26;
GameObject::assignUniqueID(v29);
}
v14 = (UndoObject *)Object;
if ( (unsigned int)cocos2d::CCArray::count(v27) )
EditorUI::selectObjects(a1->m_editorUI, v27, 1);
goto LABEL_12;
case 5:
LABEL_5:
v8 = *(cocos2d::CCArray **)(Object + 72);
if ( v8 )
{
v9 = 0;
v10 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
while ( v9 < (unsigned int)cocos2d::CCArray::count(v8) )
{
v11 = v9++;
v12 = (GameObjectCopy *)cocos2d::CCArray::objectAtIndex(v8, v11);
v13 = GameObjectCopy::create(v12->m_object);
cocos2d::CCArray::addObject(v10, v13);
GameObjectCopy::resetObject(v12);
GJBaseGameLayer::reorderObjectSection(a1, v12->m_object);
}
v14 = UndoObject::createWithArray(v10, Transform);
}
else
{
v14 = UndoObject::create(*(GameObject **)(*(_QWORD *)(Object + 56) + 56LL), Transform);
GameObjectCopy::resetObject(*(GameObjectCopy **)(Object + 56));
GJBaseGameLayer::reorderObjectSection(a1, *(GameObject **)(*(_QWORD *)(Object + 56) + 56LL));
}
if ( *(_BYTE *)(Object + 81)
&& a1->m_editorUI->m_transformControl->isVisible(a1->m_editorUI->m_transformControl) )
{
v34 = a1->m_editorUI;
p_m_transformState = &v34->m_transformState;
m_scaleX = v34->m_transformState.m_scaleX;
m_scaleY = v34->m_transformState.m_scaleY;
m_angleX = v34->m_transformState.m_angleX;
m_angleY = v34->m_transformState.m_angleY;
m_skewX = v34->m_transformState.m_skewX;
m_skewY = v34->m_transformState.m_skewY;
m_transformRotation = v34->m_transformState.m_transformRotation;
m_transformRotationX = v34->m_transformState.m_transformRotationX;
m_transformRotationY = v34->m_transformState.m_transformRotationY;
v14->m_transformState.m_transformReset = v34->m_transformState.m_transformReset;
v14->m_transformState.m_scaleX = m_scaleX;
v14->m_transformState.m_scaleY = m_scaleY;
v14->m_transformState.m_angleX = m_angleX;
v14->m_transformState.m_angleY = m_angleY;
v14->m_transformState.m_skewX = m_skewX;
v14->m_transformState.m_skewY = m_skewY;
v14->m_transformState.m_transformRotation = m_transformRotation;
v14->m_transformState.m_transformRotationX = m_transformRotationX;
v14->m_transformState.m_transformRotationY = m_transformRotationY;
cocos2d::CCPoint::operator=(&v14->m_transformState.m_transformPosition, v32, v33);
cocos2d::CCPoint::operator=(&v14->m_transformState.m_transformSkewX, v45, v46);
cocos2d::CCPoint::operator=(&v14->m_transformState.m_transformSkewY, v47, v48);
v49 = a1->m_editorUI;
v50 = *(_BYTE *)(Object + 112);
m_transformScaleX = p_m_transformState->m_transformScaleX;
v52 = *(float *)(Object + 84);
v53 = *(float *)(Object + 88);
v14->m_transformState.m_transformScaleY = p_m_transformState->m_transformScaleY;
v54 = *(float *)(Object + 92);
v14->m_undoTransform = 1;
v55 = *(float *)(Object + 96);
v56 = *(float *)(Object + 100);
v57 = *(float *)(Object + 104);
v58 = *(float *)(Object + 108);
v59 = *(float *)(Object + 116);
v60 = *(float *)(Object + 120);
v14->m_transformState.m_transformScaleX = m_transformScaleX;
v49->m_transformState.m_transformReset = v50;
v49->m_transformState.m_scaleX = v52;
v49->m_transformState.m_scaleY = v53;
v49->m_transformState.m_angleX = v54;
v49->m_transformState.m_angleY = v55;
v49->m_transformState.m_skewX = v56;
v49->m_transformState.m_skewY = v57;
v49->m_transformState.m_transformRotation = v58;
v49->m_transformState.m_transformRotationX = v59;
v49->m_transformState.m_transformRotationY = v60;
cocos2d::CCPoint::operator=(&v49->m_transformState.m_transformPosition, v61, v62);
cocos2d::CCPoint::operator=(&v49->m_transformState.m_transformSkewX, v63, v64);
cocos2d::CCPoint::operator=(&v49->m_transformState.m_transformSkewY, v65, v66);
v67 = *(float *)(Object + 152);
m_transformControl = a1->m_editorUI->m_transformControl;
v49->m_transformState.m_transformScaleX = *(float *)(Object + 148);
v49->m_transformState.m_transformScaleY = v67;
GJTransformControl::loadFromState(m_transformControl, (GJTransformState *)(Object + 84));
GJTransformControl::refreshControl(a1->m_editorUI->m_transformControl);
}
v14->m_redo = *(_BYTE *)(Object + 80);
goto LABEL_12;
case 6:
LABEL_17:
v14 = (UndoObject *)Object;
SelectedObjects = EditorUI::getSelectedObjects(a1->m_editorUI);
EditorUI::changeSelectedObjects(a1->m_editorUI, *(cocos2d::CCArray **)(Object + 72), 1);
UndoObject::setObjects((UndoObject *)Object, SelectedObjects);
LABEL_12:
if ( v5 )
{
LevelEditorLayer::addToRedoList(a1, v14);
if ( (unsigned int)cocos2d::CCArray::count(a3) )
{
LABEL_14:
if ( *(_BYTE *)(cocos2d::CCArray::lastObject(a3) + 80) )
LevelEditorLayer::undoLastAction(a1);
}
}
else
{
LABEL_34:
LevelEditorLayer::addToUndoList(a1, v14, 1);
if ( (unsigned int)cocos2d::CCArray::count(a3) && *(_BYTE *)(Object + 80) )
LevelEditorLayer::redoLastAction(a1);
}
LABEL_16:
cocos2d::CCObject::release((cocos2d::CCObject *)Object);
break;
default:
LevelEditorLayer::addToRedoList(a1, (UndoObject *)Object);
if ( !(unsigned int)cocos2d::CCArray::count(a3) )
goto LABEL_16;
goto LABEL_14;
}
}
}