//
// LevelInfoLayer::FLAlert_Clicked from 0x140300260 to 0x140300724 (1220 bytes)
//
// 2 xrefs:
// > ??> @ 0x140586c80
// > ??> @ 0x1406d4334
//
// 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=7
void LevelInfoLayer::FLAlert_Clicked(LevelInfoLayer *a1, FLAlertLayer *a2, bool a3)
{
cocos2d::CCObject *v5; // rdx
GameLevelManager *v6; // rcx
GameLevelManager *v7; // rcx
__int64 v8; // rdx
LevelInfoLayer *v9; // rdi
GameLevelManager *v10; // rcx
__int64 v11; // rax
GJGameLevel *NewLevel; // rsi
int v13; // ebx
GJGameLevel *m_level; // rdx
int random; // r8d
int seed; // r9d
int v17; // ecx
int v18; // r8d
float v19; // xmm0_4
struct cocos2d::CCScene *v20; // rax
struct cocos2d::CCTransitionFade *v21; // rbx
__int64 v22; // rcx
cocos2d::CCDirector *v23; // rax
__int64 v24; // rax
int v25; // ebx
__int64 v26; // rax
__int64 v27; // rax
__int64 i; // rdx
int v29; // ecx
__int64 v30; // rax
int v31; // ebx
__int64 v32; // rax
__int64 v33; // rax
__int64 j; // rdx
int v35; // ecx
void *v36; // [rsp+38h] [rbp+10h]
void *v37; // [rsp+38h] [rbp+10h]
void *v38; // [rsp+38h] [rbp+10h]
void *v39; // [rsp+38h] [rbp+10h]
void *v40; // [rsp+38h] [rbp+10h]
void *v41; // [rsp+38h] [rbp+10h]
switch ( a2->getTag(a2) )
{
case 4:
if ( a3 )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)&a1->m_uOrderOfArrival + 1024LL))(
*(_QWORD *)&a1->m_uOrderOfArrival,
0);
v6 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v6 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::deleteLevel(v6, *(GJGameLevel **)&a1->m_fRotationX);
LevelInfoLayer::onBack((LevelInfoLayer *)((char *)a1 - 440), nullptr);
LOBYTE(a1->m_unknown2) = 1;
}
break;
case 5:
if ( a3 && !LOBYTE(a1->m_unknown2) )
{
v7 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v37 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v37);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v7 = (GameLevelManager *)qword_1406C2EC0;
}
v7->m_levelDeleteDelegate = (LevelDeleteDelegate *)&a1->m_uID;
GameLevelManager::deleteServerLevel(
v7,
*(_DWORD *)(*(_QWORD *)&a1->m_fRotationX + 328LL) - *(_DWORD *)(*(_QWORD *)&a1->m_fRotationX + 332LL));
LOBYTE(v8) = 1;
((void (__fastcall *)(cocos2d::CCCamera *, __int64))a1->m_pCamera->cocos2d::CCLayer::cocos2d::CCNode::__vftable[4].update)(
a1->m_pCamera,
v8);
}
break;
case 6:
if ( a3 )
{
v9 = (LevelInfoLayer *)((char *)a1 - 440);
if ( !LevelInfoLayer::shouldDownloadLevel(v9) && !v9->m_isBusy )
{
v9->setKeypadEnabled(v9, 0);
v9->m_isBusy = 1;
v11 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v38 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = qword_1406C2ED8;
}
*(_DWORD *)(v11 + 700) = 2;
if ( !qword_1406C2EC0 )
{
v39 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v39);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
}
NewLevel = GameLevelManager::createNewLevel(v10);
GJGameLevel::copyLevelInfo(NewLevel);
v13 = 0;
m_level = v9->m_level;
random = m_level->m_originalLevel.random;
seed = m_level->m_originalLevel.seed;
if ( random == seed )
{
v17 = m_level->m_levelID.random;
v18 = m_level->m_levelID.seed;
if ( v17 != v18 )
v13 = v17 - v18;
}
else
{
v13 = random - seed;
}
NewLevel->m_originalLevel.value = v13;
v19 = (float)((float)rand() / 32767.0) * 1000.0;
NewLevel->m_originalLevel.seed = (int)v19;
NewLevel->m_originalLevel.random = v13 + (int)v19;
v20 = EditLevelLayer::scene(NewLevel);
v21 = cocos2d::CCTransitionFade::create(0.5, v20);
v23 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v22);
cocos2d::CCDirector::replaceScene(v23, v21);
}
}
break;
case 7:
LevelInfoLayer::onRate((LevelInfoLayer *)((char *)a1 - 440), v5);
break;
case 8:
LevelInfoLayer::onRateStars((LevelInfoLayer *)((char *)a1 - 440), nullptr);
break;
case 9:
if ( a3 )
{
*(_BYTE *)(*(_QWORD *)&a1->m_fRotationX + 1004LL) = 1;
goto LABEL_53;
}
break;
case 0xA:
if ( a3 )
{
*(_BYTE *)(*(_QWORD *)&a1->m_fRotationX + 1184LL) = 1;
LABEL_53:
LevelInfoLayer::onPlay((LevelInfoLayer *)((char *)a1 - 440), nullptr);
}
break;
case 0xB:
if ( a3 && *(_QWORD *)&a1->m_fRotationX )
{
v24 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v40 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v40);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v24 = qword_1406C2EC0;
}
v25 = 0;
v26 = *(_QWORD *)(v24 + 352);
if ( v26 )
{
v27 = *(_QWORD *)(v26 + 56);
if ( v27 )
{
for ( i = *(_QWORD *)(v27 + 288); ; i = *(_QWORD *)(i + 288) )
{
v29 = v25;
v25 = *(_DWORD *)(*(_QWORD *)(v27 + 264) + 696LL);
if ( v25 <= v29 )
v25 = v29;
v27 = i;
if ( !i )
break;
}
}
}
*(_DWORD *)(*(_QWORD *)&a1->m_fRotationX + 696LL) = v25 + 1;
}
break;
case 0xC:
if ( a3 && *(_QWORD *)&a1->m_fRotationX )
{
v30 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v41 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v41);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v30 = qword_1406C2EC0;
}
v31 = 0;
v32 = *(_QWORD *)(v30 + 352);
if ( v32 )
{
v33 = *(_QWORD *)(v32 + 56);
if ( v33 )
{
for ( j = *(_QWORD *)(v33 + 288); ; j = *(_QWORD *)(j + 288) )
{
v35 = v31;
v31 = *(_DWORD *)(*(_QWORD *)(v33 + 264) + 696LL);
if ( v31 >= v35 )
v31 = v35;
v33 = j;
if ( !j )
break;
}
}
}
*(_DWORD *)(*(_QWORD *)&a1->m_fRotationX + 696LL) = v31 - 1;
}
break;
default:
return;
}
}