//
// ChallengesPage::createChallengeNode from 0x10039dd80 to 0x10039df67 (487 bytes)
//
// 7 xrefs:
// > ChallengesPage::init @ 0x10039d5b1
// > ChallengesPage::init @ 0x10039d5c8
// > ChallengesPage::init @ 0x10039d5df
// > ChallengesPage::challengeStatusFinished @ 0x10039e0b5
// > ChallengesPage::challengeStatusFinished @ 0x10039e140
// > ChallengesPage::challengeStatusFinished @ 0x10039e1cd
// > ChallengesPage::claimItem @ 0x10039e8ab
//
// 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
//
ChallengeNode *__fastcall ChallengesPage::createChallengeNode(ChallengesPage *a1, int a2, bool a3, float a4, bool a5)
{
_BOOL4 v6; // ebx
ChallengeNode *v7; // r14
GameStatsManager *v8; // rax
GameStatsManager *v9; // rax
GameStatsManager *v10; // rax
GJChallengeItem *Challenge; // rax
double *v12; // rax
cocos2d::CCDirector *v13; // rax
float v14; // xmm0_4
unsigned int v15; // r15d
cocos2d::CCMoveTo *v16; // rax
unsigned int v17; // eax
int v18; // ecx
int v19; // r8d
int v20; // r9d
cocos2d::CCAction *v21; // rax
unsigned __int64 v23; // [rsp+0h] [rbp-50h] BYREF
unsigned __int64 v24; // [rsp+8h] [rbp-48h] BYREF
float v25[2]; // [rsp+10h] [rbp-40h] BYREF
cocos2d::CCPoint v26; // [rsp+18h] [rbp-38h] BYREF
float v27; // [rsp+20h] [rbp-30h]
_BOOL4 v28; // [rsp+24h] [rbp-2Ch]
v27 = a4;
v6 = a3;
if ( cocos2d::CCDictionary::objectForKey(a1->m_challengeNodes, a2) )
return nullptr;
v28 = v6;
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v25);
sub_10028CBE0((float *)&v23, v25[0] * 0.5, (float)((float)(0.5 * v25[1]) + 80.0) + 5.0);
v8 = GameStatsManager::sharedState();
if ( !GameStatsManager::getChallenge(v8, a2) )
{
v9 = GameStatsManager::sharedState();
GameStatsManager::processChallengeQueue(v9, a2);
a5 = 1;
}
v10 = GameStatsManager::sharedState();
Challenge = GameStatsManager::getChallenge(v10, a2);
v7 = ChallengeNode::create(Challenge, a1, a5);
((void (__fastcall *)(cocos2d::CCLayer *, ChallengeNode *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v7);
sub_10028CBE0((float *)&v24, 0.0, (float)(a2 - 1) * -80.0);
sub_10028CCE0((double *)&v26, &v23, &v24);
((void (__fastcall *)(ChallengeNode *, cocos2d::CCPoint *))v7->setPosition)(v7, &v26);
cocos2d::CCDictionary::setObject(a1->m_challengeNodes, v7, a2);
if ( !v28 )
{
v12 = (double *)((__int64 (__fastcall *)(ChallengeNode *))v7->getPosition)(v7);
sub_10028CC60(&v26, v12);
v13 = cocos2d::CCDirector::sharedDirector();
v14 = sub_100484DA0(v13);
sub_10028CBE0((float *)&v24, v14 + 160.0, v26.y);
((void (__fastcall *)(ChallengeNode *, unsigned __int64 *))v7->setPosition)(v7, &v24);
v15 = (unsigned int)cocos2d::CCDelayTime::create(v27);
v16 = cocos2d::CCMoveTo::create(0.5, &v26);
v17 = (unsigned int)cocos2d::CCEaseElasticOut::create(v16, 0.60000002);
v21 = (cocos2d::CCAction *)sub_1003B5760(v15, v17, 0, v18, v19, v20);
cocos2d::CCNode::runAction(v7, v21);
}
return v7;
}