//
// OptionsLayer::onSecretVault from 0x10079af00 to 0x10079b0a6 (422 bytes)
//
// 1 xrefs:
// > OptionsLayer::customSetup @ 0x10079a643
//
// 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 __fastcall OptionsLayer::onSecretVault(OptionsLayer *a1, cocos2d::CCObject *a2)
{
__m128 v2; // xmm0
GameStatsManager *v3; // rax
cocos2d::CCDirector *v4; // rbx
cocos2d::CCScene *v5; // rax
cocos2d::CCTransitionFade *v6; // rax
int m_lastVaultDialog; // eax
int v8; // eax
__m128 v9; // xmm1
unsigned int v10; // ecx
char *v11; // rax
DialogLayer *v12; // r14
__int128 v13; // [rsp+8h] [rbp-58h] BYREF
void *v14; // [rsp+18h] [rbp-48h]
std::string v15; // [rsp+20h] [rbp-40h] BYREF
std::string v16; // [rsp+38h] [rbp-28h] BYREF
v3 = GameStatsManager::sharedState();
if ( GameStatsManager::getStat(v3, "12") < 10 )
{
v16.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&v16.__r_.__value_.__l.0 + 1) = 8026746;
m_lastVaultDialog = a1->m_lastVaultDialog;
if ( m_lastVaultDialog < 0 )
{
v2.f32[0] = (float)((float)rand() * 4.6566129e-10) * 10.0;
v9 = _mm_or_ps(_mm_and_ps((__m128)xmmword_1008150B0, v2), (__m128)xmmword_1008150C0);
v9.f32[0] = v9.f32[0] + v2.f32[0];
v2.i64[0] = _mm_round_ss((__m128)0LL, v9, 11).u64[0];
v8 = (int)v2.f32[0];
}
else
{
v8 = m_lastVaultDialog + 1;
}
v10 = 0;
if ( v8 < 11 )
v10 = v8;
a1->m_lastVaultDialog = v10;
if ( v10 <= 0xA )
std::string::assign(&v16, (const std::string::value_type *)&unk_100823698 + *((int *)&unk_100823698 + v10));
LOBYTE(v13) = 18;
strcpy((char *)&v13 + 1, "The Guard");
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) != 0 )
sub_100006B70(&v15, v16.__r_.__value_.__l.__data_, v16.__r_.__value_.__l.__size_, *(double *)v2.i64);
else
v15 = v16;
v11 = DialogObject::create(&v13, &v15, 1, 0, 0xFFFFFF, 1.0);
v12 = DialogLayer::create((DialogObject *)v11, 1);
if ( (*(_BYTE *)&v15.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v15.__r_.__value_.__l.__data_);
if ( (v13 & 1) != 0 )
operator delete(v14);
((void (__fastcall *)(OptionsLayer *, DialogLayer *, __int64))a1->addChild_0)(a1, v12, 100);
DialogLayer::updateChatPlacement(v12, Center);
DialogLayer::animateInRandomSide(v12);
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v16.__r_.__value_.__l.__data_);
}
else
{
v4 = cocos2d::CCDirector::sharedDirector();
v5 = SecretLayer::scene();
v6 = cocos2d::CCTransitionFade::create_1(0.5, v5);
cocos2d::CCDirector::replaceScene(v4, v6);
}
}