//
// LevelAreaInnerLayer::init from 0x1002662d0 to 0x1002670b4 (3556 bytes)
//
// 2 xrefs:
// > LevelAreaInnerLayer::scene @ 0x100265fde
// > LevelAreaInnerLayer::create @ 0x100266297
//
// This function is hookable on this platform (idp: pc, 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 12:27:34 +0000
//
__int64 __fastcall LevelAreaInnerLayer::init(__int64 a1, int a2, double a3)
{
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // r14
void *v8; // rbx
__int64 v9; // rax
int v10; // edx
int v11; // ecx
int v12; // r8d
int v13; // r9d
__int64 v14; // rdi
__int64 v15; // rsi
__int64 v16; // rdi
__int64 v17; // rax
double v18; // xmm0_8
__int64 v19; // rax
double v20; // xmm0_8
__int64 v21; // r12
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
bool hasCompletedMainLevel; // r14
char v26; // r14
const std::string::value_type *v27; // rsi
std::string::pointer data; // rdi
__int64 v29; // rbx
_WORD *v30; // r13
__int64 v31; // rbx
bool hasSecretCoin; // bl
const char *v33; // rdi
__int64 v34; // r14
__int64 v35; // rbx
bool v36; // bl
const char *v37; // rdi
__int64 v38; // r14
__int64 v39; // rbx
bool v40; // bl
const char *v41; // rdi
__int64 v42; // r14
__int64 v43; // rax
void *v44; // rax
_QWORD *v45; // r15
__int64 v46; // rbx
__int64 v47; // rbx
__int64 v48; // rbx
__int64 v49; // rbx
__int64 v50; // rbx
__int64 v51; // rax
__int64 v52; // rax
__int64 v53; // rbx
int v54; // r14d
int v55; // eax
int v56; // ecx
int v57; // r8d
int v58; // r9d
__int64 v59; // rax
void *v60; // rbx
__int64 v61; // rdi
__int64 v62; // rax
float v63; // xmm0_4
__int64 v64; // rbx
__int64 v65; // rax
__int64 v66; // rax
int v67; // eax
int v68; // ecx
int v69; // r8d
int v70; // r9d
__int64 v71; // rax
__int64 v72; // rax
int v73; // eax
int v74; // ecx
int v75; // r8d
int v76; // r9d
__int64 v77; // rax
__int64 v78; // rbx
int v79; // r14d
int v80; // eax
int v81; // ecx
int v82; // r8d
int v83; // r9d
__int64 v84; // rax
void *v85; // rbx
__int64 v86; // rdi
__int64 v87; // rdi
__int64 v88; // rax
double v89; // xmm0_8
std::string *v90; // rsi
void *v91; // rdi
__int64 v92; // rdx
double v93; // xmm0_8
void *v94; // rax
int v95; // ebx
int v96; // eax
int v97; // ecx
int v98; // r8d
int v99; // r9d
__int64 v100; // rax
__int64 v101; // rax
float v103[2]; // [rsp+Ch] [rbp-D4h] BYREF
int v104; // [rsp+14h] [rbp-CCh]
unsigned int *v105; // [rsp+18h] [rbp-C8h]
__int64 MainLevel; // [rsp+20h] [rbp-C0h]
char v107[8]; // [rsp+2Ch] [rbp-B4h] BYREF
unsigned int v108; // [rsp+34h] [rbp-ACh]
__int64 v109; // [rsp+38h] [rbp-A8h]
__int64 v110; // [rsp+40h] [rbp-A0h]
unsigned __int8 v111; // [rsp+4Fh] [rbp-91h]
std::string v112; // [rsp+50h] [rbp-90h] BYREF
void *v113; // [rsp+68h] [rbp-78h]
float v114; // [rsp+74h] [rbp-6Ch]
__int64 v115; // [rsp+78h] [rbp-68h]
double v116; // [rsp+80h] [rbp-60h] BYREF
__int16 v117; // [rsp+88h] [rbp-58h] BYREF
char v118; // [rsp+8Ah] [rbp-56h]
char v119[8]; // [rsp+90h] [rbp-50h] BYREF
char v120[8]; // [rsp+98h] [rbp-48h] BYREF
char v121[8]; // [rsp+A0h] [rbp-40h] BYREF
char v122[8]; // [rsp+A8h] [rbp-38h] BYREF
v111 = cocos2d::CCLayer::init(a1);
if ( !v111 )
return v111;
v104 = a2;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
v3 = *(_QWORD *)a1;
v115 = a1;
(*(void (__fastcall **)(__int64, __int64))(v3 + 1088))(a1, 1);
v4 = cocos2d::CCDirector::sharedDirector(a1, 1);
cocos2d::CCDirector::getWinSize(v103, v4);
v5 = cocos2d::CCTextureCache::sharedTextureCache(v103);
cocos2d::CCTextureCache::addImage(v5, "TowerSheet.png", 0);
v6 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(a3);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile_2(v6, "TowerSheet.plist");
v7 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v7 + 912LL))(v7, 0);
v8 = CCMenuItemSpriteExtra::create(v7, 0, v115, (__int64)LevelAreaInnerLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v8, 1.6);
v9 = cocos2d::CCFadeIn::create(0.30000001);
cocos2d::CCNode::runAction(v7, v9);
v110 = sub_1008735E0((_DWORD)v8, 0, v10, v11, v12, v13);
v14 = v115;
v15 = v110;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v115 + 464LL))(v115, v110, 1);
v16 = cocos2d::CCDirector::sharedDirector(v14, v15);
v114 = sub_100479760(v16);
v17 = cocos2d::CCDirector::sharedDirector(v16, v15);
v18 = sub_100479740(v17);
sub_100278250(v119, v114 + 24.0, *(float *)&v18 + -23.0);
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v110 + 184LL))(v110, v119);
if ( (unsigned __int8)PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(v115, v8);
v113 = cocos2d::CCNode::create();
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v115 + 456LL))(v115, v113);
v109 = cocos2d::CCMenu::create();
v19 = cocos2d::CCSprite::createWithSpriteFrameName("towerBG_01_001.png");
(*(void (__fastcall **)(void *, __int64, __int64))(*(_QWORD *)v113 + 464LL))(v113, v19, 1);
sub_100278250(v119, v103[0] * 0.5, 0.5 * v103[1]);
(*(void (__fastcall **)(void *, char *))(*(_QWORD *)v113 + 184LL))(v113, v119);
sub_1002782A0(v119);
sub_1002782A0(v120);
sub_1002782A0(v121);
sub_1002782A0(v122);
sub_100278250(&v112, -95.5, -89.25);
v105 = (unsigned int *)v119;
sub_100278300(v119, &v112);
sub_100278250(&v112, 103.75, -33.5);
sub_100278300(v120, &v112);
sub_100278250(&v112, -95.5, 21.25);
sub_100278300(v121, &v112);
sub_100278250(&v112, 57.5, 75.5);
v20 = sub_100278300(v122, &v112);
v21 = 0;
v108 = 0;
do
{
v22 = GameLevelManager::sharedState(v20);
MainLevel = GameLevelManager::getMainLevel(v22, (unsigned int)(v21 + 5001), 1);
v23 = GameStatsManager::sharedState();
LOBYTE(v114) = GameStatsManager::hasCompletedMainLevel(v23, (unsigned int)(v21 + 5001));
if ( v21 )
{
v24 = GameStatsManager::sharedState();
hasCompletedMainLevel = GameStatsManager::hasCompletedMainLevel(v24, (unsigned int)v21 | 0x1388);
}
else
{
hasCompletedMainLevel = 1;
}
v112.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x20u);
v112.__r_.__value_.__r.__words[0] = 33;
v112.__r_.__value_.__l.__size_ = 24;
v20 = *(double *)"towerDoor_locked_001.png";
strcpy(v112.__r_.__value_.__l.__data_, "towerDoor_locked_001.png");
v26 = LOBYTE(v114) | hasCompletedMainLevel;
if ( (v26 & 1) != 0 )
{
v27 = "towerDoor_unlocked_001.png";
if ( LOBYTE(v114) )
v27 = "towerDoor_open_001.png";
std::string::assign(&v112, v27);
}
data = v112.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v112.__r_.__value_.__s.0 & 1) != 0 )
data = v112.__r_.__value_.__l.__data_;
v29 = cocos2d::CCSprite::createWithSpriteFrameName(data);
v30 = CCMenuItemSpriteExtra::create(v29, 0, v115, (__int64)LevelAreaInnerLayer::onDoor, 0);
v30[204] = 256;
(*(void (__fastcall **)(_WORD *, _QWORD))(*(_QWORD *)v30 + 72LL))(v30, (unsigned int)(v21 + 5001));
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v109 + 456LL))(v109, v30);
if ( (v26 & 1) == 0 )
{
BYTE2(v116) = -1;
LOWORD(v116) = -6703;
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v29 + 960LL))(v29, &v116);
(*(void (__fastcall **)(_WORD *, _QWORD))(*(_QWORD *)v30 + 1056LL))(v30, 0);
}
cocos2d::CCNode::convertToNodeSpace(&v116, v109, v105);
(*(void (__fastcall **)(_WORD *, double *))(*(_QWORD *)v30 + 184LL))(v30, &v116);
if ( LOBYTE(v114) )
{
sub_100278250(&v117, 0.0, 32.0);
sub_100278350(&v116, v105, &v117);
v31 = GameStatsManager::sharedState();
GJGameLevel::getCoinKey_1(MainLevel, 1);
hasSecretCoin = GameStatsManager::hasSecretCoin(v31);
v33 = "GJ_coinsIcon_gray_001.png";
if ( hasSecretCoin )
v33 = "GJ_coinsIcon_001.png";
v34 = cocos2d::CCSprite::createWithSpriteFrameName(v33);
if ( hasSecretCoin )
{
v118 = -1;
v117 = -1;
}
else
{
v118 = -31;
v117 = -7711;
}
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v34 + 960LL))(v34, &v117);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v34 + 160LL))(v34, 0.69999999);
(*(void (__fastcall **)(void *, __int64, __int64))(*(_QWORD *)v113 + 464LL))(v113, v34, 10);
sub_100278250(v107, -20.0, 0.0);
sub_100278350(&v117, &v116, v107);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v34 + 184LL))(v34, &v117);
v35 = GameStatsManager::sharedState();
GJGameLevel::getCoinKey_1(MainLevel, 2);
v36 = GameStatsManager::hasSecretCoin(v35);
v37 = "GJ_coinsIcon_gray_001.png";
if ( v36 )
v37 = "GJ_coinsIcon_001.png";
v38 = cocos2d::CCSprite::createWithSpriteFrameName(v37);
if ( v36 )
{
v118 = -1;
v117 = -1;
}
else
{
v118 = -31;
v117 = -7711;
}
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v38 + 960LL))(v38, &v117);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v38 + 160LL))(v38, 0.69999999);
(*(void (__fastcall **)(void *, __int64, __int64))(*(_QWORD *)v113 + 464LL))(v113, v38, 10);
sub_100278250(v107, 0.0, 8.0);
sub_100278350(&v117, &v116, v107);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v38 + 184LL))(v38, &v117);
v39 = GameStatsManager::sharedState();
GJGameLevel::getCoinKey_1(MainLevel, 3);
v40 = GameStatsManager::hasSecretCoin(v39);
v41 = "GJ_coinsIcon_gray_001.png";
if ( v40 )
v41 = "GJ_coinsIcon_001.png";
v42 = cocos2d::CCSprite::createWithSpriteFrameName(v41);
if ( v40 )
{
v118 = -1;
v117 = -1;
}
else
{
v118 = -31;
v117 = -7711;
}
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v42 + 960LL))(v42, &v117);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v42 + 160LL))(v42, 0.69999999);
(*(void (__fastcall **)(void *, __int64, __int64))(*(_QWORD *)v113 + 464LL))(v113, v42, 10);
*(_QWORD *)&v20 = 1101004800;
sub_100278250(v107, 20.0, 0.0);
sub_100278350(&v117, &v116, v107);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v42 + 184LL))(v42, &v117);
}
if ( (*(_BYTE *)&v112.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v112.__r_.__value_.__l.__data_);
v108 += LOBYTE(v114);
++v21;
v105 += 2;
}
while ( v21 != 4 );
v43 = cocos2d::CCSprite::createWithSpriteFrameName("towerLockedArrow_001.png");
v44 = CCMenuItemSpriteExtra::create(v43, 0, v115, (__int64)LevelAreaInnerLayer::onNextFloor, 0);
*(_QWORD *)(v115 + 416) = v44;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v109 + 456LL))(v109, v44);
v45 = (_QWORD *)(v115 + 416);
v46 = *(_QWORD *)(v115 + 416);
sub_100278250(&v116, -96.0, 108.0);
cocos2d::CCNode::convertToNodeSpace((double *)&v112, v109, (unsigned int *)&v116);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v46 + 184LL))(v46, &v112);
(*(void (__fastcall **)(void *, __int64, __int64))(*(_QWORD *)v113 + 464LL))(v113, v109, 2);
v47 = cocos2d::CCSprite::createWithSpriteFrameName("towerTorchInner_001.png");
(*(void (__fastcall **)(void *, __int64, __int64))(*(_QWORD *)v113 + 464LL))(v113, v47, 4);
sub_100278250(&v112, -195.0, 4.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v47 + 184LL))(v47, &v112);
v48 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v47 + 192LL))(v47);
sub_100278250(&v116, 0.0, 33.0);
sub_100278350(&v112, v48, &v116);
LevelAreaLayer::addTorch((__int64)v113, (__int64)&v112, 2, 4, 1, 0, 1.0, 0);
v49 = cocos2d::CCSprite::createWithSpriteFrameName("towerTorchInner_001.png");
(*(void (__fastcall **)(void *, __int64, __int64))(*(_QWORD *)v113 + 464LL))(v113, v49, 4);
sub_100278250(&v112, 195.0, 4.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v49 + 184LL))(v49, &v112);
v50 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v49 + 192LL))(v49);
sub_100278250(&v116, 0.0, 33.0);
sub_100278350(&v112, v50, &v116);
LevelAreaLayer::addTorch((__int64)v113, (__int64)&v112, 2, 4, 1, 0, 1.0, 0);
if ( !(_BYTE)v104 )
{
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v113 + 160LL))(v113, 0.2);
v51 = cocos2d::CCScaleTo::create_1(1.0, 1.0);
v52 = cocos2d::CCEaseExponentialOut::create(v51);
cocos2d::CCNode::runAction((__int64)v113, v52);
}
v53 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock4_small_001.png");
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v53 + 912LL))(v53, 0);
v54 = cocos2d::CCDelayTime::create(0.5);
v55 = cocos2d::CCFadeTo::create(200, 2.0);
v59 = sub_10039EB60(v54, v55, 0, v56, v57, v58);
cocos2d::CCNode::runAction(v53, v59);
v60 = CCMenuItemSpriteExtra::create(v53, 0, v115, (__int64)LevelAreaInnerLayer::onOnlineVault, 0);
v61 = v110;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v110 + 456LL))(v110, v60);
v62 = cocos2d::CCDirector::sharedDirector(v61, v60);
v63 = sub_100479770(v62);
sub_100278250(&v116, v63 + -22.0, 23.0);
cocos2d::CCNode::convertToNodeSpace((double *)&v112, v110, (unsigned int *)&v116);
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v60 + 184LL))(v60, &v112);
v64 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v113 + 192LL))(v113);
sub_100278250(&v116, 0.0, -2.0);
sub_100278350(&v112, v64, &v116);
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v113 + 184LL))(v113, &v112);
sub_100278250(&v112, 0.0, 4.0);
v65 = cocos2d::CCMoveBy::create(&v112, 2.0);
LODWORD(v64) = cocos2d::CCEaseInOut::create(v65, 2.0);
sub_100278250(&v112, 0.0, -4.0);
v66 = cocos2d::CCMoveBy::create(&v112, 2.0);
v67 = cocos2d::CCEaseInOut::create(v66, 2.0);
v71 = sub_10039EB60(v64, v67, 0, v68, v69, v70);
v72 = cocos2d::CCRepeatForever::create(v71);
cocos2d::CCNode::runAction((__int64)v113, v72);
LODWORD(v64) = cocos2d::CCDelayTime::create(0.0);
v73 = cocos2d::CCCallFunc::create(v115, LevelAreaInnerLayer::tryResumeTowerMusic, 0);
v77 = sub_10039EB60(v64, v73, 0, v74, v75, v76);
cocos2d::CCNode::runAction(v115, v77);
strcpy((char *)&v112, "&GJ_infoIcon_001.png");
v78 = CCSpriteGrayscale::createWithSpriteFrameName(&v112);
if ( (*(_BYTE *)&v112.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v112.__r_.__value_.__l.__data_);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v78 + 912LL))(v78, 0);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v78 + 160LL))(v78, 0.80000001);
v79 = cocos2d::CCDelayTime::create(0.1);
v80 = cocos2d::CCFadeTo::create(200, 1.0);
v84 = sub_10039EB60(v79, v80, 0, v81, v82, v83);
cocos2d::CCNode::runAction(v78, v84);
v85 = CCMenuItemSpriteExtra::create(v78, 0, v115, (__int64)LevelAreaInnerLayer::onInfo, 0);
v86 = v110;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v110 + 456LL))(v110, v85);
v87 = cocos2d::CCDirector::sharedDirector(v86, v85);
v114 = sub_100479770(v87);
v88 = cocos2d::CCDirector::sharedDirector(v87, v85);
v89 = sub_100479740(v88);
sub_100278250(&v116, v114 + -20.0, *(float *)&v89 + -20.0);
cocos2d::CCNode::convertToNodeSpace((double *)&v112, v110, (unsigned int *)&v116);
v90 = &v112;
v91 = v85;
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v85 + 184LL))(v85, &v112);
if ( v108 == 4 )
{
*(_QWORD *)&v93 = GameManager::sharedState(v85, &v112, v92).u64[0];
v90 = (std::string *)"33";
v91 = v94;
if ( (unsigned __int8)GameManager::getUGV(v94, "33", v93) )
goto LABEL_45;
*(_BYTE *)(v115 + 424) = 1;
v95 = cocos2d::CCDelayTime::create(1.0);
v96 = cocos2d::CCCallFunc::create(v115, LevelAreaInnerLayer::showFloor1CompleteDialog, 0);
v100 = sub_10039EB60(v95, v96, 0, v97, v98, v99);
cocos2d::CCNode::runAction(v115, v100);
}
else if ( v108 >= 4 )
{
goto LABEL_45;
}
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v115 + 416) + 1056LL))(*(_QWORD *)(v115 + 416), 0);
v91 = (void *)*v45;
v90 = nullptr;
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*v45 + 344LL))(*v45, 0);
LABEL_45:
if ( !*(_BYTE *)(v115 + 424) )
{
GameManager::sharedState(v91, v90, v92);
*(_BYTE *)(v101 + 1064) = 0;
}
return v111;
}