//
// GauntletSelectLayer::onPlay from 0x1001bf900 to 0x1001bfce0 (992 bytes)
//
// 1 xrefs:
// > GauntletSelectLayer::setupGauntlets @ 0x1001bf4b4
//
// 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 GauntletSelectLayer::onPlay(GauntletSelectLayer *a1, cocos2d::CCObject *a2)
{
unsigned int v4; // w20
GameStatsManager *v5; // x0
_BOOL8 isItemUnlocked; // x0
GameLevelManager *v7; // x0
GJMapPack *SavedGauntlet; // x22
GameStatsManager *v9; // x0
GameStatsManager *v10; // x0
GameManager *v11; // x19
cocos2d::CCDirector *v12; // x19
GauntletType v13; // w0
cocos2d::CCScene *v14; // x0
cocos2d::CCTransitionFade *v15; // x0
cocos2d::CCArray *v16; // x20
char *v17; // x0
char *v18; // x0
char *v19; // x0
DialogLayer *v20; // x20
__int64 v21; // x19
cocos2d::CCNode *v22; // x21
cocos2d::CCDelayTime *v23; // x22
char v24; // w0
__int64 v25; // x1
__int64 v26; // x2
__int64 v27; // x3
__int64 v28; // x4
__int64 v29; // x5
__int64 v30; // x6
__int64 v31; // x7
cocos2d::CCSequence *v32; // x0
GameStatsManager *v33; // x0
GJRewardItem *v34; // x0
GJRewardItem *v35; // x20
RewardUnlockLayer *v36; // x21
void *v37[2]; // [xsp+18h] [xbp-C8h] BYREF
char v38; // [xsp+2Fh] [xbp-B1h]
void *v39[2]; // [xsp+30h] [xbp-B0h] BYREF
char v40; // [xsp+47h] [xbp-99h]
void *v41[2]; // [xsp+48h] [xbp-98h] BYREF
char v42; // [xsp+5Fh] [xbp-81h]
void *__p[2]; // [xsp+60h] [xbp-80h] BYREF
char v44; // [xsp+77h] [xbp-69h]
void *v45[2]; // [xsp+78h] [xbp-68h] BYREF
char v46; // [xsp+8Fh] [xbp-51h]
void *v47[2]; // [xsp+90h] [xbp-50h] BYREF
char v48; // [xsp+A7h] [xbp-39h]
void *v49[2]; // [xsp+A8h] [xbp-38h] BYREF
char v50; // [xsp+BFh] [xbp-21h]
cocos2d::SEL_CallFunc v51; // 0:x1.16
if ( !a1->m_playing && !a1->m_playBlocked && !a1->m_locked )
{
v4 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
if ( v4 == 8
&& (v5 = GameStatsManager::sharedState(), !(isItemUnlocked = GameStatsManager::isItemUnlocked(v5, GJItem, 5))) )
{
v16 = (cocos2d::CCArray *)sub_10024A15C(isItemUnlocked);
sub_100009900(v49, "...");
sub_100009900(v47, "It's no use, that Gauntlet is locked.");
v17 = DialogObject::create((__int64)v49, (__int64)v47, 2, 0, 0xFFFFFF, 1.0);
sub_10024A2D0(v16, v17);
if ( v48 < 0 )
operator delete(v47[0]);
if ( v50 < 0 )
operator delete(v49[0]);
sub_100009900(v45, "...");
sub_100009900(__p, "The Demon Guardian was the only one who could open it.");
v18 = DialogObject::create((__int64)v45, (__int64)__p, 2, 0, 0xFFFFFF, 0.8);
sub_10024A2D0(v16, v18);
if ( v44 < 0 )
operator delete(__p[0]);
if ( v46 < 0 )
operator delete(v45[0]);
sub_100009900(v41, "...");
sub_100009900(v39, "Not sure what happened to him. He always was a bit crazy.");
v19 = DialogObject::create((__int64)v41, (__int64)v39, 2, 0, 0xFFFFFF, 1.0);
sub_10024A2D0(v16, v19);
if ( v40 < 0 )
operator delete(v39[0]);
if ( v42 < 0 )
operator delete(v41[0]);
v20 = DialogLayer::createWithObjects(v16, 2);
((void (__fastcall *)(GauntletSelectLayer *, DialogLayer *, __int64))a1->addChild_0)(a1, v20, 100);
DialogLayer::updateChatPlacement(v20, Center);
DialogLayer::animateInRandomSide(v20);
}
else
{
v7 = GameLevelManager::sharedState();
SavedGauntlet = GameLevelManager::getSavedGauntlet(v7, v4);
v9 = GameStatsManager::sharedState();
if ( GameStatsManager::isGauntletUnlocked(v9, v4) )
{
if ( GJMapPack::hasCompletedMapPack(SavedGauntlet)
&& (v10 = GameStatsManager::sharedState(), !GameStatsManager::isGauntletChestUnlocked(v10, v4)) )
{
v22 = (cocos2d::CCNode *)cocos2d::CCDictionary::objectForKey(a1->m_gauntlets, v4);
v23 = cocos2d::CCDelayTime::create(0.5);
v51.ptr = (void (*)(void))GauntletNode::onClaimReward;
v51.adj = 0;
v24 = (unsigned __int8)cocos2d::CCCallFunc::create(v22, v51);
v32 = sub_10018A494(v23, v25, v26, v27, v28, v29, v30, v31, v24);
cocos2d::CCNode::runAction(v22, v32);
v33 = GameStatsManager::sharedState();
v34 = GameStatsManager::unlockGauntletChest(v33, v4);
if ( v34 )
{
v35 = v34;
v36 = RewardUnlockLayer::create(v34->m_rewardType, nullptr);
((void (__fastcall *)(GauntletSelectLayer *, RewardUnlockLayer *, __int64))a1->addChild_0)(a1, v36, 100);
RewardUnlockLayer::showCollectReward(v36, v35);
}
}
else
{
a1->m_playing = 1;
v11 = GameManager::sharedState();
v11->m_currentGauntlet = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
v12 = cocos2d::CCDirector::sharedDirector();
v13 = ((unsigned int (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
v14 = GauntletLayer::scene(v13);
v15 = cocos2d::CCTransitionFade::create_1(0.5, v14);
cocos2d::CCDirector::replaceScene(v12, v15);
}
}
else if ( (unsigned int)sub_1002F8CE8() )
{
if ( !a1->m_videoPlaying )
{
a1->m_videoPlaying = 1;
GameManager::sharedState()->m_rewardedVideoDelegate = &a1->RewardedVideoDelegate;
GameManager::sharedState()->m_unk664 = v4;
a1->m_gauntletID = v4;
nullsub_158();
}
}
else
{
sub_100009900(v37, "The Gauntlet cannot be unlocked right now.\nPlease try again later.");
v21 = FLAlertLayer::create_1(0, "Unlock Gauntlet", v37, "OK", 0, 380.0);
if ( v38 < 0 )
operator delete(v37[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v21 + 1288LL))(v21);
}
}
}
}