//
// LevelPage::onTheTower from 0x5136c8 to 0x513974 (684 bytes)
//
// 2 xrefs:
// > LevelPage::dialogClosed @ 0x513a14
// > LevelPage::onPlay @ 0x513ef4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:51:34 +0000
//
int __fastcall LevelPage::onTheTower(LevelPage *this, cocos2d::CCObject *a2)
{
GameManager *v3; // r0
cocos2d::CCDirector *UGV; // r0
cocos2d::CCArray *v5; // r9
cocos2d::CCObject *v6; // r0
cocos2d::CCObject *v7; // r0
cocos2d::CCObject *v8; // r0
cocos2d::CCObject *v9; // r0
cocos2d::CCObject *v10; // r0
GameManager *v11; // r0
GameManager *v12; // r0
int v13; // r2
DialogLayer *v14; // r0
DialogLayer *v15; // r6
int v16; // r0
int result; // r0
LevelAreaLayer *v18; // r4
float v19; // r0
cocos2d::CCScene *v20; // r2
cocos2d::CCScene *v21; // r0
GameManager *v22; // r0
int v23; // [sp+4h] [bp-24h]
int v24; // [sp+4h] [bp-24h]
int v25; // [sp+4h] [bp-24h]
int v26; // [sp+4h] [bp-24h]
int v27; // [sp+4h] [bp-24h]
int v28; // [sp+Ch] [bp-1Ch] BYREF
int v29; // [sp+10h] [bp-18h]
int v30; // [sp+14h] [bp-14h]
int v31; // [sp+18h] [bp-10h] BYREF
int v32; // [sp+1Ch] [bp-Ch]
int v33; // [sp+20h] [bp-8h]
v3 = (GameManager *)GameManager::sharedState(this);
UGV = (cocos2d::CCDirector *)GameManager::getUGV(v3, "28");
if ( UGV )
{
v18 = (LevelAreaLayer *)cocos2d::CCDirector::sharedDirector(UGV);
v19 = COERCE_FLOAT(LevelAreaLayer::scene(v18));
v21 = (cocos2d::CCScene *)cocos2d::CCTransitionFade::create((cocos2d::CCTransitionFade *)0x3F000000, v19, v20);
v22 = (GameManager *)cocos2d::CCDirector::replaceScene(v18, v21);
result = GameManager::sharedState(v22);
*(_DWORD *)(result + 508) = 9;
}
else
{
v28 = 0;
v29 = 0;
v30 = 0;
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
std::string::__init(&v28, "Scratch", 7u);
v31 = 0;
v32 = 0;
v33 = 0;
std::string::__init(&v31, "Where do you think you're going?", 0x28u);
LOWORD(v23) = -1;
BYTE2(v23) = -1;
v6 = (cocos2d::CCObject *)DialogObject::create(&v28, &v31, 10, 1065353216, 0, v23);
cocos2d::CCArray::addObject(v5, v6);
std::string::~string((int)&v31);
std::string::~string((int)&v28);
v28 = 0;
v29 = 0;
v30 = 0;
std::string::__init(&v28, "Scratch", 7u);
v31 = 0;
v32 = 0;
v33 = 0;
std::string::__init(&v31, "There's nothing over there, that place has been abandoned for years.", 0x4Cu);
LOWORD(v24) = -1;
BYTE2(v24) = -1;
v7 = (cocos2d::CCObject *)DialogObject::create(&v28, &v31, 13, 1065353216, 0, v24);
cocos2d::CCArray::addObject(v5, v7);
std::string::~string((int)&v31);
std::string::~string((int)&v28);
v28 = 0;
v29 = 0;
v30 = 0;
std::string::__init(&v28, "Scratch", 7u);
v31 = 0;
v32 = 0;
v33 = 0;
std::string::__init(&v31, "...", 0x15u);
LOWORD(v25) = -1;
BYTE2(v25) = -1;
v8 = (cocos2d::CCObject *)DialogObject::create(&v28, &v31, 8, 1065353216, 0, v25);
cocos2d::CCArray::addObject(v5, v8);
std::string::~string((int)&v31);
std::string::~string((int)&v28);
v28 = 0;
v29 = 0;
v30 = 0;
std::string::__init(&v28, "Scratch", 7u);
v31 = 0;
v32 = 0;
v33 = 0;
std::string::__init(&v31, "We can take a quick look if you want, but we can't stay long.", 0x4Bu);
LOWORD(v26) = -1;
BYTE2(v26) = -1;
v9 = (cocos2d::CCObject *)DialogObject::create(&v28, &v31, 13, 1065353216, 0, v26);
cocos2d::CCArray::addObject(v5, v9);
std::string::~string((int)&v31);
std::string::~string((int)&v28);
v28 = 0;
v29 = 0;
v30 = 0;
std::string::__init(&v28, "Scratch", 7u);
v31 = 0;
v32 = 0;
v33 = 0;
std::string::__init(&v31, "RubRub is always watching....", 0x37u);
LOWORD(v27) = -1;
BYTE2(v27) = -1;
v10 = (cocos2d::CCObject *)DialogObject::create(&v28, &v31, 12, 1065353216, 0, v27);
cocos2d::CCArray::addObject(v5, v10);
std::string::~string((int)&v31);
v11 = (GameManager *)std::string::~string((int)&v28);
v12 = (GameManager *)GameManager::sharedState(v11);
GameManager::setUGV(v12, "28", (_BYTE *)&dword_0 + 1);
v14 = (DialogLayer *)DialogLayer::createWithObjects(v5, (cocos2d::CCArray *)((char *)&dword_0 + 2), v13);
*((_DWORD *)v14 + 122) = (char *)this + 316;
v15 = v14;
v16 = cocos2d::CCDirector::sharedDirector(v14);
(*(void (__fastcall **)(_DWORD, DialogLayer *, int))(**(_DWORD **)(v16 + 220) + 232))(
*(_DWORD *)(v16 + 220),
v15,
1000);
(*(void (__fastcall **)(DialogLayer *, int))(*(_DWORD *)v15 + 36))(v15, 1);
*((_DWORD *)v15 + 122) = (char *)this + 316;
*((_BYTE *)v15 + 500) = 1;
DialogLayer::updateChatPlacement(v15, 0);
return DialogLayer::animateInRandomSide(v15);
}
return result;
}