//
// FollowRewardPage::init from 0x4ffcac to 0x500588 (2268 bytes)
//
// 1 xrefs:
// > FollowRewardPage::create @ 0x4ff9d0
//
// 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 FollowRewardPage::init(FollowRewardPage *a1)
{
cocos2d::CCDirector *v2; // r0
cocos2d::CCNode *v3; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r7
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCNode *v6; // r0
int v7; // r6
cocos2d::CCSprite *v8; // r7
float v9; // s15
float v10; // s14
void (__fastcall *v11)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v12; // r6
void (__fastcall *v13)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCLabelBMFont *v14; // r7
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
int v16; // r9
cocos2d::CCSprite *v17; // r0
CCMenuItemSpriteExtra *v18; // r7
cocos2d::CCMenu *v19; // r0
float v20; // s15
float v21; // s18
cocos2d::CCMenu_vtbl *v22; // r3
cocos2d::CCMenu *v23; // r6
void (__fastcall *v24)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCArray *v25; // r0
cocos2d::CCArray *v26; // r0
GameStatsManager *v27; // r8
stl::StringData::Internal *v28; // r2
stl::StringData::Internal *v29; // r3
GameStatsManager *v30; // r8
int RewardForSpecialChest; // r8
GameManager *v32; // r0
_BOOL4 UGV; // r7
float v34; // r1
GameStatsManager *v35; // r8
stl::StringData::Internal *v36; // r2
stl::StringData::Internal *v37; // r3
GameStatsManager *v38; // r8
GameManager *v39; // r0
float v40; // r2
GameStatsManager *v41; // r8
stl::StringData::Internal *v42; // r2
stl::StringData::Internal *v43; // r3
GameStatsManager *v44; // r8
GameManager *v45; // r0
GameStatsManager *v46; // r8
stl::StringData::Internal *v47; // r2
stl::StringData::Internal *v48; // r3
GameStatsManager *v49; // r8
GameManager *v50; // r0
GameStatsManager *v51; // r8
stl::StringData::Internal *v52; // r2
stl::StringData::Internal *v53; // r3
GameStatsManager *v54; // r8
GameManager *v55; // r0
GameStatsManager *v56; // r8
stl::StringData::Internal *v57; // r2
stl::StringData::Internal *v58; // r3
GameStatsManager *v59; // r8
GameManager *v60; // r0
_BOOL4 v61; // r0
int v62; // r2
bool v63; // r3
GJChestSprite *v64; // r6
CCMenuItemSpriteExtra *v65; // r5
void (__fastcall *v66)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r8
void (__fastcall *v67)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
float width; // s17
int v69; // r0
void (__fastcall *v70)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCLabelBMFont *v71; // r10
cocos2d::CCSprite *v72; // r5
void (__fastcall *v73)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
float v75; // r2
float v76; // r3
int i; // [sp+Ch] [bp-B0h]
int isSpecialChestUnlocked; // [sp+10h] [bp-ACh]
int v79; // [sp+14h] [bp-A8h]
void (__fastcall *v80)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+1Ch] [bp-A0h]
cocos2d::CCSprite *v81; // [sp+38h] [bp-84h] BYREF
cocos2d::CCLabelBMFont *v82; // [sp+3Ch] [bp-80h] BYREF
char *v83; // [sp+40h] [bp-7Ch] BYREF
std::string v84; // [sp+44h] [bp-78h] BYREF
char *v85; // [sp+48h] [bp-74h] BYREF
std::string v86; // [sp+4Ch] [bp-70h] BYREF
char *v87; // [sp+50h] [bp-6Ch] BYREF
std::string v88; // [sp+54h] [bp-68h] BYREF
char *v89; // [sp+58h] [bp-64h] BYREF
std::string v90; // [sp+5Ch] [bp-60h] BYREF
char *v91; // [sp+60h] [bp-5Ch] BYREF
std::string v92; // [sp+64h] [bp-58h] BYREF
char *v93; // [sp+68h] [bp-54h] BYREF
cocos2d::CCSize v94; // [sp+6Ch] [bp-50h] BYREF
cocos2d::CCPoint v95; // [sp+74h] [bp-48h] BYREF
cocos2d::CCPoint v96; // [sp+7Ch] [bp-40h] BYREF
cocos2d::CCPoint v97; // [sp+84h] [bp-38h] BYREF
cocos2d::CCPoint v98; // [sp+8Ch] [bp-30h] BYREF
cocos2d::CCPoint v99; // [sp+94h] [bp-28h] BYREF
cocos2d::CCPoint v100; // [sp+9Ch] [bp-20h] BYREF
cocos2d::CCRect v101; // [sp+A4h] [bp-18h] BYREF
cocos2d::CCSize v102; // 0:^0.8
cocos2d::CCRect v103; // 0:kr00_16.16
v79 = FLAlertLayer::init(a1, (cocos2d::_ccColor4B)150);
if ( !v79 )
return v79;
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v94, v2);
cocos2d::CCRect::CCRect(&v101, 0.0, 0.0, 80.0, 80.0);
v103.origin.x = v75;
v103.origin.y = v76;
v103.size = v102;
v3 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v101,
v103);
((void (__fastcall *)(cocos2d::CCNode *, int))v3->__vftable[1].~CCNode_0)(v3, 255);
setContentSize = v3->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v101, 420.0, 280.0);
setContentSize(v3, (const cocos2d::CCSize *)&v101);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v3, -1);
setPosition = v3->setPosition;
cocos2d::CCPoint::CCPoint(&v101.origin, v94.width * 0.5, v94.height * 0.5);
v6 = v3;
v7 = 0;
setPosition(v6, &v101.origin);
do
{
v8 = cocos2d::CCSprite::createWithSpriteFrameName("dailyLevelCorner_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v8, 8);
switch ( v7 )
{
case 2:
cocos2d::CCSprite::setFlipX(v8, 1);
cocos2d::CCSprite::setFlipY(v8, 1);
v9 = 115.0;
LABEL_9:
v10 = 185.0;
goto LABEL_12;
case 3:
cocos2d::CCSprite::setFlipX(v8, 1);
v9 = -115.0;
goto LABEL_9;
case 1:
cocos2d::CCSprite::setFlipY(v8, 1);
v9 = 115.0;
break;
default:
v9 = -115.0;
break;
}
v10 = -185.0;
LABEL_12:
++v7;
v11 = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v101.origin, v10 + (float)(v94.width * 0.5), v9 + (float)(v94.height * 0.5));
v11(v8, &v101.origin);
}
while ( v7 != 4 );
v12 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v12->setScale)(v12, 1061997773);
a1->m_mainLayer->addChild(a1->m_mainLayer, v12);
v13 = v12->setPosition;
cocos2d::CCPoint::CCPoint(&v101.origin, v94.width * 0.5, (float)((float)(v94.height * 0.5) + 140.0) - 22.0);
v13(v12, &v101.origin);
v14 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v14);
v14->setScale(v14, 0.5);
v15 = v14->setPosition;
v16 = (int)v12->getPosition(v12);
cocos2d::CCPoint::CCPoint(&v100, 0.0, -26.0);
cocos2d::CCPoint::operator+(&v101, v16, &v100);
v15(v14, &v101.origin);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
LODWORD(v100.x) = FollowRewardPage::onClose;
v100.y = 0.0;
v18 = CCMenuItemSpriteExtra::create(
v17,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(FollowRewardPage::onClose, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v18, 1.6);
v19 = (cocos2d::CCMenu *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v18, nullptr);
v20 = (float)(v94.width * 0.5) - 210.0;
v21 = (float)(v94.height * 0.5) + 140.0;
v22 = v19->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v23 = v19;
a1->m_buttonMenu = v19;
v24 = v22->setPosition;
cocos2d::CCPoint::CCPoint(&v101.origin, v20 + 10.0, v21 - 10.0);
v24(v23, &v101.origin);
v25 = (cocos2d::CCArray *)((int (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, int))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_buttonMenu,
10);
v26 = (cocos2d::CCArray *)cocos2d::CCArray::create(v25);
a1->m_chests = v26;
cocos2d::CCObject::retain(v26);
cocos2d::CCPoint::CCPoint(&v95, v94.width * 0.5, (float)(v94.height * 0.5) - 30.0);
for ( i = 1; i != 7; ++i )
{
sub_776584((int)&v81, (char *)&unk_939830);
sub_776584((int)&v82, (char *)&unk_939830);
cocos2d::CCPoint::CCPoint(&v96, &stru_AC7304);
switch ( i )
{
case 2:
v35 = GameStatsManager::sharedState();
sub_776584((int)&v85, "0008");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((int)v35, &v85, v36, v37);
sub_774008(&v85);
v38 = GameStatsManager::sharedState();
sub_776584((int)&v86, "0008");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((int)v38, &v86);
sub_774008(&v86);
sub_7753D4((int)&v81, "gj_twIcon_001.png");
sub_7753D4((int)&v82, "Twitter");
v39 = GameManager::sharedState();
UGV = GameManager::getUGV(v39, "24");
v34 = 0.0;
goto LABEL_17;
case 3:
v41 = GameStatsManager::sharedState();
sub_776584((int)&v87, "0009");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((int)v41, &v87, v42, v43);
sub_774008(&v87);
v44 = GameStatsManager::sharedState();
sub_776584((int)&v88, "0009");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((int)v44, &v88);
sub_774008(&v88);
sub_7753D4((int)&v81, "gj_fbIcon_001.png");
sub_7753D4((int)&v82, "Facebook");
v45 = GameManager::sharedState();
UGV = GameManager::getUGV(v45, "23");
v34 = 90.0;
goto LABEL_17;
case 4:
v46 = GameStatsManager::sharedState();
sub_776584((int)&v89, "0010");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((int)v46, &v89, v47, v48);
sub_774008(&v89);
v49 = GameStatsManager::sharedState();
sub_776584((int)&v90, "0010");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((int)v49, &v90);
sub_774008(&v90);
sub_7753D4((int)&v81, "gj_twitchIcon_001.png");
sub_7753D4((int)&v82, "Twitch");
v50 = GameManager::sharedState();
UGV = GameManager::getUGV(v50, "26");
v34 = -90.0;
goto LABEL_22;
case 5:
v51 = GameStatsManager::sharedState();
sub_776584((int)&v91, "0011");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((int)v51, &v91, v52, v53);
sub_774008(&v91);
v54 = GameStatsManager::sharedState();
sub_776584((int)&v92, "0011");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((int)v54, &v92);
sub_774008(&v92);
sub_7753D4((int)&v81, "gj_discordIcon_001.png");
sub_7753D4((int)&v82, "Discord");
v55 = GameManager::sharedState();
UGV = GameManager::getUGV(v55, "27");
v34 = 0.0;
goto LABEL_22;
case 6:
v56 = GameStatsManager::sharedState();
sub_776584((int)&v93, "0024");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((int)v56, &v93, v57, v58);
sub_774008(&v93);
v59 = GameStatsManager::sharedState();
sub_776584((int)&v98, "0024");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((int)v59, (const std::string *)&v98);
sub_774008(&v98);
sub_7753D4((int)&v81, "gj_rdIcon_001.png");
sub_7753D4((int)&v82, "Reddit");
v60 = GameManager::sharedState();
v61 = GameManager::getUGV(v60, "32");
v34 = 90.0;
UGV = v61;
LABEL_22:
v40 = -48.0;
break;
default:
v27 = GameStatsManager::sharedState();
sub_776584((int)&v83, "0007");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((int)v27, &v83, v28, v29);
sub_774008(&v83);
v30 = GameStatsManager::sharedState();
sub_776584((int)&v84, "0007");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((int)v30, &v84);
sub_774008(&v84);
sub_7753D4((int)&v81, "gj_ytIcon_001.png");
sub_7753D4((int)&v82, "YouTube");
v32 = GameManager::sharedState();
UGV = GameManager::getUGV(v32, "22");
v34 = -90.0;
LABEL_17:
v40 = 48.0;
break;
}
cocos2d::CCPoint::CCPoint(&v99, v34, v40);
cocos2d::CCPoint::operator=((PlayerObject *)&v96, COERCE_FLOAT(&v99), v62, v63);
v64 = GJChestSprite::create(*(_DWORD *)(RewardForSpecialChest + 60));
GJChestSprite::switchToState(v64, Closed, 0);
cocos2d::CCArray::addObject(a1->m_chests, v64);
((void (__fastcall *)(GJChestSprite *, int))v64->setScale)(v64, 1056964608);
LODWORD(v101.origin.x) = FollowRewardPage::onSpecialItem;
v101.origin.y = 0.0;
v65 = CCMenuItemSpriteExtra::create(
v64,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(FollowRewardPage::onSpecialItem, (unsigned int)a1));
sub_776584((int)&v99, "chestClick.ogg");
sub_775D40(&v65->m_selectSound, &v99);
sub_774008(&v99);
v66 = v65->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v99, 50.0, 40.0);
v66(v65, (const cocos2d::CCSize *)&v99);
v67 = v64->setPosition;
width = v65->getContentSize(v65)->width;
v69 = (int)v65->getContentSize(v65);
cocos2d::CCPoint::CCPoint(&v99, width * 0.5, *(float *)(v69 + 4) * 0.5);
v67(v64, &v99);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v65);
v65->m_animationEnabled = 0;
v65->m_colorEnabled = 1;
v65->setTag(v65, i);
v64->setTag(v64, i);
cocos2d::CCPoint::operator+(&v97, &v95, &v96);
v70 = v65->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v99, a1->m_buttonMenu, &v97);
v70(v65, &v99);
v71 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v71->setScale)(v71, 1056964608);
a1->m_mainLayer->addChild(a1->m_mainLayer, v71);
v80 = v71->setPosition;
cocos2d::CCPoint::CCPoint(&v98, 0.0, 42.0);
cocos2d::CCPoint::operator+(&v99, &v97, &v98);
v80(v71, &v99);
if ( isSpecialChestUnlocked )
{
FollowRewardPage::switchToOpenedState(a1, v65);
}
else if ( !UGV )
{
v72 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v81);
((void (__fastcall *)(cocos2d::CCSprite *, int))v72->setScale)(v72, 1067030938);
v72->setTag(v72, i + 10);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v72, 11);
v73 = v72->setPosition;
cocos2d::CCPoint::CCPoint(&v98, 0.0, 2.0);
cocos2d::CCPoint::operator+(&v99, &v97, &v98);
v73(v72, &v99);
v64->m_dark = 1;
v64->setColor(v64, (const cocos2d::ccColor3B *)&word_9ACCD8);
}
sub_774008(&v82);
sub_774008(&v81);
}
GameManager::sharedState()->m_gameRateDelegate2 = &a1->GameRateDelegate;
return v79;
}