//
// GauntletSelectLayer::onPlay from 0x4d6b6c to 0x4d6e62 (758 bytes)
//
// 0 xrefs:
//
// 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 GauntletSelectLayer::onPlay(GauntletSelectLayer *a1, cocos2d::CCObject *a2)
{
int v4; // r5
GameStatsManager *v5; // r0
cocos2d::CCArray *v6; // r9
cocos2d::CCObject *v7; // r0
cocos2d::CCObject *v8; // r0
cocos2d::CCObject *v9; // r0
DialogLayer *v10; // r5
GameLevelManager *v11; // r0
GJMapPack *SavedGauntlet; // r8
GameStatsManager *v13; // r0
FLAlertLayer *v14; // r5
GameStatsManager *v15; // r0
GameManager *v16; // r4
cocos2d::CCDirector *v17; // r4
GauntletType v18; // r0
cocos2d::CCScene *v19; // r0
cocos2d::CCTransitionFade *v20; // r0
cocos2d::CCNode *v21; // r6
cocos2d::CCSequence *v22; // r9
cocos2d::CCFiniteTimeAction *v23; // r0
cocos2d::CCAction *v24; // r0
GameStatsManager *v25; // r0
GJRewardItem *v26; // r0
GJRewardItem *v27; // r5
RewardUnlockLayer *v28; // r6
int v29; // [sp+4h] [bp-20h]
int v30; // [sp+4h] [bp-20h]
int v31; // [sp+4h] [bp-20h]
char v32; // [sp+10h] [bp-14h] BYREF
_DWORD v33[2]; // [sp+14h] [bp-10h] BYREF
if ( !a1->m_playing && !a1->m_playBlocked && !a1->m_locked )
{
v4 = a2->getTag(a2);
if ( v4 != 8 || (v5 = GameStatsManager::sharedState(), GameStatsManager::isItemUnlocked(v5, GJItem, 5)) )
{
v11 = GameLevelManager::sharedState();
SavedGauntlet = GameLevelManager::getSavedGauntlet(v11, v4);
v13 = GameStatsManager::sharedState();
if ( GameStatsManager::isGauntletUnlocked(v13, v4) )
{
if ( GJMapPack::hasCompletedMapPack(SavedGauntlet)
&& (v15 = GameStatsManager::sharedState(), !GameStatsManager::isGauntletChestUnlocked(v15, v4)) )
{
v21 = (cocos2d::CCNode *)cocos2d::CCDictionary::objectForKey(a1->m_gauntlets, v4);
v33[1] = 0;
v33[0] = GauntletNode::onClaimReward;
v22 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(0.5);
v23 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(v21, GauntletNode::onClaimReward, 0);
v24 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v22, v23, 0);
cocos2d::CCNode::runAction(v21, v24);
v25 = GameStatsManager::sharedState();
v26 = GameStatsManager::unlockGauntletChest(v25, v4);
v27 = v26;
if ( v26 )
{
v28 = RewardUnlockLayer::create(v26->m_rewardType, nullptr);
a1->addChild_0(a1, v28, 100);
RewardUnlockLayer::showCollectReward(v28, v27);
}
}
else
{
a1->m_playing = 1;
v16 = GameManager::sharedState();
v16->m_currentGauntlet = a2->getTag(a2);
v17 = cocos2d::CCDirector::sharedDirector();
v18 = a2->getTag(a2);
v19 = GauntletLayer::scene(v18);
v20 = cocos2d::CCTransitionFade::create(0.5, v19);
cocos2d::CCDirector::replaceScene(v17, v20);
}
}
else if ( AdToolbox::hasCachedRewardedVideo() )
{
if ( !a1->m_videoPlaying )
{
a1->m_videoPlaying = 1;
GameManager::sharedState()->m_rewardedVideoDelegate = &a1->RewardedVideoDelegate;
GameManager::sharedState()->m_unk664 = v4;
a1->m_gauntletID = v4;
AdToolbox::showRewardedVideo();
}
}
else
{
sub_776584((int)v33, "The Gauntlet cannot be unlocked right now.\nPlease try again later.");
v14 = FLAlertLayer::create(0, (int)"Unlock Gauntlet", (int)v33, (int)"OK", 0, 380.0);
sub_774008(v33);
v14->show(v14);
}
}
else
{
v6 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
sub_776584((int)&v32, "...");
sub_776584((int)v33, "It's no use, that Gauntlet is locked.");
LOWORD(v29) = -1;
BYTE2(v29) = -1;
v7 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v32,
(std::string)v33,
(std::string)2,
1065353216,
0.0,
v29);
cocos2d::CCArray::addObject(v6, v7);
sub_774008(v33);
sub_774008(&v32);
sub_776584((int)&v32, "...");
sub_776584((int)v33, "The Demon Guardian was the only one who could open it.");
LOWORD(v30) = -1;
BYTE2(v30) = -1;
v8 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v32,
(std::string)v33,
(std::string)2,
1061997773,
0.0,
v30);
cocos2d::CCArray::addObject(v6, v8);
sub_774008(v33);
sub_774008(&v32);
sub_776584((int)&v32, "...");
sub_776584((int)v33, "Not sure what happened to him. He always was a bit crazy.");
LOWORD(v31) = -1;
BYTE2(v31) = -1;
v9 = (cocos2d::CCObject *)DialogObject::create(
(DialogObject *)&v32,
(std::string)v33,
(std::string)2,
1065353216,
0.0,
v31);
cocos2d::CCArray::addObject(v6, v9);
sub_774008(v33);
sub_774008(&v32);
v10 = DialogLayer::createWithObjects(v6, (int)&dword_0 + 2);
a1->addChild_0(a1, v10, 100);
DialogLayer::updateChatPlacement(v10, Center);
DialogLayer::animateInRandomSide(v10);
}
}
}