//
// CreatorLayer::onTreasureRoom from 0x1000dc1ac to 0x1000dc4ec (832 bytes)
//
// 1 xrefs:
// > CreatorLayer::init @ 0x1000db4fc
//
// 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 10:58:59 +0000
//
void __fastcall CreatorLayer::onTreasureRoom(__int64 a1)
{
int v2; // w0
__int64 Stat; // x0
int v4; // w20
__int64 v5; // x0
__int64 UGV; // x0
int v7; // w19
__int64 v8; // x0
void *v9; // x0
__int64 v10; // x20
char *v11; // x0
char *v12; // x0
char *v13; // x0
_QWORD *v14; // x20
const char *v15; // x9
__int64 v16; // x0
const std::string::value_type *CString; // x0
char *v18; // x0
__int64 v19; // x20
std::string __dst; // [xsp+10h] [xbp-100h] BYREF
void *v21[2]; // [xsp+30h] [xbp-E0h] BYREF
char v22; // [xsp+47h] [xbp-C9h]
std::string v23; // [xsp+48h] [xbp-C8h] BYREF
void *__p[2]; // [xsp+60h] [xbp-B0h] BYREF
char v25; // [xsp+77h] [xbp-99h]
void *v26[2]; // [xsp+78h] [xbp-98h] BYREF
char v27; // [xsp+8Fh] [xbp-81h]
void *v28[2]; // [xsp+90h] [xbp-80h] BYREF
char v29; // [xsp+A7h] [xbp-69h]
void *v30[2]; // [xsp+A8h] [xbp-68h] BYREF
char v31; // [xsp+BFh] [xbp-51h]
void *v32[2]; // [xsp+C0h] [xbp-50h] BYREF
char v33; // [xsp+D7h] [xbp-39h]
void *v34[2]; // [xsp+D8h] [xbp-38h] BYREF
char v35; // [xsp+EFh] [xbp-21h]
v2 = GameStatsManager::sharedState(a1);
Stat = GameStatsManager::getStat(v2, "21");
v4 = Stat;
v5 = GameManager::sharedState(Stat);
UGV = GameManager::getUGV(v5, "5");
if ( (_DWORD)UGV )
{
v7 = cocos2d::CCDirector::sharedDirector(UGV);
v8 = SecretRewardsLayer::scene(0);
v9 = (void *)cocos2d::CCTransitionFade::create_1(v8, 0.5);
cocos2d::CCDirector::replaceScene(v7, v9);
}
else if ( v4 < 5 )
{
sub_100009900(&v23, "Bring me 5 keys,\nand I will let you pass.");
if ( v4 >= 1 )
{
v15 = "s";
if ( v4 == 4 )
v15 = "";
v16 = sub_1003065B0("Collect %i more key%s,\nand I will let you pass.", 5 - v4, v15);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v16);
std::string::assign(&v23, CString);
}
sub_100009900(v21, "The Keymaster");
if ( SHIBYTE(v23.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, v23.__r_.__value_.__l.__data_, v23.__r_.__value_.__l.__size_);
else
__dst = v23;
v18 = DialogObject::create((__int64)v21, (__int64)&__dst, 2, 0, 0xFFFFFF, 1.0);
v19 = DialogLayer::create((__int64)v18, 2);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( v22 < 0 )
operator delete(v21[0]);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v19, 100);
DialogLayer::updateChatPlacement(v19, 0);
DialogLayer::animateInRandomSide(v19);
if ( SHIBYTE(v23.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v23.__r_.__value_.__l.__data_);
}
else
{
v10 = sub_1002E736C(UGV);
sub_100009900(v34, "The Keymaster");
sub_100009900(v32, "Well, well, well.\nLook who it is.");
v11 = DialogObject::create((__int64)v34, (__int64)v32, 2, 0, 0xFFFFFF, 1.0);
sub_1002E74E0(v10, v11);
if ( v33 < 0 )
operator delete(v32[0]);
if ( v35 < 0 )
operator delete(v34[0]);
sub_100009900(v30, "The Keymaster");
sub_100009900(v28, "I see you have the keys.\nBut what comes next?");
v12 = DialogObject::create((__int64)v30, (__int64)v28, 2, 0, 0xFFFFFF, 1.0);
sub_1002E74E0(v10, v12);
if ( v29 < 0 )
operator delete(v28[0]);
if ( v31 < 0 )
operator delete(v30[0]);
sub_100009900(v26, "The Keymaster");
sub_100009900(__p, "The door is open.\nTime to find out...");
v13 = DialogObject::create((__int64)v26, (__int64)__p, 2, 0, 0xFFFFFF, 1.0);
sub_1002E74E0(v10, v13);
if ( v25 < 0 )
operator delete(__p[0]);
if ( v27 < 0 )
operator delete(v26[0]);
v14 = DialogLayer::createWithObjects(v10, 2);
v14[78] = a1 + 416;
(*(void (__fastcall **)(_QWORD *, _QWORD))(*v14 + 72LL))(v14, 0);
(*(void (__fastcall **)(__int64, _QWORD *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v14, 100);
DialogLayer::updateChatPlacement((__int64)v14, 0);
sub_1000909DC((__int64)v14, 2);
}
}