//
// GJPathsLayer::init from 0xa6ef00 to 0xa6f3e8 (1256 bytes)
//
// 3 xrefs:
// > GJPathsLayer::create @ 0xa6f4d0
// > ??> @ 0x7c8c0
// > ??> @ 0x11ed970
//
// 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 GJPathsLayer::init(GJPathsLayer *a1)
{
cocos2d::CCTextureCache *v2; // x0
cocos2d::CCSpriteFrameCache *v3; // x0
GameStatsManager *v4; // x0
int v6; // w20
cocos2d::CCDirector *v7; // x0
cocos2d::CCLayer *v8; // x0
cocos2d::CCSprite *v9; // x28
cocos2d::CCSprite *v10; // x0
CCMenuItemSpriteExtra *v11; // x28
cocos2d::CCMenu *v12; // x28
cocos2d::CCSprite *v13; // x28
cocos2d::CCSprite *v14; // x28
cocos2d::CCSprite *v15; // x28
GJPathSprite *v16; // x28
CCMenuItemSpriteExtra *v17; // x28
float v18; // s8
float v19; // s8
float v20; // s13
float v21; // s0
cocos2d::CCMenu *m_buttonMenu; // x27
void (__fastcall *v23)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+90h] [xbp+90h]
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+90h] [xbp+90h]
void (__fastcall *v26)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+90h] [xbp+90h]
void (__fastcall *v27)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+90h] [xbp+90h]
void (__fastcall *v28)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+90h] [xbp+90h]
char v29; // [xsp+9Fh] [xbp+9Fh]
float v30; // [xsp+A0h] [xbp+A0h]
float v31; // [xsp+A4h] [xbp+A4h]
cocos2d::CCPoint v32; // [xsp+A8h] [xbp+A8h] BYREF
_BYTE v33[8]; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint v34; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCPoint v35; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v36; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v37; // 0:x2.16
cocos2d::SEL_MenuHandler v38; // 0:x2.16
v2 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v2, "GJ_PathSheet.png", 0);
v3 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v3, "GJ_PathSheet.plist");
a1->m_exiting = 1;
v4 = GameStatsManager::sharedState();
GameStatsManager::trySelectActivePath(v4);
FLAlertLayer::incrementForcePrio(a1);
v35.x = -1.1642e-10;
v29 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v35);
if ( v29 )
{
v6 = 0;
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v7);
v8 = cocos2d::CCLayer::create();
a1->m_mainLayer = v8;
a1->addChild(a1, v8);
v9 = cocos2d::CCSprite::createWithSpriteFrameName("pathSelectBG_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v9, -1);
v9->setScale(v9, 1.2);
setPosition = v9->setPosition;
cocos2d::CCPoint::CCPoint(&v35, v30 * 0.5, v31 * 0.5);
setPosition(v9, &v35);
a1->m_joystickConnected = -1;
v10 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
a1->m_closeSprite = v10;
v37.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v37.adj = (size_t)GJPathsLayer::onClose;
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, v37);
CCMenuItemSpriteExtra::setSizeMult(v11, 1.6);
v12 = (cocos2d::CCMenu *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v11, nullptr);
a1->m_buttonMenu = v12;
v25 = v12->setPosition;
cocos2d::CCPoint::CCPoint(
&v35,
(float)((float)(v30 * 0.5) + -130.0) + 10.0,
(float)((float)(v31 * 0.5) + 130.0) - 10.0);
v25(v12, &v35);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_buttonMenu, 10);
v13 = cocos2d::CCSprite::createWithSpriteFrameName("label_paths_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v13, 20);
v26 = v13->setPosition;
cocos2d::CCPoint::CCPoint(&v35, v30 * 0.5, (float)(v31 * 0.5) + 29.0);
v26(v13, &v35);
v13->setScale(v13, 0.8);
v14 = cocos2d::CCSprite::createWithSpriteFrameName("label_of_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v14, 20);
v27 = v14->setPosition;
cocos2d::CCPoint::CCPoint(&v35, v30 * 0.5, v31 * 0.5);
v27(v14, &v35);
v14->setScale(v14, 0.8);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("label_power_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v15, 20);
v28 = v15->setPosition;
cocos2d::CCPoint::CCPoint(&v35, v30 * 0.5, (float)(v31 * 0.5) + -34.0);
v28(v15, &v35);
v15->setScale(v15, 0.8);
cocos2d::CCPoint::CCPoint(&v32, v30 * 0.5, v31 * 0.5);
do
{
v16 = GJPathSprite::create(v6 + 1);
GJPathSprite::updateState(v16);
v38.adj = (size_t)GJPathsLayer::onPath;
v38.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v17 = CCMenuItemSpriteExtra::create(v16, nullptr, v38);
v17->setTag(v17, v6 + 1);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v17);
v18 = (float)v6++;
v19 = (float)(90.0 - (float)(v18 * 36.0)) * 0.0174532925;
v20 = cosf(v19);
v21 = sinf(v19);
m_buttonMenu = a1->m_buttonMenu;
v23 = v17->setPosition;
cocos2d::CCPoint::CCPoint(&v35, v20 * 100.0, v21 * 100.0);
cocos2d::CCPoint::operator+(&v34, &v32, &v35);
v36 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v34);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _BYTE *, float, float))v23)(v17, v33, v36.x, v36.y);
}
while ( v6 != 10 );
}
return v29;
}