//
// SecretLayer2::onSecretLevel from 0xa8c01c to 0xa8c1d0 (436 bytes)
//
// 3 xrefs:
// > ??> @ 0x49090
// > SecretLayer2::init @ 0xa90a44
// > ??> @ 0x15416c0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:00:37 +0000
//
__int64 __fastcall SecretLayer2::onSecretLevel(SecretLayer2 *this, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // x0
GameLevelManager *Stat; // x0
DialogLayer *v5; // x0
DialogLayer *v6; // x20
GameLevelManager *v8; // x0
GameManager *MainLevel; // x21
cocos2d::CCDirector *v10; // x0
cocos2d::CCDirector *v11; // x20
AppDelegate *v12; // x0
cocos2d::CCScene *v13; // x1
cocos2d::CCScene *v14; // x0
__int64 v15[2]; // [xsp+38h] [xbp+38h] BYREF
void *v16; // [xsp+48h] [xbp+48h]
__int64 v17[2]; // [xsp+50h] [xbp+50h] BYREF
void *v18; // [xsp+60h] [xbp+60h]
v3 = (GameStatsManager *)GameStatsManager::sharedState(_stack_chk_guard);
Stat = (GameLevelManager *)GameStatsManager::getStat(v3, "13");
if ( (int)Stat > 199 )
{
v8 = (GameLevelManager *)GameLevelManager::sharedState(Stat);
MainLevel = (GameManager *)GameLevelManager::getMainLevel(v8, (_BYTE *)&elf_hash_bucket[624] + 1, 0);
v10 = (cocos2d::CCDirector *)GameManager::sharedState(MainLevel);
*((_DWORD *)v10 + 177) = 12;
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
v12 = PlayLayer::scene(MainLevel, nullptr);
v14 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v12, 0.5, v13);
cocos2d::CCDirector::replaceScene(v11, v14);
return _stack_chk_guard;
}
v15[0] = 0;
v15[1] = 0;
v16 = nullptr;
std::string::__init(v15, "The Keymaster", 0xDu);
v17[0] = 0;
v17[1] = 0;
v18 = nullptr;
std::string::__init(v17, "You are not prepared.\nCollect more diamonds...", 0x34u);
v5 = (DialogLayer *)DialogObject::create((char *)v15, (char *)v17, 2, 0, 0xFFFFFF, 1.0);
v6 = (DialogLayer *)DialogLayer::create(v5, (DialogObject *)((char *)&dword_0 + 2));
if ( (v17[0] & 1) != 0 )
{
operator delete(v18);
if ( (v15[0] & 1) == 0 )
goto LABEL_4;
goto LABEL_7;
}
if ( (v15[0] & 1) != 0 )
LABEL_7:
operator delete(v16);
LABEL_4:
(*(void (__fastcall **)(SecretLayer2 *, DialogLayer *, __int64))(*(_QWORD *)this + 464LL))(this, v6, 100);
DialogLayer::updateChatPlacement((__int64)v6, 0);
DialogLayer::animateInRandomSide(v6);
return _stack_chk_guard;
}