//
// ChallengeNode::init from 0x100388490 to 0x100388ffd (2925 bytes)
//
// 1 xrefs:
// > ChallengeNode::create @ 0x100387f2c
//
// This function is hookable on this platform (idp: pc, 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 12:29:11 +0000
//
__int64 __fastcall ChallengeNode::init(_QWORD *a1, __int64 a2, __int64 a3, int a4)
{
const char *v8; // r12
__int64 v9; // rax
__int64 v10; // rbx
bool v11; // zf
__int64 v12; // rdi
__int64 v13; // rax
__int64 v14; // r13
std::string *v15; // rbx
int v16; // eax
const std::string::value_type *v17; // rsi
const std::string::value_type *v18; // rsi
__int64 v19; // rax
__int64 CString; // rax
__int64 v21; // rbx
unsigned __int64 *v22; // r12
std::string::pointer data; // rdi
char *v24; // rbx
unsigned __int64 *v25; // r12
float v26; // xmm0_4
__int64 v27; // r12
float v28; // xmm0_4
char *v29; // r12
char *v30; // rbx
__int64 v31; // rax
__m128 v32; // xmm2
__int64 v33; // rax
__int64 v34; // rax
__int64 v35; // rbx
unsigned __int64 *v36; // r13
double v37; // xmm0_8
char *v38; // rbx
void *v39; // rbx
__int64 v40; // r12
double v41; // xmm0_8
char *v42; // rbx
__int64 v43; // rax
__int64 v44; // rax
__int64 v45; // r15
unsigned __int64 *v46; // rbx
_QWORD *v47; // rax
char *v48; // rbx
__int64 v49; // rax
__int64 v50; // rax
__int64 v51; // r15
unsigned __int64 *v52; // rbx
char v54; // [rsp+0h] [rbp-90h]
char v55; // [rsp+0h] [rbp-90h]
char v56; // [rsp+0h] [rbp-90h]
float v57; // [rsp+4h] [rbp-8Ch]
std::string v58; // [rsp+8h] [rbp-88h] BYREF
std::string v59; // [rsp+20h] [rbp-70h] BYREF
__int16 v60; // [rsp+3Ch] [rbp-54h] BYREF
char v61; // [rsp+3Eh] [rbp-52h]
float v62; // [rsp+40h] [rbp-50h]
float v63; // [rsp+44h] [rbp-4Ch]
unsigned __int64 v64; // [rsp+48h] [rbp-48h] BYREF
float v65; // [rsp+50h] [rbp-40h]
unsigned __int8 v66; // [rsp+57h] [rbp-39h]
double v67[7]; // [rsp+58h] [rbp-38h] BYREF
v66 = cocos2d::CCNode::init();
if ( !v66 )
return v66;
a1[41] = a2;
v8 = "GJ_square02.png";
if ( a2 )
{
cocos2d::CCObject::retain(a2);
v9 = a1[41];
if ( v9 )
{
v8 = "GJ_square02.png";
if ( *(_BYTE *)(v9 + 100) )
v8 = "GJ_square03.png";
}
}
a1[40] = a3;
sub_100278270((__int64)&v59, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v10 = cocos2d::extension::CCScale9Sprite::create_2(v8, &v59);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v10 + 912LL))(v10, 255);
sub_100278260((float *)&v59, 300.0, 70.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v10 + 320LL))(v10, &v59);
(*(void (__fastcall **)(_QWORD *, __int64, __int64))(*a1 + 464LL))(a1, v10, 0xFFFFFFFFLL);
if ( !a1[41] )
{
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v10 + 960LL))(v10, &unk_100A08AE0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v10 + 912LL))(v10, 75);
v13 = cocos2d::CCLabelBMFont::create_3("00:00:00", "bigFont.fnt");
a1[43] = v13;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v13 + 160LL))(v13, 0.5);
(*(void (__fastcall **)(_QWORD *, _QWORD))(*a1 + 456LL))(a1, a1[43]);
*((_BYTE *)a1 + 352) = 1;
return v66;
}
v11 = (*(_BYTE *)(a2 + 112) & 1) == 0;
v65 = *(float *)&a4;
if ( v11 )
v12 = a2 + 113;
else
v12 = *(_QWORD *)(a2 + 128);
v14 = cocos2d::CCLabelBMFont::create_3(v12, "bigFont.fnt");
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 456LL))(a1, v14);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v14 + 160LL))(v14, 0.5);
v15 = &v59;
sub_100278250((float *)&v59, 0.0, 1.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v14 + 296LL))(v14, &v59);
sub_100278250((float *)&v59, -140.0, 29.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v14 + 184LL))(v14, &v59);
*(_WORD *)&v59.__r_.__value_.__l.0 = 0;
v58.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x1Au);
v58.__r_.__value_.__r.__words[0] = 27;
v58.__r_.__value_.__l.__size_ = 23;
strcpy(v58.__r_.__value_.__l.__data_, "currencyOrbIcon_001.png");
v16 = *(_DWORD *)(a2 + 56);
switch ( v16 )
{
case 3:
std::string::assign(&v59, "Stars/Moons");
v17 = "GJ_starsIcon_001.png";
break;
case 2:
v18 = "Silver Coins";
if ( *(_DWORD *)(a2 + 84) - *(_DWORD *)(a2 + 88) == 1 )
v18 = "Silver Coin";
std::string::assign(&v59, v18);
v17 = "GJ_coinsIcon2_001.png";
break;
case 1:
std::string::assign(&v59, "Mana Orbs");
v17 = "currencyOrbIcon_001.png";
break;
default:
v17 = "?";
goto LABEL_21;
}
v15 = &v58;
LABEL_21:
std::string::assign(v15, v17);
v19 = sub_10088E820("Collect %i %s.", v54);
CString = cocos2d::CCString::getCString(v19);
v21 = cocos2d::CCLabelBMFont::create_3(CString, "goldFont.fnt");
sub_100278250((float *)v67, 0.0, 1.0);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v21 + 296LL))(v21, v67);
v22 = (unsigned __int64 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 192LL))(v14);
sub_100278250((float *)&v64, 0.0, -20.0);
sub_100278350(v67, v22, &v64);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v21 + 184LL))(v21, v67);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v21 + 160LL))(v21, 0.5);
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 456LL))(a1, v21);
if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) != 0 )
data = v58.__r_.__value_.__l.__data_;
else
data = v58.__r_.__value_.__s.__data_;
v24 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)data, COERCE_DOUBLE(1056964608));
(*(void (__fastcall **)(_QWORD *, char *))(*a1 + 456LL))(a1, v24);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v24 + 160LL))(v24, 0.69999999);
v25 = (unsigned __int64 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 192LL))(v14);
v62 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 328LL))(v14);
v63 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v14 + 168LL))(v14);
v57 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 328LL))(v14) + 4);
v26 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v14 + 168LL))(v14);
sub_100278250((float *)&v64, (float)(v62 * v63) + 14.0, (float)((float)(v57 * v26) * -0.5) + -1.0);
sub_100278350(v67, v25, &v64);
(*(void (__fastcall **)(char *, double *))(*(_QWORD *)v24 + 184LL))(v24, v67);
if ( LOBYTE(v65) )
{
v27 = cocos2d::CCLabelBMFont::create_3("New!", "goldFont.fnt");
sub_100278250((float *)v67, 0.0, 0.5);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v27 + 296LL))(v27, v67);
v65 = *(float *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v24 + 192LL))(v24);
v62 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 192LL))(v14) + 4);
v63 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 328LL))(v14) + 4);
v28 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v14 + 168LL))(v14);
sub_100278250((float *)v67, v65 + 15.0, v62 + (float)((float)(v63 * v28) * -0.5));
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v27 + 184LL))(v27, v67);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v27 + 160LL))(v27, 0.60000002);
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 456LL))(a1, v27);
}
v61 = 0;
v60 = 0;
v29 = cocos2d::CCSprite::create_1((__int64)"GJ_progressBar_001.png");
(*(void (__fastcall **)(char *, __int16 *))(*(_QWORD *)v29 + 960LL))(v29, &v60);
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v29 + 912LL))(v29, 125);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v29 + 128LL))(v29, 0.5);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v29 + 144LL))(v29, 0.52499998);
(*(void (__fastcall **)(_QWORD *, char *, __int64))(*a1 + 464LL))(a1, v29, 3);
sub_100278250((float *)v67, 0.0, 1.0);
(*(void (__fastcall **)(char *, double *))(*(_QWORD *)v29 + 296LL))(v29, v67);
sub_100278250((float *)v67, -140.0, -13.0);
(*(void (__fastcall **)(char *, double *))(*(_QWORD *)v29 + 184LL))(v29, v67);
v30 = cocos2d::CCSprite::create_1((__int64)"GJ_progressBar_001.png");
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v30 + 128LL))(v30, 0.98000002);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v30 + 144LL))(v30, 0.77999997);
(*(void (__fastcall **)(char *, void *))(*(_QWORD *)v30 + 960LL))(v30, &unk_100A08AE3);
v65 = *((float *)v30 + 108);
(*(void (__fastcall **)(char *, char *, __int64))(*(_QWORD *)v29 + 464LL))(v29, v30, 1);
sub_100278250((float *)v67, 0.0, 0.5);
(*(void (__fastcall **)(char *, double *))(*(_QWORD *)v30 + 296LL))(v30, v67);
v31 = (*(__int64 (__fastcall **)(char *))(*(_QWORD *)v29 + 328LL))(v29);
sub_100278250((float *)v67, (float)((float)(-0.98000002 * v65) + v65) * 0.5, *(float *)(v31 + 4) * 0.5);
(*(void (__fastcall **)(char *, double *))(*(_QWORD *)v30 + 184LL))(v30, v67);
v32 = 0;
v32.f32[0] = fminf(
(float)((float)(*(_DWORD *)(a2 + 60) - *(_DWORD *)(a2 + 64))
/ (float)(*(_DWORD *)(a2 + 84) - *(_DWORD *)(a2 + 88)))
* *((float *)v30 + 108),
*((float *)v30 + 108));
sub_100278270((__int64)v67, 0.0, 0.0, v32, (__m128)*((unsigned int *)v30 + 109));
(*(void (__fastcall **)(char *, double *))(*(_QWORD *)v30 + 1136LL))(v30, v67);
v33 = sub_10088E820("%i / %i", v55);
v34 = cocos2d::CCString::getCString(v33);
v35 = cocos2d::CCLabelBMFont::create_3(v34, "bigFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v35 + 160LL))(v35, 0.28);
(*(void (__fastcall **)(_QWORD *, __int64, __int64))(*a1 + 464LL))(a1, v35, 4);
v36 = (unsigned __int64 *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v29 + 192LL))(v29);
*(_QWORD *)&v37 = *(unsigned int *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v29 + 328LL))(v29);
*(float *)&v37 = (float)(*(float *)&v37 * 0.5) * 0.5;
sub_100278250((float *)&v64, *(float *)&v37, -5.0);
sub_100278350(v67, v36, &v64);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v35 + 184LL))(v35, v67);
if ( *(_BYTE *)(a2 + 100) )
{
v38 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_rewardBtn_001.png", v37);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v38 + 160LL))(v38, 0.80000001);
v39 = CCMenuItemSpriteExtra::create((__int64)v38, 0, (__int64)a1, (__int64)ChallengeNode::onClaimReward, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v39, 1.5);
v40 = cocos2d::CCMenu::createWithItem(v39);
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 456LL))(a1, v40);
sub_100278250((float *)v67, 115.0, 0.0);
v41 = (*(double (__fastcall **)(__int64, double *))(*(_QWORD *)v40 + 184LL))(v40, v67);
v42 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_bigDiamond_001.png", v41);
(*(void (__fastcall **)(_QWORD *, char *))(*a1 + 456LL))(a1, v42);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v42 + 160LL))(v42, 0.60000002);
sub_100278250((float *)v67, 70.0, 0.0);
(*(void (__fastcall **)(char *, double *))(*(_QWORD *)v42 + 184LL))(v42, v67);
v43 = sub_10088E820("%ix", v56);
v44 = cocos2d::CCString::getCString(v43);
v45 = cocos2d::CCLabelBMFont::create_3(v44, "bigFont.fnt");
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 456LL))(a1, v45);
sub_100278250((float *)v67, 1.0, 0.5);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v45 + 296LL))(v45, v67);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v45 + 160LL))(v45, 0.40000001);
v46 = (unsigned __int64 *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v42 + 192LL))(v42);
sub_100278250((float *)&v64, -14.0, 0.0);
sub_100278350(v67, v46, &v64);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v45 + 184LL))(v45, v67);
v47 = (_QWORD *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v40 + 192LL))(v40);
sub_100278300(a1 + 42, v47);
}
else
{
v48 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_bigDiamond_001.png", v37);
(*(void (__fastcall **)(_QWORD *, char *))(*a1 + 456LL))(a1, v48);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v48 + 160LL))(v48, 0.80000001);
sub_100278250((float *)v67, 118.0, 0.0);
(*(void (__fastcall **)(char *, double *))(*(_QWORD *)v48 + 184LL))(v48, v67);
v49 = sub_10088E820("%ix", v56);
v50 = cocos2d::CCString::getCString(v49);
v51 = cocos2d::CCLabelBMFont::create_3(v50, "bigFont.fnt");
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 456LL))(a1, v51);
sub_100278250((float *)v67, 1.0, 0.5);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v51 + 296LL))(v51, v67);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v51 + 160LL))(v51, 0.60000002);
v52 = (unsigned __int64 *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v48 + 192LL))(v48);
sub_100278250((float *)&v64, -20.0, 0.0);
sub_100278350(v67, v52, &v64);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v51 + 184LL))(v51, v67);
}
if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v58.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v59.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v59.__r_.__value_.__l.__data_);
return v66;
}