//
// TutorialLayer::loadPage from 0x1001bd7f8 to 0x1001bdb78 (896 bytes)
//
// 2 xrefs:
// > TutorialLayer::init @ 0x1001bd760
// > TutorialLayer::onNext @ 0x1001bd7f4
//
// 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 __fastcall TutorialLayer::loadPage(TutorialLayer *a1, int a2)
{
cocos2d::CCDirector *v4; // x0
cocos2d::CCString *v5; // x0
const char *CString; // x0
cocos2d::CCSprite *v7; // x21
float v8; // s10
__n128 v9; // q0
__n128 v10; // q1
__n128 v11; // q0
__n128 v12; // q1
float v13; // s8
float v14; // s9
const std::string::value_type *v15; // x1
const std::string::value_type *v16; // x1
int v17; // w8
std::string *v18; // x1
__n128 v19; // q0
__n128 v20; // q1
cocos2d::CCObject *v21; // x20
__n128 v22; // q0
__n128 v23; // q1
int m_page; // w20
__int64 v25; // [xsp+10h] [xbp-80h] BYREF
void *__p[2]; // [xsp+18h] [xbp-78h] BYREF
char v27; // [xsp+2Fh] [xbp-61h]
std::string v28; // [xsp+30h] [xbp-60h] BYREF
float v29; // [xsp+48h] [xbp-48h]
float v30; // [xsp+4Ch] [xbp-44h]
((void (__fastcall *)(cocos2d::CCLayer *, __int64))a1->m_tutorialLayer->removeAllChildrenWithCleanup)(
a1->m_tutorialLayer,
1);
TutorialLayer::removeTutorialTexture(a1);
a1->m_page = a2;
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v4);
v5 = (cocos2d::CCString *)sub_100268F4C("tutorial_%02d.png", a2);
CString = cocos2d::CCString::getCString(v5);
v7 = cocos2d::CCSprite::create(CString);
v8 = 0.0;
v9.n128_u32[0] = 0;
v10.n128_u32[0] = 0;
sub_100022980(v9, v10, &v28);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v7->setAnchorPoint)(v7, &v28);
if ( AppDelegate::get()->m_startupScriptFilename.m_data.m_short.shortStorage.__elems_[3] == 1 )
((void (__fastcall *)(cocos2d::CCSprite *, float))v7->setScale)(v7, 2.0);
v11 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *))a1->m_tutorialLayer->addChild)(
a1->m_tutorialLayer,
v7);
v11.n128_f32[0] = (float)((float)(v29 * 0.5) + -210.0) + 10.0;
v12.n128_f32[0] = (float)((float)(v30 * 0.5) + -130.0) + 10.0;
sub_100022980(v11, v12, &v28);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v7->setPosition)(v7, &v28);
sub_100009900(&v28, "");
v13 = 0.7;
v14 = 40.0;
if ( a2 <= 2 )
{
if ( a2 == 1 )
{
v16 = "Tap the screen to jump.\nHold down to keep jumping.";
}
else
{
if ( a2 != 2 )
goto LABEL_18;
v16 = "Hold to fly up.\nRelease to fly down.";
}
std::string::assign(&v28, v16);
goto LABEL_16;
}
if ( a2 == 3 )
{
v15 = "You can enter practice mode from the pause menu.\nPractice mode lets you place checkpoints.";
LABEL_12:
std::string::assign(&v28, v15);
v8 = -13.0;
v13 = 0.6;
LABEL_16:
v17 = 1109393408;
goto LABEL_17;
}
if ( a2 != 4 )
{
if ( a2 != 5 )
goto LABEL_18;
v15 = "Jump Orbs activate when you are on top of them.\n"
"Tap while touching an orb to interact with it and use its effect.";
goto LABEL_12;
}
std::string::assign(
&v28,
"You can place checkpoints manually, or use the auto-checkpoint feature.\n"
"Tap the delete button to remove your last checkpoint.");
v8 = -13.0;
v13 = 0.55;
v17 = 1110704128;
LABEL_17:
v14 = *(float *)&v17;
LABEL_18:
if ( (v28.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v18 = &v28;
else
v18 = (std::string *)v28.__r_.__value_.__r.__words[0];
sub_100009900(__p, (char *)v18);
v19.n128_u32[0] = 0.5;
v20.n128_u32[0] = 1.0;
sub_100022980(v19, v20, &v25);
v21 = TextArea::create((__int64)__p, (__int64)"bigFont.fnt", &v25, 0, 1.0, 400.0 / v13, v14);
if ( v27 < 0 )
operator delete(__p[0]);
((void (__fastcall *)(cocos2d::CCObject *, float))v21->__vftable[2].copyWithZone)(v21, v13);
v22 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCObject *))a1->m_tutorialLayer->addChild)(
a1->m_tutorialLayer,
v21);
v22.n128_f32[0] = v29 * 0.5;
v23.n128_f32[0] = v8 + (float)((float)((float)(v30 * 0.5) + 130.0) + -75.0);
sub_100022980(v22, v23, &v25);
((void (__fastcall *)(cocos2d::CCObject *, __int64 *))v21->__vftable[2].isEqual)(v21, &v25);
m_page = a1->m_page;
((void (*)(void))a1->m_nextButton->setVisible)();
if ( m_page < 5 )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_nextButton->setEnabled)(a1->m_nextButton, 1);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_exitButton->setVisible)(a1->m_exitButton, 0);
}
else
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_nextButton->setEnabled)(a1->m_nextButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_exitButton->setVisible)(a1->m_exitButton, 1);
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_exitButton->setEnabled)(a1->m_exitButton, m_page > 4);
if ( SHIBYTE(v28.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v28.__r_.__value_.__l.__data_);
}