// // ChallengeNode::init from 0x4cbe20 to 0x4cc65c (2108 bytes) // // 1 xrefs: // > ChallengeNode::create @ 0x4cc6c8 // // 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 // bool ChallengeNode::init(ChallengeNode *a1, GJChallengeItem *a2, ChallengesPage *a3, bool a4) { GJChallengeItem *m_challengeItem; // r3 char *v8; // r5 cocos2d::CCNode *v9; // r5 void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r8 cocos2d::CCLabelBMFont *v11; // r0 cocos2d::CCLabelBMFont_vtbl *v12; // r3 cocos2d::CCLabelBMFont *v13; // r5 void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r8 void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8 GJChallengeType m_challengeType; // r3 cocos2d::CCSprite **v17; // r0 char *v18; // r1 cocos2d::CCString *v19; // r0 char *v20; // r1 cocos2d::CCLabelBMFont *v21; // r9 void (__fastcall *v22)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r8 void (__fastcall *v23)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11 int v24; // r10 cocos2d::CCSprite *v25; // r10 void (__fastcall *v26)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9 int v27; // r11 float width; // s16 float v29; // s18 float height; // s16 float v31; // r0 const char *v32; // r1 cocos2d::CCNode *v33; // r5 cocos2d::CCLabelBMFont *v34; // r9 void (__fastcall *v35)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r11 void (__fastcall *v36)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7 float v37; // s18 float y; // s19 float v39; // s16 float v40; // r0 void (__fastcall *v41)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7 void (__fastcall *v42)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7 const char *v43; // r1 float *v44; // r7 float v45; // s16 void (__fastcall *v46)(float *, cocos2d::CCRect *); // r9 void (__fastcall *v47)(float *, cocos2d::CCRect *); // r9 int v48; // r0 float v49; // s13 void (__fastcall *v50)(float *, cocos2d::CCRect *); // r9 float v51; // r3 cocos2d::CCString *v52; // r0 cocos2d::CCLabelBMFont *v53; // r7 void (__fastcall *v54)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8 int v55; // r9 float *v56; // r0 cocos2d::CCSprite *v57; // r7 void (__fastcall *v58)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8 cocos2d::CCString *v59; // r0 cocos2d::CCLabelBMFont *v60; // r6 void (__fastcall *v61)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r4 void (__fastcall *v62)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4 int v63; // r7 cocos2d::CCSprite *v64; // r7 CCMenuItemSpriteExtra *v65; // r7 cocos2d::CCMenu *v66; // r8 void (__fastcall *v67)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7 cocos2d::CCSprite *v68; // r7 void (__fastcall *v69)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9 cocos2d::CCString *v70; // r0 cocos2d::CCLabelBMFont *v71; // r6 void (__fastcall *v72)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r9 void (__fastcall *v73)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9 int v74; // r10 float v75; // r0 int v76; // r2 bool v77; // r3 float v79; // r2 float v80; // r3 _BOOL4 v81; // [sp+Ch] [bp-40h] _BOOL4 v82; // [sp+10h] [bp-3Ch] _BYTE v83[4]; // [sp+18h] [bp-34h] BYREF int v84; // [sp+1Ch] [bp-30h] BYREF cocos2d::CCSprite *v85; // [sp+20h] [bp-2Ch] BYREF cocos2d::CCPoint v86; // [sp+24h] [bp-28h] BYREF cocos2d::CCPoint v87; // [sp+2Ch] [bp-20h] BYREF cocos2d::CCRect v88; // [sp+34h] [bp-18h] BYREF cocos2d::CCSize v89; // 0:^0.8 cocos2d::CCRect v90; // 0:kr00_16.16 v82 = a4; v81 = cocos2d::CCNode::init(a1); if ( v81 ) { a1->m_challengeItem = a2; if ( a2 ) cocos2d::CCObject::retain(a2); m_challengeItem = a1->m_challengeItem; if ( m_challengeItem ) m_challengeItem = (GJChallengeItem *)m_challengeItem->m_canClaim; a1->m_challengesPage = a3; if ( m_challengeItem ) v8 = "GJ_square03.png"; else v8 = "GJ_square02.png"; cocos2d::CCRect::CCRect(&v88, 0.0, 0.0, 80.0, 80.0); v90.origin.x = v79; v90.origin.y = v80; v90.size = v89; v9 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create( (cocos2d::extension::CCScale9Sprite *)v8, (const char *)&v88, v90); ((void (__fastcall *)(cocos2d::CCNode *, int))v9->__vftable[1].~CCNode_0)(v9, 255); setContentSize = v9->setContentSize; cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v88, 300.0, 70.0); setContentSize(v9, (const cocos2d::CCSize *)&v88); a1->addChild_0(a1, v9, -1); if ( a1->m_challengeItem ) { v13 = cocos2d::CCLabelBMFont::create(); a1->addChild(a1, v13); ((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v13->setScale)(v13, 1056964608); setAnchorPoint = v13->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v88.origin, 0.0, 1.0); setAnchorPoint(v13, &v88.origin); setPosition = v13->setPosition; cocos2d::CCPoint::CCPoint(&v88.origin, -140.0, 29.0); setPosition(v13, &v88.origin); sub_776584((int)&v84, (char *)&unk_939830); sub_776584((int)&v85, "currencyOrbIcon_001.png"); m_challengeType = a2->m_challengeType; switch ( m_challengeType ) { case 1: sub_7753D4((int)&v84, "Mana Orbs"); v17 = &v85; v18 = "currencyOrbIcon_001.png"; break; case 3: sub_7753D4((int)&v84, "Stars/Moons"); v17 = &v85; v18 = "GJ_starsIcon_001.png"; break; case 2: if ( a2->m_goal.random - a2->m_goal.seed == 1 ) v20 = "Silver Coin"; else v20 = "Silver Coins"; sub_7753D4((int)&v84, v20); v17 = &v85; v18 = "GJ_coinsIcon2_001.png"; break; default: v17 = (cocos2d::CCSprite **)&v84; v18 = "?"; break; } sub_7753D4((int)v17, v18); v19 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"Collect %i %s.", (const char *)(a2->m_goal.random - a2->m_goal.seed), v84); cocos2d::CCString::getCString(v19); v21 = cocos2d::CCLabelBMFont::create(); v22 = v21->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v88.origin, 0.0, 1.0); v22(v21, &v88.origin); v23 = v21->setPosition; v24 = (int)v13->getPosition(v13); cocos2d::CCPoint::CCPoint(&v87, 0.0, -20.0); cocos2d::CCPoint::operator+(&v88, v24, &v87); v23(v21, &v88.origin); ((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v21->setScale)(v21, 1056964608); a1->addChild(a1, v21); v25 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v85); a1->addChild(a1, v25); ((void (__fastcall *)(cocos2d::CCSprite *, int))v25->setScale)(v25, 1060320051); v26 = v25->setPosition; v27 = (int)v13->getPosition(v13); width = v13->getContentSize(v13)->width; v29 = (float)(width * COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))v13->getScale)(v13))) + 14.0; height = v13->getContentSize(v13)->height; v31 = v13->getScale(v13); cocos2d::CCPoint::CCPoint(&v87, v29, (float)-(float)(0.5 * (float)(height * v31)) - 1.0); cocos2d::CCPoint::operator+(&v88, v27, &v87); v26(v25, &v88.origin); if ( v82 ) { v34 = cocos2d::CCLabelBMFont::create(); v35 = v34->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v88.origin, 0.0, 0.5); v35(v34, &v88.origin); v36 = v34->setPosition; v37 = v25->getPosition(v25)->x + 15.0; y = v13->getPosition(v13)->y; v39 = v13->getContentSize(v13)->height; v40 = v13->getScale(v13); cocos2d::CCPoint::CCPoint(&v88.origin, v37, y - (float)((float)(v39 * v40) * 0.5)); v36(v34, &v88.origin); ((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v34->setScale)(v34, 1058642330); a1->addChild(a1, v34); } v83[0] = 0; v83[1] = 0; v83[2] = 0; v33 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v32); ((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v33->__vftable[1].getTag)(v33, v83); ((void (__fastcall *)(cocos2d::CCNode *, int))v33->__vftable[1].~CCNode_0)(v33, 125); ((void (__fastcall *)(cocos2d::CCNode *, int))v33->setScaleX)(v33, 1056964608); ((void (__fastcall *)(cocos2d::CCNode *, int))v33->setScaleY)(v33, 1057384038); a1->addChild_0(a1, v33, 3); v41 = v33->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v88.origin, 0.0, 1.0); v41(v33, &v88.origin); v42 = v33->setPosition; cocos2d::CCPoint::CCPoint(&v88.origin, -140.0, -13.0); v42(v33, &v88.origin); v44 = (float *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v43); (*(void (__fastcall **)(float *, int))(*(_DWORD *)v44 + 64))(v44, 1065017672); (*(void (__fastcall **)(float *, int))(*(_DWORD *)v44 + 72))(v44, 1061662228); (*(void (__fastcall **)(float *, void *))(*(_DWORD *)v44 + 472))(v44, &unk_9AC5E3); v45 = v44[86] - (float)(v44[86] * 0.98); v33->addChild_0(v33, (cocos2d::CCNode *)v44, 1); v46 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_DWORD *)v44 + 140); cocos2d::CCPoint::CCPoint(&v88.origin, 0.0, 0.5); v46(v44, &v88); v47 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_DWORD *)v44 + 92); v48 = (int)v33->getContentSize(v33); cocos2d::CCPoint::CCPoint(&v88.origin, v45 * 0.5, *(float *)(v48 + 4) * 0.5); v47(v44, &v88); v49 = v44[86]; v50 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_DWORD *)v44 + 560); if ( v49 > (float)(v49 * (float)((float)(a2->m_count.random - a2->m_count.seed) / (float)(a2->m_goal.random - a2->m_goal.seed))) ) v51 = v49 * (float)((float)(a2->m_count.random - a2->m_count.seed) / (float)(a2->m_goal.random - a2->m_goal.seed)); else v51 = v44[86]; cocos2d::CCRect::CCRect(&v88, 0.0, 0.0, v51, v44[87]); v50(v44, &v88); v52 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%i / %i", (const char *)(a2->m_count.random - a2->m_count.seed), a2->m_goal.random - a2->m_goal.seed); cocos2d::CCString::getCString(v52); v53 = cocos2d::CCLabelBMFont::create(); ((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v53->setScale)(v53, 1049582633); a1->addChild_0(a1, v53, 4); v54 = v53->setPosition; v55 = (int)v33->getPosition(v33); v56 = (float *)v33->getContentSize(v33); cocos2d::CCPoint::CCPoint(&v87, (float)(*v56 * 0.5) * 0.5, -5.0); cocos2d::CCPoint::operator+(&v88, v55, &v87); v54(v53, &v88.origin); if ( a2->m_canClaim ) { v64 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rewardBtn_001.png"); ((void (__fastcall *)(cocos2d::CCSprite *, int))v64->setScale)(v64, 1061997773); LODWORD(v88.origin.x) = ChallengeNode::onClaimReward; v88.origin.y = 0.0; v65 = CCMenuItemSpriteExtra::create( v64, nullptr, (cocos2d::SEL_MenuHandler)__PAIR64__(ChallengeNode::onClaimReward, (unsigned int)a1)); CCMenuItemSpriteExtra::setSizeMult(v65, 1.5); v66 = cocos2d::CCMenu::createWithItem(v65); a1->addChild(a1, v66); v67 = v66->setPosition; cocos2d::CCPoint::CCPoint(&v87, 115.0, 0.0); v67(v66, &v87); v68 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png"); a1->addChild(a1, v68); ((void (__fastcall *)(cocos2d::CCSprite *, int))v68->setScale)(v68, 1058642330); v69 = v68->setPosition; cocos2d::CCPoint::CCPoint(&v87, 70.0, 0.0); v69(v68, &v87); v70 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%ix", (const char *)(a2->m_reward.random - a2->m_reward.seed)); cocos2d::CCString::getCString(v70); v71 = cocos2d::CCLabelBMFont::create(); a1->addChild(a1, v71); v72 = v71->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v87, 1.0, 0.5); v72(v71, &v87); ((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v71->setScale)(v71, 1053609165); v73 = v71->setPosition; v74 = (int)v68->getPosition(v68); cocos2d::CCPoint::CCPoint(&v86, -14.0, 0.0); cocos2d::CCPoint::operator+(&v87, v74, &v86); v73(v71, &v87); v75 = ((float (__fastcall *)(cocos2d::CCMenu *))v66->getPosition)(v66); cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_unkPoint, v75, v76, v77); } else { v57 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png"); a1->addChild(a1, v57); ((void (__fastcall *)(cocos2d::CCSprite *, int))v57->setScale)(v57, 1061997773); v58 = v57->setPosition; cocos2d::CCPoint::CCPoint(&v88.origin, 118.0, 0.0); v58(v57, &v88.origin); v59 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%ix", (const char *)(a2->m_reward.random - a2->m_reward.seed)); cocos2d::CCString::getCString(v59); v60 = cocos2d::CCLabelBMFont::create(); a1->addChild(a1, v60); v61 = v60->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v88.origin, 1.0, 0.5); v61(v60, &v88.origin); ((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v60->setScale)(v60, 1058642330); v62 = v60->setPosition; v63 = (int)v57->getPosition(v57); cocos2d::CCPoint::CCPoint(&v87, -20.0, 0.0); cocos2d::CCPoint::operator+(&v88, v63, &v87); v62(v60, &v88.origin); } sub_774008(&v85); sub_774008(&v84); } else { ((void (__fastcall *)(cocos2d::CCNode *, void *))v9->__vftable[1].getTag)(v9, &unk_9AC5E0); ((void (__fastcall *)(cocos2d::CCNode *, int))v9->__vftable[1].~CCNode_0)(v9, 75); v11 = cocos2d::CCLabelBMFont::create(); v12 = v11->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; a1->m_countdownLabel = v11; ((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v12->setScale)(v11, 1056964608); a1->addChild(a1, a1->m_countdownLabel); a1->m_unloaded = 1; } } return v81; }