//
// CreatorLayer::onTreasureRoom from 0x3aabe8 to 0x3aae64 (636 bytes)
//
// 0 xrefs:
//
// 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 CreatorLayer::onTreasureRoom(CreatorLayer *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // r0
int Stat; // r11
GameManager *v5; // r0
cocos2d::CCDirector *v6; // r4
cocos2d::CCScene *v7; // r0
cocos2d::CCTransitionFade *v8; // r0
cocos2d::CCArray *v9; // r11
cocos2d::CCObject *v10; // r0
cocos2d::CCObject *v11; // r0
cocos2d::CCObject *v12; // r0
DialogLayer *v13; // r0
DialogLayer *v14; // r4
const char *v15; // r1
__int16 *v16; // r2
cocos2d::CCString *v17; // r0
char *CString; // r0
DialogObject *v19; // r0
DialogLayer *v20; // r9
_BYTE v21[4]; // [sp+10h] [bp-14h] BYREF
char v22; // [sp+14h] [bp-10h] BYREF
_BYTE v23[4]; // [sp+18h] [bp-Ch] BYREF
v3 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v3, "21");
v5 = GameManager::sharedState();
if ( GameManager::getUGV(v5, (const char *)&aO1i2r3e45s7t89[8]) )
{
v6 = cocos2d::CCDirector::sharedDirector();
v7 = SecretRewardsLayer::scene(0);
v8 = cocos2d::CCTransitionFade::create(0.5, v7);
cocos2d::CCDirector::replaceScene(v6, v8);
}
else if ( Stat <= 4 )
{
sub_776584((int)v21, "Bring me 5 keys,\nand I will let you pass.");
v15 = (const char *)(5 - Stat);
if ( Stat > 0 )
{
if ( v15 == (_BYTE *)&dword_0 + 1 )
v16 = (__int16 *)&unk_939830;
else
v16 = &aO1i2r3e45s7t89[9];
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Collect %i more key%s,\n"
"and I will let you pass.",
v15,
v16);
CString = (char *)cocos2d::CCString::getCString(v17);
sub_7753D4((int)v21, CString);
}
sub_776584((int)&v22, "The Keymaster");
sub_775C20(v23, v21);
v19 = (DialogObject *)DialogObject::create(
(DialogObject *)&v22,
(std::string)v23,
(std::string)2,
1065353216,
0.0,
255);
v20 = DialogLayer::create(v19, (int)&dword_0 + 2);
sub_774008(v23);
sub_774008(&v22);
a1->addChild_0(a1, v20, 100);
DialogLayer::updateChatPlacement(v20, Center);
DialogLayer::animateInRandomSide(v20);
sub_774008(v21);
}
else
{
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
sub_776584((int)&v22, "The Keymaster");
sub_776584((int)v23, "Well, well, well.\nLook who it is.");
v10 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v22,
(std::string)v23,
(std::string)2,
1065353216,
0.0,
255);
cocos2d::CCArray::addObject(v9, v10);
sub_774008(v23);
sub_774008(&v22);
sub_776584((int)&v22, "The Keymaster");
sub_776584((int)v23, "I see you have the keys.\nBut what comes next?");
v11 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v22,
(std::string)v23,
(std::string)2,
1065353216,
0.0,
255);
cocos2d::CCArray::addObject(v9, v11);
sub_774008(v23);
sub_774008(&v22);
sub_776584((int)&v22, "The Keymaster");
sub_776584((int)v23, "The door is open.\nTime to find out...");
v12 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v22,
(std::string)v23,
(std::string)2,
1065353216,
0.0,
255);
cocos2d::CCArray::addObject(v9, v12);
sub_774008(v23);
sub_774008(&v22);
v13 = DialogLayer::createWithObjects(v9, (int)&dword_0 + 2);
v13->m_delegate = &a1->DialogDelegate;
v14 = v13;
v13->setTag(v13, 0);
a1->addChild_0(a1, v14, 100);
DialogLayer::updateChatPlacement(v14, Center);
DialogLayer::animateIn(v14, FromLeft);
}
}