//
// EditLevelLayer::onPlay from 0x1001de600 to 0x1001de885 (645 bytes)
//
// 4 xrefs:
// > EditLevelLayer::FLAlert_Clicked @ 0x1001e0f33
// > EditLevelLayer::keyDown @ 0x1001e1242
// > sub_1001E1250 @ 0x1001e1269
// > EditLevelLayer::init @ 0x1001dd9b4
//
// 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:26:27 +0000
//
__int64 __fastcall EditLevelLayer::onPlay(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v4; // rdi
unsigned int v5; // eax
__int64 v6; // rcx
unsigned int v7; // eax
_BYTE *v8; // rbx
unsigned int v9; // r14d
__int64 v10; // rax
double v11; // xmm0_8
__int64 v12; // rax
__int64 v13; // rax
int v14; // r14d
int v15; // eax
int v16; // ecx
int v17; // r8d
int v18; // r9d
__int64 v19; // rax
_QWORD v20[2]; // [rsp+0h] [rbp-40h] BYREF
void *__p; // [rsp+10h] [rbp-30h]
void *v22[5]; // [rsp+18h] [rbp-28h] BYREF
result = cocos2d::CCDirector::sharedDirector(a1, a2);
if ( *(_BYTE *)(result + 176) || *(_BYTE *)(a1 + 496) )
return result;
v4 = *(_QWORD *)(a1 + 472);
v5 = *(unsigned __int8 *)(v4 + 1472);
if ( (v5 & 1) != 0 )
{
if ( !*(_QWORD *)(v4 + 1480) )
goto LABEL_10;
}
else if ( !(v5 >> 1) )
{
goto LABEL_10;
}
if ( *(_DWORD *)(v4 + 1520) != *(_DWORD *)(v4 + 788) || *(_DWORD *)(v4 + 1524) != 4 )
sub_1005839A0(v4);
LABEL_10:
if ( !*(_BYTE *)(a1 + 536) )
{
v6 = *(_QWORD *)(a1 + 472);
v7 = *(unsigned __int8 *)(v6 + 1472);
if ( (v7 & 1) != 0 )
{
if ( *(_QWORD *)(v6 + 1480) )
goto LABEL_13;
}
else if ( v7 >> 1 )
{
LABEL_13:
__p = operator new(0x60u);
v20[0] = 97;
v20[1] = 91;
strcpy(
(char *)__p,
"There is a saved checkpoint for this level.\nDo you want to load it?");
v8 = (_BYTE *)FLAlertLayer::create_1(a1 + 416, "Load Save", v20, "New Game", "Load Save", 380.0);
if ( (v20[0] & 1) != 0 )
operator delete(__p);
sub_100494AC0(v8);
v8[656] = 1;
(*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v8 + 72LL))(v8, 11);
return (*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v8 + 1312LL))(v8);
}
}
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 480)) )
{
v9 = 0;
do
{
v10 = sub_1007FEFE0(*(_QWORD *)(a1 + 480), v9);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v10 + 1160LL))(v10, 0);
++v9;
}
while ( v9 < (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 480)) );
}
v11 = (*(double (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1072LL))(a1, 0);
*(_BYTE *)(a1 + 496) = 1;
v12 = FMODAudioEngine::sharedEngine(v11);
FMODAudioEngine::stopAllMusic(v12, 1);
v13 = FMODAudioEngine::sharedEngine(v11);
strcpy((char *)v22, " playSound_01.ogg");
FMODAudioEngine::playEffect(v13, v22, 1.0, 0.0, 0.30000001);
if ( ((__int64)v22[0] & 1) != 0 )
operator delete(v22[2]);
EditLevelLayer::verifyLevelName(a1, COERCE_DOUBLE(1065353216));
v14 = cocos2d::CCDelayTime::create(0.0);
v15 = cocos2d::CCCallFunc::create(a1, EditLevelLayer::playStep2, 0);
v19 = sub_10039EB60(v14, v15, 0, v16, v17, v18);
return cocos2d::CCNode::runAction(a1, v19);
}