//
// LevelPage::addSecretDoor from 0x14031cab0 to 0x14031ccbc (524 bytes)
//
// 2 xrefs:
// > LevelPage::updateDynamicPage @ 0x14031bc4c
// > ??> @ 0x1406d4b20
//
// 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=3
void LevelPage::addSecretDoor(LevelPage *a1)
{
GameManager *v2; // rcx
GameManager *v3; // rcx
bool UGV; // bl
__int64 v5; // rcx
cocos2d::CCDirector *v6; // rax
const char *v7; // rcx
GameManager *v8; // rcx
__int64 v9; // rcx
cocos2d::CCNode *v10; // rdi
CCMenuItemSpriteExtra *v11; // rbx
void *v12; // [rsp+40h] [rbp+18h]
void *v13; // [rsp+40h] [rbp+18h]
void *v14; // [rsp+40h] [rbp+18h]
v2 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v12 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v2 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getUGV(v2, "6") )
{
v3 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v13 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = (GameManager *)qword_1406C2ED8;
}
UGV = GameManager::getUGV(v3, "8");
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
v7 = "secretDoorBtn2_closed_001.png";
if ( UGV )
v7 = "secretDoorBtn2_open_001.png";
a1->m_secretDoor = cocos2d::CCSprite::createWithSpriteFrameName(v7);
v8 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v14 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v8, (const char *)&word_140531E88) )
a1->m_secretDoor->setOpacity(&a1->m_secretDoor->cocos2d::CCRGBAProtocol, 0);
v10 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v9);
a1->addChild_1(a1, v10);
v11 = CCMenuItemSpriteExtra::create(
a1->m_secretDoor,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)LevelPage::onSecretDoor);
LOWORD(v11->m_scaleMultiplier) = 256;
v10->addChild_1(v10, v11);
((void (__fastcall *)(cocos2d::CCNode *))v10->setPosition)(v10);
HIDWORD(v11->m_pfnSelector.adj) = 0x40000000;
cocos2d::CCArray::addObject(a1->m_dynamicObjects, v11);
cocos2d::CCArray::addObject(a1->m_dynamicObjects, a1->m_secretDoor);
}
}