//
// SecretLayer3::init from 0x944c44 to 0x9460f8 (5300 bytes)
//
// 3 xrefs:
// > SecretLayer3::create @ 0x9461a0
// > ??> @ 0x9a8c0
// > ??> @ 0x11b35a0
//
// 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 v3; // w21
cocos2d::CCTextureCache *v4; // x0
cocos2d::CCSpriteFrameCache *v5; // x0
GameManager *v6; // x21
void *v7; // x0
unsigned int v8; // w21
cocos2d::CCDirector *v9; // x0
const char *v10; // x1
cocos2d::CCNode *v11; // x23
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x2
cocos2d::CCSprite *v15; // x24
void (__fastcall *v16)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v17; // x23
void (__fastcall *v18)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCSprite *v19; // x23
void (__fastcall *v20)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCSprite *v21; // x27
void (__fastcall *setScale)(cocos2d::CCSprite *__hidden, float); // x25
float v23; // s0
void (__fastcall *v24)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
__int64 v25; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
void (__fastcall *v27)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCArray *v28; // x0
cocos2d::CCArray *v29; // x26
cocos2d::CCArray *v30; // x25
cocos2d::CCSpriteFrameCache *v31; // x28
cocos2d::CCString *v32; // x0
const char *CString; // x0
cocos2d::CCSpriteFrame *v34; // x0
cocos2d::CCSpriteFrameCache *v35; // x28
const char *v36; // x1
cocos2d::CCString *v37; // x0
const char *v38; // x0
cocos2d::CCSpriteFrame *v39; // x0
cocos2d::CCAnimation *v40; // x0
cocos2d::CCAnimate *v41; // x0
cocos2d::CCRepeatForever *v42; // x0
cocos2d::CCAnimation *v43; // x0
cocos2d::CCAnimate *v44; // x0
cocos2d::CCRepeatForever *v45; // x0
cocos2d::CCSprite *v46; // x25
void (__fastcall *v47)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCFadeTo *v48; // x0
cocos2d::CCFadeTo *v49; // x0
cocos2d::CCEaseInOut *v50; // x0
cocos2d::CCActionInterval *v51; // x0
cocos2d::CCRepeatForever *v52; // x0
cocos2d::CCScaleTo *v53; // x0
cocos2d::CCActionInterval *v54; // x0
cocos2d::CCActionInterval *v55; // x0
cocos2d::CCEaseInOut *v56; // x0
cocos2d::CCActionInterval *v57; // x0
cocos2d::CCRepeatForever *v58; // x0
cocos2d::CCSprite *v59; // x25
cocos2d::CCSprite *v60; // x25
cocos2d::CCSprite *v61; // x0
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v63)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
__int64 v64; // x27
void (__fastcall *v65)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCSprite *v66; // x21
void (__fastcall *v67)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
__int64 v68; // x25
DungeonBarsSprite *v69; // x0
DungeonBarsSprite *m_dungeonBars; // x21
void (__fastcall *v71)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
__int64 v72; // x25
GameManager *v73; // x0
cocos2d::CCSprite *v74; // x21
cocos2d::CCSprite_vtbl *v75; // x1
void (__fastcall *v76)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
__int64 v77; // x27
GameManager *v78; // x0
cocos2d::CCSprite *v79; // x0
cocos2d::CCSprite *m_demonBody; // x21
void (__fastcall *v81)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCMenu *v82; // x21
cocos2d::CCArray *v83; // x0
cocos2d::CCArray *v84; // x0
__int64 v85; // x27
GameManager *v86; // x0
GameManager *v87; // x0
GameManager *v88; // x0
GameManager *v89; // x0
unsigned int v90; // w23
unsigned int v91; // w1
__int64 v92; // x25
GameStatsManager *v93; // x25
int isSpecialChestUnlocked; // w25
void *v95; // x0
GameStatsManager *v96; // x25
__int64 RewardForSpecialChest; // x23
void *v98; // x0
GJChestSprite *v99; // x25
cocos2d::CCArray *v100; // x0
__int64 v101; // x0
void (__fastcall *v102)(__int64, int *); // x3
CCMenuItemSpriteExtra *v103; // x23
void *v104; // x0
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x27
void (__fastcall *v106)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
__int64 v107; // x0
void (__fastcall *v108)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
GameStatsManager *v109; // x23
int v110; // w23
void *v111; // x0
cocos2d::CCMenu *v112; // x23
GameStatsManager *v113; // x25
__int64 v114; // x21
void *v115; // x0
GJChestSprite *v116; // x21
CCMenuItemSpriteExtra *v117; // x25
void *v118; // x27
CCMenuItemSpriteExtra *m_secretChest; // x25
void (__fastcall *v120)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x27
void (__fastcall *v121)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
const cocos2d::CCSize *v122; // x0
CCMenuItemSpriteExtra *v123; // x21
cocos2d::CCSprite *v124; // x0
const cocos2d::CCPoint *(__fastcall *v125)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v126)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
__int64 v127; // x25
CCMenuItemSpriteExtra *v128; // x0
GameManager *v129; // x0
cocos2d::CCSprite *v130; // x0
CCMenuItemSpriteExtra *v131; // x22
cocos2d::CCNode *v132; // x21
void (__fastcall *v133)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCDirector *v134; // x0
float v135; // s0
float v136; // s8
cocos2d::CCDirector *v137; // x0
float v138; // s0
bool isControllerConnected; // w0
cocos2d::CCSprite *v140; // x0
CCMenuItemSpriteExtra *v141; // x27
cocos2d::CCSprite *v142; // x0
CCMenuItemSpriteExtra *v143; // x27
cocos2d::CCSprite *v144; // x0
CCMenuItemSpriteExtra *v145; // x27
GameManager *v146; // x0
unsigned int *v147; // x1
int v148; // w2
unsigned int *v149; // x1
int v150; // w2
unsigned int *v151; // x1
int v152; // w2
unsigned int *v153; // x1
int v154; // w2
unsigned int *v155; // x1
int v156; // w2
unsigned int *v157; // x25
int v158; // w0
unsigned int *v159; // x1
int v160; // w2
bool v161; // [xsp+94h] [xbp+94h]
cocos2d::CCString *v162; // [xsp+98h] [xbp+98h]
cocos2d::CCString *v163; // [xsp+98h] [xbp+98h]
__int64 v164; // [xsp+A0h] [xbp+A0h]
cocos2d::CCEaseInOut *v165; // [xsp+A0h] [xbp+A0h]
cocos2d::CCEaseInOut *v166; // [xsp+A0h] [xbp+A0h]
__int64 v167; // [xsp+A0h] [xbp+A0h]
const cocos2d::CCPoint *v168; // [xsp+A0h] [xbp+A0h]
float v169; // [xsp+A0h] [xbp+A0h]
float v170; // [xsp+A0h] [xbp+A0h]
void (__fastcall *v171)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+A0h] [xbp+A0h]
void (__fastcall *v172)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+A0h] [xbp+A0h]
void (__fastcall *v173)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+A0h] [xbp+A0h]
float v174; // [xsp+B0h] [xbp+B0h]
float v175; // [xsp+B4h] [xbp+B4h]
char v176[8]; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCPoint v177; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v178; // [xsp+C8h] [xbp+C8h] BYREF
int v179[2]; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCPoint v180; // 0:kr10_8.8
cocos2d::CCPoint v181; // 0:kr18_8.8
cocos2d::SEL_MenuHandler v182; // 0:x2.16
cocos2d::SEL_MenuHandler v183; // 0:x2.16
cocos2d::SEL_MenuHandler v184; // 0:x2.16
cocos2d::SEL_MenuHandler v185; // 0:x2.16
cocos2d::SEL_MenuHandler v186; // 0:x2.16
cocos2d::SEL_MenuHandler v187; // 0:x2.16
v161 = cocos2d::CCLayer::init(a1);
if ( !v161 )
return v161;
v3 = cocos2d::CCTexture2D::defaultAlphaPixelFormat();
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888);
v4 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v4, "DungeonSheet.png", 0);
v5 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v5, "DungeonSheet.plist");
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(v3);
v6 = GameManager::sharedState();
sub_D153B8((int)v179, "secretLoop02.mp3");
GameManager::fadeInMusic((__int64)v6, v179);
v7 = (void *)(*(_QWORD *)v179 - 24LL);
if ( (__int64 *)(*(_QWORD *)v179 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v151 = (unsigned int *)(*(_QWORD *)v179 - 8LL);
do
v152 = __ldaxr(v151);
while ( __stlxr(v152 - 1, v151) );
}
else
{
v152 = *(_DWORD *)(*(_QWORD *)v179 - 8LL);
*(_DWORD *)(*(_QWORD *)v179 - 8LL) = v152 - 1;
}
if ( v152 <= 0 )
operator delete(v7);
}
v8 = 1;
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
v11 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v10);
setAnchorPoint = v11->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v179, 0.0, 0.0);
setAnchorPoint(v11, (const cocos2d::CCPoint *)v179);
a1->addChild_0(a1, v11, -3);
v11->setScaleX(v11, (float)(v174 + 10.0) / v11[1].m_obContentSize.height);
v11->setScaleY(v11, (float)(v175 + 10.0) / v11[1].m_sAdditionalTransform.a);
setPosition = v11->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v179, -5.0, -5.0);
setPosition(v11, (const cocos2d::CCPoint *)v179);
getTag = v11->__vftable[1].getTag;
LOWORD(v179[0]) = 1280;
BYTE2(v179[0]) = 30;
((void (__fastcall *)(cocos2d::CCNode *, int *))getTag)(v11, v179);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_gate_001.png");
a1->addChild_0(a1, v15, 2);
v16 = v15->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v179, v174 * 0.5, (float)(v175 * 0.5) + -5.0);
v16(v15, (const cocos2d::CCPoint *)v179);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_foreground_001.png");
a1->addChild_0(a1, v17, 3);
v18 = v17->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v179, v174 * 0.5, 15.0);
v18(v17, (const cocos2d::CCPoint *)v179);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("Fire_02_looped_001.png");
a1->addChild_0(a1, v19, 4);
v20 = v19->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v179, (float)(v174 * 0.5) + -160.0, (float)(v175 * 0.5) + 50.0);
v20(v19, (const cocos2d::CCPoint *)v179);
v21 = cocos2d::CCSprite::createWithSpriteFrameName("Fire_02_looped_001.png");
a1->addChild_0(a1, v21, 3);
setScale = v21->setScale;
v23 = v19->getScale(v19);
setScale(v21, v23 + v23);
v24 = v21->setPosition;
v25 = (__int64)v19->getPosition(v19);
v24(v21, (const cocos2d::CCPoint *)v25);
setColor = v19->setColor;
LOWORD(v179[0]) = 255;
BYTE2(v179[0]) = 0;
setColor(v19, (const cocos2d::ccColor3B *)v179);
v27 = v21->setColor;
LOBYTE(v179[0]) = -1;
*(_WORD *)((char *)v179 + 1) = 255;
v28 = (cocos2d::CCArray *)((__int64 (__fastcall *)(cocos2d::CCSprite *, int *))v27)(v21, v179);
v29 = (cocos2d::CCArray *)cocos2d::CCArray::create(v28);
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create(v29);
do
{
v31 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v32 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Fire_02_looped_%03i.png",
(const char *)v8);
CString = cocos2d::CCString::getCString(v32);
v34 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v31, CString);
cocos2d::CCArray::addObject(v29, v34);
v35 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v36 = (const char *)v8++;
v37 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Fire_02_2_looped_%03i.png",
v36);
v38 = cocos2d::CCString::getCString(v37);
v39 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v35, v38);
cocos2d::CCArray::addObject(v30, v39);
}
while ( v8 != 10 );
v40 = cocos2d::CCAnimation::createWithSpriteFrames(v29, 0.08);
v41 = cocos2d::CCAnimate::create(v40);
v42 = cocos2d::CCRepeatForever::create(v41);
cocos2d::CCNode::runAction(v19, v42);
v43 = cocos2d::CCAnimation::createWithSpriteFrames(v30, 0.08);
v44 = cocos2d::CCAnimate::create(v43);
v45 = cocos2d::CCRepeatForever::create(v44);
cocos2d::CCNode::runAction(v21, v45);
v46 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonShine_001.png");
v162 = (cocos2d::CCString *)v46->setPosition;
v164 = (__int64)v19->getPosition(v19);
cocos2d::CCPoint::CCPoint(&v178, 0.0, -10.0);
cocos2d::CCPoint::operator+(v179, v164, &v178);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v162)(v46, v179);
a1->addChild_0(a1, v46, 5);
v46->setScale(v46, 1.2);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v46->setBlendFunc)(v46, 0x100000302LL);
v46->setOpacity(v46, 4294967240LL);
v47 = v46->setColor;
LOWORD(v179[0]) = -14081;
BYTE2(v179[0]) = 0;
v47(v46, (const cocos2d::ccColor3B *)v179);
v48 = cocos2d::CCFadeTo::create(1.6, 0xA0u);
v165 = cocos2d::CCEaseInOut::create(v48, 1.3);
v49 = cocos2d::CCFadeTo::create(1.6, 0xE1u);
v50 = cocos2d::CCEaseInOut::create(v49, 1.3);
v51 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v165, v50, 0);
v52 = cocos2d::CCRepeatForever::create(v51);
v53 = (cocos2d::CCScaleTo *)cocos2d::CCNode::runAction(v46, v52);
v54 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create(v53, 1.0, 1.0);
v166 = cocos2d::CCEaseInOut::create(v54, 1.5);
v55 = (cocos2d::CCActionInterval *)cocos2d::CCScaleTo::create((cocos2d::CCScaleTo *)v166, 1.0, 1.2);
v56 = cocos2d::CCEaseInOut::create(v55, 1.5);
v57 = (cocos2d::CCActionInterval *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v166, v56, 0);
v58 = cocos2d::CCRepeatForever::create(v57);
cocos2d::CCNode::runAction(v46, v58);
v59 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonTorch_001.png");
a1->addChild_0(a1, v59, 6);
v163 = (cocos2d::CCString *)v59->setPosition;
v167 = (__int64)v19->getPosition(v19);
cocos2d::CCPoint::CCPoint(&v178, -1.0, -10.0);
cocos2d::CCPoint::operator+(v179, v167, &v178);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v163)(v59, v179);
v60 = cocos2d::CCSprite::createWithSpriteFrameName("dungeonShine_001.png");
v61 = v19;
getPosition = v19->getPosition;
v63 = v60->setPosition;
v64 = (__int64)getPosition(v61);
cocos2d::CCPoint::CCPoint(&v178, 0.0, -14.0);
cocos2d::CCPoint::operator+(v179, v64, &v178);
v63(v60, (const cocos2d::CCPoint *)v179);
a1->addChild_0(a1, v60, 7);
v60->setScale(v60, 0.6);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v60->setBlendFunc)(v60, 0x100000302LL);
v60->setOpacity(v60, 4294967215LL);
v65 = v60->setColor;
LOWORD(v179[0]) = -26881;
BYTE2(v179[0]) = 0;
v65(v60, (const cocos2d::ccColor3B *)v179);
v66 = cocos2d::CCSprite::createWithSpriteFrameName("dungeon_bars_bottom_001.png");
a1->addChild_0(a1, v66, 12);
v67 = v66->setPosition;
v68 = (__int64)v15->getPosition(v15);
cocos2d::CCPoint::CCPoint(&v178, 0.0, -52.0);
cocos2d::CCPoint::operator+(v179, v68, &v178);
v67(v66, (const cocos2d::CCPoint *)v179);
v69 = DungeonBarsSprite::create();
a1->m_dungeonBars = v69;
a1->addChild_0(a1, v69, 9);
m_dungeonBars = a1->m_dungeonBars;
v71 = m_dungeonBars->setPosition;
v72 = (__int64)v15->getPosition(v15);
cocos2d::CCPoint::CCPoint(&v178, -2.0, 10.0);
cocos2d::CCPoint::operator+(v179, v72, &v178);
v71(m_dungeonBars, (const cocos2d::CCPoint *)v179);
v73 = GameManager::sharedState();
if ( GameManager::getUGV(v73, "13") )
a1->m_dungeonBars->setVisible(a1->m_dungeonBars, 0);
v74 = cocos2d::CCSprite::createWithSpriteFrameName("secretEyes_01_001.png");
v75 = v15->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_demonEyes = v74;
v76 = v74->setPosition;
v77 = (__int64)v75->getPosition(v15);
cocos2d::CCPoint::CCPoint(&v178, 13.5, 6.0);
cocos2d::CCPoint::operator+(v179, v77, &v178);
v76(v74, (const cocos2d::CCPoint *)v179);
a1->addChild_0(a1, a1->m_demonEyes, 10);
v78 = GameManager::sharedState();
if ( !GameManager::getUGV(v78, "12") || (v146 = GameManager::sharedState(), GameManager::getUGV(v146, "13")) )
a1->m_demonEyes->setVisible(a1->m_demonEyes, 0);
else
SecretLayer3::animateEyes(a1);
v79 = cocos2d::CCSprite::createWithSpriteFrameName("secretBody_01_001.png");
a1->m_demonBody = v79;
a1->addChild_0(a1, v79, 9);
m_demonBody = a1->m_demonBody;
v81 = m_demonBody->setPosition;
v168 = a1->m_demonEyes->getPosition(a1->m_demonEyes);
cocos2d::CCPoint::CCPoint(&v178, 0.0, -2.0);
cocos2d::CCPoint::operator+(v179, v168, &v178);
v81(m_demonBody, (const cocos2d::CCPoint *)v179);
a1->m_demonBody->setVisible(a1->m_demonBody, 0);
v82 = cocos2d::CCMenu::create();
v83 = (cocos2d::CCArray *)((__int64 (__fastcall *)(SecretLayer3 *, cocos2d::CCMenu *, __int64))a1->addChild_0)(
a1,
v82,
12);
v84 = (cocos2d::CCArray *)cocos2d::CCArray::create(v83);
a1->m_locksArray = v84;
cocos2d::CCObject::retain(v84);
v85 = (__int64)v15->getPosition(v15);
cocos2d::CCPoint::CCPoint(&v178, 160.0, 20.0);
cocos2d::CCPoint::operator+(v179, v85, &v178);
cocos2d::CCNode::convertToNodeSpace(v82, (const cocos2d::CCPoint *)v179);
v86 = GameManager::sharedState();
if ( !GameManager::getUGV(v86, "14") )
{
v144 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock01_001.png");
v187.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v187.adj = (size_t)SecretLayer3::onClick;
v145 = CCMenuItemSpriteExtra::create(v144, nullptr, v187);
v82->addChild(v82, v145);
v173 = v145->setPosition;
cocos2d::CCPoint::CCPoint(&v178, -30.0, -25.0);
cocos2d::CCPoint::operator+(v179, v176, &v178);
v173(v145, (const cocos2d::CCPoint *)v179);
v145->setTag(v145, 1);
cocos2d::CCArray::addObject(a1->m_locksArray, v145);
}
v87 = GameManager::sharedState();
if ( !GameManager::getUGV(v87, "15") )
{
v142 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock02_001.png");
v186.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v186.adj = (size_t)SecretLayer3::onClick;
v143 = CCMenuItemSpriteExtra::create(v142, nullptr, v186);
v82->addChild(v82, v143);
v172 = v143->setPosition;
cocos2d::CCPoint::CCPoint(&v178, 0.0, 25.0);
cocos2d::CCPoint::operator+(v179, v176, &v178);
v172(v143, (const cocos2d::CCPoint *)v179);
v143->setTag(v143, 2);
cocos2d::CCArray::addObject(a1->m_locksArray, v143);
}
v88 = GameManager::sharedState();
if ( !GameManager::getUGV(v88, "16") )
{
v140 = cocos2d::CCSprite::createWithSpriteFrameName("secretLock03_001.png");
v185.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v185.adj = (size_t)SecretLayer3::onClick;
v141 = CCMenuItemSpriteExtra::create(v140, nullptr, v185);
v82->addChild(v82, v141);
v171 = v141->setPosition;
cocos2d::CCPoint::CCPoint(&v178, 30.0, -25.0);
cocos2d::CCPoint::operator+(v179, v176, &v178);
v171(v141, (const cocos2d::CCPoint *)v179);
v141->setTag(v141, 3);
cocos2d::CCArray::addObject(a1->m_locksArray, v141);
}
v89 = GameManager::sharedState();
if ( !GameManager::getUGV(v89, "12") )
{
v90 = 0;
while ( v90 < (unsigned int)cocos2d::CCArray::count(a1->m_locksArray) )
{
v91 = v90++;
v92 = cocos2d::CCArray::objectAtIndex(a1->m_locksArray, v91);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v92 + 1040LL))(v92, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v92 + 328LL))(v92, 0);
}
}
v93 = GameStatsManager::sharedState();
sub_D153B8((int)v179, "0001");
isSpecialChestUnlocked = (unsigned __int8)GameStatsManager::isSpecialChestUnlocked((__int64)v93, (char **)v179);
v95 = (void *)(*(_QWORD *)v179 - 24LL);
if ( (__int64 *)(*(_QWORD *)v179 - 24LL) == &qword_124B6B0 )
goto LABEL_21;
if ( &pthread_create )
{
v149 = (unsigned int *)(*(_QWORD *)v179 - 8LL);
do
v150 = __ldaxr(v149);
while ( __stlxr(v150 - 1, v149) );
}
else
{
v150 = *(_DWORD *)(*(_QWORD *)v179 - 8LL);
*(_DWORD *)(*(_QWORD *)v179 - 8LL) = v150 - 1;
}
if ( v150 > 0 )
{
LABEL_21:
if ( isSpecialChestUnlocked )
goto LABEL_25;
}
else
{
operator delete(v95);
if ( isSpecialChestUnlocked )
goto LABEL_25;
}
v96 = GameStatsManager::sharedState();
sub_D153B8((int)v179, "0001");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((__int64)v96, (const std::string *)v179);
v98 = (void *)(*(_QWORD *)v179 - 24LL);
if ( (__int64 *)(*(_QWORD *)v179 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v155 = (unsigned int *)(*(_QWORD *)v179 - 8LL);
do
v156 = __ldaxr(v155);
while ( __stlxr(v156 - 1, v155) );
}
else
{
v156 = *(_DWORD *)(*(_QWORD *)v179 - 8LL);
*(_DWORD *)(*(_QWORD *)v179 - 8LL) = v156 - 1;
}
if ( v156 <= 0 )
operator delete(v98);
}
v99 = GJChestSprite::create(*(_DWORD *)(RewardForSpecialChest + 64));
GJChestSprite::switchToState(v99, Closed, 0);
v99->setScale(v99, 0.6);
v100 = v99->getChildren(v99);
v101 = cocos2d::CCArray::objectAtIndex(v100, 0);
v102 = *(void (__fastcall **)(__int64, int *))(*(_QWORD *)v101 + 944LL);
LOWORD(v179[0]) = -14136;
BYTE2(v179[0]) = -1;
v102(v101, v179);
v182.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v182.adj = (size_t)SecretLayer3::onChest01;
v103 = CCMenuItemSpriteExtra::create(v99, nullptr, v182);
sub_D153B8((int)v179, "chestClick.ogg");
sub_D18EA8(&v103->m_selectSound, v179);
v104 = (void *)(*(_QWORD *)v179 - 24LL);
if ( (__int64 *)(*(_QWORD *)v179 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v153 = (unsigned int *)(*(_QWORD *)v179 - 8LL);
do
v154 = __ldaxr(v153);
while ( __stlxr(v154 - 1, v153) );
}
else
{
v154 = *(_DWORD *)(*(_QWORD *)v179 - 8LL);
*(_DWORD *)(*(_QWORD *)v179 - 8LL) = v154 - 1;
}
if ( v154 <= 0 )
operator delete(v104);
}
setContentSize = v103->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v179, 60.0, 48.0);
setContentSize(v103, (const cocos2d::CCSize *)v179);
v106 = v99->setPosition;
v169 = v103->getContentSize(v103)->width * 0.5;
v107 = (__int64)v103->getContentSize(v103);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v179, v169, *(float *)(v107 + 4) * 0.5);
v106(v99, (const cocos2d::CCPoint *)v179);
v82->addChild(v82, v103);
v108 = v103->setPosition;
cocos2d::CCPoint::CCPoint(&v178, v174 - 80.0, 60.0);
v180 = cocos2d::CCNode::convertToNodeSpace(v82, &v178);
((void (__fastcall *)(CCMenuItemSpriteExtra *, int *, float, float))v108)(v103, v179, v180.x, v180.y);
LABEL_25:
v109 = GameStatsManager::sharedState();
sub_D153B8((int)v179, "0002");
v110 = (unsigned __int8)GameStatsManager::isSpecialChestUnlocked((__int64)v109, (char **)v179);
v111 = (void *)(*(_QWORD *)v179 - 24LL);
if ( (__int64 *)(*(_QWORD *)v179 - 24LL) == &qword_124B6B0 )
goto LABEL_26;
if ( &pthread_create )
{
v147 = (unsigned int *)(*(_QWORD *)v179 - 8LL);
do
v148 = __ldaxr(v147);
while ( __stlxr(v148 - 1, v147) );
}
else
{
v148 = *(_DWORD *)(*(_QWORD *)v179 - 8LL);
*(_DWORD *)(*(_QWORD *)v179 - 8LL) = v148 - 1;
}
if ( v148 > 0 )
{
LABEL_26:
if ( !v110 )
goto LABEL_27;
}
else
{
operator delete(v111);
if ( !v110 )
{
LABEL_27:
v112 = cocos2d::CCMenu::create();
a1->addChild_0(a1, v112, 10);
v113 = GameStatsManager::sharedState();
sub_D153B8((int)v179, "0002");
v114 = GameStatsManager::getRewardForSpecialChest((__int64)v113, (const std::string *)v179);
v115 = (void *)(*(_QWORD *)v179 - 24LL);
if ( (__int64 *)(*(_QWORD *)v179 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v159 = (unsigned int *)(*(_QWORD *)v179 - 8LL);
do
v160 = __ldaxr(v159);
while ( __stlxr(v160 - 1, v159) );
}
else
{
v160 = *(_DWORD *)(*(_QWORD *)v179 - 8LL);
*(_DWORD *)(*(_QWORD *)v179 - 8LL) = v160 - 1;
}
if ( v160 <= 0 )
operator delete(v115);
}
v116 = GJChestSprite::create(*(_DWORD *)(v114 + 64));
GJChestSprite::switchToState(v116, Closed, 0);
v116->setScale(v116, 0.6);
v183.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v183.adj = (size_t)SecretLayer3::onChest02;
v117 = CCMenuItemSpriteExtra::create(v116, nullptr, v183);
a1->m_secretChest = v117;
sub_D153B8((int)v179, "chestClick.ogg");
sub_D18EA8(&v117->m_selectSound, v179);
v118 = (void *)(*(_QWORD *)v179 - 24LL);
if ( (__int64 *)(*(_QWORD *)v179 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v157 = (unsigned int *)(*(_QWORD *)v179 - 8LL);
do
v158 = __ldaxr(v157);
while ( __stlxr(v158 - 1, v157) );
}
else
{
v158 = *(_DWORD *)(*(_QWORD *)v179 - 8LL);
*(_DWORD *)(*(_QWORD *)v179 - 8LL) = v158 - 1;
}
if ( v158 <= 0 )
operator delete(v118);
}
m_secretChest = a1->m_secretChest;
v120 = m_secretChest->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v179, 60.0, 48.0);
v120(m_secretChest, (const cocos2d::CCSize *)v179);
v121 = v116->setPosition;
v170 = a1->m_secretChest->getContentSize(a1->m_secretChest)->width * 0.5;
v122 = a1->m_secretChest->getContentSize(a1->m_secretChest);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v179, v170, v122->height * 0.5);
v121(v116, (const cocos2d::CCPoint *)v179);
v112->addChild(v112, a1->m_secretChest);
v123 = a1->m_secretChest;
v124 = v15;
v125 = v15->getPosition;
v126 = v123->setPosition;
v127 = (__int64)v125(v124);
cocos2d::CCPoint::CCPoint(&v177, 0.0, -24.0);
cocos2d::CCPoint::operator+(&v178, v127, &v177);
v181 = cocos2d::CCNode::convertToNodeSpace(v112, &v178);
((void (__fastcall *)(CCMenuItemSpriteExtra *, int *, float, float))v126)(v123, v179, v181.x, v181.y);
v128 = a1->m_secretChest;
v128->m_animationEnabled = 0;
v128->m_colorEnabled = 1;
v129 = GameManager::sharedState();
if ( !GameManager::getUGV(v129, "13") )
{
a1->m_secretChest->setEnabled(a1->m_secretChest, 0);
a1->m_secretChest->setVisible(a1->m_secretChest, 0);
}
}
}
v130 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v184.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v184.adj = (size_t)SecretLayer3::onBack;
v131 = CCMenuItemSpriteExtra::create(v130, nullptr, v184);
CCMenuItemSpriteExtra::setSizeMult(v131, 1.5);
v132 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v131, nullptr);
a1->addChild_0(a1, v132, 1);
v133 = v132->setPosition;
v134 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v134);
v136 = v135;
v137 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v137);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v179, v136 + 24.0, v138 - 23.0);
v133(v132, (const cocos2d::CCPoint *)v179);
isControllerConnected = PlatformToolbox::isControllerConnected();
if ( isControllerConnected )
{
v161 = isControllerConnected;
GameToolbox::addBackButton(a1, v131);
}
return v161;
}