//
// SecretLayer2::onSecretLevel from 0x14057a130 to 0x14057a3d8 (680 bytes)
//
// 2 xrefs:
// > SecretLayer2::init @ 0x140578e4a
// > ??> @ 0x14092c864
//
// 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 11:34:24 +0000
//
// Hidden C++ exception states: #wind=4
void __fastcall SecretLayer2::onSecretLevel(__int64 a1)
{
__int64 v2; // rcx
__int64 v3; // rcx
__int64 MainLevel; // rbx
__int64 v5; // r8
__int64 v6; // r9
__int64 v7; // rcx
struct cocos2d::CCScene *v8; // rax
struct cocos2d::CCScene *v9; // rbx
__int64 v10; // rcx
cocos2d::CCDirector *v11; // rax
void **v12; // rax
cocos2d::CCLayerColor *DialogLayer; // rsi
__int64 v14; // rcx
__int64 v15; // rax
__int64 v16; // rdi
__int64 v17; // rbx
__int64 v18; // rax
_WORD v19[8]; // [rsp+30h] [rbp-40h] BYREF
__int64 v20; // [rsp+40h] [rbp-30h]
__int64 v21; // [rsp+48h] [rbp-28h]
__int128 v22; // [rsp+50h] [rbp-20h] BYREF
__int64 v23; // [rsp+60h] [rbp-10h]
__int64 v24; // [rsp+68h] [rbp-8h]
__int128 *v25; // [rsp+A0h] [rbp+30h] BYREF
char v26; // [rsp+A8h] [rbp+38h] BYREF
v2 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v25 = (__int128 *)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v2 = qword_14090BFE0;
}
if ( (int)GameStatsManager::getStat(v2, "13") < 200 )
{
v25 = &v22;
LOWORD(v25) = -1;
BYTE2(v25) = -1;
v22 = 0;
v23 = 0;
v24 = 0;
*(_QWORD *)&v22 = sub_14003D460(0x40u);
v23 = 52;
v24 = 63;
strcpy((char *)v22, "You are not prepared.\nCollect more diamonds...");
v19[7] = 0;
v20 = 13;
v21 = 15;
strcpy((char *)v19, "The Keymaster");
v12 = DialogObject::create((__int64)v19, (__int64)&v22, 2, 1.0, 0, (__int64)&v25);
DialogLayer = DialogLayer::createDialogLayer((__int64)v12, 0, 2u);
(*(void (__fastcall **)(__int64, cocos2d::CCLayerColor *, __int64))(*(_QWORD *)a1 + 456LL))(a1, DialogLayer, 100);
v15 = cocos2d::CCDirector::sharedDirector(v14);
cocos2d::CCDirector::getWinSize(v15, &v25);
v16 = **((_QWORD **)DialogLayer + 70);
v17 = *((_QWORD *)DialogLayer + 70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v26, *(float *)&v25 * 0.5, *((float *)&v25 + 1) * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v16 + 184))(v17, v18);
DialogLayer::animateInRandomSide(DialogLayer);
}
else
{
v3 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v25 = (__int128 *)operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v25);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v3 = *(_QWORD *)&qword_14090BFB0;
}
MainLevel = GameLevelManager::getMainLevel(v3, 0xBB9u, 0);
v7 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v25 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v7 = qword_14090BFD0;
}
*(_DWORD *)(v7 + 740) = 12;
v8 = (struct cocos2d::CCScene *)PlayLayer::scene(MainLevel, 0, v5, v6);
v9 = cocos2d::CCTransitionFade::create(0.5, v8);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::replaceScene(v11, v9);
}
}