//
// LevelPage::onSecretDoor from 0x79bd50 to 0x79c690 (2368 bytes)
//
// 3 xrefs:
// > ??> @ 0xb36b8
// > LevelPage::addSecretDoor @ 0x79ef4c
// > ??> @ 0x122e398
//
// 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 LevelPage::onSecretDoor(LevelPage *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
GameManager *v4; // x0
cocos2d::CCSprite *v5; // x20
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
float width; // s0
cocos2d::CCSprite *m_secretDoor; // x0
__int128 v9; // q0
const cocos2d::CCSize *(__fastcall *getContentSize)(const cocos2d::CCNode *__hidden); // x1
__int64 v11; // x0
cocos2d::CCScaleTo *v12; // x0
cocos2d::CCActionInterval *v13; // x0
cocos2d::CCEaseBounceOut *v14; // x0
cocos2d::CCFadeOut *v15; // x0
GameManager *v16; // x0
GameStatsManager *v17; // x0
_BOOL8 isItemUnlocked; // x0
_BOOL4 v19; // w20
cocos2d::CCArray *v20; // x24
cocos2d::CCObject *v21; // x0
void *v22; // x0
void *v23; // x0
cocos2d::CCObject *v24; // x0
void *v25; // x0
void *v26; // x0
cocos2d::CCObject *v27; // x0
void *v28; // x0
void *v29; // x0
DialogLayer *v30; // x0
DialogLayer_vtbl *v31; // x2
DialogLayer *v32; // x20
cocos2d::CCDirector *v33; // x0
cocos2d::CCObject *v34; // x0
void *v35; // x0
void *v36; // x0
cocos2d::CCObject *v37; // x0
void *v38; // x0
void *v39; // x0
cocos2d::CCObject *v40; // x0
void *v41; // x0
void *v42; // x0
cocos2d::CCDirector *v43; // x20
cocos2d::CCScene *v44; // x0
cocos2d::CCTransitionFade *v45; // x0
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x1
int v57; // w2
unsigned int *v58; // x21
int v59; // w1
unsigned int *v60; // x1
int v61; // w2
unsigned int *v62; // x1
int v63; // w2
unsigned int *v64; // x1
int v65; // w2
unsigned int *v66; // x1
int v67; // w2
unsigned int *v68; // x1
int v69; // w2
_QWORD v70[2]; // [xsp+0h] [xbp+0h] BYREF
__int128 v71; // [xsp+70h] [xbp+70h]
cocos2d::CCPoint *v72; // [xsp+88h] [xbp+88h]
__int64 v73; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v74; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::_ccColor3B v75; // 0:w5.3
cocos2d::_ccColor3B v76; // 0:w5.3
cocos2d::_ccColor3B v77; // 0:w5.3
cocos2d::_ccColor3B v78; // 0:w5.3
cocos2d::_ccColor3B v79; // 0:w5.3
cocos2d::_ccColor3B v80; // 0:w5.3
if ( !s_didClick )
{
v3 = GameManager::sharedState();
if ( GameManager::getUGV(v3, "7") )
{
v16 = GameManager::sharedState();
if ( GameManager::getUGV(v16, "8") )
{
s_didClick = (unsigned __int8)&dword_0 + 1;
v43 = cocos2d::CCDirector::sharedDirector();
v44 = SecretLayer4::scene();
v45 = cocos2d::CCTransitionFade::create(0.5, v44);
cocos2d::CCDirector::replaceScene(v43, v45);
}
else
{
v17 = GameStatsManager::sharedState();
isItemUnlocked = GameStatsManager::isItemUnlocked(v17, GJItem, 4);
v19 = isItemUnlocked;
v20 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)isItemUnlocked);
if ( v19 )
{
sub_D153B8((int)&v73, "The Gatekeeper");
sub_D153B8((unsigned int)v70 + 176, "The Master Emblem!");
v21 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v73,
(std::string)&v74,
(std::string)7LL,
1,
1.0,
(bool)&unk_FFFFFF,
v75);
cocos2d::CCArray::addObject(v20, v21);
v22 = (void *)(*(_QWORD *)&v74 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v74 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v62 = (unsigned int *)(*(_QWORD *)&v74 - 8LL);
do
v63 = __ldaxr(v62);
while ( __stlxr(v63 - 1, v62) );
}
else
{
v63 = *(_DWORD *)(*(_QWORD *)&v74 - 8LL);
*(_DWORD *)(*(_QWORD *)&v74 - 8LL) = v63 - 1;
}
if ( v63 <= 0 )
operator delete(v22);
}
v23 = (void *)(v73 - 24);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(v73 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *(_DWORD *)(v73 - 8);
*(_DWORD *)(v73 - 8) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v23);
}
sub_D153B8((unsigned int)v70 + 168, "The Gatekeeper");
sub_D153B8((unsigned int)v70 + 176, "Lord RubRub, I will open the gate for you.");
v24 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v73,
(std::string)&v74,
(std::string)7LL,
0,
0.8,
(bool)&unk_FFFFFF,
v76);
cocos2d::CCArray::addObject(v20, v24);
v25 = (void *)(*(_QWORD *)&v74 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v74 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(*(_QWORD *)&v74 - 8LL);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(_DWORD *)(*(_QWORD *)&v74 - 8LL);
*(_DWORD *)(*(_QWORD *)&v74 - 8LL) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v25);
}
v26 = (void *)(v73 - 24);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v73 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(_DWORD *)(v73 - 8);
*(_DWORD *)(v73 - 8) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v26);
}
sub_D153B8((unsigned int)v70 + 168, "The Gatekeeper");
sub_D153B8((unsigned int)v70 + 176, "Please, come in.");
v27 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v73,
(std::string)&v74,
(std::string)7LL,
0,
1.0,
(bool)&unk_FFFFFF,
v77);
cocos2d::CCArray::addObject(v20, v27);
v28 = (void *)(*(_QWORD *)&v74 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v74 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)(*(_QWORD *)&v74 - 8LL);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *(_DWORD *)(*(_QWORD *)&v74 - 8LL);
*(_DWORD *)(*(_QWORD *)&v74 - 8LL) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v28);
}
v29 = (void *)(v73 - 24);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)(v73 - 8);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *(_DWORD *)(v73 - 8);
*(_DWORD *)(v73 - 8) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v29);
}
v30 = DialogLayer::createWithObjects(v20, (int)&dword_0 + 2);
v31 = v30->cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v30->m_delegate = &a1->DialogDelegate;
v32 = v30;
v31->setTag(v30, 2);
}
else
{
sub_D153B8((int)&v73, "The Gatekeeper");
sub_D153B8((unsigned int)v70 + 176, "Who disturbs my slumber?");
v34 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v73,
(std::string)&v74,
(std::string)7LL,
1,
1.0,
(bool)&unk_FFFFFF,
v78);
cocos2d::CCArray::addObject(v20, v34);
v35 = (void *)(*(_QWORD *)&v74 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v74 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v68 = (unsigned int *)(*(_QWORD *)&v74 - 8LL);
do
v69 = __ldaxr(v68);
while ( __stlxr(v69 - 1, v68) );
}
else
{
v69 = *(_DWORD *)(*(_QWORD *)&v74 - 8LL);
*(_DWORD *)(*(_QWORD *)&v74 - 8LL) = v69 - 1;
}
if ( v69 <= 0 )
operator delete(v35);
}
v36 = (void *)(v73 - 24);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(v73 - 8);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(v73 - 8);
*(_DWORD *)(v73 - 8) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v36);
}
sub_D153B8((unsigned int)v70 + 168, "The Gatekeeper");
sub_D153B8((unsigned int)v70 + 176, "RubRub is that you?\nI cannot see in this light.");
v37 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v73,
(std::string)&v74,
(std::string)7LL,
0,
1.0,
(bool)&unk_FFFFFF,
v79);
cocos2d::CCArray::addObject(v20, v37);
v38 = (void *)(*(_QWORD *)&v74 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v74 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v64 = (unsigned int *)(*(_QWORD *)&v74 - 8LL);
do
v65 = __ldaxr(v64);
while ( __stlxr(v65 - 1, v64) );
}
else
{
v65 = *(_DWORD *)(*(_QWORD *)&v74 - 8LL);
*(_DWORD *)(*(_QWORD *)&v74 - 8LL) = v65 - 1;
}
if ( v65 <= 0 )
operator delete(v38);
}
v39 = (void *)(v73 - 24);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(v73 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *(_DWORD *)(v73 - 8);
*(_DWORD *)(v73 - 8) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v39);
}
sub_D153B8((unsigned int)v70 + 168, "The Gatekeeper");
sub_D153B8((unsigned int)v70 + 176, "Show me the Master Emblem,\nand I will let you pass.");
v40 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v73,
(std::string)&v74,
(std::string)7LL,
0,
1.0,
(bool)&unk_FFFFFF,
v80);
cocos2d::CCArray::addObject(v20, v40);
v41 = (void *)(*(_QWORD *)&v74 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v74 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v66 = (unsigned int *)(*(_QWORD *)&v74 - 8LL);
do
v67 = __ldaxr(v66);
while ( __stlxr(v67 - 1, v66) );
}
else
{
v67 = *(_DWORD *)(*(_QWORD *)&v74 - 8LL);
*(_DWORD *)(*(_QWORD *)&v74 - 8LL) = v67 - 1;
}
if ( v67 <= 0 )
operator delete(v41);
}
v42 = (void *)(v73 - 24);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(v73 - 8);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *(_DWORD *)(v73 - 8);
*(_DWORD *)(v73 - 8) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v42);
}
v32 = DialogLayer::createWithObjects(v20, (int)&dword_0 + 2);
}
v33 = cocos2d::CCDirector::sharedDirector();
v33->m_pRunningScene->addChild_0(v33->m_pRunningScene, v32, 1000);
DialogLayer::updateChatPlacement(v32, Center);
DialogLayer::animateIn(v32, FromLeft);
}
}
else if ( a1->m_secretDoor )
{
v4 = GameManager::sharedState();
GameManager::setUGV(v4, "7", 1);
v5 = cocos2d::CCSprite::createWithSpriteFrameName("secretDoorBtn2_closed_001.png");
a1->m_secretDoor->addChild_0(a1->m_secretDoor, v5, 2);
setPosition = v5->setPosition;
width = a1->m_secretDoor->getContentSize(a1->m_secretDoor)->width;
m_secretDoor = a1->m_secretDoor;
*(float *)&v9 = width * 0.5;
getContentSize = m_secretDoor->getContentSize;
v71 = v9;
v11 = (__int64)getContentSize(m_secretDoor);
v72 = &v74;
cocos2d::CCPoint::CCPoint(&v74, *(float *)&v71, *(float *)(v11 + 4) * 0.5);
setPosition(v5, &v74);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v5->setBlendFunc)(v5, 0x100000302LL);
a1->m_secretDoor->setOpacity(a1->m_secretDoor, 0xFFFFFFFFLL);
v12 = (cocos2d::CCScaleTo *)((__int64 (__fastcall *)(cocos2d::CCSprite *, float))a1->m_secretDoor->setScale)(
a1->m_secretDoor,
2.0);
v13 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create(v12, 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(v5, v15);
}
}
}