//
// LevelPage::onSecretDoor from 0x100405324 to 0x1004057d0 (1196 bytes)
//
// 1 xrefs:
// > LevelPage::addSecretDoor @ 0x100404e3c
//
// 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
//
void __fastcall LevelPage::onSecretDoor(LevelPage *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
GameManager *v4; // x0
cocos2d::CCDirector *v5; // x19
cocos2d::CCScene *v6; // x0
cocos2d::CCTransitionFade *v7; // x0
GameManager *v8; // x0
cocos2d::CCSprite *v9; // x19
float v10; // s8
__n128 v11; // q1
__n128 v12; // q0
cocos2d::CCScaleTo *v13; // x0
cocos2d::CCEaseBounceOut *v14; // x0
cocos2d::CCFadeOut *v15; // x0
GameStatsManager *v16; // x0
bool isItemUnlocked; // w21
cocos2d::CCArray *v18; // x19
DialogLayer *v19; // x19
cocos2d::CCDirector *v20; // x0
void *v21[2]; // [xsp+8h] [xbp-158h] BYREF
char v22; // [xsp+1Fh] [xbp-141h]
void *v23[2]; // [xsp+20h] [xbp-140h] BYREF
char v24; // [xsp+37h] [xbp-129h]
void *v25[2]; // [xsp+38h] [xbp-128h] BYREF
char v26; // [xsp+4Fh] [xbp-111h]
void *v27[2]; // [xsp+50h] [xbp-110h] BYREF
char v28; // [xsp+67h] [xbp-F9h]
void *__p[2]; // [xsp+68h] [xbp-F8h] BYREF
char v30; // [xsp+7Fh] [xbp-E1h]
void *v31[2]; // [xsp+80h] [xbp-E0h] BYREF
char v32; // [xsp+97h] [xbp-C9h]
void *v33[2]; // [xsp+98h] [xbp-C8h] BYREF
char v34; // [xsp+AFh] [xbp-B1h]
void *v35[2]; // [xsp+B0h] [xbp-B0h] BYREF
char v36; // [xsp+C7h] [xbp-99h]
void *v37[2]; // [xsp+C8h] [xbp-98h] BYREF
char v38; // [xsp+DFh] [xbp-81h]
void *v39[2]; // [xsp+E0h] [xbp-80h] BYREF
char v40; // [xsp+F7h] [xbp-69h]
void *v41[2]; // [xsp+F8h] [xbp-68h] BYREF
char v42; // [xsp+10Fh] [xbp-51h]
void *v43[2]; // [xsp+110h] [xbp-50h] BYREF
char v44; // [xsp+127h] [xbp-39h]
int v45; // [xsp+128h] [xbp-38h] BYREF
if ( (byte_100886DC0 & 1) == 0 )
{
v3 = GameManager::sharedState();
if ( GameManager::getUGV(v3, "7") )
{
v4 = GameManager::sharedState();
if ( GameManager::getUGV(v4, "8") )
{
byte_100886DC0 = 1;
v5 = cocos2d::CCDirector::sharedDirector();
v6 = SecretLayer4::scene();
v7 = cocos2d::CCTransitionFade::create_1(0.5, v6);
cocos2d::CCDirector::replaceScene(v5, v7);
}
else
{
v16 = GameStatsManager::sharedState();
isItemUnlocked = GameStatsManager::isItemUnlocked(v16, GJItem, 4);
v18 = (cocos2d::CCArray *)sub_10024A15C();
if ( isItemUnlocked )
{
sub_100009900(v31, "The Gatekeeper");
sub_100009900(__p, "The Master Emblem!");
DialogObject::create((__int64)v31, (__int64)__p, 7, 1, 0xFFFFFF, 1.0);
sub_10024A2D0((__int64)v18);
if ( v30 < 0 )
operator delete(__p[0]);
if ( v32 < 0 )
operator delete(v31[0]);
sub_100009900(v27, "The Gatekeeper");
sub_100009900(v25, "Lord RubRub, I will open the gate for you.");
DialogObject::create((__int64)v27, (__int64)v25, 7, 0, 0xFFFFFF, 0.8);
sub_10024A2D0((__int64)v18);
if ( v26 < 0 )
operator delete(v25[0]);
if ( v28 < 0 )
operator delete(v27[0]);
sub_100009900(v23, "The Gatekeeper");
sub_100009900(v21, "Please, come in.");
DialogObject::create((__int64)v23, (__int64)v21, 7, 0, 0xFFFFFF, 1.0);
sub_10024A2D0((__int64)v18);
if ( v22 < 0 )
operator delete(v21[0]);
if ( v24 < 0 )
operator delete(v23[0]);
v19 = DialogLayer::createWithObjects(v18, 2);
v19->m_delegate = &a1->DialogDelegate;
((void (__fastcall *)(DialogLayer *, __int64))v19->setTag)(v19, 2);
}
else
{
sub_100009900(v43, "The Gatekeeper");
sub_100009900(v41, "Who disturbs my slumber?");
DialogObject::create((__int64)v43, (__int64)v41, 7, 1, 0xFFFFFF, 1.0);
sub_10024A2D0((__int64)v18);
if ( v42 < 0 )
operator delete(v41[0]);
if ( v44 < 0 )
operator delete(v43[0]);
sub_100009900(v39, "The Gatekeeper");
sub_100009900(v37, "RubRub is that you?\nI cannot see in this light.");
DialogObject::create((__int64)v39, (__int64)v37, 7, 0, 0xFFFFFF, 1.0);
sub_10024A2D0((__int64)v18);
if ( v38 < 0 )
operator delete(v37[0]);
if ( v40 < 0 )
operator delete(v39[0]);
sub_100009900(v35, "The Gatekeeper");
sub_100009900(v33, "Show me the Master Emblem,\nand I will let you pass.");
DialogObject::create((__int64)v35, (__int64)v33, 7, 0, 0xFFFFFF, 1.0);
sub_10024A2D0((__int64)v18);
if ( v34 < 0 )
operator delete(v33[0]);
if ( v36 < 0 )
operator delete(v35[0]);
v19 = DialogLayer::createWithObjects(v18, 2);
}
v20 = cocos2d::CCDirector::sharedDirector();
((void (__fastcall *)(cocos2d::CCScene *, DialogLayer *, __int64))v20->m_pRunningScene->addChild_0)(
v20->m_pRunningScene,
v19,
1000);
DialogLayer::updateChatPlacement(v19, Center);
DialogLayer::animateIn(v19, FromLeft);
}
}
else if ( a1->m_secretDoor )
{
v8 = GameManager::sharedState();
GameManager::setUGV(v8, "7", 1);
v9 = cocos2d::CCSprite::createWithSpriteFrameName("secretDoorBtn2_closed_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))a1->m_secretDoor->addChild_0)(
a1->m_secretDoor,
v9,
2);
v10 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_secretDoor->getContentSize)(a1->m_secretDoor)
* 0.5;
v11.n128_f32[0] = *(float *)(((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_secretDoor->getContentSize)(a1->m_secretDoor)
+ 4)
* 0.5;
v12.n128_f32[0] = v10;
sub_100022980(v12, v11, &v45);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v9->setPosition)(v9, &v45);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v9->setBlendFunc)(v9, 0x100000302LL);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))a1->m_secretDoor->setOpacity)(a1->m_secretDoor, 255);
((void (__fastcall *)(cocos2d::CCSprite *, float))a1->m_secretDoor->setScale)(a1->m_secretDoor, 2.0);
v13 = cocos2d::CCScaleTo::create_1(0.5, 1.0);
v14 = cocos2d::CCEaseBounceOut::create(v13);
cocos2d::CCNode::runAction(a1->m_secretDoor, v14);
v15 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v9, v15);
}
}
}