//
// WorldSelectLayer::setupWorlds from 0x4fdf20 to 0x4fe1e2 (706 bytes)
//
// 1 xrefs:
// > WorldSelectLayer::init @ 0x4fe6f2
//
// 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)
{
const char *v2; // r7
cocos2d::CCDirector *v3; // r0
cocos2d::CCSize *WinSize; // r0
cocos2d::CCLayer *v5; // r6
GJWorldNode *v6; // r8
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
float v8; // r2
cocos2d::CCMoveBy *v9; // r0
cocos2d::CCEaseInOut *v10; // r11
cocos2d::CCMoveBy *v11; // r0
cocos2d::CCEaseInOut *v12; // r0
cocos2d::CCActionInterval *v13; // r0
cocos2d::CCRepeatForever *v14; // r11
cocos2d::CCString *v15; // r0
const char *CString; // r0
cocos2d::CCSprite *v17; // r11
void (__fastcall *v18)(void *, cocos2d::CCPoint *); // r6
void *v19; // r0
cocos2d::CCLabelBMFont *v20; // r11
cocos2d::CCSprite *v21; // r0
CCMenuItemSpriteExtra *v22; // r0
cocos2d::CCMenu *v23; // r9
BoomScrollLayer *v24; // r0
BoomScrollLayer *m_scrollLayer; // r5
float v26; // s16
cocos2d::CCDirector *v27; // r0
float v28; // r0
cocos2d::CCPoint v29; // r1
cocos2d::CCArray *v30; // [sp+Ch] [bp-50h]
void (__fastcall *v31)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+24h] [bp-38h]
cocos2d::CCSize v32; // [sp+2Ch] [bp-30h] BYREF
cocos2d::CCPoint v33; // [sp+34h] [bp-28h] BYREF
cocos2d::CCPoint v34; // [sp+3Ch] [bp-20h] BYREF
cocos2d::CCPoint v35; // [sp+44h] [bp-18h] BYREF
void (*v36)(WorldSelectLayer *, cocos2d::CCObject *); // [sp+4Ch] [bp-10h]
int v37; // [sp+50h] [bp-Ch]
v2 = (_BYTE *)(&dword_0 + 1);
v3 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(&v32, v3);
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)WinSize);
cocos2d::CCPoint::CCPoint(&v33, v32.width * 0.5, (float)((float)((float)(v32.height * 0.5) - 15.0) + 2.0) - 5.0);
do
{
v5 = cocos2d::CCLayer::create();
cocos2d::CCArray::addObject(v30, v5);
v6 = GJWorldNode::create((int)v2, a1);
v5->addChild(v5, v6);
v6->setTag(v6, (int)v2);
setPosition = v6->setPosition;
if ( v2 == (_BYTE *)&dword_0 + 2 )
v8 = -10.0;
else
v8 = 0.0;
cocos2d::CCPoint::CCPoint(&v34, 0.0, v8);
cocos2d::CCPoint::operator+(&v35, &v33, &v34);
setPosition(v6, &v35);
if ( v2 == (_BYTE *)&dword_0 + 3 )
{
v20 = cocos2d::CCLabelBMFont::create();
v5->addChild(v5, v20);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v20->setScale)(v20, 1061997773);
v31 = v20->setPosition;
cocos2d::CCPoint::CCPoint(&v34, 0.0, 142.0);
cocos2d::CCPoint::operator+(&v35, &v33, &v34);
v31(v20, &v35);
v21 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_freeLevelsBtn_001.png");
v36 = WorldSelectLayer::onFreeLevels;
v37 = 0;
v22 = CCMenuItemSpriteExtra::create(
v21,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(WorldSelectLayer::onFreeLevels, (unsigned int)a1));
v23 = cocos2d::CCMenu::createWithItem(v22);
v5->addChild(v5, v23);
v18 = (void (__fastcall *)(void *, cocos2d::CCPoint *))v23->setPosition;
cocos2d::CCPoint::CCPoint(&v35, v32.width * 0.5, (float)(v32.height * 0.5) - 20.0);
v19 = v23;
}
else
{
cocos2d::CCPoint::CCPoint(&v35, 0.0, -4.0);
v9 = cocos2d::CCMoveBy::create(2.0, &v35);
v10 = cocos2d::CCEaseInOut::create(v9, 1.8);
cocos2d::CCPoint::CCPoint(&v35, 0.0, 4.0);
v11 = cocos2d::CCMoveBy::create(2.0, &v35);
v12 = cocos2d::CCEaseInOut::create(v11, 1.8);
v13 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v10, v12, 0);
v14 = cocos2d::CCRepeatForever::create(v13);
cocos2d::CCNode::runAction(v6, v14);
((void (__fastcall *)(cocos2d::CCRepeatForever *, int))v14->step)(v14, 1056964608);
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"worldLabel_%02d_001.png", v2);
CString = cocos2d::CCString::getCString(v15);
v17 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
v5->addChild(v5, v17);
v18 = (void (__fastcall *)(void *, cocos2d::CCPoint *))v17->setPosition;
cocos2d::CCPoint::CCPoint(&v34, 0.0, 142.0);
cocos2d::CCPoint::operator+(&v35, &v33, &v34);
v19 = v17;
}
v18(v19, &v35);
if ( v6->m_activeButton )
a1->m_worldNode = v6;
++v2;
}
while ( v2 != byte_4 );
v24 = BoomScrollLayer::create(v30, 0, 0, nullptr, nullptr);
a1->m_scrollLayer = v24;
v24->m_extendedLayer->m_delegate = &a1->BoomScrollLayerDelegate;
a1->m_scrollLayer->m_delegate = &a1->BoomScrollLayerDelegate;
a1->addChild(a1, a1->m_scrollLayer);
m_scrollLayer = a1->m_scrollLayer;
v26 = v32.width * 0.5;
v27 = cocos2d::CCDirector::sharedDirector();
v28 = COERCE_FLOAT(cocos2d::CCDirector::getScreenBottom(v27));
cocos2d::CCPoint::CCPoint(&v35, v26, v28 + 15.0);
LODWORD(v29.x) = &v35;
BoomScrollLayer::setPagesIndicatorPosition(m_scrollLayer, v29);
}