//
// OptionsLayer::onSecretVault from 0x7c780c to 0x7c7c40 (1076 bytes)
//
// 3 xrefs:
// > ??> @ 0x6b1a8
// > OptionsLayer::customSetup @ 0x7c85a0
// > ??> @ 0x122b808
//
// 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
//
void OptionsLayer::onSecretVault(OptionsLayer *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // x0
cocos2d::CCDirector *v4; // x20
cocos2d::CCScene *v5; // x0
cocos2d::CCTransitionFade *v6; // x0
char v7; // cf
char v8; // zf
int m_lastVaultDialog; // w0
int v10; // w0
DialogObject *v11; // x0
DialogLayer *v12; // x23
void *v13; // x0
void *v14; // x0
void *v15; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
__int64 v22; // [xsp+50h] [xbp+50h] BYREF
__int64 v23; // [xsp+58h] [xbp+58h] BYREF
__int64 v24; // [xsp+60h] [xbp+60h] BYREF
cocos2d::_ccColor3B v25; // 0:w5.3
v3 = GameStatsManager::sharedState();
if ( GameStatsManager::getStat(v3, "12") <= 9 )
{
sub_D153B8((int)&v22, "zzz");
m_lastVaultDialog = a1->m_lastVaultDialog;
if ( m_lastVaultDialog < 0 )
v10 = llroundf((float)((float)rand() * 4.6566e-10) * 10.0);
else
v10 = m_lastVaultDialog + 1;
a1->m_lastVaultDialog = v10;
if ( !(!v8 & v7) )
{
switch ( v10 )
{
case 0:
goto LABEL_7;
case 1:
sub_D1798C(&v22, "No!", 3);
break;
case 2:
sub_D1798C(&v22, "It's a secret...", 16);
break;
case 3:
sub_D1798C(&v22, "Stop it!", 8);
break;
case 4:
sub_D1798C(&v22, "Not allowed!", 12);
break;
case 5:
sub_D1798C(&v22, "Why u click?", 12);
break;
case 6:
sub_D1798C(&v22, "Nothing to see here...", 22);
break;
case 7:
sub_D1798C(&v22, "Don't touch!", 12);
break;
case 8:
sub_D1798C(&v22, "Just, stop.", 11);
break;
case 9:
sub_D1798C(&v22, "No one seems to be home.", 24);
break;
case 10:
sub_D1798C(&v22, "zzzZZZ...", 9);
break;
default:
a1->m_lastVaultDialog = 0;
LABEL_7:
sub_D1798C(&v22, "Go away!", 8);
break;
}
}
sub_D153B8((int)&v23, "The Guard");
sub_D18D28(&v24);
v11 = (DialogObject *)DialogObject::create(
(DialogObject *)&v23,
(std::string)&v24,
(std::string)1LL,
0,
1.0,
(bool)&unk_FFFFFF,
v25);
v12 = DialogLayer::create(v11, (int)&dword_0 + 1);
v13 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v24 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v13);
}
v14 = (void *)(v23 - 24);
if ( (__int64 *)(v23 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v23 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v23 - 8);
*(_DWORD *)(v23 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v14);
}
a1->addChild_0(a1, v12, 100);
DialogLayer::updateChatPlacement(v12, Center);
DialogLayer::animateInRandomSide(v12);
v15 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v22 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v22 - 8);
*(_DWORD *)(v22 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v15);
}
}
else
{
v4 = cocos2d::CCDirector::sharedDirector();
v5 = SecretLayer::scene();
v6 = cocos2d::CCTransitionFade::create(0.5, v5);
cocos2d::CCDirector::replaceScene(v4, v6);
}
}