//
// LevelPage::onTheTower from 0x140445240 to 0x14044590b (1739 bytes)
//
// 4 xrefs:
// > LevelPage::dialogClosed @ 0x140446d36
// > LevelPage::onPlay @ 0x140446dff
// > LevelPage::updateDynamicPage @ 0x140444a83
// > ??> @ 0x1409271dc
//
// This function is hookable on this platform (idp: pc, 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 11:32:23 +0000
//
// Hidden C++ exception states: #wind=4
__int64 __fastcall LevelPage::onTheTower(__int64 a1)
{
__int64 v2; // rcx
__int64 v3; // rdx
__int64 v4; // rcx
__int64 v5; // r8
__int64 v6; // r9
cocos2d::CCArray *v7; // rdi
void **v8; // rax
void **v9; // rax
void **v10; // rax
void **v11; // rax
void **v12; // rax
__int64 v13; // rcx
__int64 v14; // rcx
cocos2d::CCNode *DialogLayer; // rsi
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rcx
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rdi
__int64 v22; // rbx
__int64 v23; // rax
__int64 result; // rax
struct cocos2d::CCScene *v25; // rax
struct cocos2d::CCScene *v26; // rbx
__int64 v27; // rcx
cocos2d::CCDirector *v28; // rax
char v29[8]; // [rsp+30h] [rbp-50h] BYREF
__int64 v30; // [rsp+38h] [rbp-48h]
__int64 v31; // [rsp+40h] [rbp-40h]
__int64 v32; // [rsp+48h] [rbp-38h]
__int128 v33; // [rsp+50h] [rbp-30h] BYREF
__int64 v34; // [rsp+60h] [rbp-20h]
__int64 v35; // [rsp+68h] [rbp-18h]
__int128 *v36; // [rsp+C0h] [rbp+40h] BYREF
char v37; // [rsp+C8h] [rbp+48h] BYREF
v2 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v36 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090BFD0;
}
if ( GameManager::getUGV(v2, "28") )
{
v25 = (struct cocos2d::CCScene *)LevelAreaLayer::scene(v4, v3, v5, v6);
v26 = cocos2d::CCTransitionFade::create(0.5, v25);
v28 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v27);
cocos2d::CCDirector::replaceScene(v28, v26);
result = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v36 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
result = qword_14090BFD0;
}
*(_DWORD *)(result + 740) = 9;
}
else
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
v36 = &v33;
LOWORD(v36) = -1;
BYTE2(v36) = -1;
v33 = 0;
v34 = 0;
v35 = 0;
*(_QWORD *)&v33 = sub_14003D460(0x30u);
v34 = 40;
v35 = 47;
strcpy((char *)v33, "Where do you think you're going?");
v30 = 0;
v31 = 7;
v32 = 15;
strcpy(v29, "Scratch");
v8 = DialogObject::create((__int64)v29, (__int64)&v33, 10, 1.0, 0, (__int64)&v36);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v8);
v36 = &v33;
LOWORD(v36) = -1;
BYTE2(v36) = -1;
v33 = 0;
v34 = 0;
v35 = 0;
*(_QWORD *)&v33 = sub_14003D460(0x50u);
v34 = 76;
v35 = 79;
strcpy((char *)v33, "There's nothing over there, that place has been abandoned for years.");
v30 = 0;
v31 = 7;
v32 = 15;
strcpy(v29, "Scratch");
v9 = DialogObject::create((__int64)v29, (__int64)&v33, 13, 1.0, 0, (__int64)&v36);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v9);
v36 = &v33;
LOWORD(v36) = -1;
BYTE2(v36) = -1;
v33 = 0;
v34 = 0;
v35 = 0;
*(_QWORD *)&v33 = sub_14003D460(0x20u);
v34 = 21;
v35 = 31;
strcpy((char *)v33, "...");
v30 = 0;
v31 = 7;
v32 = 15;
strcpy(v29, "Scratch");
v10 = DialogObject::create((__int64)v29, (__int64)&v33, 8, 1.0, 0, (__int64)&v36);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v10);
v36 = &v33;
LOWORD(v36) = -1;
BYTE2(v36) = -1;
v33 = 0;
v34 = 0;
v35 = 0;
*(_QWORD *)&v33 = sub_14003D460(0x50u);
v34 = 75;
v35 = 79;
strcpy((char *)v33, "We can take a quick look if you want, but we can't stay long.");
v30 = 0;
v31 = 7;
v32 = 15;
strcpy(v29, "Scratch");
v11 = DialogObject::create((__int64)v29, (__int64)&v33, 13, 1.0, 0, (__int64)&v36);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v11);
v36 = &v33;
LOWORD(v36) = -1;
BYTE2(v36) = -1;
v33 = 0;
v34 = 0;
v35 = 0;
*(_QWORD *)&v33 = sub_14003D460(0x40u);
v34 = 55;
v35 = 63;
strcpy((char *)v33, "RubRub is always watching....");
v30 = 0;
v31 = 7;
v32 = 15;
strcpy(v29, "Scratch");
v12 = DialogObject::create((__int64)v29, (__int64)&v33, 12, 1.0, 0, (__int64)&v36);
cocos2d::CCArray::addObject(v7, (struct cocos2d::CCObject *)v12);
v13 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v36 = (__int128 *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v13 = qword_14090BFD0;
}
GameManager::setUGV(v13, "28", 1u);
DialogLayer = DialogLayer::createDialogLayer(0, (__int64)v7, 2u);
v16 = a1 + 408;
if ( !a1 )
v16 = 0;
*((_QWORD *)DialogLayer + 78) = v16;
v17 = cocos2d::CCDirector::sharedDirector(v14);
(*(void (__fastcall **)(_QWORD, cocos2d::CCNode *, __int64))(**(_QWORD **)(v17 + 272) + 456LL))(
*(_QWORD *)(v17 + 272),
DialogLayer,
1000);
(*(void (__fastcall **)(cocos2d::CCNode *, __int64))(*(_QWORD *)DialogLayer + 64LL))(DialogLayer, 1);
v19 = a1 + 408;
if ( !a1 )
v19 = 0;
*((_QWORD *)DialogLayer + 78) = v19;
*((_BYTE *)DialogLayer + 640) = 1;
v20 = cocos2d::CCDirector::sharedDirector(v18);
cocos2d::CCDirector::getWinSize(v20, &v36);
v21 = **((_QWORD **)DialogLayer + 70);
v22 = *((_QWORD *)DialogLayer + 70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, *(float *)&v36 * 0.5, *((float *)&v36 + 1) * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v21 + 184))(v22, v23);
return DialogLayer::animateInRandomSide(DialogLayer);
}
return result;
}