//
// LevelPage::onPlay from 0x513ea8 to 0x51404e (422 bytes)
//
// 1 xrefs:
// > LevelSelectLayer::onPlay @ 0x514096
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:51:35 +0000
//
int __fastcall LevelPage::onPlay(int this, cocos2d::CCObject *a2)
{
int v2; // r4
GameStatsManager *v3; // r0
int Stat; // r0
_DWORD *v5; // r3
int v6; // r1
int v7; // r3
int v8; // r5
cocos2d::CCString *v9; // r0
const char *CString; // r5
size_t v11; // r0
char *v12; // r6
size_t v13; // r0
int *v14; // r4
FMODAudioEngine *v15; // r0
char **v16; // r0
FMODAudioEngine *v17; // r6
float v18; // r1
cocos2d::CCSequence *v19; // r6
cocos2d::CCFiniteTimeAction *v20; // r0
cocos2d::CCAction *v21; // r0
int v22[2]; // [sp+14h] [bp-1Ch] BYREF
char *v23; // [sp+1Ch] [bp-14h]
int v24; // [sp+20h] [bp-10h] BYREF
int v25; // [sp+24h] [bp-Ch]
int v26; // [sp+28h] [bp-8h]
v2 = this;
if ( *(_DWORD *)(*(_DWORD *)(this + 324) + 268) - *(_DWORD *)(*(_DWORD *)(this + 324) + 272) != -1 )
{
v3 = (GameStatsManager *)GameStatsManager::sharedState((GameStatsManager *)this);
Stat = GameStatsManager::getStat(v3, (const char *)&a1i2r3e45s789g[10]);
v5 = *(_DWORD **)(v2 + 324);
v6 = Stat;
this = v5[68];
if ( v5[67] - this == -2 )
{
return LevelPage::onTheTower((LevelPage *)v2, nullptr);
}
else
{
v7 = v5[230];
if ( v7 > v6 )
{
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Collect %i more Secret Coins to unlock this level!",
(const char *)(v7 - v6));
v22[0] = 0;
v22[1] = 0;
v23 = nullptr;
CString = (const char *)cocos2d::CCString::getCString(v9);
v11 = strlen(CString);
std::string::__init(v22, CString, v11);
if ( (v22[0] & 1) != 0 )
v12 = v23;
else
v12 = (char *)v22 + 1;
v24 = 0;
v25 = 0;
v26 = 0;
v13 = strlen(v12);
std::string::__init(&v24, v12, v13);
v14 = FLAlertLayer::create(
0,
(cocos2d::CCLabelBMFont *)"Locked",
(int)&v24,
(ButtonSprite *)"OK",
nullptr,
300.0);
std::string::~string((int)&v24);
(*(void (__fastcall **)(int *))(*v14 + 656))(v14);
return std::string::~string((int)v22);
}
else if ( !*(_BYTE *)(v2 + 320) && !s_didClick )
{
this = cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)this);
v8 = *(unsigned __int8 *)(this + 140);
if ( !*(_BYTE *)(this + 140) )
{
*(_BYTE *)(v2 + 320) = 1;
s_didClick = 1;
v15 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine((FMODAudioEngine *)this);
v16 = FMODAudioEngine::stopAllMusic(v15, 1);
v24 = v8;
v25 = v8;
v26 = v8;
v17 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine((FMODAudioEngine *)v16);
std::string::__init(&v24, "playSound_01.ogg", 0x10u);
FMODAudioEngine::playEffect(v17, (int)&v24, 1065353216, 0, 1050253722);
std::string::~string((int)&v24);
v19 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(nullptr, v18);
v20 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(v2, LevelPage::playStep2, 0);
v21 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v19, v20, 0);
return cocos2d::CCNode::runAction((cocos2d::CCNode *)v2, v21);
}
}
}
}
return this;
}