//
// LevelPage::onSecretDoor from 0x140446250 to 0x140446c5c (2572 bytes)
//
// 2 xrefs:
// > LevelPage::addSecretDoor @ 0x140446196
// > ??> @ 0x14092720c
//
// 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:32:23 +0000
//
// Hidden C++ exception states: #wind=6
char __fastcall LevelPage::onSecretDoor(__int64 a1)
{
_UNKNOWN **v1; // rax
__int64 v3; // rcx
__int64 v4; // rcx
struct cocos2d::CCSprite *v5; // rdi
__int64 v6; // rbx
float v7; // xmm6_4
float *v8; // rax
__int64 v9; // rax
__int64 v10; // rdx
struct cocos2d::CCActionInterval *v11; // rax
struct cocos2d::CCAction *v12; // rax
struct cocos2d::CCAction *v13; // rax
__int64 v14; // rcx
__int64 v15; // rdx
__int64 v16; // rcx
__int64 v17; // r8
__int64 v18; // r9
struct cocos2d::CCScene *v19; // rsi
__int64 v20; // rcx
cocos2d::CCLayer *v21; // rbx
struct cocos2d::CCScene *v22; // rbx
__int64 v23; // rcx
cocos2d::CCDirector *v24; // rax
char isItemUnlocked; // bl
__int64 v26; // rcx
cocos2d::CCArray *v27; // r14
void **v28; // rax
void **v29; // rax
void **v30; // rax
__int64 v31; // rcx
cocos2d::CCNode *DialogLayer; // r14
void **v33; // rax
void **v34; // rax
void **v35; // rax
__int64 v36; // rax
__int64 v37; // rax
__int64 v38; // rcx
__int64 v39; // rax
__int64 v40; // rdi
__int64 v41; // rbx
__int64 v42; // rax
char v44[16]; // [rsp+38h] [rbp-19h] BYREF
__int64 v45; // [rsp+48h] [rbp-9h]
__int64 v46; // [rsp+50h] [rbp-1h]
__int128 v47; // [rsp+58h] [rbp+7h] BYREF
__int64 v48; // [rsp+68h] [rbp+17h]
__int128 v49; // [rsp+70h] [rbp+1Fh]
_UNKNOWN *retaddr; // [rsp+B0h] [rbp+5Fh] BYREF
__int64 v51; // [rsp+C8h] [rbp+77h] BYREF
char v52; // [rsp+D0h] [rbp+7Fh] BYREF
v1 = &retaddr;
if ( !byte_1409097A4 )
{
v3 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v51 = (__int64)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v51);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v3 = qword_14090BFD0;
}
LOBYTE(v1) = GameManager::getUGV(v3, &word_14070D040);
if ( (_BYTE)v1 )
{
v14 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v51 = (__int64)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v51);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v14 = qword_14090BFD0;
}
if ( GameManager::getUGV(v14, &word_14070D038) )
{
byte_1409097A4 = 1;
v19 = (struct cocos2d::CCScene *)cocos2d::CCScene::create(v16, v15, v17, v18);
*(_QWORD *)(cocos2d::CCApplication::sharedApplication(v20) + 232) = v19;
v21 = (cocos2d::CCLayer *)operator new(0x1F0u);
v51 = (__int64)v21;
cocos2d::CCLayer::CCLayer(v21);
*(_QWORD *)v21 = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 40) = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 41) = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 42) = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 43) = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 44) = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 51) = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 52) = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 53) = &SecretLayer4::`vftable';
*((_QWORD *)v21 + 54) = -1;
*((_QWORD *)v21 + 55) = 0;
*((_DWORD *)v21 + 112) = 0;
*((_DWORD *)v21 + 113) = -1;
*((_QWORD *)v21 + 57) = 0;
*((_QWORD *)v21 + 58) = 0;
*((_QWORD *)v21 + 60) = 0;
*((_BYTE *)v21 + 488) = 0;
if ( (unsigned __int8)SecretLayer4::init(v21) )
{
cocos2d::CCObject::autorelease(v21);
}
else
{
(*(void (__fastcall **)(cocos2d::CCLayer *, __int64))(*(_QWORD *)v21 + 8LL))(v21, 1);
v21 = nullptr;
}
(*(void (__fastcall **)(struct cocos2d::CCScene *, cocos2d::CCLayer *))(*(_QWORD *)v19 + 464LL))(v19, v21);
v22 = cocos2d::CCTransitionFade::create(0.5, v19);
v24 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v23);
LOBYTE(v1) = cocos2d::CCDirector::replaceScene(v24, v22);
}
else
{
if ( !qword_14090BFE0 )
{
v51 = (__int64)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v51);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
}
isItemUnlocked = GameStatsManager::isItemUnlocked(v16, 0xCu, 4u);
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v26);
v51 = (__int64)&v47;
v47 = 0;
v48 = 0;
*(_QWORD *)&v49 = 0;
if ( isItemUnlocked )
{
LOWORD(v51) = -1;
BYTE2(v51) = -1;
*(_QWORD *)&v47 = sub_14003D460(0x20u);
v48 = 26;
*(_QWORD *)&v49 = 31;
strcpy((char *)v47, "The Master Emblem!");
v44[15] = 0;
v45 = 14;
v46 = 15;
strcpy(v44, "The Gatekeeper");
v33 = DialogObject::create((__int64)v44, (__int64)&v47, 7, 1.0, 1, (__int64)&v51);
cocos2d::CCArray::addObject(v27, (struct cocos2d::CCObject *)v33);
v51 = (__int64)&v47;
LOWORD(v51) = -1;
BYTE2(v51) = -1;
v47 = 0;
v48 = 0;
*(_QWORD *)&v49 = 0;
*(_QWORD *)&v47 = sub_14003D460(0x40u);
v48 = 50;
*(_QWORD *)&v49 = 63;
strcpy((char *)v47, "Lord RubRub, I will open the gate for you.");
v44[15] = 0;
v45 = 14;
v46 = 15;
strcpy(v44, "The Gatekeeper");
v34 = DialogObject::create((__int64)v44, (__int64)&v47, 7, 0.80000001, 0, (__int64)&v51);
cocos2d::CCArray::addObject(v27, (struct cocos2d::CCObject *)v34);
v51 = (__int64)&v47;
LOWORD(v51) = -1;
BYTE2(v51) = -1;
v47 = 0;
v48 = 0;
*(_QWORD *)&v49 = 0;
*(_QWORD *)&v47 = sub_14003D460(0x20u);
v48 = 16;
*(_QWORD *)&v49 = 31;
strcpy((char *)v47, "Please, come in.");
v44[15] = 0;
v45 = 14;
v46 = 15;
strcpy(v44, "The Gatekeeper");
v35 = DialogObject::create((__int64)v44, (__int64)&v47, 7, 1.0, 0, (__int64)&v51);
cocos2d::CCArray::addObject(v27, (struct cocos2d::CCObject *)v35);
DialogLayer = DialogLayer::createDialogLayer(0, (__int64)v27, 2u);
v36 = a1 + 408;
if ( !a1 )
v36 = 0;
*((_QWORD *)DialogLayer + 78) = v36;
(*(void (__fastcall **)(cocos2d::CCNode *, __int64))(*(_QWORD *)DialogLayer + 64LL))(DialogLayer, 2);
}
else
{
LOWORD(v51) = -1;
BYTE2(v51) = -1;
*(_QWORD *)&v47 = sub_14003D460(0x20u);
v48 = 24;
*(_QWORD *)&v49 = 31;
strcpy((char *)v47, "Who disturbs my slumber?");
v44[15] = 0;
v45 = 14;
v46 = 15;
strcpy(v44, "The Gatekeeper");
v28 = DialogObject::create((__int64)v44, (__int64)&v47, 7, 1.0, 1, (__int64)&v51);
cocos2d::CCArray::addObject(v27, (struct cocos2d::CCObject *)v28);
v51 = (__int64)&v47;
LOWORD(v51) = -1;
BYTE2(v51) = -1;
v47 = 0;
v48 = 0;
*(_QWORD *)&v49 = 0;
*(_QWORD *)&v47 = sub_14003D460(0x40u);
v48 = 61;
*(_QWORD *)&v49 = 63;
strcpy((char *)v47, "RubRub is that you?\nI cannot see in this light.");
v44[15] = 0;
v45 = 14;
v46 = 15;
strcpy(v44, "The Gatekeeper");
v29 = DialogObject::create((__int64)v44, (__int64)&v47, 7, 1.0, 0, (__int64)&v51);
cocos2d::CCArray::addObject(v27, (struct cocos2d::CCObject *)v29);
v51 = (__int64)&v47;
LOWORD(v51) = -1;
BYTE2(v51) = -1;
v47 = 0;
v48 = 0;
*(_QWORD *)&v49 = 0;
*(_QWORD *)&v47 = sub_14003D460(0x50u);
v48 = 65;
*(_QWORD *)&v49 = 79;
strcpy((char *)v47, "Show me the Master Emblem,\nand I will let you pass.");
v44[15] = 0;
v45 = 14;
v46 = 15;
strcpy(v44, "The Gatekeeper");
v30 = DialogObject::create((__int64)v44, (__int64)&v47, 7, 1.0, 0, (__int64)&v51);
cocos2d::CCArray::addObject(v27, (struct cocos2d::CCObject *)v30);
DialogLayer = DialogLayer::createDialogLayer(0, (__int64)v27, 2u);
}
v37 = cocos2d::CCDirector::sharedDirector(v31);
(*(void (__fastcall **)(_QWORD, cocos2d::CCNode *, __int64))(**(_QWORD **)(v37 + 272) + 456LL))(
*(_QWORD *)(v37 + 272),
DialogLayer,
1000);
v39 = cocos2d::CCDirector::sharedDirector(v38);
cocos2d::CCDirector::getWinSize(v39, &v51);
v40 = **((_QWORD **)DialogLayer + 70);
v41 = *((_QWORD *)DialogLayer + 70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, *(float *)&v51 * 0.5, *((float *)&v51 + 1) * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v40 + 184))(v41, v42);
LOBYTE(v1) = (unsigned __int8)DialogLayer::animateIn(DialogLayer, 2);
}
}
else if ( *(_QWORD *)(a1 + 568) )
{
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v51 = (__int64)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v51);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
GameManager::setUGV(v4, &word_14070D040, 1u);
v5 = cocos2d::CCSprite::createWithSpriteFrameName("secretDoorBtn2_closed_001.png");
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 568) + 456LL))(
*(_QWORD *)(a1 + 568),
v5,
2);
v6 = *(_QWORD *)v5;
v7 = *(float *)((*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 568) + 320LL))(*(_QWORD *)(a1 + 568)) + 4)
* 0.5;
v8 = (float *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 568) + 320LL))(*(_QWORD *)(a1 + 568));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v51, *v8 * 0.5, v7);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v6 + 184))(v5, v9);
v51 = 0x100000302LL;
(**((void (__fastcall ***)(__int64, __int64))v5 + 43))((__int64)v5 + 344, 0x100000302LL);
LOBYTE(v10) = -1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(*(_QWORD *)(a1 + 568) + 320LL) + 40LL))(
*(_QWORD *)(a1 + 568) + 320LL,
v10);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 568) + 160LL))(*(_QWORD *)(a1 + 568));
v11 = cocos2d::CCScaleTo::create(0.5, 1.0);
v12 = cocos2d::CCEaseBounceOut::create(v11);
cocos2d::CCNode::runAction(*(cocos2d::CCNode **)(a1 + 568), v12);
v13 = cocos2d::CCFadeOut::create(0.5);
LOBYTE(v1) = (unsigned __int8)cocos2d::CCNode::runAction(v5, v13);
}
}
return (char)v1;
}