//
// LevelPage::onTheTower from 0x14031bce0 to 0x14031c396 (1718 bytes)
//
// 4 xrefs:
// > LevelPage::dialogClosed @ 0x14031d866
// > LevelPage::onPlay @ 0x14031d92c
// > LevelPage::updateDynamicPage @ 0x14031b530
// > ??> @ 0x1406d4afc
//
// 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
//
// Hidden C++ exception states: #wind=4
void LevelPage::onTheTower(LevelPage *a1, cocos2d::CCObject *a2)
{
GameManager *v3; // rcx
__int64 v4; // rcx
cocos2d::CCArray *v5; // rdi
char *v6; // rax
char *v7; // rax
char *v8; // rax
char *v9; // rax
char *v10; // rax
GameManager *v11; // rcx
DialogLayer *DialogLayer; // rax
DialogLayer *v13; // rdi
DialogDelegate *v14; // rcx
__int64 v15; // rax
__int64 v16; // rcx
DialogDelegate *v17; // rax
cocos2d::CCDirector *v18; // rax
cocos2d::CCLayer_vtbl *v19; // rbx
const cocos2d::CCPoint *v20; // rax
struct cocos2d::CCScene *v21; // rax
struct cocos2d::CCTransitionFade *v22; // rbx
__int64 v23; // rcx
cocos2d::CCDirector *v24; // rax
__int64 v25; // rax
char v26[8]; // [rsp+30h] [rbp-50h] BYREF
__int64 v27; // [rsp+38h] [rbp-48h]
__int64 v28; // [rsp+40h] [rbp-40h]
__int64 v29; // [rsp+48h] [rbp-38h]
__int128 v30; // [rsp+50h] [rbp-30h] BYREF
__int64 v31; // [rsp+60h] [rbp-20h]
__int64 v32; // [rsp+68h] [rbp-18h]
__int128 *v33; // [rsp+B0h] [rbp+30h] BYREF
v3 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v33 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v33);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getUGV(v3, "28") )
{
v21 = LevelAreaLayer::scene();
v22 = cocos2d::CCTransitionFade::create(0.5, v21);
v24 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v23);
cocos2d::CCDirector::replaceScene(v24, v22);
v25 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v33 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v33);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v25 = qword_1406C2ED8;
}
*(_DWORD *)(v25 + 700) = 9;
}
else
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
v33 = &v30;
LOWORD(v33) = -1;
BYTE2(v33) = -1;
v30 = 0;
v31 = 0;
v32 = 15;
*(_QWORD *)&v30 = sub_14003AA10(0x30u);
v31 = 40;
v32 = 47;
strcpy((char *)v30, "Where do you think you're going?");
v27 = 0;
v28 = 7;
v29 = 15;
strcpy(v26, "Scratch");
v6 = DialogObject::create((__int64)v26, (__int64)&v30, 10, 1.0, 0, (__int64)&v33);
cocos2d::CCArray::addObject(v5, (struct cocos2d::CCObject *)v6);
v33 = &v30;
LOWORD(v33) = -1;
BYTE2(v33) = -1;
v30 = 0;
v31 = 0;
v32 = 15;
*(_QWORD *)&v30 = sub_14003AA10(0x50u);
v31 = 76;
v32 = 79;
strcpy((char *)v30, "There's nothing over there, that place has been abandoned for years.");
v27 = 0;
v28 = 7;
v29 = 15;
strcpy(v26, "Scratch");
v7 = DialogObject::create((__int64)v26, (__int64)&v30, 13, 1.0, 0, (__int64)&v33);
cocos2d::CCArray::addObject(v5, (struct cocos2d::CCObject *)v7);
v33 = &v30;
LOWORD(v33) = -1;
BYTE2(v33) = -1;
v30 = 0;
v31 = 0;
v32 = 15;
*(_QWORD *)&v30 = sub_14003AA10(0x20u);
v31 = 21;
v32 = 31;
strcpy((char *)v30, "...");
v27 = 0;
v28 = 7;
v29 = 15;
strcpy(v26, "Scratch");
v8 = DialogObject::create((__int64)v26, (__int64)&v30, 8, 1.0, 0, (__int64)&v33);
cocos2d::CCArray::addObject(v5, (struct cocos2d::CCObject *)v8);
v33 = &v30;
LOWORD(v33) = -1;
BYTE2(v33) = -1;
v30 = 0;
v31 = 0;
v32 = 15;
*(_QWORD *)&v30 = sub_14003AA10(0x50u);
v31 = 75;
v32 = 79;
strcpy((char *)v30, "We can take a quick look if you want, but we can't stay long.");
v27 = 0;
v28 = 7;
v29 = 15;
strcpy(v26, "Scratch");
v9 = DialogObject::create((__int64)v26, (__int64)&v30, 13, 1.0, 0, (__int64)&v33);
cocos2d::CCArray::addObject(v5, (struct cocos2d::CCObject *)v9);
v33 = &v30;
LOWORD(v33) = -1;
BYTE2(v33) = -1;
v30 = 0;
v31 = 0;
v32 = 15;
*(_QWORD *)&v30 = sub_14003AA10(0x40u);
v31 = 55;
v32 = 63;
strcpy((char *)v30, "RubRub is always watching....");
v27 = 0;
v28 = 7;
v29 = 15;
strcpy(v26, "Scratch");
v10 = DialogObject::create((__int64)v26, (__int64)&v30, 12, 1.0, 0, (__int64)&v33);
cocos2d::CCArray::addObject(v5, (struct cocos2d::CCObject *)v10);
v11 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v33 = (__int128 *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v33);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = (GameManager *)qword_1406C2ED8;
}
GameManager::setUGV(v11, "28", 1);
DialogLayer = DialogLayer::createDialogLayer(nullptr, v5, 2);
v13 = DialogLayer;
v14 = &a1->DialogDelegate;
if ( !a1 )
v14 = nullptr;
DialogLayer->m_delegate = v14;
v15 = cocos2d::CCDirector::sharedDirector(v14);
(*(void (__fastcall **)(_QWORD, DialogLayer *, __int64))(**(_QWORD **)(v15 + 264) + 440LL))(
*(_QWORD *)(v15 + 264),
v13,
1000);
v13->setTag(v13, 1);
v17 = &a1->DialogDelegate;
if ( !a1 )
v17 = nullptr;
v13->m_delegate = v17;
v13->m_noRemove = 1;
v18 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v16);
cocos2d::CCDirector::getWinSize(v18);
v19 = v13->m_mainLayer->__vftable;
cocos2d::CCPoint::CCPoint(0.17206264, *(float *)&v33 * 0.5);
v19->setPosition_0(v13->m_mainLayer, v20);
DialogLayer::animateInRandomSide(v13);
}
}