//
// LevelPage::onSecretDoor from 0x14031ccc0 to 0x14031d79e (2782 bytes)
//
// 2 xrefs:
// > LevelPage::addSecretDoor @ 0x14031cc0a
// > ??> @ 0x1406d4b2c
//
// 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=6
void LevelPage::onSecretDoor(LevelPage *a1, cocos2d::CCObject *a2)
{
float v2; // xmm0_4
float v3; // xmm3_4
GameManager *v5; // rcx
GameManager *v6; // rcx
struct cocos2d::CCSprite *v7; // rdi
cocos2d::CCSprite_vtbl *v8; // rbx
const cocos2d::CCSize *v9; // rax
const cocos2d::CCPoint *v10; // rax
__int64 v11; // rdx
struct cocos2d::CCScaleTo *v12; // rax
struct cocos2d::CCEaseBounceOut *v13; // rax
cocos2d::ccColor3B *v14; // r8
void *v15; // rax
cocos2d::ccColor3B *v16; // r8
CCLightFlash *v17; // rcx
GameManager *v18; // rcx
GameStatsManager *v19; // rcx
struct cocos2d::CCScene *v20; // rsi
__int64 v21; // rdx
__int64 v22; // rcx
SecretLayer4 *v23; // rbx
struct cocos2d::CCTransitionFade *v24; // rbx
__int64 v25; // rcx
cocos2d::CCDirector *v26; // rax
bool isItemUnlocked; // bl
__int64 v28; // rcx
cocos2d::CCArray *v29; // rsi
char *v30; // rax
char *v31; // rax
char *v32; // rax
__int64 v33; // rcx
DialogLayer *DialogLayer; // rsi
char *v35; // rax
char *v36; // rax
char *v37; // rax
DialogDelegate *v38; // rax
__int64 v39; // rax
__int64 v40; // rcx
cocos2d::CCDirector *v41; // rax
cocos2d::CCLayer_vtbl *v42; // rbx
const cocos2d::CCPoint *v43; // rax
_BOOL8 v44; // rdx
float v45; // xmm1_4
double v46; // xmm0_8
cocos2d::CCLayer_vtbl *v47; // rbx
const cocos2d::CCPoint *v48; // rax
struct cocos2d::CCMoveTo *v49; // rax
struct cocos2d::CCEaseElasticOut *v50; // rax
cocos2d::ccColor3B *v51; // r8
float v52; // xmm6_4
float v53; // [rsp+28h] [rbp-29h]
float v54; // [rsp+28h] [rbp-29h]
float v55; // [rsp+28h] [rbp-29h]
char v56[16]; // [rsp+38h] [rbp-19h] BYREF
__int64 v57; // [rsp+48h] [rbp-9h]
__int64 v58; // [rsp+50h] [rbp-1h]
__int128 v59; // [rsp+58h] [rbp+7h] BYREF
__int64 v60; // [rsp+68h] [rbp+17h]
__int128 v61; // [rsp+70h] [rbp+1Fh]
__int64 v62; // [rsp+C8h] [rbp+77h] BYREF
if ( !byte_1406C10B8 )
{
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v62 = (__int64)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v62);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v5, (const char *)&word_140531E88) )
{
if ( !a1->m_secretDoor )
return;
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v62 = (__int64)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v62);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
GameManager::setUGV(v6, (const char *)&word_140531E88, 1);
v7 = cocos2d::CCSprite::createWithSpriteFrameName("secretDoorBtn2_closed_001.png");
a1->m_secretDoor->addChild_0(a1->m_secretDoor, v7, 2);
v8 = v7->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_secretDoor->getContentSize(a1->m_secretDoor);
v9 = a1->m_secretDoor->getContentSize(a1->m_secretDoor);
cocos2d::CCPoint::CCPoint(v2, v9->width * 0.5);
v8->setPosition_0(v7, v10);
v62 = 0x100000302LL;
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v7->setBlendFunc)(
&v7->cocos2d::CCTextureProtocol,
0x100000302LL);
LOBYTE(v11) = -1;
a1->m_secretDoor->setOpacity(&a1->m_secretDoor->cocos2d::CCRGBAProtocol, v11);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_secretDoor->setScale_0)(a1->m_secretDoor);
v12 = cocos2d::CCScaleTo::create(0.5, 1.0);
v13 = cocos2d::CCEaseBounceOut::create(v12);
cocos2d::CCNode::runAction((CCLightFlash *)a1->m_secretDoor, (cocos2d::CCPoint)v13, v14, v3, v53);
v15 = cocos2d::CCFadeOut::create(0.5);
v17 = (CCLightFlash *)v7;
goto LABEL_25;
}
v18 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v62 = (__int64)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v62);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v18 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getUGV(v18, "8") )
{
byte_1406C10B8 = 1;
v20 = (struct cocos2d::CCScene *)cocos2d::CCScene::create(v19);
*(_QWORD *)(cocos2d::CCApplication::sharedApplication(v22, v21) + 224) = v20;
v23 = (SecretLayer4 *)operator new(0x1F0u);
v62 = (__int64)v23;
cocos2d::CCLayer::CCLayer(v23);
v23->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (SecretLayer4_vtbl *)&SecretLayer4::`vftable';
v23->cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable = (cocos2d::CCTouchDelegate_vtbl *)&SecretLayer4::`vftable';
v23->cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable = (cocos2d::CCAccelerometerDelegate_vtbl *)&SecretLayer4::`vftable';
v23->cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable = (cocos2d::CCKeypadDelegate_vtbl *)&SecretLayer4::`vftable';
v23->cocos2d::CCLayer::cocos2d::CCKeyboardDelegate::__vftable = (cocos2d::CCKeyboardDelegate_vtbl *)&SecretLayer4::`vftable';
v23->cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable = (cocos2d::CCMouseDelegate_vtbl *)&SecretLayer4::`vftable';
v23->TextInputDelegate::__vftable = (TextInputDelegate_vtbl *)&SecretLayer4::`vftable';
v23->FLAlertLayerProtocol::__vftable = (FLAlertLayerProtocol_vtbl *)&SecretLayer4::`vftable';
v23->DialogDelegate::__vftable = (DialogDelegate_vtbl *)&SecretLayer4::`vftable';
*(_QWORD *)&v23->m_threadTag = -1;
*(_QWORD *)&v23->m_selectedThread = 0;
v23->m_basicMessageCount = 0;
v23->m_errorMessageIndex = -1;
v23->m_searchInput = nullptr;
v23->m_messageLabel = nullptr;
v23->m_messageThreads = nullptr;
v23->m_exiting = 0;
if ( SecretLayer4::init(v23) )
{
cocos2d::CCObject::autorelease(v23);
}
else
{
((void (__fastcall *)(SecretLayer4 *, __int64))v23->~SecretLayer4)(v23, 1);
v23 = nullptr;
}
v20->addChild_1(v20, v23);
v24 = cocos2d::CCTransitionFade::create(0.5, v20);
v26 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v25);
cocos2d::CCDirector::replaceScene(v26, v24);
}
else
{
if ( !qword_1406C2EE8 )
{
v62 = (__int64)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v62);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
isItemUnlocked = GameStatsManager::isItemUnlocked(v19, GJItem, 4);
v29 = (cocos2d::CCArray *)cocos2d::CCArray::create(v28);
*(_QWORD *)&v61 = 15;
v62 = (__int64)&v59;
v59 = 0;
v60 = 0;
if ( isItemUnlocked )
{
LOWORD(v62) = -1;
BYTE2(v62) = -1;
*(_QWORD *)&v59 = sub_14003AA10(0x20u);
v60 = 26;
*(_QWORD *)&v61 = 31;
strcpy((char *)v59, "The Master Emblem!");
v56[15] = 0;
v57 = 14;
v58 = 15;
strcpy(v56, "The Gatekeeper");
v35 = DialogObject::create((__int64)v56, (__int64)&v59, 7, 1.0, 1, (__int64)&v62);
cocos2d::CCArray::addObject(v29, (struct cocos2d::CCObject *)v35);
v62 = (__int64)&v59;
LOWORD(v62) = -1;
BYTE2(v62) = -1;
v59 = 0;
v60 = 0;
*(_QWORD *)&v61 = 15;
*(_QWORD *)&v59 = sub_14003AA10(0x40u);
v60 = 50;
*(_QWORD *)&v61 = 63;
strcpy((char *)v59, "Lord RubRub, I will open the gate for you.");
v56[15] = 0;
v57 = 14;
v58 = 15;
strcpy(v56, "The Gatekeeper");
v36 = DialogObject::create((__int64)v56, (__int64)&v59, 7, 0.80000001, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v29, (struct cocos2d::CCObject *)v36);
v62 = (__int64)&v59;
LOWORD(v62) = -1;
BYTE2(v62) = -1;
v59 = 0;
v60 = 0;
*(_QWORD *)&v61 = 15;
*(_QWORD *)&v59 = sub_14003AA10(0x20u);
v60 = 16;
*(_QWORD *)&v61 = 31;
strcpy((char *)v59, "Please, come in.");
v56[15] = 0;
v57 = 14;
v58 = 15;
strcpy(v56, "The Gatekeeper");
v3 = 1.0;
v37 = DialogObject::create((__int64)v56, (__int64)&v59, 7, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v29, (struct cocos2d::CCObject *)v37);
DialogLayer = DialogLayer::createDialogLayer(nullptr, v29, 2);
v38 = &a1->DialogDelegate;
if ( !a1 )
v38 = nullptr;
DialogLayer->m_delegate = v38;
DialogLayer->setTag(DialogLayer, 2);
}
else
{
LOWORD(v62) = -1;
BYTE2(v62) = -1;
*(_QWORD *)&v59 = sub_14003AA10(0x20u);
v60 = 24;
*(_QWORD *)&v61 = 31;
strcpy((char *)v59, "Who disturbs my slumber?");
v56[15] = 0;
v57 = 14;
v58 = 15;
strcpy(v56, "The Gatekeeper");
v30 = DialogObject::create((__int64)v56, (__int64)&v59, 7, 1.0, 1, (__int64)&v62);
cocos2d::CCArray::addObject(v29, (struct cocos2d::CCObject *)v30);
v62 = (__int64)&v59;
LOWORD(v62) = -1;
BYTE2(v62) = -1;
v59 = 0;
v60 = 0;
*(_QWORD *)&v61 = 15;
*(_QWORD *)&v59 = sub_14003AA10(0x40u);
v60 = 61;
*(_QWORD *)&v61 = 63;
strcpy((char *)v59, "RubRub is that you?\nI cannot see in this light.");
v56[15] = 0;
v57 = 14;
v58 = 15;
strcpy(v56, "The Gatekeeper");
v31 = DialogObject::create((__int64)v56, (__int64)&v59, 7, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v29, (struct cocos2d::CCObject *)v31);
v62 = (__int64)&v59;
LOWORD(v62) = -1;
BYTE2(v62) = -1;
v59 = 0;
v60 = 0;
*(_QWORD *)&v61 = 15;
*(_QWORD *)&v59 = sub_14003AA10(0x50u);
v60 = 65;
*(_QWORD *)&v61 = 79;
strcpy((char *)v59, "Show me the Master Emblem,\nand I will let you pass.");
v56[15] = 0;
v57 = 14;
v58 = 15;
strcpy(v56, "The Gatekeeper");
v3 = 1.0;
v32 = DialogObject::create((__int64)v56, (__int64)&v59, 7, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v29, (struct cocos2d::CCObject *)v32);
DialogLayer = DialogLayer::createDialogLayer(nullptr, v29, 2);
}
v39 = cocos2d::CCDirector::sharedDirector(v33);
(*(void (__fastcall **)(_QWORD, DialogLayer *, __int64))(**(_QWORD **)(v39 + 264) + 440LL))(
*(_QWORD *)(v39 + 264),
DialogLayer,
1000);
v41 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v40);
cocos2d::CCDirector::getWinSize(v41);
v42 = DialogLayer->m_mainLayer->__vftable;
cocos2d::CCPoint::CCPoint(1.9431574e-19, *(float *)&v62 * 0.5);
v42->setPosition_0(DialogLayer->m_mainLayer, v43);
LOBYTE(v44) = 1;
DialogLayer->setVisible(DialogLayer, v44);
v45 = sub_14003CF30();
DialogLayer->m_animateTime = v45;
DialogLayer->m_mainLayer->getPosition_0(DialogLayer->m_mainLayer);
v46 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62);
v47 = DialogLayer->m_mainLayer->__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v46, -191.0);
v47->setPosition_0(DialogLayer->m_mainLayer, v48);
v49 = cocos2d::CCMoveTo::create(0.5, (const struct cocos2d::CCPoint *)&v62);
v50 = cocos2d::CCEaseElasticOut::create(v49, 0.60000002);
cocos2d::CCNode::runAction((CCLightFlash *)DialogLayer->m_mainLayer, (cocos2d::CCPoint)v50, v51, 1.0, v55);
v52 = (float)DialogLayer->getOpacity(&DialogLayer->cocos2d::CCRGBAProtocol);
if ( v52 > 0.0 )
{
DialogLayer->setOpacity(&DialogLayer->cocos2d::CCRGBAProtocol, 0);
v15 = cocos2d::CCFadeTo::create(0.14, (int)v52);
v17 = (CCLightFlash *)DialogLayer;
LABEL_25:
cocos2d::CCNode::runAction(v17, (cocos2d::CCPoint)v15, v16, v3, v54);
}
}
}
}