//
// SecretLayer3::onClick from 0xa8cabc to 0xa8d620 (2916 bytes)
//
// 5 xrefs:
// > ??> @ 0x84358
// > SecretLayer3::init @ 0xa93500
// > SecretLayer3::init @ 0xa9359c
// > SecretLayer3::init @ 0xa93638
// > ??> @ 0x1543730
//
// 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:38 +0000
//
__int64 __fastcall SecretLayer3::onClick(SecretLayer3 *this, cocos2d::CCObject *a2)
{
cocos2d::CCArray *v5; // x0
int v6; // w22
GameManager *v7; // x0
cocos2d::CCArray *v8; // x23
cocos2d::CCNode *v9; // x21
GameManager *v10; // x0
GameStatsManager *v11; // x0
__int64 v12; // x0
GameManager *isItemUnlocked; // x0
cocos2d::CCObject *v14; // x0
cocos2d::CCObject *v15; // x0
cocos2d::CCObject *v16; // x0
GameManager *v17; // x0
int v18; // w23
int v19; // w25
int v20; // w24
FMODAudioEngine *v21; // x0
__int64 v22; // x26
FMODAudioEngine *v23; // x0
__int64 v24; // x26
cocos2d::CCNode *v25; // x27
const cocos2d::CCPoint *v26; // x0
bool v27; // w2
__int64 v28; // x21
void (__fastcall *v29)(__int64, float *); // x2
__int64 v30; // x0
__int64 v31; // x2
__int64 v32; // x21
__int64 v33; // x0
__int64 v34; // x2
__int64 v35; // x21
GameManager *v36; // x0
GameManager *UGV; // x0
GameManager *v38; // x0
GameManager *v39; // x0
GameManager *v40; // x0
cocos2d::CCDelayTime *v41; // x0
cocos2d::CCSequence *v42; // x21
SecretLayer3 *v43; // x0
__int64 (__fastcall *v44)(SecretLayer3 *); // x1
cocos2d::CCFiniteTimeAction *v45; // x0
cocos2d::CCAction *v46; // x0
__int64 v47; // x0
GameManager *v48; // x0
cocos2d::CCObject *v49; // x0
cocos2d::CCObject *v50; // x0
cocos2d::CCObject *v51; // x0
__int64 v52; // x0
GameManager *v53; // x0
cocos2d::CCObject *v54; // x0
cocos2d::CCObject *v55; // x0
cocos2d::CCObject *v56; // x0
cocos2d::CCObject *v57; // x0
cocos2d::CCObject *v58; // x0
GameManager *v59; // x0
GameManager *v60; // x0
GameManager *v61; // x0
GameManager *v62; // x0
__int64 v63; // [xsp+70h] [xbp+70h] BYREF
float v64[4]; // [xsp+78h] [xbp+78h] BYREF
GameManager *v65; // [xsp+88h] [xbp+88h] BYREF
__int64 v66; // [xsp+90h] [xbp+90h]
void *v67; // [xsp+98h] [xbp+98h]
FMODAudioEngine *v68; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v69; // [xsp+A8h] [xbp+A8h]
void *v70; // [xsp+B0h] [xbp+B0h]
if ( *((_BYTE *)this + 424) )
return _stack_chk_guard;
v5 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 64LL))(a2);
v6 = (int)v5;
v7 = (GameManager *)cocos2d::CCArray::create(v5);
v8 = v7;
if ( v6 == 1 )
{
v10 = (GameManager *)GameManager::sharedState(v7);
v11 = (GameStatsManager *)GameManager::setUGV(v10, "19", 1u);
v12 = GameStatsManager::sharedState(v11);
isItemUnlocked = (GameManager *)(unsigned __int8)GameStatsManager::isItemUnlocked(v12, 0xCu, 1u);
if ( (_BYTE)isItemUnlocked )
{
v17 = (GameManager *)GameManager::sharedState(isItemUnlocked);
v18 = 255;
v19 = 100;
v20 = 0;
GameManager::setUGV(v17, (char *)&word_1217DE8, 1u);
goto LABEL_22;
}
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init((__int64 *)&v68, "The first key is hidden in a secret gauntlet...", 0x3Fu);
v14 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v8, v14);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init(
(__int64 *)&v68,
"Only a chosen few can find it, but I will grant you this gift...",
0x50u);
v15 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v8, v15);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init(
(__int64 *)&v68,
"Complete the Chaos Gauntlet, and the key will be yours...",
0x5Bu);
v16 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v8, v16);
LABEL_17:
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
goto LABEL_6;
}
if ( v6 == 2 )
{
v47 = GameStatsManager::sharedState(v7);
v48 = (GameManager *)(unsigned __int8)GameStatsManager::isItemUnlocked(v47, 0xCu, 2u);
if ( (_BYTE)v48 )
{
v61 = (GameManager *)GameManager::sharedState(v48);
v18 = 50;
v19 = 255;
v20 = 50;
GameManager::setUGV(v61, "15", 1u);
goto LABEL_22;
}
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init((__int64 *)&v68, "They tried to hide it from me,\nbut I have my spies.", 0x43u);
v49 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v8, v49);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init((__int64 *)&v68, "The second key is locked away in a secret chest.", 0x40u);
v50 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v8, v50);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init((__int64 *)&v68, "Unlock 50 secret chests to claim the key.", 0x39u);
v51 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v8, v51);
goto LABEL_17;
}
if ( v6 != 3 )
{
LABEL_6:
v9 = (cocos2d::CCNode *)DialogLayer::createWithObjects(v8, (cocos2d::CCArray *)byte_4);
(*(void (__fastcall **)(SecretLayer3 *, cocos2d::CCNode *, __int64))(*(_QWORD *)this + 464LL))(this, v9, 100);
DialogLayer::updateChatPlacement((__int64)v9, 0);
DialogLayer::animateIn(v9, 1u);
return _stack_chk_guard;
}
v52 = GameStatsManager::sharedState(v7);
v53 = (GameManager *)(unsigned __int8)GameStatsManager::isItemUnlocked(v52, 0xCu, 3u);
if ( !(_BYTE)v53 )
{
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init(
(__int64 *)&v68,
"The third key is hidden well.\nEven I have not been able to find it.",
0x51u);
v54 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 0.9);
cocos2d::CCArray::addObject(v8, v54);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init(
(__int64 *)&v68,
"I suspect it is guarded by The Gatekeeper.\nRubRub's trusted pet....",
0x6Bu);
v55 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 0.8);
cocos2d::CCArray::addObject(v8, v55);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init((__int64 *)&v68, "To claim the key you must fool him.\nI do not know how.", 0x44u);
v56 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 0.9);
cocos2d::CCArray::addObject(v8, v56);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init((__int64 *)&v68, "You will find The Gatekeeper at the end of the world.", 0x3Du);
v57 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 1.0);
cocos2d::CCArray::addObject(v8, v57);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v65 = nullptr;
v66 = 0;
v67 = nullptr;
std::string::__init((__int64 *)&v65, "...", 3u);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init(
(__int64 *)&v68,
"Touch the ground beneath the promise, and the door will be revealed.",
0x4Cu);
v58 = (cocos2d::CCObject *)DialogObject::create((char *)&v65, (char *)&v68, 15, 0, 0xFFFFFF, 0.8);
cocos2d::CCArray::addObject(v8, v58);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
v59 = (GameManager *)(unsigned __int8)v65;
if ( ((unsigned __int8)v65 & 1) != 0 )
operator delete(v67);
v60 = (GameManager *)GameManager::sharedState(v59);
GameManager::setUGV(v60, "6", 1u);
goto LABEL_6;
}
v62 = (GameManager *)GameManager::sharedState(v53);
v18 = 0;
v19 = 200;
v20 = 255;
GameManager::setUGV(v62, "16", 1u);
LABEL_22:
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)a2 + 1056LL))(a2, 0);
v21 = (FMODAudioEngine *)(*(__int64 (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)a2 + 344LL))(a2, 0);
v22 = FMODAudioEngine::sharedEngine(v21);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init((__int64 *)&v68, "chestClick.ogg", 0xEu);
FMODAudioEngine::playEffect(v22, (char *)&v68);
v23 = (FMODAudioEngine *)(unsigned __int8)v68;
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
v24 = FMODAudioEngine::sharedEngine(v23);
v68 = nullptr;
v69 = 0;
v70 = nullptr;
std::string::__init((__int64 *)&v68, "chestOpen01.ogg", 0xFu);
FMODAudioEngine::playEffect(v24, (char *)&v68);
if ( ((unsigned __int8)v68 & 1) != 0 )
operator delete(v70);
v25 = (cocos2d::CCNode *)(*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 512LL))(a2);
v26 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)a2 + 192LL))(a2);
cocos2d::CCNode::convertToWorldSpace(&v63, v25, v26);
v28 = cocos2d::CCParticleSystemQuad::create((cocos2d::CCParticleSystemQuad *)"coinPickupEffect.plist", nullptr, v27);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v28 + 1584LL))(v28, 1);
v29 = *(void (__fastcall **)(__int64, float *))(*(_QWORD *)v28 + 1360LL);
v64[3] = 1.0;
v64[0] = (float)v20 / 255.0;
v64[1] = (float)v19 / 255.0;
v64[2] = (float)v18 / 255.0;
v29(v28, v64);
(*(void (__fastcall **)(SecretLayer3 *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v28, 1);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v28 + 184LL))(v28, &v63);
v30 = CCCircleWave::create(nullptr, 25.0, 5.0, 0.3, 0);
v31 = *(_QWORD *)v30;
*(_BYTE *)(v30 + 340) = v20;
*(_BYTE *)(v30 + 341) = v19;
v32 = v30;
*(_BYTE *)(v30 + 342) = v18;
(*(void (__fastcall **)(__int64, __int64 *))(v31 + 184))(v30, &v63);
(*(void (__fastcall **)(SecretLayer3 *, __int64, _QWORD))(*(_QWORD *)this + 464LL))(this, v32, 0);
v33 = CCCircleWave::create(nullptr, 5.0, 60.0, 0.3);
v34 = *(_QWORD *)v33;
*(_BYTE *)(v33 + 340) = v20;
*(_BYTE *)(v33 + 341) = v19;
v35 = v33;
*(_BYTE *)(v33 + 342) = v18;
(*(void (__fastcall **)(__int64, __int64 *))(v34 + 184))(v33, &v63);
(*(void (__fastcall **)(SecretLayer3 *, __int64, _QWORD))(*(_QWORD *)this + 464LL))(this, v35, 0);
*(_DWORD *)(v35 + 352) = 1;
*(_DWORD *)(v35 + 356) = (unsigned int)byte_4;
v36 = (GameManager *)GameManager::sharedState((GameManager *)byte_4);
UGV = (GameManager *)GameManager::getUGV(v36, (char *)&word_1217DE8);
LODWORD(v35) = (unsigned __int8)UGV;
v38 = (GameManager *)GameManager::sharedState(UGV);
v39 = (GameManager *)GameManager::getUGV(v38, "15");
LODWORD(v35) = v35 + (unsigned __int8)v39;
v40 = (GameManager *)GameManager::sharedState(v39);
v41 = (cocos2d::CCDelayTime *)((unsigned int)v35 + (unsigned __int8)GameManager::getUGV(v40, "16"));
if ( (_DWORD)v41 == 3 )
{
v42 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(v41, 1.0);
v43 = this;
v44 = SecretLayer3::revealStep1;
}
else
{
*((_BYTE *)this + 424) = 1;
v42 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(v41, 0.5);
v43 = this;
v44 = SecretLayer3::showUnlockDialog;
}
v45 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(v43, v44, 0);
v46 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v42, v45, 0);
cocos2d::CCNode::runAction(this, v46);
return _stack_chk_guard;
}