//
// ChallengeNode::init from 0xa629b0 to 0xa635e8 (3128 bytes)
//
// 2 xrefs:
// > ChallengeNode::create @ 0xa63680
// > ??> @ 0x696e8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:00:16 +0000
//
__int64 __fastcall ChallengeNode::init(
ChallengeNode *this,
cocos2d::CCLabelBMFont **a2,
ChallengesPage *a3,
unsigned __int8 a4)
{
unsigned __int8 v7; // w0
unsigned int v8; // w26
__int64 v9; // x0
const char *v10; // x21
__int64 v11; // x21
void (__fastcall *v12)(__int64, _QWORD *); // x23
const char *v13; // x2
cocos2d::CCLabelBMFont *v14; // x0
__int64 v15; // x21
void (__fastcall *v16)(__int64, _QWORD *); // x27
void (__fastcall *v17)(__int64, _QWORD *); // x27
int v18; // w0
char *v19; // x1
const char *v20; // x1
char *v21; // x2
cocos2d::CCString *v22; // x0
cocos2d::CCLabelBMFont *CString; // x0
const char *v24; // x2
__int64 v25; // x23
void (__fastcall *v26)(__int64, _QWORD *); // x24
__int64 v27; // x27
cocos2d::CCSprite *v28; // x0
__int64 v29; // x23
void (__fastcall *v30)(__int64, _QWORD *); // x28
__int64 v31; // x27
float v32; // s8
float v33; // s10
float v34; // s8
float v35; // s0
const char *v36; // x1
const char *v37; // x2
__int64 v38; // x27
void (__fastcall *v39)(__int64, _QWORD *); // x28
__int64 v40; // x0
__int64 (__fastcall *v41)(__int64); // x1
void (__fastcall *v42)(__int64, _QWORD *); // x23
float v43; // s10
float v44; // s12
float v45; // s8
float v46; // s0
__int64 v47; // x21
void (__fastcall *v48)(__int64, _QWORD *); // x27
void (__fastcall *v49)(__int64, _QWORD *); // x27
const char *v50; // x1
float *v51; // x23
float v52; // s8
void (__fastcall *v53)(float *, _QWORD *); // x28
void (__fastcall *v54)(float *, _QWORD *); // x28
__int64 v55; // x0
float v56; // s1
float v57; // s2
void (__fastcall *v58)(float *, _QWORD *); // x27
cocos2d::CCString *v59; // x0
cocos2d::CCLabelBMFont *v60; // x0
const char *v61; // x2
__int64 v62; // x23
void (__fastcall *v63)(__int64, _QWORD *); // x28
__int64 v64; // x27
float *v65; // x0
const char *v66; // x1
__int64 v67; // x23
void (__fastcall *v68)(__int64, _QWORD *); // x21
cocos2d::CCString *v69; // x0
cocos2d::CCLabelBMFont *v70; // x0
const char *v71; // x2
__int64 v72; // x21
void (__fastcall *v73)(__int64, _QWORD *); // x20
void (__fastcall *v74)(__int64, _QWORD *); // x20
__int64 v75; // x22
__int64 v77; // x21
cocos2d::CCMenu *v78; // x21
cocos2d::CCMenuItem *v79; // x1
__int64 v80; // x23
void (__fastcall *v81)(__int64, _QWORD *); // x21
const char *v82; // x1
__int64 v83; // x21
void (__fastcall *v84)(__int64, _QWORD *); // x27
cocos2d::CCString *v85; // x0
cocos2d::CCLabelBMFont *v86; // x0
const char *v87; // x2
__int64 v88; // x22
void (__fastcall *v89)(__int64, _QWORD *); // x27
__int64 v90; // x0
__int64 (__fastcall *v91)(__int64); // x1
void (__fastcall *v92)(__int64, _QWORD *); // x21
__int64 v93; // x27
__int64 v94; // x0
const char *v95; // x2
__int64 v96; // x0
void (__fastcall *v97)(__int64, _QWORD *); // [xsp+90h] [xbp+90h]
int v98; // [xsp+9Ch] [xbp+9Ch]
_BYTE v99[8]; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v100[8]; // [xsp+B0h] [xbp+B0h] BYREF
_QWORD v101[2]; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v102[2]; // [xsp+C8h] [xbp+C8h] BYREF
void *v103; // [xsp+D8h] [xbp+D8h]
char *v104[2]; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCSprite *v105; // [xsp+F0h] [xbp+F0h]
v98 = a4;
v7 = cocos2d::CCNode::init(this);
v8 = v7;
if ( !v7 )
return v8;
*((_QWORD *)this + 41) = a2;
if ( a2
&& (cocos2d::CCObject::retain((cocos2d::CCObject *)a2), (v9 = *((_QWORD *)this + 41)) != 0)
&& *(_BYTE *)(v9 + 100) )
{
v10 = "GJ_square03.png";
}
else
{
v10 = "GJ_square02.png";
}
*((_QWORD *)this + 40) = a3;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v101, 0.0, 0.0, 80.0, 80.0);
v11 = cocos2d::extension::CCScale9Sprite::create(v10, v101);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 912LL))(v11, 0xFFFFFFFFLL);
v12 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v11 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v101, 300.0, 70.0);
v12(v11, v101);
(*(void (__fastcall **)(ChallengeNode *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v11, 0xFFFFFFFFLL);
if ( !*((_QWORD *)this + 41) )
{
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v11 + 960LL))(v11, &unk_11739D0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 912LL))(v11, 75);
v96 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"00:00:00", "bigFont.fnt", v95);
*((_QWORD *)this + 43) = v96;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v96 + 160LL))(v96, 0.5);
(*(void (__fastcall **)(ChallengeNode *, _QWORD))(*(_QWORD *)this + 456LL))(this, *((_QWORD *)this + 43));
*((_BYTE *)this + 352) = 1;
return v8;
}
v14 = (cocos2d::CCLabelBMFont *)((char *)a2 + 113);
if ( ((_BYTE)a2[14] & 1) != 0 )
v14 = a2[16];
v15 = cocos2d::CCLabelBMFont::create(v14, "bigFont.fnt", v13);
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v15);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v15 + 160LL))(v15, 0.5);
v16 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v15 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 0.0, 1.0);
v16(v15, v101);
v17 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v15 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, -140.0, 29.0);
v17(v15, v101);
v102[0] = 0;
v102[1] = 0;
v103 = nullptr;
std::string::__init(v102, &byte_11B8890, 0);
v104[0] = nullptr;
v104[1] = nullptr;
v105 = nullptr;
std::string::__init((__int64 *)v104, "currencyOrbIcon_001.png", 0x17u);
v18 = *((_DWORD *)a2 + 14);
switch ( v18 )
{
case 1:
std::string::assign(v102, "Mana Orbs");
std::string::assign((__int64 *)v104, "currencyOrbIcon_001.png");
break;
case 3:
std::string::assign(v102, "Stars/Moons");
std::string::assign((__int64 *)v104, "GJ_starsIcon_001.png");
break;
case 2:
if ( *((_DWORD *)a2 + 21) - *((_DWORD *)a2 + 22) == 1 )
v19 = "Silver Coin";
else
v19 = "Silver Coins";
std::string::assign(v102, v19);
std::string::assign((__int64 *)v104, "GJ_coinsIcon2_001.png");
v20 = (const char *)(unsigned int)(*((_DWORD *)a2 + 21) - *((_DWORD *)a2 + 22));
if ( (v102[0] & 1) != 0 )
goto LABEL_15;
goto LABEL_18;
default:
std::string::assign(v102, "?");
break;
}
v20 = (const char *)(unsigned int)(*((_DWORD *)a2 + 21) - *((_DWORD *)a2 + 22));
if ( (v102[0] & 1) != 0 )
{
LABEL_15:
v21 = (char *)v103;
goto LABEL_19;
}
LABEL_18:
v21 = (char *)v102 + 1;
LABEL_19:
v22 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Collect %i %s.", v20, v21);
CString = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v22);
v25 = cocos2d::CCLabelBMFont::create(CString, "goldFont.fnt", v24);
v26 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v25 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 0.0, 1.0);
v26(v25, v101);
v97 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v25 + 184LL);
v27 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 192LL))(v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, 0.0, -20.0);
cocos2d::CCPoint::operator+(v101, v27);
v97(v25, v101);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v25 + 160LL))(v25, 0.5);
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v25);
v28 = (cocos2d::CCSprite *)((char *)v104 + 1);
if ( ((__int64)v104[0] & 1) != 0 )
v28 = v105;
v29 = cocos2d::CCSprite::createWithSpriteFrameName(v28, (const char *)LOBYTE(v104[0]));
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v29);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v29 + 160LL))(v29, 0.7);
v30 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v29 + 184LL);
v31 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 192LL))(v15);
v32 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 328LL))(v15);
v33 = (float)(v32 * (*(float (__fastcall **)(__int64))(*(_QWORD *)v15 + 168LL))(v15)) + 14.0;
v34 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 328LL))(v15) + 4);
v35 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v15 + 168LL))(v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, v33, -1.0 - (float)((float)(v34 * v35) * 0.5));
cocos2d::CCPoint::operator+(v101, v31);
v30(v29, v101);
if ( v98 )
{
v38 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"New!", "goldFont.fnt", v37);
v39 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v38 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 0.0, 0.5);
v39(v38, v101);
v40 = v29;
v41 = *(__int64 (__fastcall **)(__int64))(*(_QWORD *)v29 + 192LL);
v42 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v38 + 184LL);
v43 = *(float *)v41(v40) + 15.0;
v44 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 192LL))(v15) + 4);
v45 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 328LL))(v15) + 4);
v46 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v15 + 168LL))(v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, v43, v44 - (float)((float)(v45 * v46) * 0.5));
v42(v38, v101);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v38 + 160LL))(v38, 0.6);
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v38);
}
v99[0] = 0;
v99[1] = 0;
v99[2] = 0;
v47 = cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v36);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v47 + 960LL))(v47, v99);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v47 + 912LL))(v47, 125);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v47 + 128LL))(v47, 0.5);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v47 + 144LL))(v47, 0.525);
(*(void (__fastcall **)(ChallengeNode *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v47, 3);
v48 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v47 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 0.0, 1.0);
v48(v47, v101);
v49 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v47 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, -140.0, -13.0);
v49(v47, v101);
v51 = (float *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v50);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v51 + 128LL))(v51, 0.98);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v51 + 144LL))(v51, 0.78);
(*(void (__fastcall **)(float *, void *))(*(_QWORD *)v51 + 960LL))(v51, &unk_11739D8);
v52 = v51[108] - (float)(v51[108] * 0.98);
(*(void (__fastcall **)(__int64, float *, __int64))(*(_QWORD *)v47 + 464LL))(v47, v51, 1);
v53 = *(void (__fastcall **)(float *, _QWORD *))(*(_QWORD *)v51 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 0.0, 0.5);
v53(v51, v101);
v54 = *(void (__fastcall **)(float *, _QWORD *))(*(_QWORD *)v51 + 184LL);
v55 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v47 + 328LL))(v47);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, v52 * 0.5, *(float *)(v55 + 4) * 0.5);
v54(v51, v101);
v56 = v51[108];
v57 = (float)((float)(*((_DWORD *)a2 + 15) - *((_DWORD *)a2 + 16))
/ (float)(*((_DWORD *)a2 + 21) - *((_DWORD *)a2 + 22)))
* v56;
if ( v56 <= v57 )
v57 = v51[108];
v58 = *(void (__fastcall **)(float *, _QWORD *))(*(_QWORD *)v51 + 1136LL);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v101, 0.0, 0.0, v57, v51[109]);
v58(v51, v101);
v59 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i / %i",
(const char *)(unsigned int)(*((_DWORD *)a2 + 15) - *((_DWORD *)a2 + 16)),
(unsigned int)(*((_DWORD *)a2 + 21) - *((_DWORD *)a2 + 22)));
v60 = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v59);
v62 = cocos2d::CCLabelBMFont::create(v60, "bigFont.fnt", v61);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v62 + 160LL))(v62, 0.28);
(*(void (__fastcall **)(ChallengeNode *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v62, 4);
v63 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v62 + 184LL);
v64 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v47 + 192LL))(v47);
v65 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v47 + 328LL))(v47);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, (float)(*v65 * 0.5) * 0.5, -5.0);
cocos2d::CCPoint::operator+(v101, v64);
v63(v62, v101);
if ( *((_BYTE *)a2 + 100) )
{
v77 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_rewardBtn_001.png", v66);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v77 + 160LL))(v77, 0.8);
v78 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(
v77,
0,
(__int64)this,
(__int64)ChallengeNode::onClaimReward,
0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v78, 1.5);
v80 = cocos2d::CCMenu::createWithItem(v78, v79);
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v80);
v81 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v80 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 115.0, 0.0);
v81(v80, v101);
v83 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_bigDiamond_001.png", v82);
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v83);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v83 + 160LL))(v83, 0.6);
v84 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v83 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 70.0, 0.0);
v84(v83, v101);
v85 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%ix",
(const char *)(unsigned int)(*((_DWORD *)a2 + 18) - *((_DWORD *)a2 + 19)));
v86 = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v85);
v88 = cocos2d::CCLabelBMFont::create(v86, "bigFont.fnt", v87);
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v88);
v89 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v88 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 1.0, 0.5);
v89(v88, v101);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v88 + 160LL))(v88, 0.4);
v90 = v83;
v91 = *(__int64 (__fastcall **)(__int64))(*(_QWORD *)v83 + 192LL);
v92 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v88 + 184LL);
v93 = v91(v90);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, -14.0, 0.0);
cocos2d::CCPoint::operator+(v101, v93);
v92(v88, v101);
v94 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v80 + 192LL))(v80);
cocos2d::CCPoint::operator=((char *)this + 336, v94);
if ( ((__int64)v104[0] & 1) == 0 )
goto LABEL_27;
}
else
{
v67 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_bigDiamond_001.png", v66);
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v67);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v67 + 160LL))(v67, 0.8);
v68 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v67 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 118.0, 0.0);
v68(v67, v101);
v69 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%ix",
(const char *)(unsigned int)(*((_DWORD *)a2 + 18) - *((_DWORD *)a2 + 19)));
v70 = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v69);
v72 = cocos2d::CCLabelBMFont::create(v70, "bigFont.fnt", v71);
(*(void (__fastcall **)(ChallengeNode *, __int64))(*(_QWORD *)this + 456LL))(this, v72);
v73 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v72 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v101, 1.0, 0.5);
v73(v72, v101);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v72 + 160LL))(v72, 0.6);
v74 = *(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v72 + 184LL);
v75 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v67 + 192LL))(v67);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, -20.0, 0.0);
cocos2d::CCPoint::operator+(v101, v75);
v74(v72, v101);
if ( ((__int64)v104[0] & 1) == 0 )
goto LABEL_27;
}
operator delete(v105);
LABEL_27:
if ( (v102[0] & 1) != 0 )
operator delete(v103);
return v8;
}