//
// LevelAreaInnerLayer::init from 0x1003e3e90 to 0x1003e4970 (2784 bytes)
//
// 1 xrefs:
// > LevelAreaInnerLayer::create @ 0x1003e3e44
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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:04:24 +0000
//
bool __fastcall LevelAreaInnerLayer::init(_WORD *a1, char a2)
{
__int64 v3; // x28
__int64 v4; // x0
void *v5; // x0
_DWORD *v6; // x0
__int64 v7; // x0
void *v8; // x21
void *v9; // x19
float *v10; // x0
__int64 v11; // x1
__int64 v12; // x2
__int64 v13; // x3
__int64 v14; // x4
__int64 v15; // x5
__int64 v16; // x6
__int64 v17; // x7
__int64 v18; // x0
float v19; // s8
__int64 v20; // x0
float v21; // s0
void *v22; // x22
void *v23; // x0
__int64 i; // x20
__int64 v25; // x20
__int64 v26; // x0
__int64 MainLevel; // x23
__int64 v28; // x0
_BOOL4 hasCompletedMainLevel; // w19
__int64 v30; // x0
_BOOL4 v31; // w21
std::string *v32; // x0
void *v33; // x26
__int64 v34; // x27
_WORD *v35; // x28
__int64 v36; // x19
__int64 v37; // x21
const char *CoinKey_1; // x0
_BOOL4 hasSecretCoin; // w26
const char *v40; // x0
void *v41; // x0
void *v42; // x21
double v43; // d0
void *v44; // x0
__int64 v45; // x19
char v46; // w8
char v47; // w25
void *v48; // x21
float v49; // s0
float32x2_t *v50; // x21
float *v51; // x0
_OWORD *v52; // x0
void *v53; // x19
float *v54; // x21
char v55; // w0
__int64 v56; // x1
__int64 v57; // x2
__int64 v58; // x3
__int64 v59; // x4
__int64 v60; // x5
__int64 v61; // x6
__int64 v62; // x7
__int64 v63; // x0
void *v64; // x19
__int64 v65; // x0
float v66; // s0
float32x2_t *v67; // x19
double v68; // d0
_OWORD *v69; // x0
_OWORD *v70; // x19
_OWORD *v71; // x0
char v72; // w0
__int64 v73; // x1
__int64 v74; // x2
__int64 v75; // x3
__int64 v76; // x4
__int64 v77; // x5
__int64 v78; // x6
__int64 v79; // x7
__int64 v80; // x0
_DWORD *v81; // x0
float *v82; // x19
char v83; // w0
__int64 v84; // x1
__int64 v85; // x2
__int64 v86; // x3
__int64 v87; // x4
__int64 v88; // x5
__int64 v89; // x6
__int64 v90; // x7
__int64 v91; // x0
__int64 (__fastcall ***v92)(); // x19
float *v93; // x21
char v94; // w0
__int64 v95; // x1
__int64 v96; // x2
__int64 v97; // x3
__int64 v98; // x4
__int64 v99; // x5
__int64 v100; // x6
__int64 v101; // x7
__int64 v102; // x0
void *v103; // x19
__int64 v104; // x0
float v105; // s8
__int64 v106; // x0
float v107; // s0
__int64 v108; // x0
float *v109; // x19
char v110; // w0
__int64 v111; // x1
__int64 v112; // x2
__int64 v113; // x3
__int64 v114; // x4
__int64 v115; // x5
__int64 v116; // x6
__int64 v117; // x7
__int64 v118; // x0
char v120; // [xsp+18h] [xbp-E8h]
_BOOL4 v121; // [xsp+1Ch] [xbp-E4h]
__int64 v122; // [xsp+20h] [xbp-E0h]
int v123; // [xsp+2Ch] [xbp-D4h]
__int64 v124; // [xsp+30h] [xbp-D0h]
float32x2_t v125; // [xsp+38h] [xbp-C8h] BYREF
float32x2_t v126; // [xsp+40h] [xbp-C0h] BYREF
float32x2_t v127; // [xsp+48h] [xbp-B8h] BYREF
std::string v128; // [xsp+50h] [xbp-B0h] BYREF
__int64 v129; // [xsp+68h] [xbp-98h] BYREF
float32x2_t v130; // [xsp+70h] [xbp-90h] BYREF
__int64 v131; // [xsp+78h] [xbp-88h] BYREF
__int64 v132; // [xsp+80h] [xbp-80h] BYREF
__int64 v133; // [xsp+88h] [xbp-78h] BYREF
v3 = (__int64)a1;
v121 = cocos2d::CCLayer::init(a1);
if ( !v121 )
return v121;
v120 = a2;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v3 + 1072LL))(v3, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v3 + 1088LL))(v3, 1);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v4, &v129);
v5 = cocos2d::CCTextureCache::sharedTextureCache();
v6 = cocos2d::CCTextureCache::addImage((__int64)v5, "TowerSheet.png");
v7 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v6);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v7, "TowerSheet.plist");
v8 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_arrow_03_001.png");
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v8 + 912LL))(v8, 0);
v9 = CCMenuItemSpriteExtra::create((__int64)v8, 0, v3, (__int64)LevelAreaInnerLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v9, 1.6);
v10 = cocos2d::CCFadeIn::create(0.3);
cocos2d::CCNode::runAction((__int64)v8, (__int64)v10);
v122 = sub_100270434((__int64)v9, v11, v12, v13, v14, v15, v16, v17, 0);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v3 + 464LL))(v3, v122, 1);
v18 = cocos2d::CCDirector::sharedDirector();
v19 = sub_100207EA8(v18);
v20 = cocos2d::CCDirector::sharedDirector();
v21 = sub_100207E98(v20);
sub_1000262BC((float *)&v130, v19 + 24.0, v21 + -23.0);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v122 + 184LL))(v122, &v130);
if ( (unsigned int)PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(v3, (__int64)v9);
v22 = cocos2d::CCNode::create();
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v3 + 456LL))(v3, v22);
v124 = cocos2d::CCMenu::create();
v23 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"towerBG_01_001.png");
(*(void (__fastcall **)(void *, void *, __int64))(*(_QWORD *)v22 + 464LL))(v22, v23, 1);
sub_1000262BC((float *)&v130, *(float *)&v129 * 0.5, *((float *)&v129 + 1) * 0.5);
(*(void (__fastcall **)(void *, float32x2_t *))(*(_QWORD *)v22 + 184LL))(v22, &v130);
for ( i = 0; i != 32; i += 8 )
sub_1000262EC((float32x2_t *)((char *)&v130 + i));
sub_1000262BC((float *)&v128, -95.5, -89.25);
sub_10002630C(&v130, (double *)&v128);
sub_1000262BC((float *)&v128, 103.75, -33.5);
sub_10002630C(&v131, (double *)&v128);
sub_1000262BC((float *)&v128, -95.5, 21.25);
sub_10002630C(&v132, (double *)&v128);
sub_1000262BC((float *)&v128, 57.5, 75.5);
sub_10002630C(&v133, (double *)&v128);
v25 = 0;
v123 = 0;
do
{
v26 = GameLevelManager::sharedState();
MainLevel = GameLevelManager::getMainLevel(v26, (unsigned int)(v25 + 5001), 1);
v28 = GameStatsManager::sharedState();
hasCompletedMainLevel = GameStatsManager::hasCompletedMainLevel(v28, (unsigned int)(v25 + 5001));
if ( !v25 )
{
sub_100009900(&v128, "towerDoor_locked_001.png");
if ( hasCompletedMainLevel )
{
v31 = 1;
LABEL_13:
std::string::assign(&v128, "towerDoor_open_001.png");
++v123;
goto LABEL_15;
}
LABEL_14:
std::string::assign(&v128, "towerDoor_unlocked_001.png");
v31 = 1;
goto LABEL_15;
}
v30 = GameStatsManager::sharedState();
v31 = GameStatsManager::hasCompletedMainLevel(v30, (unsigned int)v25 | 0x1388);
sub_100009900(&v128, "towerDoor_locked_001.png");
if ( hasCompletedMainLevel )
goto LABEL_13;
if ( v31 )
goto LABEL_14;
LABEL_15:
if ( (v128.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v32 = &v128;
else
v32 = (std::string *)v128.__r_.__value_.__r.__words[0];
v33 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)v32);
v34 = v3;
v35 = CCMenuItemSpriteExtra::create((__int64)v33, 0, v3, (__int64)LevelAreaInnerLayer::onDoor, 0);
v35[204] = 256;
(*(void (__fastcall **)(_WORD *, _QWORD))(*(_QWORD *)v35 + 72LL))(v35, (unsigned int)(v25 + 5001));
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v124 + 456LL))(v124, v35);
if ( !hasCompletedMainLevel && !v31 )
{
v127.i8[2] = -1;
v127.i16[0] = -6703;
(*(void (__fastcall **)(void *, float32x2_t *))(*(_QWORD *)v33 + 960LL))(v33, &v127);
(*(void (__fastcall **)(_WORD *, _QWORD))(*(_QWORD *)v35 + 1056LL))(v35, 0);
}
cocos2d::CCNode::convertToNodeSpace(v124, (__int64)(&v130 + v25), &v127);
(*(void (__fastcall **)(_WORD *, float32x2_t *))(*(_QWORD *)v35 + 184LL))(v35, &v127);
v3 = v34;
if ( hasCompletedMainLevel )
{
sub_1000262BC((float *)&v126, 0.0, 32.0);
sub_100026318(&v130 + v25, &v126, &v127);
v36 = 1;
do
{
v37 = GameStatsManager::sharedState();
CoinKey_1 = (const char *)GJGameLevel::getCoinKey_1(MainLevel, v36);
hasSecretCoin = GameStatsManager::hasSecretCoin(v37, CoinKey_1);
if ( hasSecretCoin )
v40 = "GJ_coinsIcon_001.png";
else
v40 = "GJ_coinsIcon_gray_001.png";
v41 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)v40);
v42 = v41;
if ( hasSecretCoin )
{
v126.i8[2] = -1;
v126.i16[0] = -1;
}
else
{
v126.i8[2] = -31;
v126.i16[0] = -7711;
}
(*(void (__fastcall **)(void *, float32x2_t *))(*(_QWORD *)v41 + 960LL))(v41, &v126);
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v42 + 160LL))(v42, 0.7);
(*(void (__fastcall **)(void *, void *, __int64))(*(_QWORD *)v22 + 464LL))(v22, v42, 10);
sub_1000262BC((float *)&v125, (float)(v36 - 2) * 20.0, (float)(8 * (unsigned int)((_DWORD)v36 == 2)));
*(float32x2_t *)&v43 = sub_100026318(&v127, &v125, &v126);
(*(void (__fastcall **)(void *, float32x2_t *, double))(*(_QWORD *)v42 + 184LL))(v42, &v126, v43);
v36 = (unsigned int)(v36 + 1);
}
while ( (_DWORD)v36 != 4 );
}
if ( SHIBYTE(v128.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v128.__r_.__value_.__l.__data_);
++v25;
}
while ( v25 != 4 );
v44 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"towerLockedArrow_001.png");
*(_QWORD *)(v34 + 416) = CCMenuItemSpriteExtra::create((__int64)v44, 0, v34, (__int64)sub_1003E4B38, 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v124 + 456LL))(v124);
v45 = *(_QWORD *)(v34 + 416);
sub_1000262BC((float *)&v127, -96.0, 108.0);
cocos2d::CCNode::convertToNodeSpace(v124, (__int64)&v127, &v128);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v45 + 184LL))(v45, &v128);
(*(void (__fastcall **)(void *, __int64, __int64))(*(_QWORD *)v22 + 464LL))(v22, v124, 2);
v46 = 1;
do
{
v47 = v46;
v48 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"towerTorchInner_001.png");
(*(void (__fastcall **)(void *, void *, __int64))(*(_QWORD *)v22 + 464LL))(v22, v48, 4);
v49 = 195.0;
if ( (v47 & 1) != 0 )
v49 = -195.0;
sub_1000262BC((float *)&v128, v49, 4.0);
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v48 + 184LL))(v48, &v128);
v50 = (float32x2_t *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v48 + 192LL))(v48);
sub_1000262BC((float *)&v127, 0.0, 33.0);
sub_100026318(v50, &v127, (float32x2_t *)&v128);
sub_1003E32F0((__int64)v22, (__int64)&v128, 2, 4u, 1, 0, 0, 1.0);
v46 = 0;
}
while ( (v47 & 1) != 0 );
if ( (v120 & 1) == 0 )
{
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v22 + 160LL))(v22, 0.2);
v51 = cocos2d::CCScaleTo::create_1(1.0, 1.0);
v52 = cocos2d::CCEaseExponentialOut::create((__int64)v51);
cocos2d::CCNode::runAction((__int64)v22, (__int64)v52);
}
v53 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_secretLock4_small_001.png");
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v53 + 912LL))(v53, 0);
v54 = cocos2d::CCDelayTime::create(0.5);
v55 = (unsigned __int8)cocos2d::CCFadeTo::create(200, 2.0);
v63 = sub_10021D420((__int64)v54, v56, v57, v58, v59, v60, v61, v62, v55);
cocos2d::CCNode::runAction((__int64)v53, v63);
v64 = CCMenuItemSpriteExtra::create((__int64)v53, 0, v34, (__int64)sub_1003E4BD0, 0);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v122 + 456LL))(v122, v64);
v65 = cocos2d::CCDirector::sharedDirector();
v66 = sub_100207EB0(v65);
sub_1000262BC((float *)&v127, v66 + -22.0, 23.0);
cocos2d::CCNode::convertToNodeSpace(v122, (__int64)&v127, &v128);
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v64 + 184LL))(v64, &v128);
v67 = (float32x2_t *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v22 + 192LL))(v22);
sub_1000262BC((float *)&v127, 0.0, -2.0);
*(float32x2_t *)&v68 = sub_100026318(v67, &v127, (float32x2_t *)&v128);
(*(void (__fastcall **)(void *, std::string *, double))(*(_QWORD *)v22 + 184LL))(v22, &v128, v68);
sub_1000262BC((float *)&v128, 0.0, 4.0);
v69 = cocos2d::CCMoveBy::create((double *)&v128, 2.0);
v70 = cocos2d::CCEaseInOut::create((__int64)v69, 2.0);
sub_1000262BC((float *)&v128, 0.0, -4.0);
v71 = cocos2d::CCMoveBy::create((double *)&v128, 2.0);
v72 = (unsigned __int8)cocos2d::CCEaseInOut::create((__int64)v71, 2.0);
v80 = sub_10021D420((__int64)v70, v73, v74, v75, v76, v77, v78, v79, v72);
v81 = cocos2d::CCRepeatForever::create(v80);
cocos2d::CCNode::runAction((__int64)v22, (__int64)v81);
v82 = cocos2d::CCDelayTime::create(0.0);
v83 = (unsigned __int8)cocos2d::CCCallFunc::create(v34, (__int64)sub_1003E4C04, 0);
v91 = sub_10021D420((__int64)v82, v84, v85, v86, v87, v88, v89, v90, v83);
cocos2d::CCNode::runAction(v34, v91);
sub_100009900(&v128, "GJ_infoIcon_001.png");
v92 = CCSpriteGrayscale::createWithSpriteFrameName((__int64 *)&v128);
if ( SHIBYTE(v128.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v128.__r_.__value_.__l.__data_);
((void (__fastcall *)(__int64 (__fastcall ***)(), _QWORD))(*v92)[114])(v92, 0);
((void (__fastcall *)(__int64 (__fastcall ***)(), float))(*v92)[20])(v92, 0.8);
v93 = cocos2d::CCDelayTime::create(0.1);
v94 = (unsigned __int8)cocos2d::CCFadeTo::create(200, 1.0);
v102 = sub_10021D420((__int64)v93, v95, v96, v97, v98, v99, v100, v101, v94);
cocos2d::CCNode::runAction((__int64)v92, v102);
v103 = CCMenuItemSpriteExtra::create((__int64)v92, 0, v34, (__int64)LevelAreaInnerLayer::onInfo, 0);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v122 + 456LL))(v122, v103);
v104 = cocos2d::CCDirector::sharedDirector();
v105 = sub_100207EB0(v104);
v106 = cocos2d::CCDirector::sharedDirector();
v107 = sub_100207E98(v106);
sub_1000262BC((float *)&v127, v105 + -20.0, v107 + -20.0);
cocos2d::CCNode::convertToNodeSpace(v122, (__int64)&v127, &v128);
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v103 + 184LL))(v103, &v128);
CCMenuItemSpriteExtra::setSizeMult((__int64)v103, 1.2);
if ( v123 == 4 )
{
v108 = GameManager::sharedState();
if ( !GameManager::getUGV(v108, "33") )
{
*(_BYTE *)(v34 + 424) = 1;
v109 = cocos2d::CCDelayTime::create(1.0);
v110 = (unsigned __int8)cocos2d::CCCallFunc::create(v34, (__int64)sub_1003E503C, 0);
v118 = sub_10021D420((__int64)v109, v111, v112, v113, v114, v115, v116, v117, v110);
cocos2d::CCNode::runAction(v34, v118);
goto LABEL_44;
}
}
else if ( v123 <= 3 )
{
LABEL_44:
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v34 + 416) + 1056LL))(*(_QWORD *)(v34 + 416), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v34 + 416) + 344LL))(*(_QWORD *)(v34 + 416), 0);
}
if ( (*(_BYTE *)(v34 + 424) & 1) == 0 )
*(_BYTE *)(GameManager::sharedState() + 1064) = 0;
return v121;
}