//
// WorldSelectLayer::setupWorlds from 0x960c54 to 0x961074 (1056 bytes)
//
// 2 xrefs:
// > WorldSelectLayer::init @ 0x9616a0
// > ??> @ 0x2ebf0
//
// 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
//
void WorldSelectLayer::setupWorlds(WorldSelectLayer *a1)
{
unsigned int v2; // w21
cocos2d::CCDirector *v3; // x0
cocos2d::CCArray *v4; // x0
cocos2d::CCArray *v5; // x27
cocos2d::CCLayer *v6; // x22
GJWorldNode *v7; // x20
GJWorldNode_vtbl *v8; // x1
void (__fastcall *v9)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCMoveBy *v10; // x0
cocos2d::CCEaseInOut *v11; // x26
cocos2d::CCMoveBy *v12; // x0
cocos2d::CCEaseInOut *v13; // x0
cocos2d::CCActionInterval *v14; // x0
cocos2d::CCRepeatForever *v15; // x26
cocos2d::CCString *v16; // x0
const char *CString; // x0
cocos2d::CCSprite *v18; // x26
void (__fastcall *v19)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
BoomScrollLayer *v20; // x0
BoomScrollLayer *m_scrollLayer; // x20
cocos2d::CCDirector *v22; // x0
float v23; // s0
cocos2d::CCLabelBMFont *v24; // x26
cocos2d::CCSprite *v25; // x0
CCMenuItemSpriteExtra *v26; // x0
cocos2d::CCMenu *v27; // x26
void (__fastcall *v28)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *v29)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+88h] [xbp+88h]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+88h] [xbp+88h]
float v31; // [xsp+98h] [xbp+98h]
float v32; // [xsp+9Ch] [xbp+9Ch]
cocos2d::CCPoint v33; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCPoint v34; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCPoint v35; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::SEL_MenuHandler v36; // 0:x2.16
cocos2d::CCPoint v37; // 0:s0.4,4:s1.4
v2 = 1;
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v3);
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
cocos2d::CCPoint::CCPoint(&v33, v31 * 0.5, (float)((float)((float)(v32 * 0.5) + -15.0) + 2.0) - 5.0);
while ( 1 )
{
v6 = cocos2d::CCLayer::create();
cocos2d::CCArray::addObject(v5, v6);
v7 = GJWorldNode::create(v2, a1);
v6->addChild(v6, v7);
v7->setTag(v7, v2);
v8 = v7->__vftable;
if ( v2 != 2 )
break;
setPosition = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v34, 0.0, -10.0);
cocos2d::CCPoint::operator+(&v35, &v33, &v34);
setPosition(v7, &v35);
LABEL_4:
cocos2d::CCPoint::CCPoint(&v35, 0.0, -4.0);
v10 = cocos2d::CCMoveBy::create(2.0, &v35);
v11 = cocos2d::CCEaseInOut::create(v10, 1.8);
cocos2d::CCPoint::CCPoint(&v35, 0.0, 4.0);
v12 = cocos2d::CCMoveBy::create(2.0, &v35);
v13 = cocos2d::CCEaseInOut::create(v12, 1.8);
v14 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v11, v13, 0);
v15 = cocos2d::CCRepeatForever::create(v14);
cocos2d::CCNode::runAction(v7, v15);
v15->step(v15, 0.5);
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"worldLabel_%02d_001.png",
(const char *)v2);
CString = cocos2d::CCString::getCString(v16);
v18 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
v6->addChild(v6, v18);
v19 = v18->setPosition;
cocos2d::CCPoint::CCPoint(&v34, 0.0, 142.0);
cocos2d::CCPoint::operator+(&v35, &v33, &v34);
v19(v18, &v35);
if ( v7->m_activeButton )
goto LABEL_5;
LABEL_6:
if ( ++v2 == 4 )
goto LABEL_7;
}
v9 = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v34, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v35, &v33, &v34);
v9(v7, &v35);
if ( v2 != 3 )
goto LABEL_4;
v24 = cocos2d::CCLabelBMFont::create();
v6->addChild(v6, v24);
v24->setScale(v24, 0.8);
v29 = v24->setPosition;
cocos2d::CCPoint::CCPoint(&v34, 0.0, 142.0);
cocos2d::CCPoint::operator+(&v35, &v33, &v34);
v29(v24, &v35);
v25 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_freeLevelsBtn_001.png");
v36.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v36.adj = (size_t)WorldSelectLayer::onFreeLevels;
v26 = CCMenuItemSpriteExtra::create(v25, nullptr, v36);
v27 = cocos2d::CCMenu::createWithItem(v26);
v6->addChild(v6, v27);
v28 = v27->setPosition;
cocos2d::CCPoint::CCPoint(&v35, v31 * 0.5, (float)(v32 * 0.5) + -20.0);
v28(v27, &v35);
if ( v7->m_activeButton )
{
LABEL_5:
a1->m_worldNode = v7;
goto LABEL_6;
}
LABEL_7:
v20 = (BoomScrollLayer *)BoomScrollLayer::create(v5, 0, 0, nullptr, nullptr);
a1->m_scrollLayer = v20;
v20->m_extendedLayer->m_delegate = &a1->BoomScrollLayerDelegate;
a1->m_scrollLayer->m_delegate = &a1->BoomScrollLayerDelegate;
a1->addChild(a1, a1->m_scrollLayer);
m_scrollLayer = a1->m_scrollLayer;
v22 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v22);
cocos2d::CCPoint::CCPoint(&v35, v31 * 0.5, v23 + 15.0);
BoomScrollLayer::setPagesIndicatorPosition(m_scrollLayer, v37);
}