//
// LevelPage::onSecretDoor from 0x4089a8 to 0x408d70 (968 bytes)
//
// 0 xrefs:
//
// 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; // r0
GameManager *v4; // r0
cocos2d::CCSprite *v5; // r5
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
float width; // s17
const cocos2d::CCSize *v8; // r0
cocos2d::CCSprite_vtbl *v9; // r3
float v10; // r2
cocos2d::CCActionInterval *v11; // r0
cocos2d::CCEaseBounceOut *v12; // r0
cocos2d::CCFadeOut *v13; // r0
GameManager *v14; // r0
cocos2d::CCDirector *v15; // r4
cocos2d::CCScene *v16; // r0
cocos2d::CCTransitionFade *v17; // r0
GameStatsManager *v18; // r0
_BOOL4 isItemUnlocked; // r11
cocos2d::CCArray *v20; // r7
cocos2d::CCObject *v21; // r0
cocos2d::CCObject *v22; // r0
cocos2d::CCObject *v23; // r0
cocos2d::CCObject *v24; // r0
cocos2d::CCObject *v25; // r0
DialogLayer *v26; // r0
DialogLayer *v27; // r4
DialogLayer_vtbl *v28; // r3
cocos2d::CCDirector *v29; // r0
char v30; // [sp+18h] [bp-14h] BYREF
cocos2d::CCPoint v31; // [sp+1Ch] [bp-10h] BYREF
if ( !s_didClick )
{
v3 = GameManager::sharedState();
if ( GameManager::getUGV(v3, (const char *)&aO1i2r3e45s7t89[10]) )
{
v14 = GameManager::sharedState();
if ( GameManager::getUGV(v14, (const char *)&aO1i2r3e45s7t89[12]) )
{
s_didClick = 1;
v15 = cocos2d::CCDirector::sharedDirector();
v16 = SecretLayer4::scene();
v17 = cocos2d::CCTransitionFade::create(0.5, v16);
cocos2d::CCDirector::replaceScene(v15, v17);
}
else
{
v18 = GameStatsManager::sharedState();
isItemUnlocked = GameStatsManager::isItemUnlocked(v18, GJItem, 4);
v20 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)isItemUnlocked);
sub_776584((int)&v30, "The Gatekeeper");
if ( isItemUnlocked )
{
sub_776584((int)&v31, "The Master Emblem!");
v24 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v30,
(std::string)&v31,
(std::string)7,
1065353216,
COERCE_FLOAT(1),
255);
cocos2d::CCArray::addObject(v20, v24);
sub_774008(&v31);
sub_774008(&v30);
sub_776584((int)&v30, "The Gatekeeper");
sub_776584((int)&v31, "Lord RubRub, I will open the gate for you.");
v25 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v30,
(std::string)&v31,
(std::string)7,
1061997773,
0.0,
255);
cocos2d::CCArray::addObject(v20, v25);
sub_774008(&v31);
sub_774008(&v30);
sub_776584((int)&v30, "The Gatekeeper");
sub_776584((int)&v31, "Please, come in.");
}
else
{
sub_776584((int)&v31, "Who disturbs my slumber?");
v21 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v30,
(std::string)&v31,
(std::string)7,
1065353216,
COERCE_FLOAT(1),
255);
cocos2d::CCArray::addObject(v20, v21);
sub_774008(&v31);
sub_774008(&v30);
sub_776584((int)&v30, "The Gatekeeper");
sub_776584((int)&v31, "RubRub is that you?\nI cannot see in this light.");
v22 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v30,
(std::string)&v31,
(std::string)7,
1065353216,
0.0,
255);
cocos2d::CCArray::addObject(v20, v22);
sub_774008(&v31);
sub_774008(&v30);
sub_776584((int)&v30, "The Gatekeeper");
sub_776584((int)&v31, "Show me the Master Emblem,\nand I will let you pass.");
}
v23 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v30,
(std::string)&v31,
(std::string)7,
1065353216,
0.0,
255);
cocos2d::CCArray::addObject(v20, v23);
sub_774008(&v31);
sub_774008(&v30);
v26 = DialogLayer::createWithObjects(v20, (int)&dword_0 + 2);
v27 = v26;
if ( isItemUnlocked )
{
v28 = v26->cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v26->m_delegate = &a1->DialogDelegate;
v28->setTag(v26, 2);
}
v29 = cocos2d::CCDirector::sharedDirector();
v29->m_pRunningScene->addChild_0(v29->m_pRunningScene, v27, 1000);
DialogLayer::updateChatPlacement(v27, Center);
DialogLayer::animateIn(v27, FromLeft);
}
}
else if ( a1->m_secretDoor )
{
v4 = GameManager::sharedState();
GameManager::setUGV(v4, (const char *)&aO1i2r3e45s7t89[10], 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;
v8 = a1->m_secretDoor->getContentSize(a1->m_secretDoor);
cocos2d::CCPoint::CCPoint(&v31, width * 0.5, v8->height * 0.5);
setPosition(v5, &v31);
v9 = v5->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
LODWORD(v31.x) = 770;
LODWORD(v31.y) = 1;
((void (__fastcall *)(cocos2d::CCSprite *, int, int))v9->setBlendFunc)(v5, 770, 1);
a1->m_secretDoor->setOpacity(a1->m_secretDoor, 255);
((void (__fastcall *)(cocos2d::CCSprite *, int))a1->m_secretDoor->setScale)(a1->m_secretDoor, 0x40000000);
v11 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create(COERCE_COCOS2D_CCSCALETO_(0.5), 1.0, v10);
v12 = cocos2d::CCEaseBounceOut::create(v11);
cocos2d::CCNode::runAction(a1->m_secretDoor, v12);
v13 = cocos2d::CCFadeOut::create(0.5);
cocos2d::CCNode::runAction(v5, v13);
}
}
}