//
// SecretLayer3::onClick from 0x1403ec400 to 0x1403ed708 (4872 bytes)
//
// 4 xrefs:
// > SecretLayer3::init @ 0x1403eaa5e
// > SecretLayer3::init @ 0x1403eab35
// > SecretLayer3::init @ 0x1403eac0c
// > ??> @ 0x1406d80a8
//
// 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=17
void SecretLayer3::onClick(SecretLayer3 *a1, cocos2d::CCObject *a2)
{
float v2; // xmm0_4
float v3; // xmm3_4
int v6; // r14d
__int64 v7; // rcx
GameStatsManager *v8; // rcx
cocos2d::CCArray *v9; // r12
char v10; // bl
GameManager *v11; // rcx
GameStatsManager *v12; // rcx
char *v13; // rax
char *v14; // rax
char *v15; // rax
unsigned __int8 v16; // r15
GameManager *v17; // rcx
char *v18; // rax
char *v19; // rax
char *v20; // rax
GameManager *v21; // rcx
char *v22; // rax
char *v23; // rax
char *v24; // rax
char *v25; // rax
char *v26; // rax
GameManager *v27; // rcx
GameManager *v28; // rcx
__int16 v29; // r14
int v30; // ecx
int v31; // ecx
cocos2d::CCNode *v32; // rax
struct cocos2d::CCParticleSystemQuad *v33; // rbx
_BOOL8 v34; // rdx
CCCircleWave *v35; // rbx
cocos2d::CCNode *v36; // rbx
GameManager *v37; // r14
GameManager *v38; // rdi
GameManager *v39; // rbx
BOOL UGV; // ebx
int v41; // edi
__int64 v42; // rax
float v43; // xmm0_4
__int64 v44; // rbx
struct cocos2d::CCDelayTime *v45; // rax
struct cocos2d::CCFadeTo *v46; // rax
cocos2d::ccColor3B *v47; // r8
CCLightFlash *v48; // rcx
DialogLayer *DialogLayer; // rdi
__int64 v50; // rcx
cocos2d::CCDirector *v51; // rax
cocos2d::CCLayer_vtbl *v52; // rbx
const cocos2d::CCPoint *v53; // rax
_BOOL8 v54; // rdx
float v55; // xmm1_4
struct cocos2d::CCScaleTo *v56; // rax
struct cocos2d::CCEaseElasticOut *v57; // rax
cocos2d::ccColor3B *v58; // r8
float v59; // xmm6_4
float v60; // [rsp+28h] [rbp-79h]
float v61; // [rsp+28h] [rbp-79h]
__int16 v62; // [rsp+38h] [rbp-69h] BYREF
char v63; // [rsp+3Ah] [rbp-67h]
__int128 *v64; // [rsp+48h] [rbp-59h] BYREF
__int128 v65; // [rsp+50h] [rbp-51h] BYREF
__int64 v66; // [rsp+60h] [rbp-41h]
__int64 v67; // [rsp+68h] [rbp-39h]
__int128 v68; // [rsp+70h] [rbp-31h] BYREF
__int64 v69; // [rsp+80h] [rbp-21h]
__int64 v70; // [rsp+88h] [rbp-19h]
FMODAudioEngine *v71; // [rsp+90h] [rbp-11h]
FMODAudioEngine *v72; // [rsp+98h] [rbp-9h] BYREF
float v73; // [rsp+A0h] [rbp-1h]
int v74; // [rsp+A4h] [rbp+3h]
if ( !a1->m_lockInput )
{
v6 = a2->getTag(a2);
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
v10 = 0;
switch ( v6 )
{
case 1:
v11 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v64 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = (GameManager *)qword_1406C2ED8;
}
GameManager::setUGV(v11, (const char *)&word_14054445C, 1);
if ( !qword_1406C2EE8 )
{
v64 = (__int128 *)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
if ( GameStatsManager::isItemUnlocked(v12, GJItem, 1) )
{
v17 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v64 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v17 = (GameManager *)qword_1406C2ED8;
}
GameManager::setUGV(v17, "14", 1);
v10 = 1;
v62 = 25600;
v16 = -1;
}
else
{
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x40u);
v69 = 63;
v70 = 63;
strcpy((char *)v68, "The first key is hidden in a secret gauntlet...");
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v13 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v13);
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x60u);
v69 = 80;
v70 = 95;
strcpy((char *)v68, "Only a chosen few can find it, but I will grant you this gift...");
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v14 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v14);
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x60u);
v69 = 91;
v70 = 95;
strcpy(
(char *)v68,
"Complete the Chaos Gauntlet, and the key will be yours...");
v2 = 0.0;
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v3 = 1.0;
v15 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v15);
v62 = 25600;
v16 = -1;
}
break;
case 2:
if ( !qword_1406C2EE8 )
{
v64 = (__int128 *)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
if ( GameStatsManager::isItemUnlocked(v8, GJItem, 2) )
{
v21 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v64 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v21 = (GameManager *)qword_1406C2ED8;
}
GameManager::setUGV(v21, "15", 1);
v10 = 1;
v62 = -206;
v16 = 50;
}
else
{
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x50u);
v69 = 67;
v70 = 79;
strcpy((char *)v68, "They tried to hide it from me,\nbut I have my spies.");
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v18 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v18);
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x50u);
v69 = 64;
v70 = 79;
strcpy((char *)v68, "The second key is locked away in a secret chest.");
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v19 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v19);
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x40u);
v69 = 57;
v70 = 63;
strcpy((char *)v68, "Unlock 50 secret chests to claim the key.");
v2 = 0.0;
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v3 = 1.0;
v20 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v20);
v62 = -206;
v16 = 50;
}
break;
case 3:
if ( !qword_1406C2EE8 )
{
v64 = (__int128 *)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
if ( GameStatsManager::isItemUnlocked(v8, GJItem, 3) )
{
v28 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v64 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v28 = (GameManager *)qword_1406C2ED8;
}
GameManager::setUGV(v28, (const char *)&word_140544454, 1);
v10 = 1;
}
else
{
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x60u);
v69 = 81;
v70 = 95;
strcpy((char *)v68, "The third key is hidden well.\nEven I have not been able to find it.");
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v22 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 0.89999998, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v22);
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x70u);
v69 = 107;
v70 = 111;
strcpy(
(char *)v68,
"I suspect it is guarded by The Gatekeeper.\n"
"RubRub's trusted pet....");
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v23 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 0.80000001, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v23);
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x50u);
v69 = 68;
v70 = 79;
strcpy((char *)v68, "To claim the key you must fool him.\nI do not know how.");
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v24 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 0.89999998, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v24);
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x40u);
v69 = 61;
v70 = 63;
strcpy((char *)v68, "You will find The Gatekeeper at the end of the world.");
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v25 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 1.0, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v25);
v64 = &v68;
v62 = -1;
v63 = -1;
v68 = 0;
v69 = 0;
v70 = 15;
*(_QWORD *)&v68 = sub_14003AA10(0x50u);
v69 = 76;
v70 = 79;
strcpy((char *)v68, "Touch the ground beneath the promise, and the door will be revealed.");
v2 = 0.0;
v65 = 0;
v66 = 3;
v67 = 15;
LOWORD(v65) = *(_WORD *)"...";
WORD1(v65) = (unsigned __int8)asc_14053DBB0[2];
v3 = 0.80000001;
v26 = DialogObject::create((__int64)&v65, (__int64)&v68, 15, 0.80000001, 0, (__int64)&v62);
cocos2d::CCArray::addObject(v9, (struct cocos2d::CCObject *)v26);
v27 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v64 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v64);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v27 = (GameManager *)qword_1406C2ED8;
}
GameManager::setUGV(v27, "6", 1);
}
v62 = -14081;
v16 = 0;
break;
default:
goto LABEL_46;
}
v29 = v62;
if ( v10 )
{
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))a2->__vftable[12].getTag)(a2, 0);
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))a2->__vftable[4].update)(a2, 0);
v71 = (FMODAudioEngine *)&v65;
v66 = 14;
v67 = 15;
strcpy((char *)&v65, "chestClick.ogg");
HIBYTE(v65) = 0;
v30 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v72 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v72);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v30 = qword_1406C2E88;
}
FMODAudioEngine::playEffect_1(v30, (__int64)&v65);
v72 = (FMODAudioEngine *)&v68;
v69 = 15;
v70 = 15;
strcpy((char *)&v68, "chestOpen01.ogg");
v31 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v71 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v71);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v31 = qword_1406C2E88;
}
FMODAudioEngine::playEffect_1(v31, (__int64)&v68);
a2->__vftable[2].getTag(a2);
v32 = (cocos2d::CCNode *)((__int64 (__fastcall *)(cocos2d::CCObject *))a2->__vftable[6].getTag)(a2);
cocos2d::CCNode::convertToWorldSpace(v32, (const struct cocos2d::CCPoint *)&v64);
v33 = cocos2d::CCParticleSystemQuad::create("coinPickupEffect.plist", 0);
LOBYTE(v34) = 1;
v33->setAutoRemoveOnFinish(v33, v34);
v3 = (float)(unsigned __int8)v29 / 255.0;
*(float *)&v72 = v3;
*((float *)&v72 + 1) = (float)HIBYTE(v62) / 255.0;
v73 = (float)v16 / 255.0;
v74 = 1065353216;
v33->setStartColor(v33, (const cocos2d::ccColor4F *)&v72);
a1->addChild_0(a1, v33, 1);
v33->setPosition_0(v33, (const cocos2d::CCPoint *)&v64);
v35 = CCCircleWave::create(25.0, 5.0, 0.30000001, 0, 0);
*(_WORD *)&v35->m_color.r = v29;
v35->m_color.b = v16;
v35->setPosition_0(v35, (const cocos2d::CCPoint *)&v64);
a1->addChild_0(a1, v35, 0);
v36 = CCCircleWave::create(5.0, 60.0, 0.30000001, 0, 1);
LOWORD(v36[1].m_uReference) = v29;
BYTE2(v36[1].m_uReference) = v16;
v36->setPosition_0(v36, (const cocos2d::CCPoint *)&v64);
a1->addChild_0(a1, v36, 0);
v36[1].m_uIndexInArray = 1;
v36[1].m_uUnknown = 4;
v37 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v72 = (FMODAudioEngine *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v72);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v37 = (GameManager *)qword_1406C2ED8;
}
v38 = v37;
if ( !v37 )
{
v72 = (FMODAudioEngine *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v72);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v37 = (GameManager *)qword_1406C2ED8;
}
v39 = v37;
if ( !v37 )
{
v72 = (FMODAudioEngine *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v72);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v37 = (GameManager *)qword_1406C2ED8;
}
UGV = GameManager::getUGV(v39, (const char *)&word_140544454);
v41 = UGV + GameManager::getUGV(v38, "15");
if ( v41 + GameManager::getUGV(v37, "14") == 3 )
{
v42 = cocos2d::CCCallFunc::create(a1, SecretLayer3::revealStep1);
v43 = 1.0;
}
else
{
a1->m_lockInput = 1;
v42 = cocos2d::CCCallFunc::create(a1, SecretLayer3::showUnlockDialog);
v43 = 0.5;
}
v44 = v42;
v45 = cocos2d::CCDelayTime::create(v43);
v46 = (struct cocos2d::CCFadeTo *)cocos2d::CCSequence::create(v45, v44, 0);
v48 = (CCLightFlash *)a1;
LABEL_48:
cocos2d::CCNode::runAction(v48, (cocos2d::CCPoint)v46, v47, v3, v61);
return;
}
LABEL_46:
DialogLayer = DialogLayer::createDialogLayer(nullptr, v9, 4);
a1->addChild_0(a1, DialogLayer, 100);
v51 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v50);
cocos2d::CCDirector::getWinSize(v51);
v52 = DialogLayer->m_mainLayer->__vftable;
cocos2d::CCPoint::CCPoint(v2, *(float *)&v64 * 0.5);
v52->setPosition_0(DialogLayer->m_mainLayer, v53);
LOBYTE(v54) = 1;
DialogLayer->setVisible(DialogLayer, v54);
v55 = sub_14003CF30();
DialogLayer->m_animateTime = v55;
((void (__fastcall *)(cocos2d::CCLayer *))DialogLayer->m_mainLayer->setScale_0)(DialogLayer->m_mainLayer);
v56 = cocos2d::CCScaleTo::create(0.5, 1.0);
v57 = cocos2d::CCEaseElasticOut::create(v56, 0.60000002);
cocos2d::CCNode::runAction((CCLightFlash *)DialogLayer->m_mainLayer, (cocos2d::CCPoint)v57, v58, v3, v60);
v59 = (float)DialogLayer->getOpacity(&DialogLayer->cocos2d::CCRGBAProtocol);
if ( v59 <= 0.0 )
return;
DialogLayer->setOpacity(&DialogLayer->cocos2d::CCRGBAProtocol, 0);
v46 = cocos2d::CCFadeTo::create(0.14, (int)v59);
v48 = (CCLightFlash *)DialogLayer;
goto LABEL_48;
}
}