//
// SecretLayer2::onDoor from 0xa938cc to 0xa93bec (800 bytes)
//
// 3 xrefs:
// > ??> @ 0xd77e8
// > SecretLayer2::init @ 0xa90988
// > ??> @ 0x15466f8
//
// This function is hookable on this platform (idp: arm, 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 13:00:42 +0000
//
__int64 __fastcall SecretLayer2::onDoor(SecretLayer2 *this, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
cocos2d::CCDirector *UGV; // x0
char v5; // cf
char v6; // zf
int v7; // w0
unsigned int v8; // w0
DialogLayer *v9; // x0
DialogLayer *v10; // x21
SecretLayer3 *v12; // x20
AppDelegate *v13; // x0
cocos2d::CCScene *v14; // x1
cocos2d::CCScene *v15; // x0
__int64 v16; // [xsp+30h] [xbp+30h] BYREF
size_t v17; // [xsp+38h] [xbp+38h]
void *v18; // [xsp+40h] [xbp+40h]
__int64 v19[2]; // [xsp+48h] [xbp+48h] BYREF
void *v20; // [xsp+58h] [xbp+58h]
__int64 v21; // [xsp+60h] [xbp+60h] BYREF
size_t v22; // [xsp+68h] [xbp+68h]
void *v23; // [xsp+70h] [xbp+70h]
v3 = (GameManager *)GameManager::sharedState(_stack_chk_guard);
UGV = (cocos2d::CCDirector *)(unsigned __int8)GameManager::getUGV(v3, &byte_11BCA00);
if ( (_BYTE)UGV )
{
v12 = (SecretLayer3 *)cocos2d::CCDirector::sharedDirector(UGV);
v13 = SecretLayer3::scene(v12);
v15 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create(v13, 0.5, v14);
cocos2d::CCDirector::replaceScene(v12, v15);
}
else
{
v16 = 0;
v17 = 0;
v18 = nullptr;
std::string::__init(&v16, "Not allowed", 0xBu);
v7 = *((_DWORD *)this + 123);
if ( v7 < 0 )
v8 = llroundf((float)((float)rand() * 4.6566e-10) * 10.0);
else
v8 = v7 + 1;
*((_DWORD *)this + 123) = v8;
if ( !(!v6 & v5) )
{
switch ( v8 )
{
case 0u:
goto LABEL_5;
case 1u:
std::string::assign(&v16, "Its too dangerous, just stay here.");
break;
case 2u:
std::string::assign(&v16, "Leave that alone...");
break;
case 3u:
std::string::assign(&v16, "That area is off limits.");
break;
case 4u:
std::string::assign(&v16, "I keep that door locked.\nRubRub's orders.");
break;
case 5u:
std::string::assign(&v16, "I've only been down there once. Its pretty creepy.");
break;
case 6u:
std::string::assign(&v16, "Just forget about it.");
break;
case 7u:
std::string::assign(&v16, "Some things are best left alone.");
break;
case 8u:
std::string::assign(&v16, "Even I dont want to go down there.");
break;
case 9u:
std::string::assign(&v16, "Off. Limits.");
break;
case 0xAu:
std::string::assign(&v16, "Does the word locked mean nothing to you?");
break;
default:
*((_DWORD *)this + 123) = 0;
LABEL_5:
std::string::assign(&v16, "Sorry, I can't let you in.");
break;
}
}
v19[0] = 0;
v19[1] = 0;
v20 = nullptr;
std::string::__init(v19, "The Keymaster", 0xDu);
v21 = 0;
v22 = 0;
v23 = nullptr;
if ( (v16 & 1) != 0 )
{
std::string::__init(&v21, v18, v17);
}
else
{
v21 = v16;
v22 = v17;
v23 = v18;
}
v9 = (DialogLayer *)DialogObject::create((char *)v19, (char *)&v21, 2, 0, 0xFFFFFF, 1.0);
v10 = (DialogLayer *)DialogLayer::create(v9, (DialogObject *)((char *)&dword_0 + 2));
if ( (v21 & 1) != 0 )
operator delete(v23);
if ( (v19[0] & 1) != 0 )
operator delete(v20);
(*(void (__fastcall **)(SecretLayer2 *, DialogLayer *, __int64))(*(_QWORD *)this + 464LL))(this, v10, 100);
DialogLayer::updateChatPlacement((__int64)v10, 0);
DialogLayer::animateInRandomSide(v10);
if ( (v16 & 1) != 0 )
operator delete(v18);
}
return _stack_chk_guard;
}