//
// SecretLayer3::onClick from 0x140581ee0 to 0x140583161 (4737 bytes)
//
// 4 xrefs:
// > SecretLayer3::init @ 0x140580688
// > SecretLayer3::init @ 0x140580765
// > SecretLayer3::init @ 0x140580842
// > ??> @ 0x14092c9a8
//
// This function is hookable on this platform (idp: pc, 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 11:34:26 +0000
//
// Hidden C++ exception states: #wind=17
void __fastcall SecretLayer3::onClick(cocos2d::CCNode *a1, __int64 a2)
{
int v4; // ebx
__int64 v5; // rcx
__int64 v6; // rcx
cocos2d::CCArray *v7; // r13
char v8; // di
__int64 v9; // rcx
__int64 v10; // rcx
void **v11; // rax
void **v12; // rax
void **v13; // rax
unsigned __int8 v14; // r12
__int64 v15; // rcx
void **v16; // rax
void **v17; // rax
void **v18; // rax
__int64 v19; // rcx
void **v20; // rax
void **v21; // rax
void **v22; // rax
void **v23; // rax
void **v24; // rax
__int64 v25; // rcx
__int64 v26; // rcx
__int16 v27; // r15
int v28; // ecx
int v29; // ecx
__int64 (__fastcall *v30)(__int64); // rdi
__int64 v31; // rbx
__int64 v32; // rax
struct cocos2d::CCParticleSystemQuad *v33; // rbx
__int64 v34; // rdx
__int64 v35; // rdx
__int64 v36; // rcx
__int64 v37; // r8
cocos2d::CCObject *v38; // rbx
__int64 v39; // rdx
__int64 v40; // rcx
__int64 v41; // r8
cocos2d::CCObject *v42; // rbx
__int64 v43; // rcx
__int64 v44; // rsi
__int64 v45; // rdi
BOOL UGV; // ebx
BOOL v47; // ebx
__int64 v48; // rax
float v49; // xmm0_4
__int64 v50; // rbx
struct cocos2d::CCFiniteTimeAction *v51; // rax
struct cocos2d::CCAction *v52; // rax
cocos2d::CCLayerColor *DialogLayer; // rsi
__int64 v54; // rcx
__int64 v55; // rax
__int64 v56; // rdi
__int64 v57; // rbx
__int64 v58; // rax
__int16 v59; // [rsp+30h] [rbp-69h] BYREF
char v60; // [rsp+32h] [rbp-67h]
__int128 *v61; // [rsp+40h] [rbp-59h] BYREF
__int128 v62; // [rsp+48h] [rbp-51h] BYREF
__int64 v63; // [rsp+58h] [rbp-41h]
__int64 v64; // [rsp+60h] [rbp-39h]
__int128 v65; // [rsp+68h] [rbp-31h] BYREF
__int64 v66; // [rsp+78h] [rbp-21h]
__int64 v67; // [rsp+80h] [rbp-19h]
__int128 *v68; // [rsp+88h] [rbp-11h]
__int128 *v69; // [rsp+90h] [rbp-9h] BYREF
float v70; // [rsp+98h] [rbp-1h]
int v71; // [rsp+9Ch] [rbp+3h]
if ( *((_BYTE *)a1 + 424) )
return;
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
v8 = 0;
switch ( v4 )
{
case 1:
v9 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v61 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v9 = qword_14090BFD0;
}
GameManager::setUGV(v9, &word_140737FE4, 1u);
if ( !qword_14090BFE0 )
{
v61 = (__int128 *)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
}
if ( (unsigned __int8)GameStatsManager::isItemUnlocked(v10, 0xCu, 1u) )
{
v15 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v61 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v15 = qword_14090BFD0;
}
GameManager::setUGV(v15, &word_140737D98, 1u);
v8 = 1;
v59 = 25600;
v14 = -1;
}
else
{
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x40u);
v66 = 63;
v67 = 63;
strcpy((char *)v65, "The first key is hidden in a secret gauntlet...");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v11 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 1.0, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v11);
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x60u);
v66 = 80;
v67 = 95;
strcpy((char *)v65, "Only a chosen few can find it, but I will grant you this gift...");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v12 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 1.0, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v12);
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x60u);
v66 = 91;
v67 = 95;
strcpy(
(char *)v65,
"Complete the Chaos Gauntlet, and the key will be yours...");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v13 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 1.0, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v13);
v59 = 25600;
v14 = -1;
}
break;
case 2:
if ( !qword_14090BFE0 )
{
v61 = (__int128 *)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
}
if ( (unsigned __int8)GameStatsManager::isItemUnlocked(v6, 0xCu, 2u) )
{
v19 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v61 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v19 = qword_14090BFD0;
}
GameManager::setUGV(v19, "15", 1u);
v8 = 1;
v59 = -206;
v14 = 50;
}
else
{
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x50u);
v66 = 67;
v67 = 79;
strcpy((char *)v65, "They tried to hide it from me,\nbut I have my spies.");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v16 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 1.0, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v16);
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x50u);
v66 = 64;
v67 = 79;
strcpy((char *)v65, "The second key is locked away in a secret chest.");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v17 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 1.0, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v17);
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x40u);
v66 = 57;
v67 = 63;
strcpy((char *)v65, "Unlock 50 secret chests to claim the key.");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v18 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 1.0, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v18);
v59 = -206;
v14 = 50;
}
break;
case 3:
if ( !qword_14090BFE0 )
{
v61 = (__int128 *)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
}
if ( (unsigned __int8)GameStatsManager::isItemUnlocked(v6, 0xCu, 3u) )
{
v26 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v61 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v26 = qword_14090BFD0;
}
GameManager::setUGV(v26, &word_140737FEC, 1u);
v8 = 1;
}
else
{
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x60u);
v66 = 81;
v67 = 95;
strcpy((char *)v65, "The third key is hidden well.\nEven I have not been able to find it.");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v20 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 0.89999998, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v20);
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x70u);
v66 = 107;
v67 = 111;
strcpy(
(char *)v65,
"I suspect it is guarded by The Gatekeeper.\nRubRub's trusted pet....");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v21 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 0.80000001, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v21);
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x50u);
v66 = 68;
v67 = 79;
strcpy((char *)v65, "To claim the key you must fool him.\nI do not know how.");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v22 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 0.89999998, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v22);
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x40u);
v66 = 61;
v67 = 63;
strcpy((char *)v65, "You will find The Gatekeeper at the end of the world.");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v23 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 1.0, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v23);
v61 = &v65;
v59 = -1;
v60 = -1;
v65 = 0;
v66 = 0;
v67 = 0;
*(_QWORD *)&v65 = sub_14003D460(0x50u);
v66 = 76;
v67 = 79;
strcpy((char *)v65, "Touch the ground beneath the promise, and the door will be revealed.");
v62 = 0;
v63 = 3;
v64 = 15;
LOWORD(v62) = *(_WORD *)"...";
WORD1(v62) = (unsigned __int8)asc_14070EB14[2];
v24 = DialogObject::create((__int64)&v62, (__int64)&v65, 15, 0.80000001, 0, (__int64)&v59);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v24);
v25 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v61 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v25 = qword_14090BFD0;
}
GameManager::setUGV(v25, "6", 1u);
}
v59 = -14081;
v14 = 0;
break;
default:
LABEL_46:
DialogLayer = DialogLayer::createDialogLayer(0, (__int64)v7, 4u);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCLayerColor *, __int64))(*(_QWORD *)a1 + 456LL))(
a1,
DialogLayer,
100);
v55 = cocos2d::CCDirector::sharedDirector(v54);
cocos2d::CCDirector::getWinSize(v55, &v61);
v56 = **((_QWORD **)DialogLayer + 70);
v57 = *((_QWORD *)DialogLayer + 70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, *(float *)&v61 * 0.5, *((float *)&v61 + 1) * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v56 + 184))(v57, v58);
DialogLayer::animateIn(DialogLayer, 1);
return;
}
v27 = v59;
if ( !v8 )
goto LABEL_46;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 936LL))(a2, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 336LL))(a2, 0);
v68 = &v62;
v63 = 14;
v64 = 15;
strcpy((char *)&v62, "chestClick.ogg");
HIBYTE(v62) = 0;
v28 = qword_14090BF60;
if ( !qword_14090BF60 )
{
v69 = (__int128 *)operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v69);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v28 = qword_14090BF60;
}
FMODAudioEngine::playEffect_1(v28, (__int64)&v62);
v69 = &v65;
v66 = 15;
v67 = 15;
strcpy((char *)&v65, "chestOpen01.ogg");
v29 = qword_14090BF60;
if ( !qword_14090BF60 )
{
v68 = (__int128 *)operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v68);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v29 = qword_14090BF60;
}
FMODAudioEngine::playEffect_1(v29, (__int64)&v65);
v30 = *(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 504LL);
v31 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 200LL))(a2);
v32 = v30(a2);
cocos2d::CCNode::convertToWorldSpace(v32, &v61, v31);
v33 = cocos2d::CCParticleSystemQuad::create("coinPickupEffect.plist", 0);
LOBYTE(v34) = 1;
(*(void (__fastcall **)(struct cocos2d::CCParticleSystemQuad *, __int64))(*(_QWORD *)v33 + 1544LL))(v33, v34);
*(float *)&v69 = (float)(unsigned __int8)v27 / 255.0;
*((float *)&v69 + 1) = (float)HIBYTE(v59) / 255.0;
v70 = (float)v14 / 255.0;
v71 = 1065353216;
(*(void (__fastcall **)(struct cocos2d::CCParticleSystemQuad *, __int128 **))(*(_QWORD *)v33 + 1352LL))(v33, &v69);
(*(void (__fastcall **)(cocos2d::CCNode *, struct cocos2d::CCParticleSystemQuad *, __int64))(*(_QWORD *)a1 + 456LL))(
a1,
v33,
1);
(*(void (__fastcall **)(struct cocos2d::CCParticleSystemQuad *, __int128 **))(*(_QWORD *)v33 + 184LL))(v33, &v61);
v38 = CCCircleWave::create(v36, v35, v37, 0, 0);
*((_WORD *)v38 + 170) = v27;
*((_BYTE *)v38 + 342) = v14;
(*(void (__fastcall **)(cocos2d::CCObject *, __int128 **))(*(_QWORD *)v38 + 184LL))(v38, &v61);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCObject *, _QWORD))(*(_QWORD *)a1 + 456LL))(a1, v38, 0);
v42 = CCCircleWave::create(v40, v39, v41, 0, 1);
*((_WORD *)v42 + 170) = v27;
*((_BYTE *)v42 + 342) = v14;
(*(void (__fastcall **)(cocos2d::CCObject *, __int128 **))(*(_QWORD *)v42 + 184LL))(v42, &v61);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCObject *, _QWORD))(*(_QWORD *)a1 + 456LL))(a1, v42, 0);
*((_DWORD *)v42 + 88) = 1;
*((_DWORD *)v42 + 89) = 4;
v43 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v69 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v69);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v43 = qword_14090BFD0;
}
v44 = v43;
if ( !v43 )
{
v69 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v69);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v43 = qword_14090BFD0;
}
v45 = v43;
if ( !v43 )
{
v69 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v69);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v43 = qword_14090BFD0;
}
UGV = GameManager::getUGV(v43, &word_140737D98);
v47 = GameManager::getUGV(v45, &word_140737FEC) + UGV;
if ( v47 + GameManager::getUGV(v44, "15") == 3 )
{
v48 = cocos2d::CCCallFunc::create(a1, SecretLayer3::revealStep1);
v49 = 1.0;
}
else
{
*((_BYTE *)a1 + 424) = 1;
v48 = cocos2d::CCCallFunc::create(a1, SecretLayer3::showUnlockDialog);
v49 = 0.5;
}
v50 = v48;
v51 = cocos2d::CCDelayTime::create(v49);
v52 = cocos2d::CCSequence::create(v51, v50, 0);
cocos2d::CCNode::runAction(a1, v52);
}