//
// SecretLayer2::onDoor from 0x100498ae0 to 0x100498ca3 (451 bytes)
//
// 1 xrefs:
// > SecretLayer2::init @ 0x100496b05
//
// 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 12:30:50 +0000
//
void __fastcall SecretLayer2::onDoor(_DWORD *a1, __m128 a2)
{
__int64 v3; // rdi
__int64 v4; // rbx
__int64 v5; // rax
char *v6; // rax
int v7; // eax
int v8; // eax
__m128 v9; // xmm1
unsigned int v10; // ecx
char *v11; // rax
__int64 v12; // r14
std::string v13; // [rsp+0h] [rbp-60h] BYREF
std::string v14; // [rsp+20h] [rbp-40h] BYREF
std::string v15; // [rsp+38h] [rbp-28h] BYREF
v3 = GameManager::sharedState();
if ( (unsigned __int8)GameManager::getUGV(v3, "4") )
{
v4 = cocos2d::CCDirector::sharedDirector();
v5 = SecretLayer3::scene();
v6 = cocos2d::CCTransitionFade::create_1(v5, 0.5);
cocos2d::CCDirector::replaceScene(v4, v6);
}
else
{
v15.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)22;
strcpy(v15.__r_.__value_.__s.__data_, "Not allowed");
v7 = a1[123];
if ( v7 < 0 )
{
a2.f32[0] = (float)((float)rand() * 4.6566129e-10) * 10.0;
v9 = _mm_or_ps(_mm_and_ps((__m128)xmmword_100A035F0, a2), (__m128)xmmword_100A03600);
v9.f32[0] = v9.f32[0] + a2.f32[0];
v8 = (int)_mm_round_ss((__m128)0LL, v9, 11).f32[0];
}
else
{
v8 = v7 + 1;
}
v10 = 0;
if ( v8 < 11 )
v10 = v8;
a1[123] = v10;
if ( v10 <= 0xA )
std::string::assign(&v15, (const std::string::value_type *)&unk_100A0BA64 + *((int *)&unk_100A0BA64 + v10));
v14.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)26;
strcpy(v14.__r_.__value_.__s.__data_, "The Keymaster");
if ( (*(_BYTE *)&v15.__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(&v13, v15.__r_.__value_.__l.__data_, v15.__r_.__value_.__l.__size_);
else
v13 = v15;
v11 = DialogObject::create(&v14, &v13, 2, 0, 0xFFFFFF, 1.0);
v12 = DialogLayer::create((__int64)v11, 2u);
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v13.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v14.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v14.__r_.__value_.__l.__data_);
(*(void (__fastcall **)(_DWORD *, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v12, 100);
DialogLayer::updateChatPlacement(v12, 0);
DialogLayer::animateInRandomSide(v12);
if ( (*(_BYTE *)&v15.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v15.__r_.__value_.__l.__data_);
}
}