//
// LevelPage::onPlay from 0x10040392c to 0x100403aec (448 bytes)
//
// 2 xrefs:
// > LevelSelectLayer::onPlay @ 0x100403920
// > LevelPage::init @ 0x1004040f0
//
// 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 LevelPage::onPlay(LevelPage *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // x0
int Stat; // w0
cocos2d::CCObject *v5; // x1
GJGameLevel *m_level; // x8
int m_requiredCoins; // w8
bool v8; // vf
int v9; // w8
cocos2d::CCString *v10; // x0
char *CString; // x0
char *v12; // x1
FLAlertLayer *v13; // x19
FMODAudioEngine *v14; // x0
FMODAudioEngine *v15; // x20
cocos2d::CCDelayTime *v16; // x20
char v17; // w0
__int64 v18; // x1
__int64 v19; // x2
__int64 v20; // x3
__int64 v21; // x4
__int64 v22; // x5
__int64 v23; // x6
__int64 v24; // x7
cocos2d::CCSequence *v25; // x0
void *v26[2]; // [xsp+18h] [xbp-58h] BYREF
char v27; // [xsp+2Fh] [xbp-41h]
void *__p[2]; // [xsp+30h] [xbp-40h] BYREF
char v29; // [xsp+47h] [xbp-29h]
void *v30[2]; // [xsp+48h] [xbp-28h] BYREF
char v31; // [xsp+5Fh] [xbp-11h]
cocos2d::SEL_CallFunc v32; // 0:x1.16
if ( a1->m_level->m_levelID.random - a1->m_level->m_levelID.seed != -1 )
{
v3 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v3, "8");
m_level = a1->m_level;
if ( m_level->m_levelID.random - m_level->m_levelID.seed == -2 )
{
LevelPage::onTheTower(a1, v5);
}
else
{
m_requiredCoins = m_level->m_requiredCoins;
v8 = __OFSUB__(m_requiredCoins, Stat);
v9 = m_requiredCoins - Stat;
if ( (v9 < 0) ^ v8 | (v9 == 0) )
{
if ( !a1->m_isBusy )
{
a1->m_isBusy = 1;
byte_100886DC0 = 1;
v14 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v14, 1);
v15 = FMODAudioEngine::sharedEngine();
sub_100009900(v26, "playSound_01.ogg");
FMODAudioEngine::playEffect((__int64)v15, (__int64)v26, 1.0, 0.0, 0.3);
if ( v27 < 0 )
operator delete(v26[0]);
v16 = cocos2d::CCDelayTime::create(0.0);
v32.ptr = (void (*)(void))LevelPage::playStep2;
v32.adj = 0;
v17 = (unsigned __int8)cocos2d::CCCallFunc::create(a1, v32);
v25 = sub_10018A494(v16, v18, v19, v20, v21, v22, v23, v24, v17);
cocos2d::CCNode::runAction(a1, v25);
}
}
else
{
v10 = (cocos2d::CCString *)sub_100268F4C(
"Collect %i more Secret Coins to unlock this level!",
v9);
CString = (char *)cocos2d::CCString::getCString(v10);
sub_100009900(v30, CString);
if ( v31 >= 0 )
v12 = (char *)v30;
else
v12 = (char *)v30[0];
sub_100009900(__p, v12);
v13 = FLAlertLayer::create_1(0, (__int64)"Locked", (__int64)__p, (__int64)"OK", 0, 300.0);
if ( v29 < 0 )
operator delete(__p[0]);
((void (__fastcall *)(FLAlertLayer *))v13->show)(v13);
if ( v31 < 0 )
operator delete(v30[0]);
}
}
}
}