//
// LevelPage::onPlay from 0x79c694 to 0x79c9dc (840 bytes)
//
// 4 xrefs:
// > LevelSelectLayer::onPlay @ 0x79ceb0
// > ??> @ 0x48f18
// > LevelPage::init @ 0x79d1b8
// > ??> @ 0x122a540
//
// 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; // x0
int Stat; // w0
GJGameLevel *m_level; // x3
int m_requiredCoins; // w1
cocos2d::CCString *v7; // x0
char *CString; // x0
FLAlertLayer *v9; // x22
void *v10; // x0
char *v11; // x0
FMODAudioEngine *v12; // x0
FMODAudioEngine *v13; // x22
void *v14; // x0
cocos2d::CCSequence *v15; // x21
cocos2d::CCFiniteTimeAction *v16; // x0
cocos2d::CCAction *v17; // x0
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x2
int v23; // w1
char *v24; // [xsp+58h] [xbp+58h] BYREF
__int64 v25; // [xsp+60h] [xbp+60h] BYREF
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, nullptr);
}
else
{
m_requiredCoins = m_level->m_requiredCoins;
if ( Stat >= m_requiredCoins )
{
if ( !a1->m_isBusy )
{
a1->m_isBusy = 1;
s_didClick = 1;
v12 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v12, 1);
v13 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v25, "playSound_01.ogg");
FMODAudioEngine::playEffect((__int64)v13, (__int64)&v25, 1.0, 0.0, 0.3);
v14 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v25 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v14);
}
v15 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(0.0);
v16 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, LevelPage::playStep2, 0);
v17 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v15, v16, 0);
cocos2d::CCNode::runAction(a1, v17);
}
}
else
{
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Collect %i more Secret Coins to unlock this level!",
(const char *)(unsigned int)(m_requiredCoins - Stat));
CString = (char *)cocos2d::CCString::getCString(v7);
sub_D153B8((int)&v24, CString);
sub_D153B8((int)&v25, v24);
v9 = FLAlertLayer::create(0, (__int64)"Locked", (__int64)&v25);
v10 = (void *)(v25 - 24);
if ( (__int64 *)(v25 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v25 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v25 - 8);
*(_DWORD *)(v25 - 8) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v10);
}
v9->show(v9);
v11 = v24 - 24;
if ( v24 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v24 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v24 - 2);
*((_DWORD *)v24 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v11);
}
}
}
}
}