//
// TutorialLayer::loadPage from 0x7da628 to 0x7dab90 (1384 bytes)
//
// 3 xrefs:
// > TutorialLayer::init @ 0x7db020
// > TutorialLayer::onNext @ 0x7db1ac
// > ??> @ 0xac860
//
// 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 TutorialLayer::loadPage(TutorialLayer *a1, int a2)
{
cocos2d::CCDirector *v4; // x0
cocos2d::CCString *v5; // x0
cocos2d::CCSprite *CString; // x0
const char *v7; // x1
cocos2d::CCNode *v8; // x21
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
float v11; // s10
float v12; // s11
float v13; // s9
cocos2d::CCNode *v14; // x22
void *v15; // x0
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
CCMenuItemSpriteExtra *m_nextButton; // x2
char *v18; // x19
char *v19; // x0
unsigned int *v20; // x19
int v21; // w1
unsigned int *v22; // x1
int v23; // w2
double v24; // d0
double v25; // d1
__int64 v26; // [xsp+0h] [xbp+0h] BYREF
float v27; // [xsp+78h] [xbp+78h]
float v28; // [xsp+7Ch] [xbp+7Ch]
char *v29; // [xsp+80h] [xbp+80h] BYREF
cocos2d::CCPoint v30; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v31; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
a1->m_tutorialLayer->removeAllChildrenWithCleanup(a1->m_tutorialLayer, 1);
TutorialLayer::removeTutorialTexture(a1);
a1->m_page = a2;
v4 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v4);
*(float *)&v24 = WinSize.width;
*(float *)&v25 = WinSize.height;
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"tutorial_%02d.png",
(const char *)(unsigned int)a2,
v24,
v25);
CString = (cocos2d::CCSprite *)cocos2d::CCString::getCString(v5);
v8 = (cocos2d::CCNode *)cocos2d::CCSprite::create(CString, v7);
setAnchorPoint = v8->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v31, 0.0, 0.0);
setAnchorPoint(v8, &v31);
if ( *(&AppDelegate::get()->m_gamePaused + 3) )
v8->setScale(v8, 2.0);
a1->m_tutorialLayer->addChild(a1->m_tutorialLayer, v8);
setPosition = v8->setPosition;
cocos2d::CCPoint::CCPoint(
&v31,
(float)((float)(v27 * 0.5) + -210.0) + 10.0,
(float)((float)(v28 * 0.5) + -130.0) + 10.0);
setPosition(v8, &v31);
sub_D153B8((unsigned int)&v26 + 128, &byte_F288A0);
switch ( a2 )
{
case 1:
sub_D1798C(&v29, "Tap the screen to jump.\nHold down to keep jumping.", 66);
goto LABEL_4;
case 2:
sub_D1798C(&v29, "Hold to fly up.\nRelease to fly down.", 52);
goto LABEL_4;
case 3:
sub_D1798C(
&v29,
"You can enter practice mode from the pause menu.\nPractice mode lets you place checkpoints.",
106);
goto LABEL_18;
case 4:
sub_D1798C(
&v29,
"You can place checkpoints manually, or use the auto-checkpoint feature.\n"
"Tap the delete button to remove your last checkpoint.",
125);
v12 = 45.0;
v13 = 0.55;
v11 = -13.0;
break;
case 5:
sub_D1798C(
&v29,
"Jump Orbs activate when you are on top of them.\n"
"Tap while touching an orb to interact with it and use its effect.",
129);
LABEL_18:
v11 = -13.0;
v12 = 40.0;
v13 = 0.6;
break;
default:
LABEL_4:
v11 = 0.0;
v12 = 40.0;
v13 = 0.7;
break;
}
sub_D153B8((int)&v31, v29);
cocos2d::CCPoint::CCPoint(&v30, 0.5, 1.0);
v14 = (cocos2d::CCNode *)TextArea::create((__int64)&v31, "bigFont.fnt", &v30, 0, 1.0, 400.0 / v13, v12);
v15 = (void *)(*(_QWORD *)&v31 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v31 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(*(_QWORD *)&v31 - 8LL);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(*(_QWORD *)&v31 - 8LL);
*(_DWORD *)(*(_QWORD *)&v31 - 8LL) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v15);
}
v14->setScale(v14, v13);
a1->m_tutorialLayer->addChild(a1->m_tutorialLayer, v14);
v16 = v14->setPosition;
cocos2d::CCPoint::CCPoint(&v31, v27 * 0.5, (float)((float)((float)(v28 * 0.5) + 130.0) - 75.0) + v11);
v16(v14, &v31);
m_nextButton = a1->m_nextButton;
if ( a1->m_page <= 4 )
{
m_nextButton->setVisible(a1->m_nextButton, 1);
a1->m_nextButton->setEnabled(a1->m_nextButton, 1);
a1->m_exitButton->setVisible(a1->m_exitButton, 0);
a1->m_exitButton->setEnabled(a1->m_exitButton, 0);
v18 = v29;
v19 = v29 - 24;
if ( v29 - 24 == (char *)&qword_124B6B0 )
return;
}
else
{
m_nextButton->setVisible(a1->m_nextButton, 0);
a1->m_nextButton->setEnabled(a1->m_nextButton, 0);
a1->m_exitButton->setVisible(a1->m_exitButton, 1);
a1->m_exitButton->setEnabled(a1->m_exitButton, 1);
v18 = v29;
v19 = v29 - 24;
if ( v29 - 24 == (char *)&qword_124B6B0 )
return;
}
if ( &pthread_create )
{
v20 = (unsigned int *)(v18 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v18 - 2);
*((_DWORD *)v18 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v19);
}