//
// GJPathRewardPopup::init from 0x140289f20 to 0x14028a3fb (1243 bytes)
//
// 2 xrefs:
// > GJPathsLayer::onPath @ 0x140285383
// > ??> @ 0x1406d1634
//
// 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 GJPathRewardPopup::init(GJPathRewardPopup *a1, int a2)
{
float v2; // xmm3_4
bool v3; // zf
__int64 v5; // rax
cocos2d::CCTouchDispatcher *v6; // rax
bool result; // al
_BOOL8 v8; // rdx
GJPathRewardPopup_vtbl *v9; // rax
_BOOL8 v10; // rdx
__int64 v11; // rcx
cocos2d::CCDirector *v12; // rax
cocos2d::CCLayer *v13; // rax
GJPathRewardPopup_vtbl *v14; // r8
__int64 v15; // rdx
__int64 v16; // rcx
cocos2d::CCNode *v17; // rdi
cocos2d::CCNode_vtbl *v18; // rbx
double v19; // xmm0_8
const cocos2d::CCSize *v20; // rax
CCMenuItemSpriteExtra *v21; // rax
cocos2d::CCMenu *v22; // rax
cocos2d::CCMenu_vtbl *v23; // rbx
const cocos2d::CCPoint *v24; // rax
float v25; // xmm0_4
__int64 v26; // rdx
__int64 v27; // rcx
CCLightFlash *v28; // r14
float v29; // xmm0_4
CCLightFlash_vtbl *v30; // rbx
const cocos2d::CCPoint *v31; // rax
struct cocos2d::CCLabelBMFont *v32; // rsi
float v33; // xmm0_4
float v34; // xmm0_4
struct cocos2d::CCLabelBMFont *v35; // rdi
cocos2d::CCLabelBMFont_vtbl *v36; // rbx
__int64 v37; // rax
__int64 v38; // rdx
GJChestSprite *v39; // rsi
float v40; // xmm0_4
GJChestSprite *v41; // rdi
GJChestSprite_vtbl *v42; // rbx
__int64 v43; // rax
cocos2d::CCArray *v44; // rax
struct cocos2d::CCObject *v45; // rax
cocos2d::CCArray *v46; // rax
struct cocos2d::CCObject *v47; // rax
__int64 v48; // rdx
float v49; // xmm0_4
const struct cocos2d::CCPoint *v50; // rax
struct cocos2d::CCMoveBy *v51; // rax
struct cocos2d::CCEaseInOut *v52; // rbx
const struct cocos2d::CCPoint *v53; // rax
struct cocos2d::CCMoveBy *v54; // rax
struct cocos2d::CCEaseInOut *v55; // rax
struct cocos2d::CCSequence *v56; // rax
struct cocos2d::CCRepeatForever *v57; // rax
cocos2d::ccColor3B *v58; // r8
cocos2d::CCSize v59; // [rsp+20h] [rbp-28h] BYREF
float v60; // [rsp+60h] [rbp+18h]
int v61; // [rsp+68h] [rbp+20h] BYREF
char v62; // [rsp+70h] [rbp+28h] BYREF
v3 = !a1->m_forcePrioRegistered;
a1->m_pathNumber = a2;
if ( v3 )
{
a1->m_forcePrioRegistered = 1;
v5 = cocos2d::CCDirector::sharedDirector(a1);
v6 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 144LL))(v5);
cocos2d::CCTouchDispatcher::registerForcePrio(v6, a1, 2);
}
v61 = 2097152000;
result = cocos2d::CCLayerColor::initWithColor(a1, (const struct cocos2d::_ccColor4B *)&v61);
if ( result )
{
v9 = a1->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
LOBYTE(v8) = 1;
a1->m_noElasticity = 1;
v9->setTouchEnabled(a1, v8);
LOBYTE(v10) = 1;
a1->setKeypadEnabled(a1, v10);
v12 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v11);
cocos2d::CCDirector::getWinSize(v12);
v13 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();
v14 = a1->FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_mainLayer = v13;
v14->addChild_1(a1, v13);
v17 = (cocos2d::CCNode *)cocos2d::CCNode::create(v16, v15);
v18 = v17->__vftable;
v19 = cocos2d::CCSize::CCSize(&v59, 100.0, 100.0);
v18->setContentSize(v17, v20);
v21 = CCMenuItemSpriteExtra::create(v17, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJPathRewardPopup::onClaim);
v22 = cocos2d::CCMenu::create(v21, 0);
a1->m_buttonMenu = v22;
v23 = v22->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v19, v60 * 0.5);
v23->setPosition_0(a1->m_buttonMenu, v24);
v25 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_buttonMenu,
10);
cocos2d::CCPoint::CCPoint(v25, 0.0);
v28 = (CCLightFlash *)cocos2d::CCNode::create(v27, v26);
v28->setContentSize(v28, &stru_1406C1EE0);
v29 = ((float (__fastcall *)(cocos2d::CCNode *, CCLightFlash *))v17->addChild_1)(v17, v28);
v30 = v28->__vftable;
cocos2d::CCPoint::CCPoint(v29, 50.0);
v30->setPosition_0(v28, v31);
v32 = cocos2d::CCLabelBMFont::create("Reward!", "goldFont.fnt");
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v32->setScale_0)(v32);
v33 = ((float (__fastcall *)(CCLightFlash *, struct cocos2d::CCLabelBMFont *, __int64))v28->addChild_0)(
v28,
v32,
22);
cocos2d::CCPoint::CCPoint(v33, 0.0);
cocos2d::CCPoint::operator+(&v62, &v59);
v34 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *, cocos2d::CCSize *))v32->setPosition_0)(v32, &v59);
cocos2d::CCPoint::CCPoint(v34, 0.0);
v35 = cocos2d::CCLabelBMFont::create("Reward!", "goldFont.fnt");
v36 = v35->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v32->getScale(v32);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v36->setScale_0)(v35);
v28->addChild_0(v28, v35, 21);
v37 = (__int64)v32->getPosition_0(v32);
cocos2d::CCPoint::operator+(v37, &v59);
v35->setPosition_0(v35, (const cocos2d::CCPoint *)&v59);
v35->setColor(&v35->cocos2d::CCRGBAProtocol, &stru_140529ACC);
LOBYTE(v38) = 50;
v35->setOpacity(&v35->cocos2d::CCRGBAProtocol, v38);
v39 = GJChestSprite::create(6);
v28->addChild_0(v28, v39, 22);
v40 = ((float (__fastcall *)(GJChestSprite *))v39->setScale_0)(v39);
cocos2d::CCPoint::CCPoint(v40, 0.0);
cocos2d::CCPoint::operator+(&v62, &v59);
v39->setPosition_0(v39, (const cocos2d::CCPoint *)&v59);
v41 = GJChestSprite::create(6);
v28->addChild_0(v28, v41, 21);
v42 = v41->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v39->getScale(v39);
((void (__fastcall *)(GJChestSprite *))v42->setScale_0)(v41);
v43 = (__int64)v39->getPosition_0(v39);
cocos2d::CCPoint::operator+(v43, &v59);
v41->setPosition_0(v41, (const cocos2d::CCPoint *)&v59);
v44 = v41->getChildren(v41);
v45 = cocos2d::CCArray::objectAtIndex(v44, 0);
(**(void (__fastcall ***)(__int64, cocos2d::ccColor3B *))&v45[5].m_unknown2)(
(__int64)&v45[5].m_unknown2,
&stru_140529ACC);
v46 = v41->getChildren(v41);
v47 = cocos2d::CCArray::objectAtIndex(v46, 0);
LOBYTE(v48) = 50;
v49 = (*(float (__fastcall **)(int *, __int64))(*(_QWORD *)&v47[5].m_unknown2 + 40LL))(&v47[5].m_unknown2, v48);
cocos2d::CCPoint::CCPoint(v49, 0.0);
v51 = cocos2d::CCMoveBy::create(1.0, v50);
v52 = cocos2d::CCEaseInOut::create(v51, 2.0);
cocos2d::CCPoint::CCPoint(1.0, 0.0);
v54 = cocos2d::CCMoveBy::create(1.0, v53);
v55 = cocos2d::CCEaseInOut::create(v54, 2.0);
v56 = cocos2d::CCSequence::create(v52, v55, 0);
v57 = cocos2d::CCRepeatForever::create(v56);
cocos2d::CCNode::runAction(v28, (cocos2d::CCPoint)v57, v58, v2, v59.width);
return 1;
}
return result;
}