//
// SecretLayer3::init from 0x1403e9e90 to 0x1403eb4ed (5725 bytes)
//
// 5 xrefs:
// > SecretLayer2::onDoor @ 0x1403e4a61
// > SecretLayer2::onDoor @ 0x1403e4a68
// > SecretLayer2::onDoor @ 0x1403e4a52
// > ??> @ 0x1405d38a0
// > ??> @ 0x1406d8060
//
// 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
//
// Hidden C++ exception states: #wind=21
bool SecretLayer3::init(SecretLayer3 *a1)
{
float v1; // xmm3_4
bool result; // al
__int64 v4; // rcx
enum cocos2d::CCTexture2DPixelFormat v5; // ebx
cocos2d::CCTextureCache *v6; // rax
__int64 v7; // rcx
cocos2d::CCSpriteFrameCache *v8; // rax
__int64 v9; // rcx
_BOOL8 v10; // rdx
_BOOL8 v11; // rdx
__int64 v12; // rcx
cocos2d::CCDirector *v13; // rax
struct cocos2d::CCSprite *v14; // rdi
cocos2d::CCSprite_vtbl *v15; // rbx
const cocos2d::CCPoint *v16; // rax
float v17; // xmm0_4
cocos2d::CCSprite_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
struct cocos2d::CCSprite *v20; // r12
float v21; // xmm0_4
cocos2d::CCSprite_vtbl *v22; // rbx
const cocos2d::CCPoint *v23; // rax
struct cocos2d::CCSprite *v24; // rdi
float v25; // xmm0_4
cocos2d::CCSprite_vtbl *v26; // rbx
const cocos2d::CCPoint *v27; // rax
CCLightFlash *v28; // r13
float v29; // xmm0_4
CCLightFlash_vtbl *v30; // rbx
const cocos2d::CCPoint *v31; // rax
cocos2d::CCSprite_vtbl *v32; // rbx
double v33; // xmm0_8
float v34; // xmm0_4
cocos2d::CCSprite_vtbl *v35; // rbx
__int64 v36; // rax
__int64 v37; // rcx
cocos2d::CCArray *v38; // rsi
__int64 v39; // rcx
cocos2d::CCArray *v40; // r15
int i; // edi
cocos2d::CCString *v42; // rax
const char *CString; // rbx
__int64 v44; // rcx
cocos2d::CCSpriteFrameCache *v45; // rax
struct cocos2d::CCSpriteFrame *v46; // rax
cocos2d::CCString *v47; // rax
const char *v48; // rbx
__int64 v49; // rcx
cocos2d::CCSpriteFrameCache *v50; // rax
struct cocos2d::CCSpriteFrame *v51; // rax
struct cocos2d::CCAnimation *v52; // rax
struct cocos2d::CCAnimate *v53; // rax
struct cocos2d::CCRepeatForever *v54; // rax
cocos2d::ccColor3B *v55; // r8
struct cocos2d::CCAnimation *v56; // rax
struct cocos2d::CCAnimate *v57; // rax
struct cocos2d::CCRepeatForever *v58; // rax
cocos2d::ccColor3B *v59; // r8
struct cocos2d::CCSprite *v60; // rsi
__int64 v61; // rax
__int64 v62; // rdx
struct cocos2d::CCFadeTo *v63; // rax
struct cocos2d::CCEaseInOut *v64; // rdi
struct cocos2d::CCFadeTo *v65; // rax
struct cocos2d::CCEaseInOut *v66; // rax
struct cocos2d::CCSequence *v67; // rax
struct cocos2d::CCRepeatForever *v68; // rax
cocos2d::ccColor3B *v69; // r8
struct cocos2d::CCScaleTo *v70; // rax
struct cocos2d::CCEaseInOut *v71; // rdi
struct cocos2d::CCScaleTo *v72; // rax
struct cocos2d::CCEaseInOut *v73; // rax
struct cocos2d::CCSequence *v74; // rax
struct cocos2d::CCRepeatForever *v75; // rax
cocos2d::ccColor3B *v76; // r8
struct cocos2d::CCSprite *v77; // rsi
float v78; // xmm0_4
__int64 v79; // rax
double v80; // xmm0_8
struct cocos2d::CCSprite *v81; // rsi
__int64 v82; // rax
__int64 v83; // rdx
struct cocos2d::CCSprite *v84; // rdi
float v85; // xmm0_4
__int64 v86; // rax
DungeonBarsSprite *v87; // rbx
float v88; // xmm0_4
__int64 v89; // rax
double v90; // xmm0_8
GameManager *v91; // rcx
__int64 v92; // rax
GameManager *v93; // rcx
GameManager *v94; // rcx
cocos2d::CCSprite *v95; // rax
float v96; // xmm0_4
const cocos2d::CCPoint *v97; // rax
double v98; // xmm0_8
__int64 v99; // rcx
cocos2d::CCNode *v100; // rsi
__int64 v101; // rcx
cocos2d::CCArray *v102; // rax
__int64 v103; // rax
GameManager *v104; // rcx
struct cocos2d::CCSprite *v105; // rax
CCMenuItemSpriteExtra *v106; // rbx
float v107; // xmm0_4
GameManager *v108; // rcx
struct cocos2d::CCSprite *v109; // rax
CCMenuItemSpriteExtra *v110; // rbx
float v111; // xmm0_4
GameManager *v112; // rcx
struct cocos2d::CCSprite *v113; // rax
CCMenuItemSpriteExtra *v114; // rbx
float v115; // xmm0_4
GameManager *v116; // rcx
unsigned int j; // edi
struct cocos2d::CCObject *v118; // rbx
__int64 v119; // rcx
__int64 v120; // rcx
__int64 v121; // rbx
GJChestSprite *v122; // r15
cocos2d::CCArray *v123; // rax
struct cocos2d::CCObject *v124; // rax
CCMenuItemSpriteExtra *v125; // rdi
CCMenuItemSpriteExtra_vtbl *v126; // rbx
double v127; // xmm0_8
const cocos2d::CCSize *v128; // rax
GJChestSprite_vtbl *v129; // rbx
float *v130; // rax
const cocos2d::CCPoint *v131; // rax
float v132; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v133; // rbx
struct cocos2d::CCPoint v134; // rax
__int64 v135; // rcx
__int64 v136; // rcx
cocos2d::CCNode *v137; // rsi
__int64 v138; // rcx
__int64 v139; // rbx
GJChestSprite *v140; // rdi
CCMenuItemSpriteExtra *v141; // rbx
CCMenuItemSpriteExtra_vtbl *v142; // rbx
double v143; // xmm0_8
const cocos2d::CCSize *v144; // rax
GJChestSprite_vtbl *v145; // rbx
const cocos2d::CCSize *v146; // rax
const cocos2d::CCPoint *v147; // rax
float v148; // xmm0_4
__int64 v149; // rax
CCMenuItemSpriteExtra_vtbl *v150; // rbx
struct cocos2d::CCPoint v151; // rax
GameManager *v152; // rcx
struct cocos2d::CCSprite *v153; // rbx
CCMenuItemSpriteExtra *v154; // rsi
struct cocos2d::CCMenu *v155; // rdi
cocos2d::CCMenu_vtbl *v156; // rbx
__int64 v157; // rcx
cocos2d::CCDirector *v158; // rax
__int64 v159; // rcx
cocos2d::CCDirector *v160; // rax
float v161; // xmm0_4
const cocos2d::CCPoint *v162; // rax
__int64 v163; // rcx
float v164; // [rsp+28h] [rbp-E0h]
float v165; // [rsp+28h] [rbp-E0h]
float v166; // [rsp+28h] [rbp-E0h]
float v167; // [rsp+28h] [rbp-E0h]
void *v168; // [rsp+38h] [rbp-D0h]
struct cocos2d::CCSprite *v169; // [rsp+38h] [rbp-D0h]
void *v170; // [rsp+38h] [rbp-D0h]
void *v171; // [rsp+38h] [rbp-D0h]
void *v172; // [rsp+38h] [rbp-D0h]
struct cocos2d::CCPoint v173[3]; // [rsp+40h] [rbp-C8h] BYREF
__int64 v174; // [rsp+58h] [rbp-B0h]
__int64 v175; // [rsp+60h] [rbp-A8h]
char Src[15]; // [rsp+68h] [rbp-A0h] BYREF
char v177; // [rsp+77h] [rbp-91h]
__int64 v178; // [rsp+78h] [rbp-90h]
__int64 v179; // [rsp+80h] [rbp-88h]
char v180[16]; // [rsp+88h] [rbp-80h] BYREF
__int64 v181; // [rsp+98h] [rbp-70h]
__int64 v182; // [rsp+A0h] [rbp-68h]
struct cocos2d::CCPoint *v183; // [rsp+A8h] [rbp-60h]
__int128 v184; // [rsp+B0h] [rbp-58h] BYREF
__int64 v185; // [rsp+C0h] [rbp-48h]
__int64 v186; // [rsp+C8h] [rbp-40h]
cocos2d::CCSize v187; // [rsp+160h] [rbp+58h] BYREF
float v188; // [rsp+168h] [rbp+60h]
struct cocos2d::CCPoint v189; // [rsp+170h] [rbp+68h] BYREF
result = cocos2d::CCLayer::init(a1);
if ( !result )
return result;
v5 = (unsigned int)cocos2d::CCTexture2D::defaultAlphaPixelFormat(v4);
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888);
v6 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v6, "DungeonSheet.png", 0);
v8 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v7);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v8, "DungeonSheet.plist");
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v5);
v187 = (cocos2d::CCSize)&v173[1];
*(_OWORD *)&v173[1].x = 0;
v174 = 0;
v175 = 15;
v173[1] = (struct cocos2d::CCPoint)sub_14003AA10(0x20u);
v174 = 16;
v175 = 31;
strcpy(*(char **)&v173[1], "secretLoop02.mp3");
if ( !qword_1406C2ED8 )
{
v168 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v168);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
GameManager::fadeInMusic(v9, (__int64)&v173[1]);
LOBYTE(v10) = 1;
a1->setKeypadEnabled(a1, v10);
LOBYTE(v11) = 1;
a1->setKeyboardEnabled(a1, v11);
v13 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v12);
cocos2d::CCDirector::getWinSize(v13);
v14 = cocos2d::CCSprite::create("GJ_gradientBG.png");
v15 = v14->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(4.5040475e30, 0.0);
v15->setAnchorPoint(v14, v16);
a1->addChild_0(a1, v14, -3);
((void (__fastcall *)(struct cocos2d::CCSprite *))v14->setScaleX)(v14);
v17 = ((float (__fastcall *)(struct cocos2d::CCSprite *))v14->setScaleY)(v14);
v18 = v14->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v17, -5.0);
v18->setPosition_0(v14, v19);
LOWORD(v187.width) = 1280;
BYTE2(v187.width) = 30;
v14->setColor(&v14->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v187);
v20 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_gate_001.png");
v21 = ((float (__fastcall *)(SecretLayer3 *, struct cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v20, 2);
v22 = v20->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v21, v188 * 0.5);
v22->setPosition_0(v20, v23);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_foreground_001.png");
v25 = ((float (__fastcall *)(SecretLayer3 *, struct cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v24, 3);
v26 = v24->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v25, v188 * 0.5);
v26->setPosition_0(v24, v27);
v28 = (CCLightFlash *)cocos2d::CCSprite::createWithSpriteFrameName("Fire_02_looped_001.png");
v29 = ((float (__fastcall *)(SecretLayer3 *, CCLightFlash *, __int64))a1->addChild_0)(a1, v28, 4);
v30 = v28->__vftable;
cocos2d::CCPoint::CCPoint(v29, (float)(v188 * 0.5) - 160.0);
v30->setPosition_0(v28, v31);
v169 = cocos2d::CCSprite::createWithSpriteFrameName("Fire_02_looped_001.png");
a1->addChild_0(a1, v169, 3);
v32 = v169->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v33 = ((double (__fastcall *)(CCLightFlash *))v28->getScale)(v28);
v34 = *(float *)&v33 + *(float *)&v33;
((void (__fastcall *)(struct cocos2d::CCSprite *))v32->setScale_0)(v169);
v35 = v169->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v36 = (__int64)v28->getPosition_0(v28);
v35->setPosition_0(v169, (const cocos2d::CCPoint *)v36);
LOWORD(v187.width) = 255;
BYTE2(v187.width) = 0;
((void (__fastcall *)(cocos2d::CCArray **, cocos2d::CCSize *))v28->m_lightStripArray->__vftable)(
&v28->m_lightStripArray,
&v187);
LOWORD(v187.width) = -1;
BYTE2(v187.width) = 0;
v169->setColor(&v169->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v187);
v38 = (cocos2d::CCArray *)cocos2d::CCArray::create(v37);
v40 = (cocos2d::CCArray *)cocos2d::CCArray::create(v39);
for ( i = 1; i <= 9; ++i )
{
v42 = cocos2d::CCString::createWithFormat("Fire_02_looped_%03i.png", i);
CString = cocos2d::CCString::getCString(v42);
v45 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v44);
v46 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v45, CString);
cocos2d::CCArray::addObject(v38, v46);
v47 = cocos2d::CCString::createWithFormat("Fire_02_2_looped_%03i.png", i);
v48 = cocos2d::CCString::getCString(v47);
v50 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v49);
v51 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v50, v48);
cocos2d::CCArray::addObject(v40, v51);
}
v52 = cocos2d::CCAnimation::createWithSpriteFrames(v38, 0.079999998);
v53 = cocos2d::CCAnimate::create(v52);
v54 = cocos2d::CCRepeatForever::create(v53);
cocos2d::CCNode::runAction(v28, (cocos2d::CCPoint)v54, v55, v1, v164);
v56 = cocos2d::CCAnimation::createWithSpriteFrames(v40, 0.079999998);
v57 = cocos2d::CCAnimate::create(v56);
v58 = cocos2d::CCRepeatForever::create(v57);
cocos2d::CCNode::runAction((CCLightFlash *)v169, (cocos2d::CCPoint)v58, v59, v1, v165);
v60 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonShine_001.png");
cocos2d::CCPoint::CCPoint(v34, 0.0);
v61 = (__int64)v28->getPosition_0(v28);
cocos2d::CCPoint::operator+(v61, &v187);
v60->setPosition_0(v60, (const cocos2d::CCPoint *)&v187);
a1->addChild_0(a1, v60, 5);
((void (__fastcall *)(struct cocos2d::CCSprite *))v60->setScale_0)(v60);
v187 = (cocos2d::CCSize)0x100000302LL;
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v60->setBlendFunc)(
&v60->cocos2d::CCTextureProtocol,
0x100000302LL);
LOBYTE(v62) = -56;
v60->setOpacity(&v60->cocos2d::CCRGBAProtocol, v62);
LOWORD(v187.width) = -14081;
BYTE2(v187.width) = 0;
v60->setColor(&v60->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v187);
v63 = cocos2d::CCFadeTo::create(1.6, 0xA0u);
v64 = cocos2d::CCEaseInOut::create(v63, 1.3);
v65 = cocos2d::CCFadeTo::create(1.6, 0xE1u);
v66 = cocos2d::CCEaseInOut::create(v65, 1.3);
v67 = cocos2d::CCSequence::create(v64, v66, 0);
v68 = cocos2d::CCRepeatForever::create(v67);
cocos2d::CCNode::runAction((CCLightFlash *)v60, (cocos2d::CCPoint)v68, v69, v1, v166);
v70 = cocos2d::CCScaleTo::create(1.0, 1.0);
v71 = cocos2d::CCEaseInOut::create(v70, 1.5);
v72 = cocos2d::CCScaleTo::create(1.0, 1.2);
v73 = cocos2d::CCEaseInOut::create(v72, 1.5);
v74 = cocos2d::CCSequence::create(v71, v73, 0);
v75 = cocos2d::CCRepeatForever::create(v74);
cocos2d::CCNode::runAction((CCLightFlash *)v60, (cocos2d::CCPoint)v75, v76, v1, v167);
v77 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonTorch_001.png");
v78 = ((float (__fastcall *)(SecretLayer3 *, struct cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v77, 6);
cocos2d::CCPoint::CCPoint(v78, -1.0);
v79 = (__int64)v28->getPosition_0(v28);
v80 = cocos2d::CCPoint::operator+(v79, &v187);
v77->setPosition_0(v77, (const cocos2d::CCPoint *)&v187);
v81 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonShine_001.png");
cocos2d::CCPoint::CCPoint(*(float *)&v80, 0.0);
v82 = (__int64)v28->getPosition_0(v28);
cocos2d::CCPoint::operator+(v82, &v187);
v81->setPosition_0(v81, (const cocos2d::CCPoint *)&v187);
a1->addChild_0(a1, v81, 7);
((void (__fastcall *)(struct cocos2d::CCSprite *))v81->setScale_0)(v81);
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v81->setBlendFunc)(
&v81->cocos2d::CCTextureProtocol,
0x100000302LL);
LOBYTE(v83) = -81;
v81->setOpacity(&v81->cocos2d::CCRGBAProtocol, v83);
LOWORD(v187.width) = -26881;
BYTE2(v187.width) = 0;
v81->setColor(&v81->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v187);
v84 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_bars_bottom_001.png");
v85 = ((float (__fastcall *)(SecretLayer3 *, struct cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v84, 12);
cocos2d::CCPoint::CCPoint(v85, 0.0);
v86 = (__int64)v20->getPosition_0(v20);
cocos2d::CCPoint::operator+(v86, &v187);
v84->setPosition_0(v84, (const cocos2d::CCPoint *)&v187);
v87 = (DungeonBarsSprite *)operator new(0x148u);
v187 = (cocos2d::CCSize)v87;
cocos2d::CCNode::CCNode(v87);
v87->__vftable = (DungeonBarsSprite_vtbl *)&DungeonBarsSprite::`vftable';
v87->m_barsSprite = nullptr;
if ( DungeonBarsSprite::init(v87) )
{
cocos2d::CCObject::autorelease(v87);
}
else
{
((void (__fastcall *)(DungeonBarsSprite *, __int64))v87->~DungeonBarsSprite)(v87, 1);
v87 = nullptr;
}
a1->m_dungeonBars = v87;
v88 = ((float (__fastcall *)(SecretLayer3 *, DungeonBarsSprite *, __int64))a1->addChild_0)(a1, v87, 9);
cocos2d::CCPoint::CCPoint(v88, -2.0);
v89 = (__int64)v20->getPosition_0(v20);
v90 = cocos2d::CCPoint::operator+(v89, &v187);
a1->m_dungeonBars->setPosition_0(a1->m_dungeonBars, (const cocos2d::CCPoint *)&v187);
v91 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v173[0] = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)v173);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v91 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getUGV(v91, "13") )
a1->m_dungeonBars->setVisible(a1->m_dungeonBars, 0);
a1->m_demonEyes = cocos2d::CCSprite::createWithSpriteFrameName("secretEyes_01_001.png");
cocos2d::CCPoint::CCPoint(*(float *)&v90, 13.5);
v92 = (__int64)v20->getPosition_0(v20);
cocos2d::CCPoint::operator+(v92, &v187);
a1->m_demonEyes->setPosition_0(a1->m_demonEyes, (const cocos2d::CCPoint *)&v187);
a1->addChild_0(a1, a1->m_demonEyes, 10);
v93 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v187 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v187);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v93 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v93, "12") )
goto LABEL_20;
v94 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v187 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v187);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v94 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getUGV(v94, "13") )
LABEL_20:
a1->m_demonEyes->setVisible(a1->m_demonEyes, 0);
else
SecretLayer3::animateEyes(a1);
v95 = cocos2d::CCSprite::createWithSpriteFrameName("secretBody_01_001.png");
a1->m_demonBody = v95;
v96 = ((float (__fastcall *)(SecretLayer3 *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v95, 9);
cocos2d::CCPoint::CCPoint(v96, 0.0);
v97 = a1->m_demonEyes->getPosition_0(a1->m_demonEyes);
v98 = cocos2d::CCPoint::operator+(v97, &v187);
a1->m_demonBody->setPosition_0(a1->m_demonBody, (const cocos2d::CCPoint *)&v187);
a1->m_demonBody->setVisible(a1->m_demonBody, 0);
v100 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v99);
a1->addChild_0(a1, v100, 12);
v102 = (cocos2d::CCArray *)cocos2d::CCArray::create(v101);
a1->m_locksArray = v102;
cocos2d::CCObject::retain(v102);
cocos2d::CCPoint::CCPoint(*(float *)&v98, 160.0);
v103 = (__int64)v20->getPosition_0(v20);
cocos2d::CCPoint::operator+(v103, &v187);
cocos2d::CCNode::convertToNodeSpace(v100, &v189);
v104 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v170 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v170);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v104 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v104, "14") )
{
v105 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock01_001.png");
v106 = CCMenuItemSpriteExtra::create(v105, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer3::onClick);
v107 = ((float (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v100->addChild_1)(v100, v106);
cocos2d::CCPoint::CCPoint(v107, -30.0);
cocos2d::CCPoint::operator+(&v189, &v187);
v106->setPosition_0(v106, (const cocos2d::CCPoint *)&v187);
v106->setTag(v106, 1);
cocos2d::CCArray::addObject(a1->m_locksArray, v106);
}
v108 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v187 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v187);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v108 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v108, "15") )
{
v109 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock02_001.png");
v110 = CCMenuItemSpriteExtra::create(v109, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer3::onClick);
v111 = ((float (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v100->addChild_1)(v100, v110);
cocos2d::CCPoint::CCPoint(v111, 0.0);
cocos2d::CCPoint::operator+(&v189, &v187);
v110->setPosition_0(v110, (const cocos2d::CCPoint *)&v187);
v110->setTag(v110, 2);
cocos2d::CCArray::addObject(a1->m_locksArray, v110);
}
v112 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v187 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v187);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v112 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v112, (const char *)&word_140544454) )
{
v113 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock03_001.png");
v114 = CCMenuItemSpriteExtra::create(v113, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer3::onClick);
v115 = ((float (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v100->addChild_1)(v100, v114);
cocos2d::CCPoint::CCPoint(v115, 30.0);
cocos2d::CCPoint::operator+(&v189, &v187);
v114->setPosition_0(v114, (const cocos2d::CCPoint *)&v187);
v114->setTag(v114, 3);
cocos2d::CCArray::addObject(a1->m_locksArray, v114);
}
v116 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v187 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v187);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v116 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v116, "12") )
{
for ( j = 0; j < cocos2d::CCArray::count(a1->m_locksArray); ++j )
{
v118 = cocos2d::CCArray::objectAtIndex(a1->m_locksArray, j);
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v118->__vftable[12].getTag)(v118, 0);
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v118->__vftable[4].update)(v118, 0);
}
}
v187 = (cocos2d::CCSize)&v184;
v184 = 0;
v185 = 4;
v186 = 15;
strcpy((char *)&v184, "0001");
v119 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v173[0] = (struct cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(*(_QWORD *)v173);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v119 = qword_1406C2EE8;
}
if ( !GameStatsManager::isSpecialChestUnlocked(v119, &v184) )
{
v187 = (cocos2d::CCSize)&v173[1];
*(_OWORD *)&v173[1].x = 0;
v174 = 4;
v175 = 15;
strcpy((char *)&v173[1], "0001");
v173[0] = (struct cocos2d::CCPoint)&v173[1];
v120 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v171 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v171);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v120 = qword_1406C2EE8;
}
v121 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v120 + 368), &v173[1]);
sub_14003A830((__int64)&v173[1]);
v122 = GJChestSprite::create(*(_DWORD *)(v121 + 64));
GJChestSprite::switchToState(v122, Closed, 0);
((void (__fastcall *)(GJChestSprite *))v122->setScale_0)(v122);
LOWORD(v187.width) = -14136;
BYTE2(v187.width) = -1;
v123 = v122->getChildren(v122);
v124 = cocos2d::CCArray::objectAtIndex(v123, 0);
(**(void (__fastcall ***)(__int64, cocos2d::CCSize *))&v124[5].m_unknown2)((__int64)&v124[5].m_unknown2, &v187);
v187 = (cocos2d::CCSize)operator new(0x208u);
v125 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v187);
if ( v125 )
{
if ( CCMenuItemSpriteExtra::init(v125, v122, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer3::onChest01) )
{
cocos2d::CCObject::autorelease(v125);
LABEL_48:
v178 = 14;
v179 = 15;
strcpy(Src, "chestClick.ogg");
v177 = 0;
v187 = (cocos2d::CCSize)Src;
if ( &v125->m_activateSound.m_data.m_capacity != (std::size_t *)Src )
sub_14003CCE0((void **)&v125->m_activateSound.m_data.m_capacity, Src, 0xEu);
sub_14003A830((__int64)Src);
v126 = v125->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v127 = cocos2d::CCSize::CCSize(&v187, 60.000004, 48.0);
v126->setContentSize(v125, v128);
v129 = v122->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v125->getContentSize(v125);
v130 = (float *)v125->getContentSize(v125);
cocos2d::CCPoint::CCPoint(*(float *)&v127, *v130 * 0.5);
v129->setPosition_0(v122, v131);
v132 = ((float (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v100->addChild_1)(v100, v125);
v133 = v125->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v132, v188 - 80.0);
v134 = cocos2d::CCNode::convertToNodeSpace(v100, v173);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v133->setPosition_0)(v125, v134);
goto LABEL_51;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v125->~CCMenuItemSpriteExtra)(v125, 1);
}
v125 = nullptr;
goto LABEL_48;
}
LABEL_51:
*(_OWORD *)&v173[1].x = 0;
v174 = 4;
v175 = 15;
strcpy((char *)&v173[1], "0002");
v135 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v183 = (struct cocos2d::CCPoint *)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v183);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v135 = qword_1406C2EE8;
}
if ( !GameStatsManager::isSpecialChestUnlocked(v135, &v173[1]) )
{
v137 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v136);
a1->addChild_0(a1, v137, 10);
v187 = (cocos2d::CCSize)&v173[1];
*(_OWORD *)&v173[1].x = 0;
v174 = 4;
v175 = 15;
strcpy((char *)&v173[1], "0002");
v183 = &v173[1];
v138 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v173[0] = (struct cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(*(_QWORD *)v173);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v138 = qword_1406C2EE8;
}
v139 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v138 + 368), &v173[1]);
sub_14003A830((__int64)&v173[1]);
v140 = GJChestSprite::create(*(_DWORD *)(v139 + 64));
GJChestSprite::switchToState(v140, Closed, 0);
((void (__fastcall *)(GJChestSprite *))v140->setScale_0)(v140);
v187 = (cocos2d::CCSize)operator new(0x208u);
v141 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v187);
if ( v141 )
{
if ( CCMenuItemSpriteExtra::init(v141, v140, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer3::onChest02) )
{
cocos2d::CCObject::autorelease(v141);
LABEL_61:
a1->m_secretChest = v141;
v180[15] = 0;
v181 = 14;
v182 = 15;
strcpy(v180, "chestClick.ogg");
v187 = (cocos2d::CCSize)v180;
if ( &v141->m_activateSound.m_data.m_capacity != (std::size_t *)v180 )
sub_14003CCE0((void **)&v141->m_activateSound.m_data.m_capacity, v180, 0xEu);
sub_14003A830((__int64)v180);
v142 = a1->m_secretChest->__vftable;
v143 = cocos2d::CCSize::CCSize(&v187, 60.000004, 48.0);
v142->setContentSize(a1->m_secretChest, v144);
v145 = v140->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_secretChest->getContentSize(a1->m_secretChest);
v146 = a1->m_secretChest->getContentSize(a1->m_secretChest);
cocos2d::CCPoint::CCPoint(*(float *)&v143, v146->width * 0.5);
v145->setPosition_0(v140, v147);
v148 = ((float (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v137->addChild_1)(
v137,
a1->m_secretChest);
cocos2d::CCPoint::CCPoint(v148, 0.0);
v149 = (__int64)v20->getPosition_0(v20);
cocos2d::CCPoint::operator+(v149, &v187);
v150 = a1->m_secretChest->__vftable;
v151 = cocos2d::CCNode::convertToNodeSpace(v137, v173);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v150->setPosition_0)(
a1->m_secretChest,
v151);
LOBYTE(a1->m_secretChest->m_scaleMultiplier) = 0;
BYTE1(a1->m_secretChest->m_scaleMultiplier) = 1;
v152 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v172 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v172);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v152 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v152, "13") )
{
a1->m_secretChest->setEnabled(a1->m_secretChest, 0);
a1->m_secretChest->setVisible(a1->m_secretChest, 0);
}
goto LABEL_67;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v141->~CCMenuItemSpriteExtra)(v141, 1);
}
v141 = nullptr;
goto LABEL_61;
}
LABEL_67:
v153 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v187 = (cocos2d::CCSize)operator new(0x208u);
v154 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v187);
if ( !v154 )
{
LABEL_71:
v154 = nullptr;
goto LABEL_72;
}
if ( !CCMenuItemSpriteExtra::init(v154, v153, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer3::onBack) )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v154->~CCMenuItemSpriteExtra)(v154, 1);
goto LABEL_71;
}
cocos2d::CCObject::autorelease(v154);
LABEL_72:
HIDWORD(v154->m_pfnSelector.adj) = 1069547520;
v155 = cocos2d::CCMenu::create(v154, 0);
a1->addChild_0(a1, v155, 1);
v156 = v155->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v158 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v157);
cocos2d::CCDirector::getScreenTop(v158);
v160 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v159);
v161 = cocos2d::CCDirector::getScreenLeft(v160) + 24.0;
cocos2d::CCPoint::CCPoint(v161, v161);
v156->setPosition_0(v155, v162);
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v163) + 197) )
GameToolbox::addBackButton(a1, v154);
return 1;
}