//
// SecretLayer3::init from 0x4ef00c to 0x4efdae (3490 bytes)
//
// 1 xrefs:
// > SecretLayer3::create @ 0x4ede0c
//
// 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 SecretLayer3::init(SecretLayer3 *a1)
{
cocos2d::CCTexture2DPixelFormat v2; // r5
cocos2d::CCTextureCache *v3; // r0
cocos2d::CCSpriteFrameCache *v4; // r0
GameManager *v5; // r5
int v6; // r2
int v7; // r3
cocos2d::CCDirector *v8; // r0
const char *v9; // r1
cocos2d::CCNode *v10; // r5
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r3
cocos2d::CCSprite *v14; // r7
void (__fastcall *v15)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r5
cocos2d::CCSprite *v16; // r5
void (__fastcall *v17)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCSprite *v18; // r8
void (__fastcall *v19)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r5
cocos2d::CCSprite *v20; // r5
void (__fastcall *setScale)(cocos2d::CCSprite *__hidden, float); // r10
float v22; // r0
void (__fastcall *v23)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
int v24; // r0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r2
void (__fastcall *v26)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r2
const char *v27; // r10
cocos2d::CCArray *v28; // r0
cocos2d::CCArray *v29; // r9
cocos2d::CCArray *v30; // r6
cocos2d::CCString *v31; // r0
const char *CString; // r0
cocos2d::CCSpriteFrame *v33; // r0
cocos2d::CCSpriteFrameCache *v34; // r0
const char *v35; // r1
cocos2d::CCString *v36; // r0
const char *v37; // r0
cocos2d::CCSpriteFrame *v38; // r0
cocos2d::CCAnimation *v39; // r0
cocos2d::CCAnimate *v40; // r0
cocos2d::CCRepeatForever *v41; // r0
cocos2d::CCAnimation *v42; // r0
cocos2d::CCAnimate *v43; // r0
cocos2d::CCRepeatForever *v44; // r0
cocos2d::CCSprite *v45; // r10
void (__fastcall *v46)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
int v47; // r11
cocos2d::CCSprite_vtbl *v48; // r2
void (__fastcall *v49)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r2
cocos2d::CCFadeTo *v50; // r0
cocos2d::CCEaseInOut *v51; // r11
cocos2d::CCFadeTo *v52; // r0
cocos2d::CCEaseInOut *v53; // r0
cocos2d::CCActionInterval *v54; // r0
cocos2d::CCRepeatForever *v55; // r0
float v56; // r2
cocos2d::CCActionInterval *v57; // r0
cocos2d::CCEaseInOut *v58; // r11
float v59; // r2
cocos2d::CCActionInterval *v60; // r0
cocos2d::CCEaseInOut *v61; // r0
cocos2d::CCActionInterval *v62; // r0
cocos2d::CCRepeatForever *v63; // r0
cocos2d::CCSprite *v64; // r10
int v65; // r11
cocos2d::CCSprite *v66; // r11
int v67; // r10
void (__fastcall *v68)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
cocos2d::CCSprite *v69; // r10
void (__fastcall *v70)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
int v71; // r11
DungeonBarsSprite *v72; // r0
SecretLayer3_vtbl *v73; // r3
DungeonBarsSprite *m_dungeonBars; // r10
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
int v76; // r11
GameManager *v77; // r0
cocos2d::CCSprite *v78; // r0
cocos2d::CCSprite_vtbl *v79; // r3
cocos2d::CCSprite *v80; // r9
void (__fastcall *v81)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
int v82; // r11
GameManager *v83; // r0
GameManager *v84; // r0
cocos2d::CCSprite *v85; // r0
SecretLayer3_vtbl *v86; // r3
cocos2d::CCSprite *m_demonBody; // r9
void (__fastcall *v88)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
const cocos2d::CCPoint *v89; // r11
cocos2d::CCMenu *v90; // r9
cocos2d::CCArray *v91; // r0
cocos2d::CCArray *v92; // r0
int v93; // r10
GameManager *v94; // r0
cocos2d::CCSprite *v95; // r0
CCMenuItemSpriteExtra *v96; // r11
void (__fastcall *v97)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
GameManager *v98; // r0
cocos2d::CCSprite *v99; // r0
CCMenuItemSpriteExtra *v100; // r6
void (__fastcall *v101)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
GameManager *v102; // r0
cocos2d::CCSprite *v103; // r0
CCMenuItemSpriteExtra *v104; // r6
void (__fastcall *v105)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
GameManager *v106; // r0
GameStatsManager *v107; // r11
stl::StringData::Internal *v108; // r2
stl::StringData::Internal *v109; // r3
int isSpecialChestUnlocked; // r11
unsigned int v111; // r6
int v112; // r0
int v113; // r10
GameStatsManager *v114; // r11
int RewardForSpecialChest; // r6
GJChestSprite *v116; // r11
cocos2d::CCArray *v117; // r0
int v118; // r0
void (__fastcall *v119)(int, cocos2d::CCPoint *); // r2
CCMenuItemSpriteExtra *v120; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r10
void (__fastcall *v122)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
float width; // s17
int v124; // r0
void (__fastcall *v125)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
GameStatsManager *v126; // r10
stl::StringData::Internal *v127; // r2
stl::StringData::Internal *v128; // r3
int v129; // r10
cocos2d::CCMenu *v130; // r10
GameStatsManager *v131; // r11
int v132; // r9
GJChestSprite *v133; // r9
CCMenuItemSpriteExtra *v134; // r11
CCMenuItemSpriteExtra *m_secretChest; // r11
void (__fastcall *v136)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r6
void (__fastcall *v137)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
float v138; // s17
const cocos2d::CCSize *v139; // r0
CCMenuItemSpriteExtra *v140; // r6
void (__fastcall *v141)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
int v142; // r9
CCMenuItemSpriteExtra *v143; // r3
GameManager *v144; // r0
cocos2d::CCSprite *v145; // r0
CCMenuItemSpriteExtra *v146; // r7
cocos2d::CCNode *v147; // r6
void (__fastcall *v148)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCDirector *v149; // r0
float v150; // s16
cocos2d::CCDirector *v151; // r0
float v152; // r0
_BOOL4 isControllerConnected; // r5
_BOOL4 v155; // [sp+Ch] [bp-78h]
cocos2d::CCSpriteFrameCache *v156; // [sp+14h] [bp-70h]
cocos2d::CCSpriteFrameCache *v157; // [sp+14h] [bp-70h]
cocos2d::CCSpriteFrameCache *v158; // [sp+14h] [bp-70h]
cocos2d::CCSpriteFrameCache *v159; // [sp+14h] [bp-70h]
cocos2d::CCSize v160; // [sp+24h] [bp-60h] BYREF
int v161; // [sp+2Ch] [bp-58h] BYREF
int v162; // [sp+30h] [bp-54h]
cocos2d::CCPoint v163; // [sp+34h] [bp-50h] BYREF
cocos2d::CCPoint v164; // [sp+3Ch] [bp-48h] BYREF
cocos2d::CCPoint v165; // [sp+44h] [bp-40h] BYREF
void (*v166)(SecretLayer3 *, cocos2d::CCObject *); // [sp+4Ch] [bp-38h]
int v167; // [sp+50h] [bp-34h]
void (*v168)(SecretLayer3 *, cocos2d::CCObject *); // [sp+54h] [bp-30h]
int v169; // [sp+58h] [bp-2Ch]
void (*v170)(SecretLayer3 *, cocos2d::CCObject *); // [sp+5Ch] [bp-28h]
int v171; // [sp+60h] [bp-24h]
void (*v172)(SecretLayer3 *, cocos2d::CCObject *); // [sp+64h] [bp-20h]
int v173; // [sp+68h] [bp-1Ch]
cocos2d::CCPoint v174; // [sp+6Ch] [bp-18h] BYREF
cocos2d::CCPoint v175; // [sp+74h] [bp-10h] BYREF
v155 = cocos2d::CCLayer::init(a1);
if ( v155 )
{
v2 = cocos2d::CCTexture2D::defaultAlphaPixelFormat();
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888);
v3 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v3, "DungeonSheet.png", 0);
v4 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v4, "DungeonSheet.plist");
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v2);
v5 = GameManager::sharedState();
sub_776584((int)&v175, "secretLoop02.mp3");
GameManager::fadeInMusic((int)v5, &v175, v6, v7);
sub_774008(&v175);
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v160, v8);
v10 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v9);
setAnchorPoint = v10->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v175, 0.0, 0.0);
setAnchorPoint(v10, &v175);
a1->addChild_0(a1, v10, -3);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))v10->setScaleX)(v10, (float)(v160.width + 10.0) / v10[1].m_fSkewX);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))v10->setScaleY)(v10, (float)(v160.height + 10.0) / v10[1].m_fSkewY);
setPosition = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v175, -5.0, -5.0);
setPosition(v10, &v175);
getTag = v10->__vftable[1].getTag;
LOBYTE(v175.x) = 0;
*(_WORD *)((char *)&v175.x + 1) = 7685;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *))getTag)(v10, &v175);
v14 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_gate_001.png");
a1->addChild_0(a1, v14, 2);
v15 = v14->setPosition;
cocos2d::CCPoint::CCPoint(&v175, v160.width * 0.5, (float)(v160.height * 0.5) - 5.0);
v15(v14, &v175);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_foreground_001.png");
a1->addChild_0(a1, v16, 3);
v17 = v16->setPosition;
cocos2d::CCPoint::CCPoint(&v175, v160.width * 0.5, 15.0);
v17(v16, &v175);
v18 = cocos2d::CCSprite::createWithSpriteFrameName("Fire_02_looped_001.png");
a1->addChild_0(a1, v18, 4);
v19 = v18->setPosition;
cocos2d::CCPoint::CCPoint(&v175, (float)(v160.width * 0.5) - 160.0, (float)(v160.height * 0.5) + 50.0);
v19(v18, &v175);
v20 = cocos2d::CCSprite::createWithSpriteFrameName("Fire_02_looped_001.png");
a1->addChild_0(a1, v20, 3);
setScale = v20->setScale;
v22 = COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCSprite *))v18->getScale)(v18));
((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))setScale)(v20, v22 + v22);
v23 = v20->setPosition;
v24 = (int)v18->getPosition(v18);
v23(v20, (const cocos2d::CCPoint *)v24);
setColor = v18->setColor;
LOWORD(v175.x) = 255;
BYTE2(v175.x) = 0;
setColor(v18, (const cocos2d::ccColor3B *)&v175);
v26 = v20->setColor;
LOWORD(v175.x) = -1;
v27 = (_BYTE *)(&dword_0 + 1);
BYTE2(v175.x) = 0;
v28 = (cocos2d::CCArray *)((int (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCPoint *))v26)(v20, &v175);
v29 = (cocos2d::CCArray *)cocos2d::CCArray::create(v28);
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create(v29);
do
{
v156 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v31 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Fire_02_looped_%03i.png",
v27);
CString = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v156, CString);
cocos2d::CCArray::addObject(v29, v33);
v34 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v35 = v27++;
v157 = v34;
v36 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Fire_02_2_looped_%03i.png",
v35);
v37 = cocos2d::CCString::getCString(v36);
v38 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v157, v37);
cocos2d::CCArray::addObject(v30, v38);
}
while ( v27 != &byte_9[1] );
v39 = cocos2d::CCAnimation::createWithSpriteFrames(v29, 0.08);
v40 = cocos2d::CCAnimate::create(v39);
v41 = cocos2d::CCRepeatForever::create(v40);
cocos2d::CCNode::runAction(v18, v41);
v42 = cocos2d::CCAnimation::createWithSpriteFrames(v30, 0.08);
v43 = cocos2d::CCAnimate::create(v42);
v44 = cocos2d::CCRepeatForever::create(v43);
cocos2d::CCNode::runAction(v20, v44);
v45 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonShine_001.png");
v46 = v45->setPosition;
v47 = (int)v18->getPosition(v18);
cocos2d::CCPoint::CCPoint(&v174, 0.0, -10.0);
cocos2d::CCPoint::operator+(&v175, v47, &v174);
v46(v45, &v175);
a1->addChild_0(a1, v45, 5);
((void (__fastcall *)(cocos2d::CCSprite *, int))v45->setScale)(v45, 1067030938);
v48 = v45->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v161 = 770;
v162 = 1;
((void (__fastcall *)(cocos2d::CCSprite *, int, int, int *))v48->setBlendFunc)(v45, 770, 1, &v161);
v45->setOpacity(v45, 200);
v49 = v45->setColor;
LOWORD(v175.x) = -14081;
BYTE2(v175.x) = 0;
v49(v45, (const cocos2d::ccColor3B *)&v175);
v50 = cocos2d::CCFadeTo::create(1.6, 0xA0u);
v51 = cocos2d::CCEaseInOut::create(v50, 1.3);
v52 = cocos2d::CCFadeTo::create(1.6, 0xE1u);
v53 = cocos2d::CCEaseInOut::create(v52, 1.3);
v54 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v51, v53, 0);
v55 = cocos2d::CCRepeatForever::create(v54);
cocos2d::CCNode::runAction(v45, v55);
v57 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F800000, 1.0, v56);
v58 = cocos2d::CCEaseInOut::create(v57, 1.5);
v60 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)0x3F800000, 1.2, v59);
v61 = cocos2d::CCEaseInOut::create(v60, 1.5);
v62 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v58, v61, 0);
v63 = cocos2d::CCRepeatForever::create(v62);
cocos2d::CCNode::runAction(v45, v63);
v64 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonTorch_001.png");
a1->addChild_0(a1, v64, 6);
v158 = (cocos2d::CCSpriteFrameCache *)v64->setPosition;
v65 = (int)v18->getPosition(v18);
cocos2d::CCPoint::CCPoint(&v174, -1.0, -10.0);
cocos2d::CCPoint::operator+(&v175, v65, &v174);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCPoint *))v158)(v64, &v175);
v66 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonShine_001.png");
v159 = (cocos2d::CCSpriteFrameCache *)v66->setPosition;
v67 = (int)v18->getPosition(v18);
cocos2d::CCPoint::CCPoint(&v174, 0.0, -14.0);
cocos2d::CCPoint::operator+(&v175, v67, &v174);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCPoint *))v159)(v66, &v175);
a1->addChild_0(a1, v66, 7);
((void (__fastcall *)(cocos2d::CCSprite *, int))v66->setScale)(v66, 1058642330);
((void (__fastcall *)(cocos2d::CCSprite *, int, int))v66->setBlendFunc)(v66, v161, v162);
v66->setOpacity(v66, 175);
v68 = v66->setColor;
LOWORD(v175.x) = -26881;
BYTE2(v175.x) = 0;
v68(v66, (const cocos2d::ccColor3B *)&v175);
v69 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_bars_bottom_001.png");
a1->addChild_0(a1, v69, 12);
v70 = v69->setPosition;
v71 = (int)v14->getPosition(v14);
cocos2d::CCPoint::CCPoint(&v174, 0.0, -52.0);
cocos2d::CCPoint::operator+(&v175, v71, &v174);
v70(v69, &v175);
v72 = DungeonBarsSprite::create();
v73 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_dungeonBars = v72;
v73->addChild_0(a1, v72, 9);
m_dungeonBars = a1->m_dungeonBars;
v75 = m_dungeonBars->setPosition;
v76 = (int)v14->getPosition(v14);
cocos2d::CCPoint::CCPoint(&v174, -2.0, 10.0);
cocos2d::CCPoint::operator+(&v175, v76, &v174);
v75(m_dungeonBars, &v175);
v77 = GameManager::sharedState();
if ( GameManager::getUGV(v77, "13") )
a1->m_dungeonBars->setVisible(a1->m_dungeonBars, 0);
v78 = cocos2d::CCSprite::createWithSpriteFrameName("secretEyes_01_001.png");
v79 = v78->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v80 = v78;
a1->m_demonEyes = v78;
v81 = v79->setPosition;
v82 = (int)v14->getPosition(v14);
cocos2d::CCPoint::CCPoint(&v174, 13.5, 6.0);
cocos2d::CCPoint::operator+(&v175, v82, &v174);
v81(v80, &v175);
a1->addChild_0(a1, a1->m_demonEyes, 10);
v83 = GameManager::sharedState();
if ( !GameManager::getUGV(v83, "12") || (v84 = GameManager::sharedState(), GameManager::getUGV(v84, "13")) )
a1->m_demonEyes->setVisible(a1->m_demonEyes, 0);
else
SecretLayer3::animateEyes(a1);
v85 = cocos2d::CCSprite::createWithSpriteFrameName("secretBody_01_001.png");
v86 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_demonBody = v85;
v86->addChild_0(a1, v85, 9);
m_demonBody = a1->m_demonBody;
v88 = m_demonBody->setPosition;
v89 = a1->m_demonEyes->getPosition(a1->m_demonEyes);
cocos2d::CCPoint::CCPoint(&v174, 0.0, -2.0);
cocos2d::CCPoint::operator+(&v175, v89, &v174);
v88(m_demonBody, &v175);
a1->m_demonBody->setVisible(a1->m_demonBody, 0);
v90 = cocos2d::CCMenu::create();
v91 = (cocos2d::CCArray *)((int (__fastcall *)(SecretLayer3 *, cocos2d::CCMenu *, int))a1->addChild_0)(a1, v90, 12);
v92 = (cocos2d::CCArray *)cocos2d::CCArray::create(v91);
a1->m_locksArray = v92;
cocos2d::CCObject::retain(v92);
v93 = (int)v14->getPosition(v14);
cocos2d::CCPoint::CCPoint(&v174, 160.0, 20.0);
cocos2d::CCPoint::operator+(&v175, v93, &v174);
cocos2d::CCNode::convertToNodeSpace(&v163, v90, &v175);
v94 = GameManager::sharedState();
if ( !GameManager::getUGV(v94, "14") )
{
v95 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock01_001.png");
v167 = 0;
v166 = SecretLayer3::onClick;
v96 = CCMenuItemSpriteExtra::create(
v95,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer3::onClick, (unsigned int)a1));
v90->addChild(v90, v96);
v97 = v96->setPosition;
cocos2d::CCPoint::CCPoint(&v174, -30.0, -25.0);
cocos2d::CCPoint::operator+(&v175, &v163, &v174);
v97(v96, &v175);
v96->setTag(v96, 1);
cocos2d::CCArray::addObject(a1->m_locksArray, v96);
}
v98 = GameManager::sharedState();
if ( !GameManager::getUGV(v98, "15") )
{
v99 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock02_001.png");
v169 = 0;
v168 = SecretLayer3::onClick;
v100 = CCMenuItemSpriteExtra::create(
v99,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer3::onClick, (unsigned int)a1));
v90->addChild(v90, v100);
v101 = v100->setPosition;
cocos2d::CCPoint::CCPoint(&v174, 0.0, 25.0);
cocos2d::CCPoint::operator+(&v175, &v163, &v174);
v101(v100, &v175);
v100->setTag(v100, 2);
cocos2d::CCArray::addObject(a1->m_locksArray, v100);
}
v102 = GameManager::sharedState();
if ( !GameManager::getUGV(v102, "16") )
{
v103 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock03_001.png");
v171 = 0;
v170 = SecretLayer3::onClick;
v104 = CCMenuItemSpriteExtra::create(
v103,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer3::onClick, (unsigned int)a1));
v90->addChild(v90, v104);
v105 = v104->setPosition;
cocos2d::CCPoint::CCPoint(&v174, 30.0, -25.0);
cocos2d::CCPoint::operator+(&v175, &v163, &v174);
v105(v104, &v175);
v104->setTag(v104, 3);
cocos2d::CCArray::addObject(a1->m_locksArray, v104);
}
v106 = GameManager::sharedState();
if ( !GameManager::getUGV(v106, "12") )
{
v111 = 0;
while ( v111 < cocos2d::CCArray::count(a1->m_locksArray) )
{
v112 = cocos2d::CCArray::objectAtIndex(a1->m_locksArray, v111++);
v113 = v112;
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v112 + 520))(v112, 0);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v113 + 164))(v113, 0);
}
}
v107 = GameStatsManager::sharedState();
sub_776584((int)&v175, "0001");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((int)v107, (char **)&v175, v108, v109);
sub_774008(&v175);
if ( !isSpecialChestUnlocked )
{
v114 = GameStatsManager::sharedState();
sub_776584((int)&v175, "0001");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((int)v114, (const std::string *)&v175);
sub_774008(&v175);
v116 = GJChestSprite::create(*(_DWORD *)(RewardForSpecialChest + 60));
GJChestSprite::switchToState(v116, Closed, 0);
((void (__fastcall *)(GJChestSprite *, int))v116->setScale)(v116, 1058642330);
v117 = v116->getChildren(v116);
v118 = cocos2d::CCArray::objectAtIndex(v117, 0);
v119 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v118 + 472);
LOWORD(v175.x) = -14136;
BYTE2(v175.x) = -1;
v119(v118, &v175);
v173 = 0;
v172 = SecretLayer3::onChest01;
v120 = CCMenuItemSpriteExtra::create(
v116,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer3::onChest01, (unsigned int)a1));
sub_776584((int)&v175, "chestClick.ogg");
sub_775D40(&v120->m_selectSound, &v175);
sub_774008(&v175);
setContentSize = v120->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v175, 60.0, 48.0);
setContentSize(v120, (const cocos2d::CCSize *)&v175);
v122 = v116->setPosition;
width = v120->getContentSize(v120)->width;
v124 = (int)v120->getContentSize(v120);
cocos2d::CCPoint::CCPoint(&v175, width * 0.5, *(float *)(v124 + 4) * 0.5);
v122(v116, &v175);
v90->addChild(v90, v120);
v125 = v120->setPosition;
cocos2d::CCPoint::CCPoint(&v174, v160.width - 80.0, 60.0);
cocos2d::CCNode::convertToNodeSpace(&v175, v90, &v174);
v125(v120, &v175);
}
v126 = GameStatsManager::sharedState();
sub_776584((int)&v175, "0002");
v129 = GameStatsManager::isSpecialChestUnlocked((int)v126, (char **)&v175, v127, v128);
sub_774008(&v175);
if ( !v129 )
{
v130 = cocos2d::CCMenu::create();
a1->addChild_0(a1, v130, 10);
v131 = GameStatsManager::sharedState();
sub_776584((int)&v175, "0002");
v132 = GameStatsManager::getRewardForSpecialChest((int)v131, (const std::string *)&v175);
sub_774008(&v175);
v133 = GJChestSprite::create(*(_DWORD *)(v132 + 60));
GJChestSprite::switchToState(v133, Closed, 0);
((void (__fastcall *)(GJChestSprite *, int))v133->setScale)(v133, 1058642330);
v174.y = 0.0;
LODWORD(v174.x) = SecretLayer3::onChest02;
v134 = CCMenuItemSpriteExtra::create(
v133,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer3::onChest02, (unsigned int)a1));
a1->m_secretChest = v134;
sub_776584((int)&v175, "chestClick.ogg");
sub_775D40(&v134->m_selectSound, &v175);
sub_774008(&v175);
m_secretChest = a1->m_secretChest;
v136 = m_secretChest->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v175, 60.0, 48.0);
v136(m_secretChest, (const cocos2d::CCSize *)&v175);
v137 = v133->setPosition;
v138 = a1->m_secretChest->getContentSize(a1->m_secretChest)->width;
v139 = a1->m_secretChest->getContentSize(a1->m_secretChest);
cocos2d::CCPoint::CCPoint(&v175, v138 * 0.5, v139->height * 0.5);
v137(v133, &v175);
v130->addChild(v130, a1->m_secretChest);
v140 = a1->m_secretChest;
v141 = v140->setPosition;
v142 = (int)v14->getPosition(v14);
cocos2d::CCPoint::CCPoint(&v164, 0.0, -24.0);
cocos2d::CCPoint::operator+(&v165, v142, &v164);
cocos2d::CCNode::convertToNodeSpace(&v175, v130, &v165);
v141(v140, &v175);
v143 = a1->m_secretChest;
v143->m_animationEnabled = 0;
v143->m_colorEnabled = 1;
v144 = GameManager::sharedState();
if ( !GameManager::getUGV(v144, "13") )
{
a1->m_secretChest->setEnabled(a1->m_secretChest, 0);
a1->m_secretChest->setVisible(a1->m_secretChest, 0);
}
}
v145 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v175.y = 0.0;
LODWORD(v175.x) = SecretLayer3::onBack;
v146 = CCMenuItemSpriteExtra::create(
v145,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer3::onBack, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v146, 1.5);
v147 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v146, nullptr);
a1->addChild_0(a1, v147, 1);
v148 = v147->setPosition;
v149 = cocos2d::CCDirector::sharedDirector();
v150 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v149));
v151 = cocos2d::CCDirector::sharedDirector();
v152 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v151));
cocos2d::CCPoint::CCPoint(&v165, v150 + 24.0, v152 - 23.0);
v148(v147, &v165);
isControllerConnected = PlatformToolbox::isControllerConnected();
if ( isControllerConnected )
{
GameToolbox::addBackButton(a1, v146);
LOBYTE(v155) = isControllerConnected;
}
}
return v155;
}