//
// LevelAreaLayer::init from 0x100343b7c to 0x10034467c (2816 bytes)
//
// 2 xrefs:
// > LevelAreaLayer::create @ 0x100343b30
// > ??> @ 0x1007f1320
//
// 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
//
bool __fastcall LevelAreaLayer::init(LevelAreaLayer *a1)
{
_BOOL4 v2; // w19
GameManager *v3; // x21
cocos2d::CCArray *v4; // x0
cocos2d::CCTextureCache *v5; // x0
cocos2d::CCSpriteFrameCache *v6; // x0
cocos2d::CCDirector *v7; // x0
cocos2d::CCSprite *v8; // x0
CCMenuItemSpriteExtra *v9; // x21
__int64 v10; // x1
__int64 v11; // x2
__int64 v12; // x3
__int64 v13; // x4
__int64 v14; // x5
__int64 v15; // x6
__int64 v16; // x7
cocos2d::CCMenu *v17; // x22
cocos2d::CCDirector *v18; // x0
float v19; // s8
cocos2d::CCDirector *v20; // x0
__n128 v21; // q1
__n128 v22; // q0
GameManager *v23; // x0
const char *BGTexture; // x0
cocos2d::CCSprite *v25; // x21
cocos2d::CCTexture2D *v26; // x0
__n128 v27; // q0
__n128 v28; // q1
__n128 v29; // q0
__n128 v30; // q1
cocos2d::CCLayerGradient *v31; // x21
__n128 v32; // q0
__n128 v33; // q1
cocos2d::CCFadeTo *v34; // x0
cocos2d::CCEaseInOut *v35; // x22
cocos2d::CCFadeTo *v36; // x0
char v37; // w0
__int64 v38; // x1
__int64 v39; // x2
__int64 v40; // x3
__int64 v41; // x4
__int64 v42; // x5
__int64 v43; // x6
__int64 v44; // x7
cocos2d::CCSequence *v45; // x0
cocos2d::CCRepeatForever *v46; // x0
cocos2d::CCSprite *v47; // x0
__n128 v48; // q0
cocos2d::CCSprite *m_towerSprite; // x21
__n128 v50; // q1
cocos2d::CCSprite *v51; // x21
CCMenuItemSpriteExtra *v52; // x22
__int64 v53; // x1
__int64 v54; // x2
__int64 v55; // x3
__int64 v56; // x4
__int64 v57; // x5
__int64 v58; // x6
__int64 v59; // x7
cocos2d::CCMenu *v60; // x23
float32x2_t *v61; // x24
__n128 v62; // q1
__n128 v63; // q0
char v64; // w25
cocos2d::CCSprite *v65; // x23
__n128 v66; // q1
int v67; // w26
__n128 v68; // q0
cocos2d::CCSprite *v69; // x21
__n128 v70; // q0
__n128 v71; // q1
cocos2d::CCSprite *v72; // x21
float32x2_t *v73; // x22
__n128 v74; // q0
__n128 v75; // q1
double v76; // d0
__n128 v77; // q0
__n128 v78; // q1
cocos2d::CCMoveBy *v79; // x0
cocos2d::CCEaseInOut *v80; // x21
__n128 v81; // q0
__n128 v82; // q1
cocos2d::CCMoveBy *v83; // x0
char v84; // w0
__int64 v85; // x1
__int64 v86; // x2
__int64 v87; // x3
__int64 v88; // x4
__int64 v89; // x5
__int64 v90; // x6
__int64 v91; // x7
cocos2d::CCSequence *v92; // x0
cocos2d::CCRepeatForever *v93; // x0
__n128 v94; // q0
__n128 v95; // q1
__n128 v96; // q0
__n128 v97; // q1
__n128 v98; // q0
__n128 v99; // q1
__n128 v100; // q0
__n128 v101; // q1
__n128 v102; // q0
__n128 v103; // q1
__n128 v104; // q0
__n128 v105; // q1
__n128 v106; // q0
__n128 v107; // q1
cocos2d::CCParticleSystemQuad *v108; // x21
__n128 v109; // q0
__n128 v110; // q1
__n128 v111; // q0
__n128 v112; // q1
double v113; // d0
int v114; // w22
cocos2d::CCSprite *v115; // x21
float v116; // s8
__n128 v117; // q1
__n128 v118; // q0
float v119; // s2
GameManager *v120; // x0
cocos2d::CCDelayTime *v121; // x21
char v122; // w0
__int64 v123; // x1
__int64 v124; // x2
__int64 v125; // x3
__int64 v126; // x4
__int64 v127; // x5
__int64 v128; // x6
__int64 v129; // x7
cocos2d::CCSequence *v130; // x0
void *v132[2]; // [xsp+10h] [xbp-D0h] BYREF
char v133; // [xsp+27h] [xbp-B9h]
float32x2_t v134; // [xsp+28h] [xbp-B8h] BYREF
float32x2_t v135; // [xsp+30h] [xbp-B0h] BYREF
std::string __str; // [xsp+38h] [xbp-A8h] BYREF
__int128 v137; // [xsp+50h] [xbp-90h] BYREF
float v138; // [xsp+60h] [xbp-80h]
float v139; // [xsp+64h] [xbp-7Ch]
void *__p[2]; // [xsp+68h] [xbp-78h] BYREF
char v141; // [xsp+7Fh] [xbp-61h]
cocos2d::CCPoint v142; // 0:kr08_8.8
cocos2d::SEL_CallFunc v143; // 0:x1.16
cocos2d::SEL_MenuHandler v144; // 0:x3.16
cocos2d::SEL_MenuHandler v145; // 0:x3.16
cocos2d::CCPoint v146; // 0:s0.4,4:s1.4
cocos2d::CCPoint v147; // 0:s5.4,4:s6.4
cocos2d::CCPoint v148; // 0:s5.4,4:s6.4
cocos2d::CCPoint v149; // 0:s5.4,4:s6.4
cocos2d::CCPoint v150; // 0:s5.4,4:s6.4
cocos2d::CCPoint v151; // 0:s5.4,4:s6.4
cocos2d::CCPoint v152; // 0:s5.4,4:s6.4
v2 = cocos2d::CCLayer::init(a1);
if ( v2 )
{
v3 = GameManager::sharedState();
sub_100009900(__p, "tower01.mp3");
GameManager::fadeInMusic((__int64)v3, (__int64)__p);
if ( v141 < 0 )
operator delete(__p[0]);
v4 = (cocos2d::CCArray *)sub_10024A15C();
a1->m_godRays = v4;
cocos2d::CCObject::retain(v4);
v5 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v5, "TowerSheet.png", 0);
v6 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v6, "TowerSheet.plist");
((void (__fastcall *)(LevelAreaLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(LevelAreaLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v7);
v8 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v144.ptr = (void (__cdecl *)(cocos2d::CCObject *))LevelAreaLayer::onBack;
v144.adj = 0;
v9 = CCMenuItemSpriteExtra::create(v8, nullptr, a1, v144);
CCMenuItemSpriteExtra::setSizeMult(v9, 1.6);
v17 = sub_1001D7ED0(v9, v10, v11, v12, v13, v14, v15, v16, 0);
((void (__fastcall *)(LevelAreaLayer *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v17, 1);
v18 = cocos2d::CCDirector::sharedDirector();
v19 = sub_1001768D8((__int64)v18) + 24.0;
v20 = cocos2d::CCDirector::sharedDirector();
v21.n128_f32[0] = sub_1001768C8((__int64)v20) + -23.0;
v22.n128_f32[0] = v19;
sub_100022980(v22, v21, v132);
((void (__fastcall *)(cocos2d::CCMenu *, void **))v17->setPosition)(v17, v132);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v9);
v23 = GameManager::sharedState();
BGTexture = GameManager::getBGTexture(v23, 23);
v25 = cocos2d::CCSprite::create(BGTexture);
v137 = xmmword_100636BB0;
v26 = (cocos2d::CCTexture2D *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v25->getTexture)(v25);
cocos2d::CCTexture2D::setTexParameters(v26, (cocos2d::ccTexParams *)&v137);
v27 = ((__n128 (__fastcall *)(LevelAreaLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v25, 4294967293LL);
v27.n128_u32[0] = 0;
v28.n128_u32[0] = 0;
sub_100022980(v27, v28, v132);
((void (__fastcall *)(cocos2d::CCSprite *, void **))v25->setAnchorPoint)(v25, v132);
v29 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))v25->setScale)(v25, v138 / v25->m_obRect.size.width);
v30.n128_u32[0] = -1035468800;
v29.n128_u32[0] = 0;
sub_100022980(v29, v30, v132);
((void (__fastcall *)(cocos2d::CCSprite *, void **))v25->setPosition)(v25, v132);
BYTE2(v132[0]) = -76;
LOWORD(v132[0]) = 15360;
((void (__fastcall *)(cocos2d::CCSprite *, void **))v25->setColor)(v25, v132);
LODWORD(v132[0]) = -1761607936;
v135.i32[0] = 16776960;
v31 = cocos2d::CCLayerGradient::create((const cocos2d::ccColor4B *)v132, (const cocos2d::ccColor4B *)&v135);
v32.n128_u32[0] = 0;
v33.n128_u32[0] = 1.0;
sub_100022980(v32, v33, v132);
((void (__fastcall *)(cocos2d::CCLayerGradient *, void **))v31->setAnchorPoint)(v31, v132);
((void (__fastcall *)(cocos2d::CCLayerGradient *, __int64))v31->setBlendFunc)(v31, 0x100000302LL);
v31->m_bShouldPremultiply = 1;
((void (__fastcall *)(cocos2d::CCLayerGradient *, float))v31->setScaleY)(v31, 0.7);
((void (__fastcall *)(cocos2d::CCLayerGradient *))v31->updateColor)(v31);
((void (__fastcall *)(LevelAreaLayer *, cocos2d::CCLayerGradient *, __int64))a1->addChild_0)(a1, v31, 2);
v34 = cocos2d::CCFadeTo::create(3.0, 0xFFu);
v35 = cocos2d::CCEaseInOut::create(v34, 2.0);
v36 = cocos2d::CCFadeTo::create(3.0, 0x96u);
v37 = (unsigned __int8)cocos2d::CCEaseInOut::create(v36, 2.0);
v45 = sub_10018A494(v35, v38, v39, v40, v41, v42, v43, v44, v37);
v46 = cocos2d::CCRepeatForever::create(v45);
cocos2d::CCNode::runAction(v31, v46);
v47 = cocos2d::CCSprite::createWithSpriteFrameName("theTower_01_001.png");
a1->m_towerSprite = v47;
((void (__fastcall *)(LevelAreaLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v47, 1);
v48 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))a1->m_towerSprite->setScale)(a1->m_towerSprite, 1.0);
m_towerSprite = a1->m_towerSprite;
v48.n128_f32[0] = v138 * 0.5;
v50.n128_f32[0] = v139 * 0.5;
sub_100022980(v48, v50, v132);
((void (__fastcall *)(cocos2d::CCSprite *, void **))m_towerSprite->setPosition)(m_towerSprite, v132);
v51 = cocos2d::CCSprite::createWithSpriteFrameName("whiteSquare60_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v51->setScaleX)(v51, 2.0);
((void (__fastcall *)(cocos2d::CCSprite *, float))v51->setScaleY)(v51, 2.2);
v145.ptr = (void (__cdecl *)(cocos2d::CCObject *))LevelAreaLayer::onClickDoor;
v145.adj = 0;
v52 = CCMenuItemSpriteExtra::create(v51, nullptr, a1, v145);
sub_100009900(&__str, "door02.ogg");
std::string::operator=((std::string *)&v52->m_activateSound, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v60 = sub_1001D7ED0(v52, v53, v54, v55, v56, v57, v58, v59, 0);
((void (__fastcall *)(LevelAreaLayer *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v60, 10);
v61 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_towerSprite->getPosition)(a1->m_towerSprite);
v62.n128_u32[0] = -1030356992;
v63.n128_u32[0] = 0;
sub_100022980(v63, v62, &v134);
sub_1000229DC(v61, &v134, &v135);
v142 = cocos2d::CCNode::convertToNodeSpace(v60, (const cocos2d::CCPoint *)&v135);
((void (__fastcall *)(CCMenuItemSpriteExtra *, void **, float, float))v52->setPosition)(v52, v132, v142.x, v142.y);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v51->setOpacity)(v51, 0);
v64 = 1;
do
{
v65 = cocos2d::CCSprite::createWithSpriteFrameName("godray01_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, void *))v65->setColor)(v65, &unk_1006454F4);
((void (__fastcall *)(LevelAreaLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v65, 0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::CCSprite *, float))v65->setScaleX)(v65, v139 / v65->m_obRect.size.width);
((void (__fastcall *)(cocos2d::CCSprite *, float))v65->setScaleY)(v65, 3.0);
((void (__fastcall *)(cocos2d::CCSprite *, float))v65->setRotation)(v65, 90.0);
v67 = v64 & 1;
v68.n128_f32[0] = v138;
if ( (v64 & 1) != 0 )
v68.n128_f32[0] = 0.0;
v66.n128_f32[0] = v139 * 0.5;
sub_100022980(v68, v66, v132);
((void (__fastcall *)(cocos2d::CCSprite *, void **))v65->setPosition)(v65, v132);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v65->setOpacity)(v65, 125);
BYTE2(v132[0]) = 50;
LOWORD(v132[0]) = 0;
((void (__fastcall *)(cocos2d::CCSprite *, void **))v65->setColor)(v65, v132);
v64 = 0;
}
while ( v67 );
v69 = cocos2d::CCSprite::createWithSpriteFrameName("godray01_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, void *))v69->setColor)(v69, &unk_1006454F4);
((void (__fastcall *)(LevelAreaLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v69, 0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::CCSprite *, float))v69->setScaleX)(v69, v138 / v69->m_obRect.size.width);
v70 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))v69->setScaleY)(v69, 1.0);
v70.n128_f32[0] = v138 * 0.5;
v71.n128_u32[0] = 0;
sub_100022980(v70, v71, v132);
((void (__fastcall *)(cocos2d::CCSprite *, void **))v69->setPosition)(v69, v132);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v69->setOpacity)(v69, 125);
BYTE2(v132[0]) = 50;
LOWORD(v132[0]) = 0;
((void (__fastcall *)(cocos2d::CCSprite *, void **))v69->setColor)(v69, v132);
v72 = a1->m_towerSprite;
v73 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v72->getPosition)(v72);
v74.n128_u32[0] = 0;
v75.n128_u32[0] = -2.0;
sub_100022980(v74, v75, &v135);
*(float32x2_t *)&v76 = sub_1000229DC(v73, &v135, (float32x2_t *)v132);
v77 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, void **, double))v72->setPosition)(v72, v132, v76);
v77.n128_u32[0] = 0;
v78.n128_u32[0] = 4.0;
sub_100022980(v77, v78, v132);
v79 = cocos2d::CCMoveBy::create(2.0, (const cocos2d::CCPoint *)v132);
v80 = cocos2d::CCEaseInOut::create(v79, 2.0);
v81.n128_u32[0] = 0;
v82.n128_u32[0] = -4.0;
sub_100022980(v81, v82, v132);
v83 = cocos2d::CCMoveBy::create(2.0, (const cocos2d::CCPoint *)v132);
v84 = (unsigned __int8)cocos2d::CCEaseInOut::create(v83, 2.0);
v92 = sub_10018A494(v80, v85, v86, v87, v88, v89, v90, v91, v84);
v93 = cocos2d::CCRepeatForever::create(v92);
cocos2d::CCNode::runAction(a1->m_towerSprite, v93);
v94.n128_f32[0] = v138 * 0.5;
v95.n128_f32[0] = (float)(v139 * 0.5) + 13.0;
sub_100022980(v94, v95, &v135);
v96.n128_u32[0] = 0;
v97.n128_u32[0] = 0;
sub_100022980(v96, v97, &v134);
sub_1000229DC(&v135, &v134, (float32x2_t *)v132);
LevelAreaLayer::addGodRay(a1, 50.0, 0.0, 125.0, 5.0, 4.0, v147);
v98.n128_u32[0] = 0;
v99.n128_u32[0] = 10.0;
sub_100022980(v98, v99, &v134);
sub_1000229DC(&v135, &v134, (float32x2_t *)v132);
LevelAreaLayer::addGodRay(a1, 25.0, 125.0, 0.0, 3.0, 2.5, v148);
v100.n128_u32[0] = 0;
v101.n128_u32[0] = 20.0;
sub_100022980(v100, v101, &v134);
sub_1000229DC(&v135, &v134, (float32x2_t *)v132);
LevelAreaLayer::addGodRay(a1, 125.0, 25.0, 125.0, 4.0, 3.0, v149);
v102.n128_u32[0] = 0;
v103.n128_u32[0] = -20.0;
sub_100022980(v102, v103, &v134);
sub_1000229DC(&v135, &v134, (float32x2_t *)v132);
LevelAreaLayer::addGodRay(a1, 75.0, 0.0, 100.0, 6.0, 2.5, v150);
v104.n128_u32[0] = 0;
v105.n128_u32[0] = -10.0;
sub_100022980(v104, v105, &v134);
sub_1000229DC(&v135, &v134, (float32x2_t *)v132);
LevelAreaLayer::addGodRay(a1, 0.0, 100.0, 25.0, 5.0, 3.5, v151);
v106.n128_u32[0] = 0;
v107.n128_u32[0] = 10.0;
sub_100022980(v106, v107, &v134);
sub_1000229DC(&v135, &v134, (float32x2_t *)v132);
LevelAreaLayer::addGodRay(a1, 0.0, 75.0, 25.0, 4.5, 2.5, v152);
sub_100009900(
v132,
"60a-1a8a2a6a90a90a0a2a45a70a0a0a0a0a0a0a1a0a0a0a1a0a0.886275a0a0a0a0a0.7a1a0a0a0a1a0a0.552941a0a0a0a0a0.7a2a0a2a0a"
"0a0a0a0a0a0a0a2a1a0a0a0a0a0a0a0a0a0a0a0a0a0a0");
v108 = GameToolbox::particleFromString((__int64)v132, nullptr, 0);
if ( v133 < 0 )
operator delete(v132[0]);
((void (__fastcall *)(LevelAreaLayer *, cocos2d::CCParticleSystemQuad *, _QWORD))a1->addChild_0)(a1, v108, 0);
v109 = ((__n128 (__fastcall *)(cocos2d::CCParticleSystemQuad *, float))v108->setRotation)(v108, 30.0);
v109.n128_u32[0] = 1120403456;
v110.n128_u32[0] = 1109393408;
sub_100022980(v109, v110, v132);
v111 = ((__n128 (__fastcall *)(cocos2d::CCParticleSystemQuad *, void **))v108->setPosVar)(v108, v132);
v111.n128_u32[0] = -1027080192;
v112.n128_u32[0] = 1114636288;
sub_100022980(v111, v112, &v134);
*(float32x2_t *)&v113 = sub_1000229DC(&v135, &v134, (float32x2_t *)v132);
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, void **, double))v108->setPosition)(v108, v132, v113);
v114 = 20;
do
{
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, float))v108->update)(v108, 0.2);
--v114;
}
while ( v114 );
v115 = a1->m_towerSprite;
v116 = (float)(*(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v115->getContentSize)(v115) * 0.5) + 35.0;
v117.n128_f32[0] = (float)(*(float *)(((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_towerSprite->getContentSize)(a1->m_towerSprite)
+ 4)
* 0.5)
+ -69.5;
v118.n128_f32[0] = v116;
sub_100022980(v118, v117, v132);
v146.x = 0.4;
LevelAreaLayer::addTorch(v115, v146, (int)v132, v119, 1, 6, 0, nullptr);
v120 = GameManager::sharedState();
if ( !GameManager::getUGV(v120, "29") )
{
a1->m_enteringTower = 1;
v121 = cocos2d::CCDelayTime::create(1.2);
v143.ptr = (void (*)(void))LevelAreaLayer::showDialog;
v143.adj = 0;
v122 = (unsigned __int8)cocos2d::CCCallFunc::create(a1, v143);
v130 = sub_10018A494(v121, v123, v124, v125, v126, v127, v128, v129, v122);
cocos2d::CCNode::runAction(a1, v130);
}
}
return v2;
}