//
// MapSelectLayer::init from 0x640af0 to 0x640fa0 (1200 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:55:28 +0000
//
cocos2d::CCArray *__fastcall MapSelectLayer::init(cocos2d::CCTexture2D **this)
{
cocos2d::CCArray *v2; // r0
cocos2d::CCArray *v3; // r8
cocos2d::CCObject *v4; // r0
const char *v5; // r1
int v6; // r0
cocos2d::CCMenu *v7; // r5
int v8; // r9
cocos2d::CCDirector *v9; // r0
int (__fastcall *v10)(int, __int16 *); // r10
cocos2d::CCDirector *v11; // r0
float v12; // s16
cocos2d::CCDirector *v13; // r0
float v14; // r0
GameManager *v15; // r0
GJBigSprite *v16; // r0
cocos2d::CCNode *v17; // r0
cocos2d::CCNode *v18; // r9
void (__fastcall *v19)(cocos2d::CCNode *, __int16 *); // r10
cocos2d::CCNode *updated; // r0
cocos2d::CCTexture2D *v21; // r0
GameManager *v22; // r0
int v23; // r0
int v24; // r1
cocos2d::CCSprite *v25; // r0
cocos2d::CCNode *v26; // r1
int *v27; // r9
GameManager *v28; // r0
int v29; // r6
GameManager *v30; // r0
SimplePlayer *v31; // r6
GameManager *v32; // r10
int v33; // r0
int v34; // r0
GameManager *v35; // r0
GameManager *v36; // r10
int v37; // r0
int v38; // r0
GameManager *v39; // r0
GameManager *v40; // r0
int v41; // r6
GameManager *v42; // r10
int v43; // r0
int v44; // r0
int v45; // r6
float v46; // r1
int v47; // r1
int *Monster; // r9
int v49; // s16
int v50; // r0
int *v51; // r9
GameLevelManager *v52; // r0
int v53; // r0
LocalLevelManager *v54; // r9
int v55; // r2
int v56; // r3
unsigned __int8 *LocalLevelByName; // r6
GameLevelManager *v58; // r0
bool v59; // r2
GameLevelManager *v60; // r0
unsigned __int8 *NewLevel; // r0
char *v62; // r1
size_t v63; // r2
int *v64; // r0
__int16 v66; // [sp+Ch] [bp-24h] BYREF
char v67; // [sp+Eh] [bp-22h]
__int16 v68; // [sp+10h] [bp-20h] BYREF
char v69; // [sp+12h] [bp-1Eh]
int *(__fastcall *v70)(int *, cocos2d::CCObject *); // [sp+18h] [bp-18h]
int v71; // [sp+1Ch] [bp-14h]
int v72; // [sp+20h] [bp-10h] BYREF
size_t v73; // [sp+24h] [bp-Ch]
int v74; // [sp+28h] [bp-8h]
v2 = (cocos2d::CCArray *)cocos2d::CCLayer::init((cocos2d::CCLayer *)this);
v3 = v2;
if ( v2 )
{
v4 = (cocos2d::CCObject *)cocos2d::CCArray::create(v2);
*(this + 91) = v4;
cocos2d::CCObject::retain(v4);
v6 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_01_001.png", v5);
v70 = MapSelectLayer::onBack;
v71 = 0;
v7 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v6, 0, (int)this, (int)MapSelectLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v7, 1.6);
v8 = cocos2d::CCMenu::create(v7, nullptr);
v9 = (cocos2d::CCDirector *)(*((int (__fastcall **)(cocos2d::CCTexture2D **, int, int))*this + 58))(this, v8, 1);
v10 = *(int (__fastcall **)(int, __int16 *))(*(_DWORD *)v8 + 92);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
v12 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v11));
v13 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v12));
v14 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v13));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, v12 + 25.0, v14 - 22.0);
v15 = (GameManager *)v10(v8, &v68);
v16 = (GJBigSprite *)GameManager::sharedState(v15);
*((_BYTE *)v16 + 852) = 0;
v17 = GJBigSprite::create(v16);
*(this + 79) = v17;
v18 = v17;
v19 = *(void (__fastcall **)(cocos2d::CCNode *, __int16 *))(*(_DWORD *)v17 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, -165.0, -800.0);
v19(v18, &v68);
updated = GJBigSprite::updateSpriteVisibility(*(this + 79));
*((_BYTE *)*(this + 79) + 288) = 1;
v21 = (cocos2d::CCTexture2D *)cocos2d::CCNode::create(updated);
*(this + 81) = v21;
v22 = (GameManager *)(*(int (__fastcall **)(_DWORD, cocos2d::CCTexture2D *, int))(*(_DWORD *)*(this + 79) + 232))(
*(this + 79),
v21,
20);
v23 = GameManager::sharedState(v22);
v25 = SimplePlayer::create((SimplePlayer *)(*(_DWORD *)(v23 + 516) - *(_DWORD *)(v23 + 520)), v24);
*(this + 80) = v25;
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v25 + 80))(v25, 1056964608);
v27 = GJMapObject::create(*(this + 80), v26);
(*(void (__fastcall **)(_DWORD, int *, _DWORD))(*(_DWORD *)*(this + 81) + 232))(*(this + 81), v27, 0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, 462.0, 950.0);
v28 = (GameManager *)GJMapObject::setObjectOrigin(v27, (int)&v68, 0);
v29 = (int)*(this + 80);
v30 = (GameManager *)GameManager::sharedState(v28);
*(_BYTE *)(v29 + 540) = *((_BYTE *)v30 + 712);
v31 = *(this + 80);
v32 = (GameManager *)GameManager::sharedState(v30);
v33 = GameManager::sharedState(v32);
v34 = GameManager::colorForIdx(v32, *(_DWORD *)(v33 + 612) - *(_DWORD *)(v33 + 616));
v66 = v34;
v35 = (GameManager *)BYTE2(v34);
v67 = (char)v35;
v36 = (GameManager *)GameManager::sharedState(v35);
v37 = GameManager::sharedState(v36);
v38 = GameManager::colorForIdx(v36, *(_DWORD *)(v37 + 624) - *(_DWORD *)(v37 + 628));
v68 = v38;
v69 = BYTE2(v38);
v39 = SimplePlayer::setColors(v31, (int)&v66, (int)&v68);
v40 = (GameManager *)GameManager::sharedState(v39);
if ( *((_DWORD *)v40 + 159) - *((_DWORD *)v40 + 160) < 0 )
{
SimplePlayer::disableCustomGlowColor((int)*(this + 80));
}
else
{
v41 = (int)*(this + 80);
v42 = (GameManager *)GameManager::sharedState(v40);
v43 = GameManager::sharedState(v42);
v44 = GameManager::colorForIdx(v42, *(_DWORD *)(v43 + 636) - *(_DWORD *)(v43 + 640));
v68 = v44;
v69 = BYTE2(v44);
SimplePlayer::enableCustomGlowColor(v41, (int)&v68);
}
v45 = 10;
SimplePlayer::updateColors(*(this + 80));
GJMapObject::startPlayerJumpLoop((GJMapObject *)v27, v46);
do
{
Monster = GJMapObject::createMonster((GJMapObject *)((char *)&stru_38C.st_size + 2), v47);
(*(void (__fastcall **)(_DWORD, int *, _DWORD))(*(_DWORD *)*(this + 81) + 232))(*(this + 81), Monster, 0);
v49 = rand();
v50 = rand();
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v68,
(float)((float)((float)((float)((float)v49 * 4.6566e-10) + (float)((float)v49 * 4.6566e-10)) - 1.0) * 100.0)
+ 600.0,
(float)((float)((float)((float)((float)v50 * 4.6566e-10) + (float)((float)v50 * 4.6566e-10)) - 1.0) * 100.0)
+ 600.0);
GJMapObject::setObjectOrigin(Monster, (int)&v68, 1112014848);
cocos2d::CCArray::addObject(*(this + 91), (cocos2d::CCObject *)Monster);
--v45;
}
while ( v45 );
v51 = GJMapObject::createMonster((GJMapObject *)((char *)&stru_52C.st_name + 3), v47);
(*(void (__fastcall **)(_DWORD, int *, _DWORD))(*(_DWORD *)*(this + 81) + 232))(*(this + 81), v51, 0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, 436.0, 776.0);
GJMapObject::setObjectOrigin(v51, (int)&v68, 1112014848);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v51[69] + 172))(v51[69], 0);
v52 = (GameLevelManager *)cocos2d::CCArray::addObject(*(this + 91), (cocos2d::CCObject *)v51);
*((_BYTE *)this + 344) = 0;
v53 = GameLevelManager::sharedState(v52);
v72 = 0;
v73 = 0;
v74 = 0;
v54 = (LocalLevelManager *)v53;
std::string::__init(&v72, "gamemap", 7u);
LocalLevelByName = (unsigned __int8 *)GameLevelManager::getLocalLevelByName(v54, (unsigned __int8 *)&v72, v55, v56);
v58 = (GameLevelManager *)std::string::~string((int)&v72);
if ( !LocalLevelByName )
{
v60 = (GameLevelManager *)GameLevelManager::sharedState(v58);
NewLevel = GameLevelManager::createNewLevel(v60);
v72 = 0;
v73 = 0;
v74 = 0;
LocalLevelByName = NewLevel;
std::string::__init(&v72, "gamemap", 7u);
if ( LocalLevelByName + 280 != (unsigned __int8 *)&v72 )
{
if ( (v72 & 1) != 0 )
{
v62 = (char *)v74;
v63 = v73;
}
else
{
v63 = (int)(unsigned __int8)v72 >> 1;
v62 = (char *)&v72 + 1;
}
std::string::assign((_DWORD *)LocalLevelByName + 70, v62, v63);
}
std::string::~string((int)&v72);
}
v64 = LevelEditorLayer::create(
(LevelEditorLayer *)LocalLevelByName,
(GJGameLevel *)(*((unsigned __int8 *)this + 344) ^ 1),
v59);
*(this + 92) = (cocos2d::CCTexture2D *)v64;
LevelEditorLayer::toggleBackground((LevelEditorLayer *)v64, 0);
LevelEditorLayer::toggleGround(*(this + 92), 0);
if ( *((_BYTE *)this + 344) )
{
(*((void (__fastcall **)(cocos2d::CCTexture2D **, _DWORD))*this + 57))(this, *(this + 92));
(*(void (__fastcall **)(_DWORD, _DWORD, int))(*(_DWORD *)*(this + 92) + 232))(*(this + 92), *(this + 79), -100);
}
else
{
*((_BYTE *)*(this + 92) + 11708) = 1;
LevelEditorLayer::updatePreviewParticles(*(this + 92));
*((_BYTE *)*(this + 92) + 11886) = 1;
LevelEditorLayer::updateEditorMode(*(this + 92));
(*((void (__fastcall **)(cocos2d::CCTexture2D **, _DWORD))*this + 57))(this, *(this + 79));
(*(void (__fastcall **)(_DWORD, _DWORD, int))(*(_DWORD *)*(this + 81) + 232))(*(this + 81), *(this + 92), 100);
(*((void (__fastcall **)(cocos2d::CCTexture2D **, int))*this + 134))(this, 1);
(*((void (__fastcall **)(cocos2d::CCTexture2D **, int))*this + 136))(this, 1);
(*((void (__fastcall **)(cocos2d::CCTexture2D **, int))*this + 125))(this, 1);
(*((void (__fastcall **)(cocos2d::CCTexture2D **, int))*this + 138))(this, 1);
}
cocos2d::CCNode::scheduleUpdate((cocos2d::CCNode *)this);
}
return v3;
}