//
// LevelAreaLayer::init from 0x1003e22f8 to 0x1003e2df8 (2816 bytes)
//
// 2 xrefs:
// > LevelAreaLayer::create @ 0x1003e22ac
// > ??> @ 0x100949710
//
// 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:23 +0000
//
bool __fastcall LevelAreaLayer::init(__int64 a1)
{
_BOOL8 v2; // x19
__int64 v3; // x21
_QWORD *v4; // x0
void *v5; // x0
_DWORD *v6; // x0
__int64 v7; // x0
__int64 v8; // x0
void *v9; // x0
void *v10; // x21
__int64 v11; // x1
__int64 v12; // x2
__int64 v13; // x3
__int64 v14; // x4
__int64 v15; // x5
__int64 v16; // x6
__int64 v17; // x7
__int64 v18; // x22
__int64 v19; // x0
float v20; // s8
__int64 v21; // x0
float v22; // s0
_DWORD *v23; // x0
__int64 BGTexture; // x0
float *v25; // x21
unsigned int *v26; // x0
_BYTE *v27; // x21
float *v28; // x0
_OWORD *v29; // x22
float *v30; // x0
char v31; // w0
__int64 v32; // x1
__int64 v33; // x2
__int64 v34; // x3
__int64 v35; // x4
__int64 v36; // x5
__int64 v37; // x6
__int64 v38; // x7
__int64 v39; // x0
_DWORD *v40; // x0
void *v41; // x0
__int64 v42; // x21
void *v43; // x21
char *v44; // x22
__int64 v45; // x1
__int64 v46; // x2
__int64 v47; // x3
__int64 v48; // x4
__int64 v49; // x5
__int64 v50; // x6
__int64 v51; // x7
__int64 v52; // x23
float32x2_t *v53; // x24
char v54; // w25
float *v55; // x23
int v56; // w26
float v57; // s0
float *v58; // x21
__int64 v59; // x21
float32x2_t *v60; // x22
double v61; // d0
_OWORD *v62; // x0
_OWORD *v63; // x21
_OWORD *v64; // x0
char v65; // w0
__int64 v66; // x1
__int64 v67; // x2
__int64 v68; // x3
__int64 v69; // x4
__int64 v70; // x5
__int64 v71; // x6
__int64 v72; // x7
__int64 v73; // x0
_DWORD *v74; // x0
__int64 v75; // x21
double v76; // d0
int v77; // w22
__int64 v78; // x21
float v79; // s8
__int64 v80; // x0
__int64 v81; // x0
float *v82; // x21
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
void *v93[2]; // [xsp+10h] [xbp-D0h] BYREF
char v94; // [xsp+27h] [xbp-B9h]
float32x2_t v95; // [xsp+28h] [xbp-B8h] BYREF
float32x2_t v96; // [xsp+30h] [xbp-B0h] BYREF
std::string __str; // [xsp+38h] [xbp-A8h] BYREF
__int128 v98; // [xsp+50h] [xbp-90h] BYREF
__int64 v99; // [xsp+60h] [xbp-80h] BYREF
void *__p[2]; // [xsp+68h] [xbp-78h] BYREF
char v101; // [xsp+7Fh] [xbp-61h]
v2 = cocos2d::CCLayer::init((_WORD *)a1);
if ( v2 )
{
v3 = GameManager::sharedState();
sub_100009900(__p, "tower01.mp3");
GameManager::fadeInMusic(v3, (__int64)__p);
if ( v101 < 0 )
operator delete(__p[0]);
v4 = sub_1002E736C();
*(_QWORD *)(a1 + 424) = v4;
cocos2d::CCObject::retain((__int64)v4);
v5 = cocos2d::CCTextureCache::sharedTextureCache();
v6 = cocos2d::CCTextureCache::addImage((__int64)v5, "TowerSheet.png");
v7 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v6);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v7, "TowerSheet.plist");
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1088LL))(a1, 1);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8, &v99);
v9 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_arrow_03_001.png");
v10 = CCMenuItemSpriteExtra::create((__int64)v9, 0, a1, (__int64)sub_1003E2E3C, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v10, 1.6);
v18 = sub_100270434((__int64)v10, v11, v12, v13, v14, v15, v16, v17, 0);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v18, 1);
v19 = cocos2d::CCDirector::sharedDirector();
v20 = sub_100207EA8(v19) + 24.0;
v21 = cocos2d::CCDirector::sharedDirector();
v22 = sub_100207E98(v21);
sub_1000262BC((float *)v93, v20, v22 + -23.0);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v18 + 184LL))(v18, v93);
if ( (unsigned int)PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, (__int64)v10);
v23 = (_DWORD *)GameManager::sharedState();
BGTexture = GameManager::getBGTexture(v23, 23);
v25 = (float *)cocos2d::CCSprite::create(BGTexture);
v98 = xmmword_10075DE40;
v26 = (unsigned int *)(*(__int64 (__fastcall **)(float *))(*(_QWORD *)v25 + 1072LL))(v25);
cocos2d::CCTexture2D::setTexParameters(v26, (GLint *)&v98);
(*(void (__fastcall **)(__int64, float *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v25, 4294967293LL);
sub_1000262BC((float *)v93, 0.0, 0.0);
(*(void (__fastcall **)(float *, void **))(*(_QWORD *)v25 + 296LL))(v25, v93);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v25 + 160LL))(v25, *(float *)&v99 / v25[108]);
sub_1000262BC((float *)v93, 0.0, -50.0);
(*(void (__fastcall **)(float *, void **))(*(_QWORD *)v25 + 184LL))(v25, v93);
BYTE2(v93[0]) = -76;
LOWORD(v93[0]) = 15360;
(*(void (__fastcall **)(float *, void **))(*(_QWORD *)v25 + 960LL))(v25, v93);
LODWORD(v93[0]) = -1761607936;
v96.i32[0] = 16776960;
v27 = cocos2d::CCLayerGradient::create((__int64)v93, (__int64)&v96);
sub_1000262BC((float *)v93, 0.0, 1.0);
(*(void (__fastcall **)(_BYTE *, void **))(*(_QWORD *)v27 + 296LL))(v27, v93);
(*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)v27 + 1288LL))(v27, 0x100000302LL);
v27[561] = 1;
(*(void (__fastcall **)(_BYTE *, float))(*(_QWORD *)v27 + 144LL))(v27, 0.7);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v27 + 1296LL))(v27);
(*(void (__fastcall **)(__int64, _BYTE *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v27, 2);
v28 = cocos2d::CCFadeTo::create(255, 3.0);
v29 = cocos2d::CCEaseInOut::create((__int64)v28, 2.0);
v30 = cocos2d::CCFadeTo::create(150, 3.0);
v31 = (unsigned __int8)cocos2d::CCEaseInOut::create((__int64)v30, 2.0);
v39 = sub_10021D420((__int64)v29, v32, v33, v34, v35, v36, v37, v38, v31);
v40 = cocos2d::CCRepeatForever::create(v39);
cocos2d::CCNode::runAction((__int64)v27, (__int64)v40);
v41 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"theTower_01_001.png");
*(_QWORD *)(a1 + 416) = v41;
(*(void (__fastcall **)(__int64, void *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v41, 1);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 416) + 160LL))(*(_QWORD *)(a1 + 416), 1.0);
v42 = *(_QWORD *)(a1 + 416);
sub_1000262BC((float *)v93, *(float *)&v99 * 0.5, *((float *)&v99 + 1) * 0.5);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v42 + 184LL))(v42, v93);
v43 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"whiteSquare60_001.png");
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v43 + 128LL))(v43, 2.0);
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v43 + 144LL))(v43, 2.2);
v44 = (char *)CCMenuItemSpriteExtra::create((__int64)v43, 0, a1, (__int64)LevelAreaLayer::onClickDoor, 0);
sub_100009900(&__str, "door02.ogg");
std::string::operator=((std::string *)(v44 + 416), &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v52 = sub_100270434((__int64)v44, v45, v46, v47, v48, v49, v50, v51, 0);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v52, 10);
v53 = (float32x2_t *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 416) + 192LL))(*(_QWORD *)(a1 + 416));
sub_1000262BC((float *)&v95, 0.0, -75.0);
sub_100026318(v53, &v95, &v96);
cocos2d::CCNode::convertToNodeSpace(v52, (__int64)&v96, v93);
(*(void (__fastcall **)(char *, void **))(*(_QWORD *)v44 + 184LL))(v44, v93);
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v43 + 912LL))(v43, 0);
v54 = 1;
do
{
v55 = (float *)cocos2d::CCSprite::createWithSpriteFrameName((__int64)"godray01_001.png");
(*(void (__fastcall **)(float *, void *))(*(_QWORD *)v55 + 960LL))(v55, &unk_10076E45C);
(*(void (__fastcall **)(__int64, float *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v55, 0xFFFFFFFFLL);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v55 + 128LL))(v55, *((float *)&v99 + 1) / v55[108]);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v55 + 144LL))(v55, 3.0);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v55 + 360LL))(v55, 90.0);
v56 = v54 & 1;
v57 = *(float *)&v99;
if ( (v54 & 1) != 0 )
v57 = 0.0;
sub_1000262BC((float *)v93, v57, *((float *)&v99 + 1) * 0.5);
(*(void (__fastcall **)(float *, void **))(*(_QWORD *)v55 + 184LL))(v55, v93);
(*(void (__fastcall **)(float *, __int64))(*(_QWORD *)v55 + 912LL))(v55, 125);
BYTE2(v93[0]) = 50;
LOWORD(v93[0]) = 0;
(*(void (__fastcall **)(float *, void **))(*(_QWORD *)v55 + 960LL))(v55, v93);
v54 = 0;
}
while ( v56 );
v58 = (float *)cocos2d::CCSprite::createWithSpriteFrameName((__int64)"godray01_001.png");
(*(void (__fastcall **)(float *, void *))(*(_QWORD *)v58 + 960LL))(v58, &unk_10076E45C);
(*(void (__fastcall **)(__int64, float *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v58, 0xFFFFFFFFLL);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v58 + 128LL))(v58, *(float *)&v99 / v58[108]);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v58 + 144LL))(v58, 1.0);
sub_1000262BC((float *)v93, *(float *)&v99 * 0.5, 0.0);
(*(void (__fastcall **)(float *, void **))(*(_QWORD *)v58 + 184LL))(v58, v93);
(*(void (__fastcall **)(float *, __int64))(*(_QWORD *)v58 + 912LL))(v58, 125);
BYTE2(v93[0]) = 50;
LOWORD(v93[0]) = 0;
(*(void (__fastcall **)(float *, void **))(*(_QWORD *)v58 + 960LL))(v58, v93);
v59 = *(_QWORD *)(a1 + 416);
v60 = (float32x2_t *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v59 + 192LL))(v59);
sub_1000262BC((float *)&v96, 0.0, -2.0);
*(float32x2_t *)&v61 = sub_100026318(v60, &v96, (float32x2_t *)v93);
(*(void (__fastcall **)(__int64, void **, double))(*(_QWORD *)v59 + 184LL))(v59, v93, v61);
sub_1000262BC((float *)v93, 0.0, 4.0);
v62 = cocos2d::CCMoveBy::create((double *)v93, 2.0);
v63 = cocos2d::CCEaseInOut::create((__int64)v62, 2.0);
sub_1000262BC((float *)v93, 0.0, -4.0);
v64 = cocos2d::CCMoveBy::create((double *)v93, 2.0);
v65 = (unsigned __int8)cocos2d::CCEaseInOut::create((__int64)v64, 2.0);
v73 = sub_10021D420((__int64)v63, v66, v67, v68, v69, v70, v71, v72, v65);
v74 = cocos2d::CCRepeatForever::create(v73);
cocos2d::CCNode::runAction(*(_QWORD *)(a1 + 416), (__int64)v74);
sub_1000262BC((float *)&v96, *(float *)&v99 * 0.5, (float)(*((float *)&v99 + 1) * 0.5) + 13.0);
sub_1000262BC((float *)&v95, 0.0, 0.0);
sub_100026318(&v96, &v95, (float32x2_t *)v93);
sub_1003E2FE0(a1, v93, 50.0, 0.0, 125.0, 5.0, 4.0);
sub_1000262BC((float *)&v95, 0.0, 10.0);
sub_100026318(&v96, &v95, (float32x2_t *)v93);
sub_1003E2FE0(a1, v93, 25.0, 125.0, 0.0, 3.0, 2.5);
sub_1000262BC((float *)&v95, 0.0, 20.0);
sub_100026318(&v96, &v95, (float32x2_t *)v93);
sub_1003E2FE0(a1, v93, 125.0, 25.0, 125.0, 4.0, 3.0);
sub_1000262BC((float *)&v95, 0.0, -20.0);
sub_100026318(&v96, &v95, (float32x2_t *)v93);
sub_1003E2FE0(a1, v93, 75.0, 0.0, 100.0, 6.0, 2.5);
sub_1000262BC((float *)&v95, 0.0, -10.0);
sub_100026318(&v96, &v95, (float32x2_t *)v93);
sub_1003E2FE0(a1, v93, 0.0, 100.0, 25.0, 5.0, 3.5);
sub_1000262BC((float *)&v95, 0.0, 10.0);
sub_100026318(&v96, &v95, (float32x2_t *)v93);
sub_1003E2FE0(a1, v93, 0.0, 75.0, 25.0, 4.5, 2.5);
sub_100009900(
v93,
"60a-1a8a2a6a90a90a0a2a45a70a0a0a0a0a0a0a1a0a0a0a1a0a0.886275a0a0a0a0a0.7a1a0a0a0a1a0a0.552941a0a0a0a0a0.7a2a0a2a0a"
"0a0a0a0a0a0a0a2a1a0a0a0a0a0a0a0a0a0a0a0a0a0a0");
v75 = GameToolbox::particleFromString((__int64)v93, 0, 0);
if ( v94 < 0 )
operator delete(v93[0]);
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)a1 + 464LL))(a1, v75, 0);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v75 + 360LL))(v75, 30.0);
sub_1000262BC((float *)v93, 100.0, 40.0);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v75 + 960LL))(v75, v93);
sub_1000262BC((float *)&v95, -100.0, 60.0);
*(float32x2_t *)&v76 = sub_100026318(&v96, &v95, (float32x2_t *)v93);
(*(void (__fastcall **)(__int64, void **, double))(*(_QWORD *)v75 + 184LL))(v75, v93, v76);
v77 = 20;
do
{
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v75 + 40LL))(v75, 0.2);
--v77;
}
while ( v77 );
v78 = *(_QWORD *)(a1 + 416);
v79 = (float)(*(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v78 + 328LL))(v78) * 0.5) + 35.0;
v80 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 416) + 328LL))(*(_QWORD *)(a1 + 416));
sub_1000262BC((float *)v93, v79, (float)(*(float *)(v80 + 4) * 0.5) + -69.5);
sub_1003E32F0(v78, v93, 1, 6, 0, 0, 0, 0.4);
v81 = GameManager::sharedState();
if ( !GameManager::getUGV(v81, "29") )
{
*(_BYTE *)(a1 + 432) = 1;
v82 = cocos2d::CCDelayTime::create(1.2);
v83 = (unsigned __int8)cocos2d::CCCallFunc::create(a1, (__int64)sub_1003E39F4, 0);
v91 = sub_10021D420((__int64)v82, v84, v85, v86, v87, v88, v89, v90, v83);
cocos2d::CCNode::runAction(a1, v91);
}
}
return v2;
}