//
// LevelPage::onPlay from 0x408dd4 to 0x408f28 (340 bytes)
//
// 1 xrefs:
// > LevelSelectLayer::onPlay @ 0x409526
//
// 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 LevelPage::onPlay(LevelPage *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // r0
int Stat; // r0
GJGameLevel *m_level; // r3
int m_requiredCoins; // r3
cocos2d::CCString *v7; // r0
char *CString; // r0
FLAlertLayer *v9; // r7
FMODAudioEngine *v10; // r0
FMODAudioEngine *v11; // r7
cocos2d::CCDelayTime *v12; // r0
cocos2d::CCSequence *v13; // r8
cocos2d::CCFiniteTimeAction *v14; // r0
cocos2d::CCAction *v15; // r0
char *v16; // [sp+10h] [bp-10h] BYREF
_DWORD v17[2]; // [sp+14h] [bp-Ch] BYREF
if ( a1->m_level->m_levelID.random - a1->m_level->m_levelID.seed != -1 )
{
v3 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v3, (const char *)&aO1i2r3e45s7t89[12]);
m_level = a1->m_level;
if ( m_level->m_levelID.random - m_level->m_levelID.seed == -2 )
{
LevelPage::onTheTower(a1, nullptr);
}
else
{
m_requiredCoins = m_level->m_requiredCoins;
if ( m_requiredCoins <= Stat )
{
if ( !a1->m_isBusy )
{
a1->m_isBusy = 1;
s_didClick = 1;
v10 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v10, 1);
v11 = FMODAudioEngine::sharedEngine();
sub_776584((int)v17, "playSound_01.ogg");
FMODAudioEngine::playEffect(v11, (int)v17, 1.0, 0, 1050253722);
sub_774008(v17);
v12 = cocos2d::CCDelayTime::create(0.0);
v17[1] = 0;
v17[0] = LevelPage::playStep2;
v13 = (cocos2d::CCSequence *)v12;
v14 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, LevelPage::playStep2, 0);
v15 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v13, v14, 0);
cocos2d::CCNode::runAction(a1, v15);
}
}
else
{
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Collect %i more Secret Coins to unlock this level!",
(const char *)(m_requiredCoins - Stat));
CString = (char *)cocos2d::CCString::getCString(v7);
sub_776584((int)&v16, CString);
sub_776584((int)v17, v16);
v9 = FLAlertLayer::create(0, (int)"Locked", (int)v17, (int)"OK", 0, 300.0);
sub_774008(v17);
v9->show(v9);
sub_774008(&v16);
}
}
}
}