//
// ChallengeNode::init from 0x5ff7d0 to 0x60004c (2172 bytes)
//
// 1 xrefs:
// > ChallengeNode::create @ 0x6000b8
//
// 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:54:40 +0000
//
int __fastcall ChallengeNode::init(ChallengeNode *this, cocos2d::CCLabelBMFont **a2, ChallengesPage *a3, int a4)
{
int v7; // r3
const char *v8; // r5
int v9; // r5
void (__fastcall *v10)(int, _DWORD *); // r8
const char *v11; // r2
const char *v12; // r2
int v13; // r0
cocos2d::CCLabelBMFont *v14; // r0
int v15; // r5
void (__fastcall *v16)(int, _DWORD *); // r8
void (__fastcall *v17)(int, _DWORD *); // r8
cocos2d::CCLabelBMFont *v18; // r3
int *v19; // r0
char *v20; // r1
char *v21; // r2
char *v22; // r1
cocos2d::CCString *v23; // r0
cocos2d::CCLabelBMFont *CString; // r0
const char *v25; // r2
int v26; // r9
void (__fastcall *v27)(int, _DWORD *); // r8
void (__fastcall *v28)(int, _DWORD *); // r11
int v29; // r10
const char *v30; // r1
cocos2d::CCSprite *v31; // r0
int v32; // r10
void (__fastcall *v33)(int, _DWORD *); // r9
int v34; // r11
float v35; // s16
float v36; // s18
float v37; // s16
float v38; // r0
const char *v39; // r1
const char *v40; // r2
int v41; // r5
int v42; // r9
void (__fastcall *v43)(int, _DWORD *); // r11
void (__fastcall *v44)(int, _DWORD *); // r7
float v45; // s18
float v46; // s19
float v47; // s16
float v48; // r0
void (__fastcall *v49)(int, _DWORD *); // r7
void (__fastcall *v50)(int, _DWORD *); // r7
const char *v51; // r1
float *v52; // r7
float v53; // s16
void (__fastcall *v54)(float *, _DWORD *); // r9
void (__fastcall *v55)(float *, _DWORD *); // r9
int v56; // r0
float v57; // s13
void (__fastcall *v58)(float *, _DWORD *); // r9
float v59; // r3
cocos2d::CCString *v60; // r0
cocos2d::CCLabelBMFont *v61; // r0
const char *v62; // r2
int v63; // r7
void (__fastcall *v64)(int, _DWORD *); // r8
int v65; // r9
float *v66; // r0
const char *v67; // r1
int v68; // r7
void (__fastcall *v69)(int, _DWORD *); // r8
cocos2d::CCString *v70; // r0
cocos2d::CCLabelBMFont *v71; // r0
const char *v72; // r2
int v73; // r6
void (__fastcall *v74)(int, _DWORD *); // r4
void (__fastcall *v75)(int, _DWORD *); // r4
int v76; // r7
int v77; // r7
cocos2d::CCMenu *v78; // r7
cocos2d::CCMenuItem *v79; // r1
int v80; // r8
void (__fastcall *v81)(int, _BYTE *); // r7
const char *v82; // r1
int v83; // r7
void (__fastcall *v84)(int, _BYTE *); // r9
cocos2d::CCString *v85; // r0
cocos2d::CCLabelBMFont *v86; // r0
const char *v87; // r2
int v88; // r6
void (__fastcall *v89)(int, _BYTE *); // r9
void (__fastcall *v90)(int, _BYTE *); // r9
int v91; // r10
int v92; // r0
int v94; // [sp+Ch] [bp-50h]
_BYTE v96[4]; // [sp+18h] [bp-44h] BYREF
_BYTE v97[8]; // [sp+1Ch] [bp-40h] BYREF
_BYTE v98[8]; // [sp+24h] [bp-38h] BYREF
int v99[2]; // [sp+2Ch] [bp-30h] BYREF
char *v100; // [sp+34h] [bp-28h]
int v101[2]; // [sp+38h] [bp-24h] BYREF
cocos2d::CCSprite *v102; // [sp+40h] [bp-1Ch]
_DWORD v103[4]; // [sp+44h] [bp-18h] BYREF
v94 = cocos2d::CCNode::init(this);
if ( v94 )
{
*((_DWORD *)this + 67) = a2;
if ( a2 )
cocos2d::CCObject::retain((cocos2d::CCObject *)a2);
v7 = *((_DWORD *)this + 67);
if ( v7 )
v7 = *(unsigned __int8 *)(v7 + 96);
*((_DWORD *)this + 66) = a3;
if ( v7 )
v8 = "GJ_square03.png";
else
v8 = "GJ_square02.png";
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v103, 0.0, 0.0, 80.0, 80.0);
v9 = cocos2d::extension::CCScale9Sprite::create(v8, v103);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v9 + 456))(v9, 255);
v10 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v9 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v103, 300.0, 70.0);
v10(v9, v103);
(*(void (__fastcall **)(ChallengeNode *, int, int))(*(_DWORD *)this + 232))(this, v9, -1);
if ( *((_DWORD *)this + 67) )
{
if ( ((_BYTE)a2[26] & 1) != 0 )
v14 = a2[28];
else
v14 = (cocos2d::CCLabelBMFont *)((char *)a2 + 105);
v15 = cocos2d::CCLabelBMFont::create(v14, "bigFont.fnt", v11);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v15);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v15 + 80))(v15, 1056964608);
v16 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v15 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, 0.0, 1.0);
v16(v15, v103);
v17 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v15 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, -140.0, 29.0);
v17(v15, v103);
v99[0] = 0;
v99[1] = 0;
v100 = nullptr;
std::string::__init(v99, &unk_B6B226, 0);
v101[0] = 0;
v101[1] = 0;
v102 = nullptr;
std::string::__init(v101, "currencyOrbIcon_001.png", 0x17u);
v18 = a2[13];
if ( v18 == (cocos2d::CCLabelBMFont *)((char *)&dword_0 + 1) )
{
std::string::assign(v99, "Mana Orbs");
v19 = v101;
v20 = "currencyOrbIcon_001.png";
}
else if ( v18 == (cocos2d::CCLabelBMFont *)((char *)&dword_0 + 3) )
{
std::string::assign(v99, "Stars/Moons");
v19 = v101;
v20 = "GJ_starsIcon_001.png";
}
else if ( v18 == (cocos2d::CCLabelBMFont *)((char *)&dword_0 + 2) )
{
if ( a2[20] - a2[21] == 1 )
v22 = "Silver Coin";
else
v22 = "Silver Coins";
std::string::assign(v99, v22);
v19 = v101;
v20 = "GJ_coinsIcon2_001.png";
}
else
{
v19 = v99;
v20 = "?";
}
std::string::assign(v19, v20);
if ( (v99[0] & 1) != 0 )
v21 = v100;
else
v21 = (char *)v99 + 1;
v23 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Collect %i %s.",
(const char *)(a2[20] - a2[21]),
v21);
CString = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v23);
v26 = cocos2d::CCLabelBMFont::create(CString, "goldFont.fnt", v25);
v27 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v26 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, 0.0, 1.0);
v27(v26, v103);
v28 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v26 + 92);
v29 = (*(int (__fastcall **)(int))(*(_DWORD *)v15 + 96))(v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, 0.0, -20.0);
cocos2d::CCPoint::operator+(v103, v29, v98);
v28(v26, v103);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v26 + 80))(v26, 1056964608);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v26);
if ( (v101[0] & 1) != 0 )
v31 = v102;
else
v31 = (cocos2d::CCSprite *)((char *)v101 + 1);
v32 = cocos2d::CCSprite::createWithSpriteFrameName(v31, v30);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v32);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v32 + 80))(v32, 1060320051);
v33 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v32 + 92);
v34 = (*(int (__fastcall **)(int))(*(_DWORD *)v15 + 96))(v15);
v35 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v15 + 164))(v15);
v36 = (float)(v35 * COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v15 + 84))(v15))) + 14.0;
v37 = *(float *)((*(int (__fastcall **)(int))(*(_DWORD *)v15 + 164))(v15) + 4);
v38 = (*(float (__fastcall **)(int))(*(_DWORD *)v15 + 84))(v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, v36, (float)-(float)(0.5 * (float)(v37 * v38)) - 1.0);
cocos2d::CCPoint::operator+(v103, v34, v98);
v33(v32, v103);
if ( a4 )
{
v42 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"New!", "goldFont.fnt", v40);
v43 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v42 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, 0.0, 0.5);
v43(v42, v103);
v44 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v42 + 92);
v45 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v32 + 96))(v32) + 15.0;
v46 = *(float *)((*(int (__fastcall **)(int))(*(_DWORD *)v15 + 96))(v15) + 4);
v47 = *(float *)((*(int (__fastcall **)(int))(*(_DWORD *)v15 + 164))(v15) + 4);
v48 = (*(float (__fastcall **)(int))(*(_DWORD *)v15 + 84))(v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, v45, v46 - (float)((float)(v47 * v48) * 0.5));
v44(v42, v103);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v42 + 80))(v42, 1058642330);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v42);
}
v96[0] = 0;
v96[1] = 0;
v96[2] = 0;
v41 = cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v39);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v41 + 480))(v41, v96);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v41 + 456))(v41, 125);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v41 + 64))(v41, 1056964608);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v41 + 72))(v41, 1057384038);
(*(void (__fastcall **)(ChallengeNode *, int, int))(*(_DWORD *)this + 232))(this, v41, 3);
v49 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v41 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, 0.0, 1.0);
v49(v41, v103);
v50 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v41 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, -140.0, -13.0);
v50(v41, v103);
v52 = (float *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v51);
(*(void (__fastcall **)(float *, int))(*(_DWORD *)v52 + 64))(v52, 1065017672);
(*(void (__fastcall **)(float *, int))(*(_DWORD *)v52 + 72))(v52, 1061662228);
(*(void (__fastcall **)(float *, void *))(*(_DWORD *)v52 + 480))(v52, &unk_BEE6DF);
v53 = v52[86] - (float)(v52[86] * 0.98);
(*(void (__fastcall **)(int, float *, int))(*(_DWORD *)v41 + 232))(v41, v52, 1);
v54 = *(void (__fastcall **)(float *, _DWORD *))(*(_DWORD *)v52 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, 0.0, 0.5);
v54(v52, v103);
v55 = *(void (__fastcall **)(float *, _DWORD *))(*(_DWORD *)v52 + 92);
v56 = (*(int (__fastcall **)(int))(*(_DWORD *)v41 + 164))(v41);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, v53 * 0.5, *(float *)(v56 + 4) * 0.5);
v55(v52, v103);
v57 = v52[86];
v58 = *(void (__fastcall **)(float *, _DWORD *))(*(_DWORD *)v52 + 568);
if ( v57 > (float)(v57 * (float)((float)(a2[14] - a2[15]) / (float)(a2[20] - a2[21]))) )
v59 = v57 * (float)((float)(a2[14] - a2[15]) / (float)(a2[20] - a2[21]));
else
v59 = v52[86];
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v103, 0.0, 0.0, v59, v52[87]);
v58(v52, v103);
v60 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i / %i",
(const char *)(a2[14] - a2[15]),
a2[20] - a2[21]);
v61 = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v60);
v63 = cocos2d::CCLabelBMFont::create(v61, "bigFont.fnt", v62);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v63 + 80))(v63, 1049582633);
(*(void (__fastcall **)(ChallengeNode *, int, int))(*(_DWORD *)this + 232))(this, v63, 4);
v64 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v63 + 92);
v65 = (*(int (__fastcall **)(int))(*(_DWORD *)v41 + 96))(v41);
v66 = (float *)(*(int (__fastcall **)(int))(*(_DWORD *)v41 + 164))(v41);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, (float)(*v66 * 0.5) * 0.5, -5.0);
cocos2d::CCPoint::operator+(v103, v65, v98);
v64(v63, v103);
if ( *((_BYTE *)a2 + 96) )
{
v77 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_rewardBtn_001.png", v67);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v77 + 80))(v77, 1061997773);
v103[0] = ChallengeNode::onClaimReward;
v103[1] = 0;
v78 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v77, 0, (int)this, (int)ChallengeNode::onClaimReward, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v78, 1.5);
v80 = cocos2d::CCMenu::createWithItem(v78, v79);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v80);
v81 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v80 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, 115.0, 0.0);
v81(v80, v98);
v83 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_bigDiamond_001.png", v82);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v83);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v83 + 80))(v83, 1058642330);
v84 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v83 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, 70.0, 0.0);
v84(v83, v98);
v85 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%ix",
(const char *)(a2[17] - a2[18]));
v86 = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v85);
v88 = cocos2d::CCLabelBMFont::create(v86, "bigFont.fnt", v87);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v88);
v89 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v88 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, 1.0, 0.5);
v89(v88, v98);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v88 + 80))(v88, 1053609165);
v90 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v88 + 92);
v91 = (*(int (__fastcall **)(int))(*(_DWORD *)v83 + 96))(v83);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v97, -14.0, 0.0);
cocos2d::CCPoint::operator+(v98, v91, v97);
v90(v88, v98);
v92 = (*(int (__fastcall **)(int))(*(_DWORD *)v80 + 96))(v80);
cocos2d::CCPoint::operator=((char *)this + 272, v92);
}
else
{
v68 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_bigDiamond_001.png", v67);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v68);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v68 + 80))(v68, 1061997773);
v69 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v68 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, 118.0, 0.0);
v69(v68, v103);
v70 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%ix",
(const char *)(a2[17] - a2[18]));
v71 = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v70);
v73 = cocos2d::CCLabelBMFont::create(v71, "bigFont.fnt", v72);
(*(void (__fastcall **)(ChallengeNode *, int))(*(_DWORD *)this + 228))(this, v73);
v74 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v73 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v103, 1.0, 0.5);
v74(v73, v103);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v73 + 80))(v73, 1058642330);
v75 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v73 + 92);
v76 = (*(int (__fastcall **)(int))(*(_DWORD *)v68 + 96))(v68);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, -20.0, 0.0);
cocos2d::CCPoint::operator+(v103, v76, v98);
v75(v73, v103);
}
std::string::~string((int)v101);
std::string::~string((int)v99);
}
else
{
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v9 + 480))(v9, &unk_BEE6DC);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v9 + 456))(v9, 75);
v13 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"00:00:00", "bigFont.fnt", v12);
*((_DWORD *)this + 70) = v13;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v13 + 80))(v13, 1056964608);
(*(void (__fastcall **)(ChallengeNode *, _DWORD))(*(_DWORD *)this + 228))(this, *((_DWORD *)this + 70));
*((_BYTE *)this + 284) = 1;
}
}
return v94;
}