//
// SecretLayer2::onSecretLevel from 0x1403e4660 to 0x1403e4908 (680 bytes)
//
// 2 xrefs:
// > SecretLayer2::init @ 0x1403e32a7
// > ??> @ 0x1406d7f58
//
// 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=4
void SecretLayer2::onSecretLevel(SecretLayer2 *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // rcx
GameLevelManager *v4; // rcx
GJGameLevel *MainLevel; // rbx
__int64 v6; // rcx
struct cocos2d::CCScene *v7; // rax
struct cocos2d::CCTransitionFade *v8; // rbx
__int64 v9; // rcx
cocos2d::CCDirector *v10; // rax
char *v11; // rax
DialogLayer *DialogLayer; // rdi
__int64 v13; // rcx
cocos2d::CCDirector *v14; // rax
cocos2d::CCLayer_vtbl *v15; // rbx
const cocos2d::CCPoint *v16; // rax
_WORD v17[8]; // [rsp+30h] [rbp-40h] BYREF
__int64 v18; // [rsp+40h] [rbp-30h]
__int64 v19; // [rsp+48h] [rbp-28h]
__int128 v20; // [rsp+50h] [rbp-20h] BYREF
__int64 v21; // [rsp+60h] [rbp-10h]
__int64 v22; // [rsp+68h] [rbp-8h]
__int128 *v23; // [rsp+90h] [rbp+20h] BYREF
v3 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v23 = (__int128 *)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v3 = (GameStatsManager *)qword_1406C2EE8;
}
if ( GameStatsManager::getStat(v3, "13") < 200 )
{
v23 = &v20;
LOWORD(v23) = -1;
BYTE2(v23) = -1;
v20 = 0;
v21 = 0;
v22 = 15;
*(_QWORD *)&v20 = sub_14003AA10(0x40u);
v21 = 52;
v22 = 63;
strcpy((char *)v20, "You are not prepared.\nCollect more diamonds...");
v17[7] = 0;
v18 = 13;
v19 = 15;
strcpy((char *)v17, "The Keymaster");
v11 = DialogObject::create((__int64)v17, (__int64)&v20, 2, 1.0, 0, (__int64)&v23);
DialogLayer = DialogLayer::createDialogLayer((DialogObject *)v11, nullptr, 2);
a1->addChild_0(a1, DialogLayer, 100);
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v13);
cocos2d::CCDirector::getWinSize(v14);
v15 = DialogLayer->m_mainLayer->__vftable;
cocos2d::CCPoint::CCPoint(1.9431574e-19, *(float *)&v23 * 0.5);
v15->setPosition_0(DialogLayer->m_mainLayer, v16);
DialogLayer::animateInRandomSide(DialogLayer);
}
else
{
v4 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v23 = (__int128 *)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v4 = (GameLevelManager *)qword_1406C2EC0;
}
MainLevel = GameLevelManager::getMainLevel(v4, 3001, 0);
v6 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v23 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = qword_1406C2ED8;
}
*(_DWORD *)(v6 + 700) = 12;
v7 = PlayLayer::scene(MainLevel, 0, 0);
v8 = cocos2d::CCTransitionFade::create(0.5, v7);
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::replaceScene(v10, v8);
}
}