//
// EditorUI::keyDown from 0x140125320 to 0x1401267af (5263 bytes)
//
// 2 xrefs:
// > ??> @ 0x140552cb8
// > ??> @ 0x1406c99e4
//
// 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
//
// Hidden C++ exception states: #wind=9
void EditorUI::keyDown(EditorUI *a1, cocos2d::enumKeyCodes a2, double a3)
{
__int64 v3; // rsi
GameManager *v5; // rcx
CCMenuItemSpriteExtra *m_playtestStopBtn; // rax
__int64 v7; // rax
__int64 v8; // rcx
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rcx
__int64 v13; // rax
__int64 v14; // rcx
__int64 v15; // rax
__int64 v16; // rax
EditCommand v17; // edx
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rcx
__int64 v22; // rax
double v23; // xmm0_8
float v24; // xmm8_4
__int64 v25; // rcx
cocos2d::CCDirector *v26; // rax
float v27; // xmm7_4
float v28; // xmm6_4
__int64 v29; // rcx
__int64 v30; // rax
cocos2d::CCString *v31; // rax
const char *CString; // rax
size_t v33; // r8
__int64 v34; // rdx
__int64 v35; // rcx
__int64 v36; // r8
__int64 v37; // r9
void **v38; // r15
char *v39; // r14
unsigned __int64 v40; // r13
__int64 v41; // rbx
unsigned __int64 v42; // rsi
cocos2d::CCArray *m_tabsArray; // rbx
__int64 v44; // rax
char *v45; // rax
__int64 *v46; // rbx
__int64 v47; // rdi
__int64 v48; // rax
__int64 v49; // rax
float v50; // xmm0_4
cocos2d::CCPoint v51; // rax
__int64 v52; // rax
EditorUI *v53; // rsi
float v54; // xmm0_4
cocos2d::CCLayer *m_objectLayer; // rdi
__int64 v56; // rax
__int64 v57; // rax
__int64 v58; // rax
EditorUI *v59; // rcx
__int64 v60; // rax
__int64 v61; // rax
EditorUI *v62; // rcx
__int64 v63; // rax
__int64 v64; // rax
EditorUI *v65; // rcx
__int64 v66; // rax
__int64 v67; // rax
__int64 v68; // rax
__int64 v69; // rax
__int64 v70; // rax
__int64 v71; // rax
__int64 v72; // rax
double v73; // xmm0_8
float v74; // xmm8_4
__int64 v75; // rcx
cocos2d::CCDirector *v76; // rax
float v77; // xmm7_4
float v78; // xmm6_4
__int64 v79; // rax
__int64 v80; // rdx
__int64 v81; // r8
cocos2d::CCArray *v82; // rbx
void **v83; // rcx
__int64 v84; // rax
CCMenuItemSpriteExtra *v85; // rdx
int v86; // eax
__int64 v87; // rax
__int64 v88; // rcx
__int64 v89; // rax
GameManager *v90; // rcx
_BOOL8 v91; // r15
unsigned __int64 v92; // rcx
__int64 v93; // rbx
char *v94; // r13
GameManager *v95; // rcx
GameManager *v96; // rcx
GameManager *v97; // rax
GameManager *v98; // rcx
GameManager *v99; // rax
GameManager *v100; // rax
GameManager *v101; // rcx
GameManager *v102; // rax
bool GameVariable; // al
__int64 v104; // r8
void **v105; // rbx
__int64 v106; // r8
CCMenuItemSpriteExtra *m_editObjectBtn; // rcx
CCMenuItemSpriteExtra *v108; // rax
void **v109; // rbx
const char *v110; // r9
size_t v111; // rdx
CCMenuItemSpriteExtra *v112; // rax
CCMenuItemSpriteExtra *v113; // rcx
void **v114; // rbx
char *v115; // rdx
size_t v116; // r8
void **v117; // rdx
size_t v118; // r8
__int64 v119; // rdx
__int64 v120; // r8
__int64 v121; // rbx
__int64 v122; // rcx
float *v123; // rax
float *v124; // r14
__int64 v125; // rcx
float *v126; // rax
float *v127; // r15
cocos2d::CCDirector *v128; // rax
EditorUI *v129; // rdi
void **v130; // [rsp+38h] [rbp-D0h] BYREF
cocos2d::CCPoint v131; // [rsp+40h] [rbp-C8h] BYREF
float v132; // [rsp+48h] [rbp-C0h]
float v133; // [rsp+4Ch] [rbp-BCh]
__int16 v134; // [rsp+58h] [rbp-B0h] BYREF
char v135; // [rsp+5Ah] [rbp-AEh]
cocos2d::CCPoint v136[3]; // [rsp+68h] [rbp-A0h] BYREF
__int64 v137; // [rsp+80h] [rbp-88h]
__int64 v138; // [rsp+88h] [rbp-80h]
cocos2d::CCPoint *v139; // [rsp+90h] [rbp-78h] BYREF
void *v140[2]; // [rsp+98h] [rbp-70h] BYREF
__int64 v141; // [rsp+A8h] [rbp-60h]
unsigned __int64 v142; // [rsp+B0h] [rbp-58h]
void *Src[2]; // [rsp+B8h] [rbp-50h] BYREF
unsigned __int64 v144; // [rsp+C8h] [rbp-40h]
unsigned __int64 v145; // [rsp+D0h] [rbp-38h]
v3 = a2;
*(double *)&a1->m_pasteBtn = sub_14003CF30();
if ( (_DWORD)v3 == 32 )
{
if ( LOBYTE(a1->m_createButtonBars) )
return;
LOBYTE(a1->m_createButtonBars) = 1;
}
m_playtestStopBtn = a1->m_playtestStopBtn;
if ( LODWORD(m_playtestStopBtn[4].m_fScaleX) == 1 )
{
(**(void (__fastcall ***)(__int64, _QWORD))(*((_QWORD *)&m_playtestStopBtn[25].m_activateSound.m_data.m_bigStorage
+ 1)
+ 544LL))(
*((_QWORD *)&m_playtestStopBtn[25].m_activateSound.m_data.m_bigStorage + 1) + 544LL,
(unsigned int)v3);
goto LABEL_188;
}
switch ( (_DWORD)v3 )
{
case 'Z':
v7 = cocos2d::CCDirector::sharedDirector(v5);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 176LL))(v7) + 89) )
{
v9 = cocos2d::CCDirector::sharedDirector(v8);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 176LL))(v9) + 88) )
{
EditorUI::redoLastAction((EditorUI *)((char *)a1 - 344), nullptr);
return;
}
}
v10 = cocos2d::CCDirector::sharedDirector(v8);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 176LL))(v10) + 89) )
{
EditorUI::undoLastAction((EditorUI *)((char *)a1 - 344), nullptr);
return;
}
goto LABEL_119;
case 'D':
v11 = cocos2d::CCDirector::sharedDirector(v5);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v11 + 176LL))(v11) + 90) )
{
if ( a1->m_editObjectBtn
|| cocos2d::CCArray::count((cocos2d::CCArray *)a1->m_objectEditorStates._Vec._Mypair._Myval2._Myfirst) )
{
EditorUI::createUndoSelectObject((EditorUI *)((char *)a1 - 344), 0);
}
EditorUI::deselectAll((EditorUI *)((char *)a1 - 344));
return;
}
v13 = cocos2d::CCDirector::sharedDirector(v12);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 176LL))(v13) + 89) )
{
EditorUI::onDuplicate((EditorUI *)((char *)a1 - 344), nullptr);
return;
}
v15 = cocos2d::CCDirector::sharedDirector(v14);
v16 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 176LL))(v15);
v17 = Right;
if ( *(_BYTE *)(v16 + 88) )
v17 = SmallRight;
LABEL_93:
EditorUI::moveObjectCall_1((EditorUI *)((char *)a1 - 344), v17);
return;
case 'C':
v18 = cocos2d::CCDirector::sharedDirector(v5);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 176LL))(v18) + 89) )
{
EditorUI::doCopyObjects((EditorUI *)((char *)a1 - 344), 0);
return;
}
goto LABEL_119;
case 'V':
v19 = cocos2d::CCDirector::sharedDirector(v5);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v19 + 176LL))(v19) + 89) )
{
EditorUI::doPasteObjects((EditorUI *)((char *)a1 - 344), 0);
return;
}
goto LABEL_119;
}
if ( (unsigned int)(v3 - 48) <= 9 )
{
v20 = cocos2d::CCDirector::sharedDirector(v5);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 176LL))(v20) + 89)
|| (v22 = cocos2d::CCDirector::sharedDirector(v21),
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v22 + 176LL))(v22) + 90)) )
{
v23 = (*(double (__fastcall **)(_QWORD))(**(_QWORD **)&a1->m_playtestStopBtn[7].m_nScriptTapHandler + 168LL))(*(_QWORD *)&a1->m_playtestStopBtn[7].m_nScriptTapHandler);
v24 = *(float *)&v23;
v26 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v25);
cocos2d::CCDirector::getWinSize(v26);
v27 = v132 * 0.5;
v28 = (float)(*(float *)&a1->MusicDownloadDelegate::__vftable * 0.5) + (float)(v133 * 0.5);
v30 = cocos2d::CCDirector::sharedDirector(v29);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v30 + 176LL))(v30) + 89) )
{
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&a1->m_playtestStopBtn[7].m_nScriptTapHandler + 200LL))(*(_QWORD *)&a1->m_playtestStopBtn[7].m_nScriptTapHandler);
cocos2d::CCPoint::CCPoint(&v131);
cocos2d::CCPoint::CCPoint(v136, (float)(v27 - v131.x) / v24, (float)(v28 - v131.y) / v24);
cocos2d::CCPoint::operator=(*(_QWORD *)&a1->m_playtestStopBtn[28].m_uOrderOfArrival + 8 * (v3 - 48), v136);
v31 = cocos2d::CCString::createWithFormat("Position %i saved.", (int)v3 - 48);
CString = cocos2d::CCString::getCString(v31);
*(_OWORD *)Src = 0;
v144 = 0;
v145 = 0;
v33 = -1;
do
++v33;
while ( CString[v33] );
sub_14003A930(Src, CString, v33);
v139 = &v136[1];
*(_OWORD *)&v136[1].x = 0;
v137 = 0;
v138 = 15;
LOBYTE(v136[1].x) = 0;
*(_OWORD *)v140 = 0;
v141 = 0;
v142 = 0;
v38 = Src;
v39 = (char *)Src[0];
v40 = v145;
if ( v145 > 0xF )
v38 = (void **)Src[0];
v41 = 0x7FFFFFFFFFFFFFFFLL;
v42 = v144;
if ( v144 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v35, v34, v36, v37);
v142 = 15;
if ( v144 > 0xF )
{
if ( (v144 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v41 = v144 | 0xF;
if ( (v144 | 0xF) < 0x16 )
v41 = 22;
}
v140[0] = sub_14003AA10(v41 + 1);
v141 = v42;
v142 = v41;
memcpy(v140[0], v38, v42 + 1);
}
else
{
v141 = v144;
*(_OWORD *)v140 = *(_OWORD *)v38;
}
m_tabsArray = a1[-1].m_tabsArray;
v44 = TextAlertPopup::create(v140, v34, v36, 150, &v136[1]);
((void (__fastcall *)(cocos2d::CCArray **, __int64, __int64))m_tabsArray[6].data)(&a1[-1].m_tabsArray, v44, 100);
if ( v40 > 0xF )
{
v45 = v39;
if ( v40 + 1 >= 0x1000 )
{
v39 = *((char **)v39 - 1);
if ( (unsigned __int64)(v45 - v39 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v39);
}
}
else
{
cocos2d::CCPoint::CCPoint(&v131);
if ( v131.x != 0.0 || v131.y != 0.0 )
{
v46 = *(__int64 **)&a1->m_playtestStopBtn[7].m_nScriptTapHandler;
v47 = *v46;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v130, v27 - (float)(v131.x * v24), v28 - (float)(v131.y * v24));
(*(void (__fastcall **)(__int64 *, __int64))(v47 + 184))(v46, v48);
}
}
return;
}
}
switch ( (_DWORD)v3 )
{
case 0x31:
EditorUI::toggleMode((EditorUI *)((char *)a1 - 344), (cocos2d::CCObject *)a1->m_objectEditorStates._Maxidx);
return;
case 0x32:
EditorUI::toggleMode((EditorUI *)((char *)a1 - 344), *(cocos2d::CCObject **)&a1->m_transformState.m_scaleX);
return;
case 0x33:
EditorUI::toggleMode((EditorUI *)((char *)a1 - 344), (cocos2d::CCObject *)a1->m_objectEditorStates._Mask);
return;
case 0xB8:
v49 = cocos2d::CCDirector::sharedDirector(v5);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v49 + 176LL))(v49) + 88) )
{
v50 = (*(float (__fastcall **)(_QWORD))(**(_QWORD **)&a1->m_playtestStopBtn[7].m_nScriptTapHandler + 168LL))(*(_QWORD *)&a1->m_playtestStopBtn[7].m_nScriptTapHandler);
EditorUI::updateZoom((EditorUI *)((char *)a1 - 344), fmaxf(fminf(v50 + 0.1, 4.0), 0.1));
}
else
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v130, 0.0, -10.0);
EditorUI::moveGamelayer((EditorUI *)((char *)a1 - 344), v51);
}
return;
case 0xBD:
v52 = cocos2d::CCDirector::sharedDirector(v5);
v53 = (EditorUI *)((char *)a1 - 344);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v52 + 176LL))(v52) + 88) )
{
v54 = v53->m_editorLayer->m_objectLayer->getScale(v53->m_editorLayer->m_objectLayer);
EditorUI::updateZoom((EditorUI *)((char *)a1 - 344), fmaxf(fminf(v54 + -0.1, 4.0), 0.1));
}
else
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v130, 0.0, 10.0);
m_objectLayer = v53->m_editorLayer->m_objectLayer;
v56 = (__int64)m_objectLayer->getPosition_0(m_objectLayer);
cocos2d::CCPoint::operator+(v56, v136);
m_objectLayer->setPosition_0(m_objectLayer, v136);
EditorUI::constrainGameLayerPosition(v53, -100.0, -100.0);
}
return;
case 0x2E:
case 8:
EditorUI::onDeleteSelected((EditorUI *)((char *)a1 - 344), nullptr);
goto LABEL_188;
case 0x54:
v57 = cocos2d::CCDirector::sharedDirector(v5);
v58 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v57 + 176LL))(v57);
v59 = (EditorUI *)((char *)a1 - 344);
if ( *(_BYTE *)(v58 + 89) )
EditorUI::activateTransformControl(v59, nullptr);
else
EditorUI::toggleSwipe(v59, nullptr);
return;
case 0x51:
v60 = cocos2d::CCDirector::sharedDirector(v5);
v61 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v60 + 176LL))(v60);
v62 = (EditorUI *)((char *)a1 - 344);
if ( *(_BYTE *)(v61 + 90) )
EditorUI::transformObjectCall_1(v62, FlipX);
else
EditorUI::transformObjectCall_1(v62, RotateCCW);
return;
case 0x45:
v63 = cocos2d::CCDirector::sharedDirector(v5);
v64 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v63 + 176LL))(v63);
v65 = (EditorUI *)((char *)a1 - 344);
if ( *(_BYTE *)(v64 + 90) )
EditorUI::transformObjectCall_1(v65, FlipY);
else
EditorUI::transformObjectCall_1(v65, RotateCW);
return;
case 0x41:
v66 = cocos2d::CCDirector::sharedDirector(v5);
v67 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v66 + 176LL))(v66);
v17 = Left;
if ( *(_BYTE *)(v67 + 88) )
v17 = SmallLeft;
goto LABEL_93;
case 0x57:
v68 = cocos2d::CCDirector::sharedDirector(v5);
v69 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v68 + 176LL))(v68);
v17 = Up;
if ( *(_BYTE *)(v69 + 88) )
v17 = SmallUp;
goto LABEL_93;
case 0x53:
v70 = cocos2d::CCDirector::sharedDirector(v5);
v71 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v70 + 176LL))(v70);
v17 = Down;
if ( *(_BYTE *)(v71 + 88) )
v17 = SmallDown;
goto LABEL_93;
case 0x52:
EditorUI::toggleEnableRotate((EditorUI *)((char *)a1 - 344), nullptr);
return;
case 0x46:
EditorUI::toggleFreeMove((EditorUI *)((char *)a1 - 344), nullptr);
return;
case 0x47:
EditorUI::toggleSnap((EditorUI *)((char *)a1 - 344), nullptr);
return;
case 0xD:
v72 = cocos2d::CCDirector::sharedDirector(v5);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v72 + 176LL))(v72) + 89) )
{
if ( LODWORD(a1->cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable) == -1 )
EditorUI::onPlayback((EditorUI *)((char *)a1 - 344), nullptr);
LABEL_104:
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)&a1->m_transformState.m_transformScaleX + 328LL))(*(_QWORD *)&a1->m_transformState.m_transformScaleX) )
{
v129 = (EditorUI *)((char *)a1 - 344);
EditorUI::showUI(v129, 1);
if ( v129->m_isPlayingMusic )
EditorUI::onPlayback(v129, nullptr);
LevelEditorLayer::onStopPlaytest(v129->m_editorLayer);
EditorUI::playtestStopped(v129);
}
else if ( LODWORD(a1->cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable) == -1 )
{
EditorUI::onPlaytest((EditorUI *)((char *)a1 - 344), nullptr);
}
return;
}
goto LABEL_119;
case 0x70:
v73 = (*(double (__fastcall **)(_QWORD))(**(_QWORD **)&a1->m_playtestStopBtn[7].m_nScriptTapHandler + 168LL))(*(_QWORD *)&a1->m_playtestStopBtn[7].m_nScriptTapHandler);
v74 = *(float *)&v73;
v76 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v75);
cocos2d::CCDirector::getWinSize(v76);
v77 = v132 * 0.5;
v78 = (float)(*(float *)&a1->MusicDownloadDelegate::__vftable * 0.5) + (float)(v133 * 0.5);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&a1->m_playtestStopBtn[7].m_nScriptTapHandler + 200LL))(*(_QWORD *)&a1->m_playtestStopBtn[7].m_nScriptTapHandler);
cocos2d::CCPoint::CCPoint(&v131);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v130, (float)(v77 - v131.x) / v74, (float)(v78 - v131.y) / v74);
cocos2d::CCPoint::operator=(&a1->m_playtestStopBtn[28].m_fVertexZ, v79);
v130 = (void **)&v136[1];
*(_OWORD *)&v136[1].x = 0;
v137 = 0;
v138 = 15;
LOBYTE(v136[1].x) = 0;
v141 = 14;
v142 = 15;
strcpy((char *)v140, "Preview Locked");
HIBYTE(v140[1]) = 0;
v82 = a1[-1].m_tabsArray;
v83 = v140;
LABEL_109:
v84 = TextAlertPopup::create(v83, v80, v81, 150, &v136[1]);
((void (__fastcall *)(cocos2d::CCArray **, __int64, __int64))v82[6].data)(&a1[-1].m_tabsArray, v84, 100);
return;
case 0x71:
cocos2d::CCPoint::operator=(&a1->m_playtestStopBtn[28].m_fVertexZ, &dword_1406C1AA8);
v130 = (void **)&v136[1];
*(_OWORD *)&v136[1].x = 0;
v137 = 0;
v138 = 15;
LOBYTE(v136[1].x) = 0;
*(_OWORD *)Src = 0;
v144 = 0;
v145 = 15;
Src[0] = sub_14003AA10(0x20u);
v144 = 16;
v145 = 31;
strcpy((char *)Src[0], "Preview Unlocked");
v82 = a1[-1].m_tabsArray;
v83 = Src;
goto LABEL_109;
}
if ( (unsigned int)(v3 - 114) <= 6 )
{
*(_OWORD *)v140 = 0;
v141 = 0;
v142 = 15;
LOBYTE(v140[0]) = 0;
switch ( (_DWORD)v3 )
{
case 'u':
if ( !qword_1406C2ED8 )
{
v130 = (void **)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v130);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
GameManager::toggleGameVariable(v5, "0121");
v90 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v130 = (void **)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v130);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v90 = (GameManager *)qword_1406C2ED8;
}
LOBYTE(v91) = GameManager::getGameVariable(v90, "0121");
v92 = v142 >> 1;
v93 = 0x7FFFFFFFFFFFFFFFLL;
if ( v142 <= 0x7FFFFFFFFFFFFFFFLL - (v142 >> 1) )
{
v93 = 31;
if ( v142 + v92 > 0x1F )
v93 = v142 + v92;
}
v94 = (char *)sub_14003AA10(v93 + 1);
v141 = 16;
v142 = v93;
strcpy(v94, "Hide Invisible: ");
v140[0] = v94;
goto LABEL_175;
case 't':
if ( !qword_1406C2ED8 )
{
v130 = (void **)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v130);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
GameManager::toggleGameVariable(v5, "0045");
LevelEditorLayer::updateOptions((LevelEditorLayer *)a1->m_playtestStopBtn);
v95 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v130 = (void **)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v130);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v95 = (GameManager *)qword_1406C2ED8;
}
LOBYTE(v91) = GameManager::getGameVariable(v95, "0045");
v141 = 15;
memmove(v140, "Show Hitboxes: ", 0xFu);
HIBYTE(v140[1]) = 0;
goto LABEL_175;
case 's':
GameManager::sharedState();
GameManager::toggleGameVariable(v96, "0137");
LevelEditorLayer::updatePreviewParticles((LevelEditorLayer *)a1->m_playtestStopBtn);
v97 = GameManager::sharedState();
v91 = !GameManager::getGameVariable(v97, "0137");
sub_14003CCE0(v140, "Particle Icons: ", 0x10u);
LABEL_175:
if ( v91 )
{
v115 = "On";
v116 = 2;
}
else
{
v115 = "Off";
v116 = 3;
}
sub_140041270(v140, v115, v116);
v130 = Src;
v144 = 12;
v145 = 15;
Src[0] = *(void **)"chatFont.fnt";
Src[1] = (void *)*(unsigned int *)".fnt";
v117 = v140;
if ( v142 > 0xF )
v117 = (void **)v140[0];
*(_OWORD *)&v136[1].x = 0;
v137 = 0;
v138 = 0;
v118 = -1;
do
++v118;
while ( *((_BYTE *)v117 + v118) );
sub_14003A930(&v136[1], v117, v118);
v121 = TextAlertPopup::create(&v136[1], v119, v120, 100, Src);
v134 = -256;
v135 = 0;
v122 = *(_QWORD *)(v121 + 328);
if ( v122 )
(**(void (__fastcall ***)(__int64, __int16 *))(v122 + 368))(v122 + 368, &v134);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v130, 20.0, -20.0);
v124 = v123;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v139, 0.0, 1.0);
v127 = v126;
if ( *(_QWORD *)(v121 + 328) )
{
v128 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v125);
cocos2d::CCDirector::getWinSize(v128);
cocos2d::CCPoint::CCPoint(
v136,
*(float *)(v121 + 320) * 0.5 + (float)(v132 * *v127) + *v124,
(float)(v133 * v127[1]) + *(float *)(v121 + 324) * 0.5 + v124[1]);
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v121 + 184LL))(v121, v136);
}
((void (__fastcall *)(cocos2d::CCArray **, __int64, __int64))a1[-1].m_tabsArray[6].data)(
&a1[-1].m_tabsArray,
v121,
100);
sub_14003A830((__int64)v140);
goto LABEL_188;
case 'r':
GameManager::sharedState();
GameManager::toggleGameVariable(v98, "0036");
LevelEditorLayer::updateEditorMode((LevelEditorLayer *)a1->m_playtestStopBtn);
v99 = GameManager::sharedState();
LOBYTE(v91) = GameManager::getGameVariable(v99, "0036");
v141 = 14;
memmove(v140, "Preview Mode: ", 0xEu);
BYTE6(v140[1]) = 0;
goto LABEL_175;
case 'v':
v100 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v100, "0097") )
return;
GameManager::sharedState();
GameManager::toggleGameVariable(v101, "0180");
v102 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v102, "0180");
BYTE4(a1->SetIDPopupDelegate::__vftable) = GameVariable;
v91 = !GameVariable;
EditorUI::updateButtons((EditorUI *)((char *)a1 - 344));
if ( v142 < 0xB )
{
sub_14003CE20((__int64)v140, 0xBu, v104, "Link Mode: ");
}
else
{
v105 = v140;
if ( v142 > 0xF )
v105 = (void **)v140[0];
v141 = 11;
memmove(v105, "Link Mode: ", 0xBu);
*((_BYTE *)v105 + 11) = 0;
}
goto LABEL_175;
case 'w':
if ( cocos2d::CCArray::count((cocos2d::CCArray *)a1->m_objectEditorStates._Vec._Mypair._Myval2._Myfirst) )
return;
m_editObjectBtn = a1->m_editObjectBtn;
v108 = a1->m_playtestStopBtn;
if ( !m_editObjectBtn || v108[28].m_pParent == m_editObjectBtn )
m_editObjectBtn = nullptr;
v108[28].m_pParent = m_editObjectBtn;
LOBYTE(v91) = a1->m_playtestStopBtn[28].m_pParent != nullptr;
if ( v142 >= 0xA )
{
v109 = v140;
if ( v142 > 0xF )
v109 = (void **)v140[0];
v141 = 10;
memmove(v109, "Trace In: ", 0xAu);
*((_BYTE *)v109 + 10) = 0;
goto LABEL_174;
}
v110 = "Trace In: ";
v111 = 10;
break;
default:
if ( cocos2d::CCArray::count((cocos2d::CCArray *)a1->m_objectEditorStates._Vec._Mypair._Myval2._Myfirst) )
return;
v112 = a1->m_editObjectBtn;
v113 = a1->m_playtestStopBtn;
if ( !v112 || v113[28].m_pUserData == v112 || LODWORD(v112[2].m_pGrid) != 1 )
v112 = nullptr;
v113[28].m_pUserData = v112;
LOBYTE(v91) = a1->m_playtestStopBtn[28].m_pUserData != nullptr;
if ( v142 >= 0xB )
{
v114 = v140;
if ( v142 > 0xF )
v114 = (void **)v140[0];
v141 = 11;
memmove(v114, "Trace Out: ", 0xBu);
*((_BYTE *)v114 + 11) = 0;
goto LABEL_174;
}
v110 = "Trace Out: ";
v111 = 11;
break;
}
sub_14003CE20((__int64)v140, v111, v106, v110);
LABEL_174:
BYTE2(a1->m_playtestStopBtn[28].m_pListener) = 1;
goto LABEL_175;
}
if ( (_DWORD)v3 == 39 )
{
++WORD1(a1->m_playtestStopBtn[27].m_pGrid);
EditorUI::updateGroupIDLabel((EditorUI *)((char *)a1 - 344));
return;
}
if ( (_DWORD)v3 != 37 )
{
LABEL_119:
v87 = cocos2d::CCDirector::sharedDirector(v5);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v87 + 176LL))(v87) + 90) && (_DWORD)v3 == 38 )
{
EditorUI::onTargetIDChange((EditorUI *)((char *)a1 - 344), 1);
return;
}
v89 = cocos2d::CCDirector::sharedDirector(v88);
if ( *(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v89 + 176LL))(v89) + 90) && (_DWORD)v3 == 40 )
{
EditorUI::onTargetIDChange((EditorUI *)((char *)a1 - 344), -1);
return;
}
LABEL_188:
if ( (_DWORD)v3 == 27 || (_DWORD)v3 == 1011 )
{
EditorUI::onPause((EditorUI *)((char *)a1 - 344), nullptr);
return;
}
if ( (_DWORD)v3 != 13 && (_DWORD)v3 != 1009 )
{
if ( (_DWORD)v3 == 32 )
LOBYTE(a1->cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable) = 1;
return;
}
goto LABEL_104;
}
v85 = a1->m_playtestStopBtn;
v86 = SWORD1(v85[27].m_pGrid) - 1;
if ( v86 < -1 )
LOWORD(v86) = -1;
WORD1(v85[27].m_pGrid) = v86;
EditorUI::updateGroupIDLabel((EditorUI *)((char *)a1 - 344));
}