//
// LevelPage::onTheTower from 0x79b5c8 to 0x79bc94 (1740 bytes)
//
// 5 xrefs:
// > LevelPage::dialogClosed @ 0x79bd44
// > LevelPage::onPlay @ 0x79c88c
// > ??> @ 0x5b020
// > LevelPage::updateDynamicPage @ 0x79f994
// > ??> @ 0x122aef8
//
// 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 LevelPage::onTheTower(LevelPage *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // x0
_BOOL8 UGV; // x0
cocos2d::CCArray *v5; // x23
cocos2d::CCObject *v6; // x0
void *v7; // x0
void *v8; // x0
cocos2d::CCObject *v9; // x0
void *v10; // x0
void *v11; // x0
cocos2d::CCObject *v12; // x0
void *v13; // x0
void *v14; // x0
cocos2d::CCObject *v15; // x0
void *v16; // x0
void *v17; // x0
cocos2d::CCObject *v18; // x0
void *v19; // x0
void *v20; // x0
GameManager *v21; // x0
DialogDelegate *v22; // x24
DialogLayer *v23; // x0
DialogLayer *v24; // x19
cocos2d::CCDirector *v25; // x0
cocos2d::CCDirector *v26; // x19
cocos2d::CCScene *v27; // x0
cocos2d::CCTransitionFade *v28; // x0
unsigned int *v29; // x1
int v30; // w2
unsigned int *v31; // x1
int v32; // w2
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x1
int v42; // w2
unsigned int *v43; // x1
int v44; // w2
unsigned int *v45; // x1
int v46; // w2
unsigned int *v47; // x1
int v48; // w2
_QWORD v49[2]; // [xsp+0h] [xbp+0h] BYREF
__int64 v50; // [xsp+78h] [xbp+78h] BYREF
__int64 v51; // [xsp+80h] [xbp+80h] BYREF
cocos2d::_ccColor3B v52; // 0:w5.3
cocos2d::_ccColor3B v53; // 0:w5.3
cocos2d::_ccColor3B v54; // 0:w5.3
cocos2d::_ccColor3B v55; // 0:w5.3
cocos2d::_ccColor3B v56; // 0:w5.3
v3 = GameManager::sharedState();
UGV = GameManager::getUGV(v3, "28");
if ( UGV )
{
v26 = cocos2d::CCDirector::sharedDirector();
v27 = LevelAreaLayer::scene();
v28 = cocos2d::CCTransitionFade::create(0.5, v27);
cocos2d::CCDirector::replaceScene(v26, v28);
GameManager::sharedState()->m_sceneEnum = 9;
}
else
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)UGV);
sub_D153B8((int)&v50, "Scratch");
sub_D153B8((unsigned int)v49 + 128, "Where do you think you're going?");
v6 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v50,
(std::string)&v51,
(std::string)10LL,
0,
1.0,
(bool)&unk_FFFFFF,
v52);
cocos2d::CCArray::addObject(v5, v6);
v7 = (void *)(v51 - 24);
if ( (__int64 *)(v51 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)(v51 - 8);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *(_DWORD *)(v51 - 8);
*(_DWORD *)(v51 - 8) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v7);
}
v8 = (void *)(v50 - 24);
if ( (__int64 *)(v50 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(v50 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *(_DWORD *)(v50 - 8);
*(_DWORD *)(v50 - 8) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v8);
}
sub_D153B8((unsigned int)v49 + 120, "Scratch");
sub_D153B8((unsigned int)v49 + 128, "There's nothing over there, that place has been abandoned for years.");
v9 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v50,
(std::string)&v51,
(std::string)13LL,
0,
1.0,
(bool)&unk_FFFFFF,
v53);
cocos2d::CCArray::addObject(v5, v9);
v10 = (void *)(v51 - 24);
if ( (__int64 *)(v51 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v51 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(_DWORD *)(v51 - 8);
*(_DWORD *)(v51 - 8) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v10);
}
v11 = (void *)(v50 - 24);
if ( (__int64 *)(v50 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(v50 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(_DWORD *)(v50 - 8);
*(_DWORD *)(v50 - 8) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v11);
}
sub_D153B8((unsigned int)v49 + 120, "Scratch");
sub_D153B8((unsigned int)v49 + 128, "...");
v12 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v50,
(std::string)&v51,
(std::string)8LL,
0,
1.0,
(bool)&unk_FFFFFF,
v54);
cocos2d::CCArray::addObject(v5, v12);
v13 = (void *)(v51 - 24);
if ( (__int64 *)(v51 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v51 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(_DWORD *)(v51 - 8);
*(_DWORD *)(v51 - 8) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v13);
}
v14 = (void *)(v50 - 24);
if ( (__int64 *)(v50 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v50 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *(_DWORD *)(v50 - 8);
*(_DWORD *)(v50 - 8) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v14);
}
sub_D153B8((unsigned int)v49 + 120, "Scratch");
sub_D153B8((unsigned int)v49 + 128, "We can take a quick look if you want, but we can't stay long.");
v15 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v50,
(std::string)&v51,
(std::string)13LL,
0,
1.0,
(bool)&unk_FFFFFF,
v55);
cocos2d::CCArray::addObject(v5, v15);
v16 = (void *)(v51 - 24);
if ( (__int64 *)(v51 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v43 = (unsigned int *)(v51 - 8);
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *(_DWORD *)(v51 - 8);
*(_DWORD *)(v51 - 8) = v44 - 1;
}
if ( v44 <= 0 )
operator delete(v16);
}
v17 = (void *)(v50 - 24);
if ( (__int64 *)(v50 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(v50 - 8);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(_DWORD *)(v50 - 8);
*(_DWORD *)(v50 - 8) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v17);
}
sub_D153B8((unsigned int)v49 + 120, "Scratch");
sub_D153B8((unsigned int)v49 + 128, "RubRub is always watching....");
v18 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v50,
(std::string)&v51,
(std::string)12LL,
0,
1.0,
(bool)&unk_FFFFFF,
v56);
cocos2d::CCArray::addObject(v5, v18);
v19 = (void *)(v51 - 24);
if ( (__int64 *)(v51 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(v51 - 8);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(_DWORD *)(v51 - 8);
*(_DWORD *)(v51 - 8) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v19);
}
v20 = (void *)(v50 - 24);
if ( (__int64 *)(v50 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v50 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(v50 - 8);
*(_DWORD *)(v50 - 8) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v20);
}
v21 = GameManager::sharedState();
v22 = &a1->DialogDelegate;
GameManager::setUGV(v21, "28", 1);
v23 = DialogLayer::createWithObjects(v5, (int)&dword_0 + 2);
v23->m_delegate = v22;
v24 = v23;
v25 = cocos2d::CCDirector::sharedDirector();
v25->m_pRunningScene->addChild_0(v25->m_pRunningScene, v24, 1000);
v24->setTag(v24, 1);
v24->m_delegate = v22;
v24->m_noRemove = 1;
DialogLayer::updateChatPlacement(v24, Center);
DialogLayer::animateInRandomSide(v24);
}
}