//
// LevelEditorLayer::handleAction from 0x1000b2410 to 0x1000b2d59 (2377 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::handleAction @ 0x1000b28df
// > LevelEditorLayer::redoLastAction @ 0x1000b2fd7
// > LevelEditorLayer::undoLastAction @ 0x1000b302a
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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 12:20:20 +0000
//
__int64 __fastcall LevelEditorLayer::handleAction(__int64 a1, int a2, __int64 a3)
{
int v4; // r12d
__int64 result; // rax
__int64 v7; // r13
__int64 v8; // rdi
char *v9; // r14
_BYTE *v10; // r14
__int64 v11; // r15
__int64 v12; // r13
unsigned int v13; // r12d
__int64 v14; // r14
__int64 v15; // rsi
__int64 v16; // r15
unsigned int v17; // r12d
_BYTE *v18; // r14
__int64 v19; // r15
__int64 v20; // r13
unsigned int v21; // r12d
__int64 v22; // r14
__int64 v23; // r15
__int64 v24; // r14
__int64 v25; // rsi
__int64 SelectedObjects; // r15
__int64 v27; // rdi
char v28; // al
__int64 v29; // r15
unsigned int v30; // r14d
char *v31; // rsi
__int64 v32; // rax
__int64 v33; // rax
unsigned __int8 v34; // cl
__int64 v35; // r14
char *v36; // rsi
__int64 v37; // rax
char *v38; // r15
__int64 v39; // r14
__int128 v40; // xmm1
__int64 v41; // r14
__int128 v42; // xmm1
__int64 v43; // r15
__int64 v44; // rdi
__int64 v45; // r14
__int64 v46; // rsi
__int64 *v47; // r13
__int64 v48; // rax
float v49; // xmm0_4
__int64 v50; // rax
unsigned int *v51; // rax
__int64 *v52; // r12
__int64 v53; // r15
__int64 v54; // rdi
float *v55; // r13
__int64 v56; // rax
float v57; // xmm0_4
float *v58; // r14
float v59; // xmm2_4
float v60; // xmm0_4
float v61; // xmm1_4
float v62; // xmm3_4
char v63[8]; // [rsp+8h] [rbp-88h] BYREF
float *v64; // [rsp+10h] [rbp-80h]
__int64 v65; // [rsp+18h] [rbp-78h]
__int64 *v66; // [rsp+20h] [rbp-70h]
unsigned __int64 v67; // [rsp+28h] [rbp-68h]
int v68; // [rsp+34h] [rbp-5Ch] BYREF
float v69; // [rsp+3Ch] [rbp-54h]
int *v70; // [rsp+40h] [rbp-50h] BYREF
__int64 v71; // [rsp+48h] [rbp-48h]
char *v72; // [rsp+50h] [rbp-40h]
char *v73; // [rsp+58h] [rbp-38h]
char v74; // [rsp+63h] [rbp-2Dh] BYREF
int v75; // [rsp+64h] [rbp-2Ch]
v4 = a2;
result = sub_1007FEF90(a3);
if ( (_DWORD)result )
{
v7 = sub_1007FF000(a3);
cocos2d::CCObject::retain(v7);
v71 = a3;
v8 = a3;
sub_1007FF120(a3, 1);
v9 = (char *)v7;
if ( (_BYTE)a2 )
{
switch ( *(_DWORD *)(v7 + 64) )
{
case 1:
goto LABEL_23;
case 2:
goto LABEL_5;
case 3:
goto LABEL_12;
case 4:
goto LABEL_16;
case 5:
goto LABEL_6;
case 6:
goto LABEL_26;
default:
goto LABEL_33;
}
}
switch ( *(_DWORD *)(v7 + 64) )
{
case 1:
LABEL_5:
v10 = *(_BYTE **)(*(_QWORD *)(v7 + 56) + 56LL);
GJBaseGameLayer::removeObjectFromSection(a1, v10);
LevelEditorLayer::removeSpecial(a1, (__int64)v10);
v10[1132] = v10[1133];
EditorUI::deselectObject(*(_QWORD *)(a1 + 14248), v10);
(*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v10 + 1312LL))(v10, 1);
goto LABEL_32;
case 2:
LABEL_23:
v23 = *(_QWORD *)(*(_QWORD *)(v7 + 56) + 56LL);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1344LL))(a1, v23);
LevelEditorLayer::addSpecial(a1, v23);
if ( *(_BYTE *)(v23 + 1132) == 1 )
{
v24 = *(_QWORD *)(a1 + 14248);
v25 = sub_1007FE9A0(v23);
EditorUI::selectObjects(v24, v25, 1);
}
GameObject::assignUniqueID(v23);
goto LABEL_32;
case 3:
LABEL_16:
v75 = a2;
v19 = sub_1007FE900(v8);
v73 = (char *)v7;
v20 = *(_QWORD *)(v7 + 72);
if ( (unsigned int)sub_1007FEF90(v20) )
{
v21 = 0;
do
{
v22 = sub_1007FEFE0(v20, v21);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1344LL))(a1, v22);
LevelEditorLayer::addSpecial(a1, v22);
if ( *(_BYTE *)(v22 + 1132) == 1 )
sub_1007FEBF0(v19, v22);
GameObject::assignUniqueID(v22);
++v21;
}
while ( v21 < (unsigned int)sub_1007FEF90(v20) );
}
v7 = (__int64)v73;
v9 = v73;
LOBYTE(v4) = v75;
if ( !(unsigned int)sub_1007FEF90(v19) )
goto LABEL_33;
EditorUI::selectObjects(*(_QWORD *)(a1 + 14248), v19, 1);
goto LABEL_32;
case 4:
LABEL_12:
v16 = *(_QWORD *)(v7 + 72);
v9 = (char *)v7;
if ( (unsigned int)sub_1007FEF90(v16) )
{
v75 = a2;
v17 = 0;
do
{
v18 = (_BYTE *)sub_1007FEFE0(v16, v17);
GJBaseGameLayer::removeObjectFromSection(a1, v18);
LevelEditorLayer::removeSpecial(a1, (__int64)v18);
v18[1132] = v18[1133];
EditorUI::deselectObject(*(_QWORD *)(a1 + 14248), v18);
(*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v18 + 1312LL))(v18, 1);
++v17;
}
while ( v17 < (unsigned int)sub_1007FEF90(v16) );
v9 = (char *)v7;
LOBYTE(v4) = v75;
}
goto LABEL_33;
case 5:
LABEL_6:
v11 = *(_QWORD *)(v7 + 72);
if ( v11 )
{
v75 = a2;
v73 = (char *)v7;
v12 = sub_1007FE900(v8);
if ( (unsigned int)sub_1007FEF90(v11) )
{
v13 = 0;
do
{
v14 = sub_1007FEFE0(v11, v13);
v15 = GameObjectCopy::create(*(_QWORD *)(v14 + 56));
sub_1007FEBF0(v12, v15);
GameObjectCopy::resetObject(v14);
GJBaseGameLayer::reorderObjectSection(a1, *(_QWORD *)(v14 + 56));
++v13;
}
while ( v13 < (unsigned int)sub_1007FEF90(v11) );
}
v9 = UndoObject::createWithArray(v12, 5);
v7 = (__int64)v73;
v4 = v75;
if ( v73[81] != 1 )
goto LABEL_67;
}
else
{
v9 = UndoObject::create(*(_QWORD *)(*(_QWORD *)(v7 + 56) + 56LL), 5);
GameObjectCopy::resetObject(*(_QWORD *)(v7 + 56));
GJBaseGameLayer::reorderObjectSection(a1, *(_QWORD *)(*(_QWORD *)(v7 + 56) + 56LL));
if ( *(_BYTE *)(v7 + 81) != 1 )
goto LABEL_67;
}
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 14248) + 792LL) + 352LL))(*(_QWORD *)(*(_QWORD *)(a1 + 14248) + 792LL)) )
{
v38 = v9;
v39 = sub_1006139A0(*(_QWORD *)(a1 + 14248));
v40 = *(_OWORD *)(v39 + 16);
*(_OWORD *)(v38 + 84) = *(_OWORD *)v39;
*(_OWORD *)(v38 + 100) = v40;
*(_QWORD *)(v38 + 116) = *(_QWORD *)(v39 + 32);
sub_100278300(v38 + 124, v39 + 40);
sub_100278300(v38 + 132, v39 + 48);
sub_100278300(v38 + 140, v39 + 56);
*(_QWORD *)(v38 + 148) = *(_QWORD *)(v39 + 64);
v72 = v38;
v38[81] = 1;
v41 = *(_QWORD *)(a1 + 14248);
v42 = *(_OWORD *)(v7 + 100);
*(_OWORD *)(v41 + 504) = *(_OWORD *)(v7 + 84);
*(_OWORD *)(v41 + 520) = v42;
*(_QWORD *)(v41 + 536) = *(_QWORD *)(v7 + 116);
sub_100278300(v41 + 544, v7 + 124);
sub_100278300(v41 + 552, v7 + 132);
sub_100278300(v41 + 560, v7 + 140);
*(_QWORD *)(v41 + 568) = *(_QWORD *)(v7 + 148);
GJTransformControl::loadFromState(*(_QWORD *)(*(_QWORD *)(a1 + 14248) + 792LL), v7 + 84);
v43 = *(_QWORD *)(a1 + 14248);
v44 = *(_QWORD *)(v43 + 792);
v45 = *(_QWORD *)(v44 + 424);
if ( v45 )
{
v75 = v4;
v73 = (char *)v7;
v69 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3920) + 168LL))(*(_QWORD *)(a1 + 3920));
v46 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3920) + 192LL))(*(_QWORD *)(a1 + 3920));
sub_1002782D0(v63, v46);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 3920) + 160LL))(*(_QWORD *)(a1 + 3920), 1.0);
(*(void (__fastcall **)(_QWORD, int *))(**(_QWORD **)(a1 + 3920) + 184LL))(
*(_QWORD *)(a1 + 3920),
&dword_100BE1180);
v47 = *(__int64 **)(*(_QWORD *)(a1 + 14248) + 800LL);
v48 = *v47;
v65 = v43 + 544;
(*(void (__fastcall **)(__int64 *, __int64))(v48 + 184))(v47, v43 + 544);
(*(void (__fastcall **)(__int64 *, float))(*v47 + 128))(v47, *(float *)(v43 + 504));
(*(void (__fastcall **)(__int64 *, float))(*v47 + 144))(v47, *(float *)(v43 + 508));
(*(void (__fastcall **)(__int64 *, float))(*v47 + 376))(v47, *(float *)(v43 + 512));
(*(void (__fastcall **)(__int64 *, float))(*v47 + 392))(v47, *(float *)(v43 + 516));
(*(void (__fastcall **)(__int64 *, float))(*v47 + 264))(v47, *(float *)(v43 + 520));
v64 = (float *)v43;
v49 = *(float *)(v43 + 524);
v50 = *v47;
v66 = v47;
(*(void (__fastcall **)(__int64 *, float))(v50 + 280))(v47, v49);
v51 = *(unsigned int **)(v45 + 56);
if ( *v51 )
{
v52 = *((__int64 **)v51 + 2);
v67 = (unsigned __int64)&v52[*v51 - 1];
do
{
v53 = *v52;
if ( !*v52 )
break;
v54 = *(_QWORD *)(a1 + 14248) + 464LL;
v68 = *(_DWORD *)(v53 + 916);
v70 = &v68;
v55 = (float *)sub_1000DFF80(v54, &v68, &unk_100A04AD3, &v70, &v74);
v56 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v53 + 192LL))(v53);
cocos2d::CCNode::convertToNodeSpace(&v70, v66, v56);
sub_100278350(&v68, &v70, v65);
sub_100278300(v55 + 5, &v68);
v57 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v53 + 384LL))(v53);
v58 = v64;
v55[9] = v57 - v64[128];
v55[10] = (*(float (__fastcall **)(__int64))(*(_QWORD *)v53 + 400LL))(v53) - v58[129];
v59 = v58[126];
v60 = v58[127];
v61 = *(float *)(v53 + 1316);
if ( v59 != 0.0 )
{
v62 = *(float *)(v53 + 1312);
if ( v62 != 0.0 )
v55[7] = *(float *)(v53 + 1152) / (float)(v59 * v62);
}
if ( v60 != 0.0 && v61 != 0.0 )
v55[8] = *(float *)(v53 + 1156) / (float)(v60 * v61);
++v52;
}
while ( (unsigned __int64)v52 <= v67 );
}
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 3920) + 160LL))(*(_QWORD *)(a1 + 3920), v69);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 3920) + 184LL))(*(_QWORD *)(a1 + 3920), v63);
v44 = *(_QWORD *)(*(_QWORD *)(a1 + 14248) + 792LL);
v7 = (__int64)v73;
LOBYTE(v4) = v75;
}
GJTransformControl::refreshControl(v44);
v72[80] = *(_BYTE *)(v7 + 80);
goto LABEL_35;
}
LABEL_67:
v9[80] = *(_BYTE *)(v7 + 80);
LABEL_33:
v28 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 14248) + 792LL) + 352LL))(*(_QWORD *)(*(_QWORD *)(a1 + 14248) + 792LL));
v72 = v9;
if ( v28 )
{
sub_100611790(*(_QWORD *)(a1 + 14248));
EditorUI::showTransformControl(*(_QWORD *)(a1 + 14248));
}
LABEL_35:
v29 = v71;
v30 = 200;
if ( *(_BYTE *)(a1 + 14007) )
v30 = 1000;
if ( (_BYTE)v4 )
{
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 14264)) >= v30 )
sub_1007FF150(*(_QWORD *)(a1 + 14264), 0, 1);
v31 = v72;
sub_1007FEBF0(*(_QWORD *)(a1 + 14264), v72);
if ( (unsigned int)sub_1007FEF90(v29) && *(_BYTE *)(sub_1007FF000(v29) + 80) == 1 )
{
v32 = cocos2d::CCDirector::sharedDirector(v29, v31);
v33 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v32 + 192LL))(v32);
v34 = 1;
v35 = 14256;
if ( *(_BYTE *)(v33 + 133) )
goto LABEL_51;
goto LABEL_50;
}
}
else
{
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 14256)) >= v30 )
sub_1007FF150(*(_QWORD *)(a1 + 14256), 0, 1);
v36 = v72;
sub_1007FEBF0(*(_QWORD *)(a1 + 14256), v72);
if ( (unsigned int)sub_1007FEF90(v29) && *(_BYTE *)(v7 + 80) == 1 )
{
v37 = cocos2d::CCDirector::sharedDirector(v29, v36);
v35 = 14264;
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v37 + 192LL))(v37) + 133) )
{
v34 = 0;
LABEL_51:
LevelEditorLayer::handleAction(a1, v34, *(_QWORD *)(a1 + v35));
goto LABEL_52;
}
LABEL_50:
++*(_DWORD *)(a1 + 14724);
EditorBuildStats::noteAction(a1 + 14704);
v34 = v4;
goto LABEL_51;
}
}
LABEL_52:
result = cocos2d::CCObject::release(v7);
break;
case 6:
LABEL_26:
SelectedObjects = EditorUI::getSelectedObjects(*(_QWORD *)(a1 + 14248));
EditorUI::changeSelectedObjects(*(_QWORD *)(a1 + 14248), *(_QWORD *)(v7 + 72), 1);
v27 = *(_QWORD *)(v7 + 72);
v9 = (char *)v7;
if ( v27 == SelectedObjects )
goto LABEL_33;
if ( SelectedObjects )
{
cocos2d::CCObject::retain(SelectedObjects);
v27 = *(_QWORD *)(v7 + 72);
}
if ( v27 )
cocos2d::CCObject::release(v27);
*(_QWORD *)(v7 + 72) = SelectedObjects;
LABEL_32:
v9 = (char *)v7;
goto LABEL_33;
default:
goto LABEL_33;
}
}
return result;
}