//
// SecretRewardsLayer::init from 0x1403d2670 to 0x1403d4cb5 (9797 bytes)
//
// 2 xrefs:
// > SecretRewardsLayer::scene @ 0x1403d2618
// > ??> @ 0x1406d7cb8
//
// 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=23
bool SecretRewardsLayer::init(SecretRewardsLayer *a1, bool a2)
{
bool result; // al
cocos2d::CCTextureCache *v4; // rax
__int64 v5; // rcx
cocos2d::CCSpriteFrameCache *v6; // rax
_BOOL8 v7; // rdx
_BOOL8 v8; // rdx
__int64 v9; // rcx
cocos2d::CCDirector *v10; // rax
GameManager *v11; // rcx
GameManager *v12; // rcx
__int64 v13; // rcx
cocos2d::CCLayer *v14; // rax
cocos2d::CCSprite *v15; // rax
cocos2d::CCSprite_vtbl *v16; // rbx
const cocos2d::CCPoint *v17; // rax
float v18; // xmm0_4
cocos2d::CCSprite_vtbl *v19; // rbx
double v20; // xmm0_8
const cocos2d::CCPoint *v21; // rax
struct cocos2d::CCSprite *v22; // rdi
cocos2d::CCSprite_vtbl *v23; // rbx
__int64 v24; // rax
float v25; // xmm0_4
cocos2d::CCSprite_vtbl *v26; // rbx
const cocos2d::CCPoint *v27; // rax
__int64 v28; // rdx
double v29; // xmm0_8
struct cocos2d::CCSprite *v30; // rdi
cocos2d::CCSprite_vtbl *v31; // rbx
__int64 v32; // rax
float v33; // xmm0_4
cocos2d::CCSprite_vtbl *v34; // rbx
const cocos2d::CCPoint *v35; // rax
__int64 v36; // rdx
cocos2d::CCSprite *v37; // rax
CCMenuItemSpriteExtra *v38; // rsi
struct cocos2d::CCMenu *v39; // rdi
cocos2d::CCMenu_vtbl *v40; // rbx
__int64 v41; // rcx
cocos2d::CCDirector *v42; // rax
__int64 v43; // rcx
cocos2d::CCDirector *v44; // rax
float v45; // xmm0_4
double v46; // xmm0_8
const cocos2d::CCPoint *v47; // rax
__int64 v48; // rcx
GameStatsManager *v49; // rcx
int Stat; // eax
cocos2d::CCString *v51; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *v53; // rax
cocos2d::CCLabelBMFont_vtbl *v54; // rbx
__int64 v55; // rax
float v56; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v57; // rbx
const cocos2d::CCPoint *v58; // rax
cocos2d::CCSprite *v59; // rax
float v60; // xmm0_4
const cocos2d::CCPoint *v61; // rax
GameStatsManager *v62; // rcx
int v63; // eax
cocos2d::CCString *v64; // rax
const char *v65; // rax
cocos2d::CCLabelBMFont *v66; // rax
cocos2d::CCLabelBMFont_vtbl *v67; // rbx
const cocos2d::CCPoint *v68; // rax
float v69; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v70; // rbx
const cocos2d::CCPoint *v71; // rax
cocos2d::CCSprite *v72; // rax
float v73; // xmm0_4
const cocos2d::CCPoint *v74; // rax
struct cocos2d::CCSprite *v75; // rdi
float v76; // xmm0_4
cocos2d::CCSprite_vtbl *v77; // rbx
const cocos2d::CCPoint *v78; // rax
struct cocos2d::CCSprite *v79; // rdi
float v80; // xmm0_4
cocos2d::CCSprite_vtbl *v81; // rbx
__int64 v82; // rax
float v83; // xmm0_4
cocos2d::CCSprite_vtbl *v84; // rbx
const cocos2d::CCPoint *v85; // rax
__int64 v86; // rdx
__int64 v87; // rcx
cocos2d::CCArray *v88; // rsi
__int64 v89; // rcx
cocos2d::CCArray *v90; // r12
__int64 v91; // rcx
cocos2d::CCDictionary *v92; // rax
unsigned int v93; // r13d
float v94; // xmm0_4
unsigned int v95; // r14d
struct cocos2d::CCObject *v96; // rbx
__int64 v97; // rcx
struct cocos2d::CCObject *v98; // rdi
struct cocos2d::CCObject *v99; // rsi
unsigned int v100; // r12d
cocos2d::CCString *v101; // rax
const char *v102; // rax
struct cocos2d::CCSprite *v103; // rdi
float v104; // xmm0_4
cocos2d::CCSprite_vtbl *v105; // rbx
const cocos2d::CCPoint *v106; // rax
int v107; // r14d
cocos2d::CCString *v108; // rax
const char *v109; // rax
size_t v110; // r8
cocos2d::CCString *v111; // rax
const char *v112; // rax
size_t v113; // r8
GJChestSprite *v114; // r12
CCMenuItemSpriteExtra *v115; // rdi
cocos2d::CCString *v116; // rax
char *v117; // rax
size_t v118; // r8
__int64 v119; // rcx
__int64 v120; // rax
CCMenuItemSpriteExtra_vtbl *v121; // rbx
double v122; // xmm0_8
const cocos2d::CCSize *v123; // rax
GJChestSprite_vtbl *v124; // rbx
float *v125; // rax
const cocos2d::CCPoint *v126; // rax
cocos2d::CCNode *v127; // r12
CCMenuItemSpriteExtra_vtbl *v128; // rbx
struct cocos2d::CCPoint v129; // rax
SecretRewardsLayer *v130; // rcx
struct cocos2d::CCSprite *v131; // rdi
float v132; // xmm0_4
__int64 v133; // rdx
void **v134; // rcx
struct cocos2d::CCSprite *v135; // r12
float v136; // xmm0_4
__int64 v137; // rax
double v138; // xmm0_8
__int64 v139; // r8
signed int v140; // esi
signed int v141; // edi
cocos2d::CCString *v142; // rax
const char *v143; // rax
struct cocos2d::CCLabelBMFont *v144; // r12
float v145; // xmm0_4
__int64 v146; // rax
__int16 *v147; // rdx
__int64 v148; // rax
__int64 v149; // rax
__int64 i; // rdx
signed int v151; // ecx
__int64 v152; // rax
__int64 v153; // rax
__int64 j; // rdx
signed int v155; // ecx
struct cocos2d::CCObject *v156; // r14
cocos2d::CCArray *v157; // r13
__int64 v158; // rcx
cocos2d::CCNode *v159; // r12
GJChestSprite *v160; // rsi
CCMenuItemSpriteExtra *v161; // rdi
cocos2d::CCLabelBMFont *v162; // rax
float v163; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v164; // rbx
const cocos2d::CCPoint *v165; // rax
struct cocos2d::CCSprite *v166; // rbx
float v167; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v168; // rbx
double v169; // xmm0_8
float v170; // xmm6_4
double v171; // xmm0_8
double v172; // xmm0_8
const cocos2d::CCSize *v173; // rax
GJChestSprite_vtbl *v174; // rbx
float *v175; // rax
const cocos2d::CCPoint *v176; // rax
CCMenuItemSpriteExtra_vtbl *v177; // rbx
struct cocos2d::CCPoint v178; // rax
GameStatsManager *v179; // rsi
int v180; // ebx
SecretRewardsLayer *v181; // rcx
struct cocos2d::CCSprite *v182; // rsi
float v183; // xmm0_4
__int64 v184; // rdx
struct cocos2d::CCSprite *v185; // rdi
float v186; // xmm0_4
__int64 v187; // rax
float v188; // xmm0_4
cocos2d::CCSprite *v189; // rax
float v190; // xmm0_4
cocos2d::CCSprite_vtbl *v191; // rbx
const cocos2d::CCPoint *v192; // rax
struct cocos2d::CCObject *v193; // rbx
__int64 v194; // rcx
cocos2d::CCNode *v195; // r12
unsigned int v196; // r14d
__int64 v197; // rsi
unsigned __int64 v198; // rdi
_BYTE *v199; // rbx
unsigned __int64 v200; // rcx
__int64 v201; // rbx
_QWORD *v202; // rsi
void *v203; // rcx
unsigned __int64 v204; // rdi
_BYTE *v205; // rbx
unsigned __int64 v206; // rcx
_BYTE *v207; // rax
char v208; // cl
unsigned __int64 v209; // rdi
_BYTE *v210; // rbx
unsigned __int64 v211; // rcx
__int64 v212; // rbx
_QWORD *v213; // rsi
void *v214; // rcx
_BYTE *v215; // rbx
unsigned __int64 v216; // rcx
unsigned __int64 v217; // rdi
_BYTE *v218; // rbx
unsigned __int64 v219; // rcx
__int64 v220; // rbx
_QWORD *v221; // rsi
void *v222; // rcx
_BYTE *v223; // rbx
unsigned __int64 v224; // rcx
void *v225; // rbx
void *v226; // rcx
void **v227; // rcx
struct cocos2d::CCSprite *v228; // rsi
CCMenuItemSpriteExtra *v229; // rdi
float v230; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v231; // rbx
struct cocos2d::CCPoint v232; // rax
__int64 v233; // rax
__int64 v234; // rax
double v235; // xmm0_8
__int64 v236; // rax
double v237; // xmm0_8
float v238; // xmm0_4
int k; // edi
void **v240; // rcx
struct cocos2d::CCSprite *v241; // rbx
float v242; // xmm0_4
int v243; // edx
BoomScrollLayer *v244; // rax
__int64 v245; // rcx
cocos2d::CCDirector *v246; // rax
float ScreenBottom; // xmm0_4
BoomScrollLayer *m_mainScrollLayer; // rbx
__int64 v249; // rax
__int64 v250; // rcx
cocos2d::CCDirector *v251; // rax
float ScreenTop; // xmm6_4
__int64 v253; // rcx
cocos2d::CCDirector *v254; // rax
float ScreenRight; // xmm0_4
__int64 v256; // rax
ExtendedLayer *m_extendedLayer; // rcx
cocos2d::CCNode *v258; // rdi
struct cocos2d::CCSprite *v259; // rsi
CCMenuItemSpriteExtra *v260; // rax
CCMenuItemSpriteExtra *v261; // rbx
CCMenuItemSpriteExtra_vtbl *v262; // rbx
__int64 v263; // rcx
cocos2d::CCDirector *v264; // rax
float v265; // xmm0_4
struct cocos2d::CCPoint v266; // rax
cocos2d::CCSprite *v267; // rsi
CCMenuItemSpriteExtra *v268; // rax
CCMenuItemSpriteExtra *v269; // rbx
CCMenuItemSpriteExtra_vtbl *v270; // rbx
__int64 v271; // rcx
cocos2d::CCDirector *v272; // rax
float v273; // xmm0_4
struct cocos2d::CCPoint v274; // rax
BoomScrollLayer *v275; // rcx
cocos2d::CCArray *m_dynamicObjects; // rcx
unsigned int v277; // eax
int v278; // ebx
_WORD v279[2]; // [rsp+38h] [rbp-D0h] BYREF
bool isSpecialChestUnlocked; // [rsp+3Ch] [rbp-CCh]
void **v281; // [rsp+40h] [rbp-C8h] BYREF
float v282; // [rsp+48h] [rbp-C0h]
_WORD v283[2]; // [rsp+50h] [rbp-B8h] BYREF
bool v284; // [rsp+54h] [rbp-B4h]
__int64 v285; // [rsp+58h] [rbp-B0h] BYREF
__int16 v286; // [rsp+60h] [rbp-A8h]
__int16 v287; // [rsp+64h] [rbp-A4h]
char v288; // [rsp+66h] [rbp-A2h]
__int16 v289; // [rsp+68h] [rbp-A0h]
_WORD v290[6]; // [rsp+6Ch] [rbp-9Ch] BYREF
__int16 v291; // [rsp+78h] [rbp-90h] BYREF
char v292; // [rsp+7Ah] [rbp-8Eh]
__int16 v293; // [rsp+7Ch] [rbp-8Ch]
cocos2d::CCRect v294; // [rsp+80h] [rbp-88h] BYREF
cocos2d::CCArray *v295; // [rsp+90h] [rbp-78h] BYREF
struct cocos2d::CCPoint v296; // [rsp+98h] [rbp-70h] BYREF
struct cocos2d::CCObject *v297; // [rsp+A0h] [rbp-68h]
void *v298; // [rsp+A8h] [rbp-60h] BYREF
void **v299; // [rsp+B0h] [rbp-58h]
char Src[15]; // [rsp+B8h] [rbp-50h] BYREF
char v301; // [rsp+C7h] [rbp-41h]
__int64 v302; // [rsp+C8h] [rbp-40h]
__int64 v303; // [rsp+D0h] [rbp-38h]
char v304[16]; // [rsp+D8h] [rbp-30h] BYREF
__int64 v305; // [rsp+E8h] [rbp-20h]
__int64 v306; // [rsp+F0h] [rbp-18h]
char v307[8]; // [rsp+F8h] [rbp-10h] BYREF
char v308[8]; // [rsp+100h] [rbp-8h] BYREF
struct cocos2d::CCPoint v309; // [rsp+108h] [rbp+0h] BYREF
struct cocos2d::CCObject *v310; // [rsp+110h] [rbp+8h]
void *v311; // [rsp+118h] [rbp+10h]
void *v312; // [rsp+120h] [rbp+18h]
cocos2d::CCPoint v313; // [rsp+128h] [rbp+20h] BYREF
cocos2d::CCPoint v314; // [rsp+130h] [rbp+28h] BYREF
char v315[8]; // [rsp+138h] [rbp+30h] BYREF
char v316[8]; // [rsp+140h] [rbp+38h] BYREF
struct cocos2d::CCPoint v317[4]; // [rsp+150h] [rbp+48h] BYREF
void *v318; // [rsp+170h] [rbp+68h]
void *v319; // [rsp+178h] [rbp+70h]
void *v320; // [rsp+180h] [rbp+78h]
CCMenuItemSpriteExtra *v321; // [rsp+190h] [rbp+88h]
cocos2d::CCSize v322; // [rsp+198h] [rbp+90h] BYREF
void *v323[2]; // [rsp+1A0h] [rbp+98h] BYREF
__int64 v324; // [rsp+1B0h] [rbp+A8h]
unsigned __int64 v325; // [rsp+1B8h] [rbp+B0h]
void *v326[2]; // [rsp+1C0h] [rbp+B8h] BYREF
__int64 v327; // [rsp+1D0h] [rbp+C8h]
unsigned __int64 v328; // [rsp+1D8h] [rbp+D0h]
__int128 v329; // [rsp+1E0h] [rbp+D8h] BYREF
__int64 v330; // [rsp+1F0h] [rbp+E8h]
__int64 v331; // [rsp+1F8h] [rbp+F0h]
v284 = a2;
result = cocos2d::CCLayer::init(a1);
if ( !result )
return result;
a1->m_inMainLayer = 1;
v4 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v4, "TreasureRoomSheet.png", 0);
v6 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v5);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v6, "TreasureRoomSheet.plist");
LOBYTE(v7) = 1;
a1->setKeypadEnabled(a1, v7);
LOBYTE(v8) = 1;
a1->setKeyboardEnabled(a1, v8);
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(v10);
v11 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v281 = (void **)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v281);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getUGV(v11, "10") )
a1->m_scratchDialogIndex = 4;
v12 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v281 = (void **)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v281);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getUGV(v12, (const char *)&word_140543238) )
a1->m_potborDialogIndex = 3;
v281 = v326;
v327 = 14;
v328 = 15;
strcpy((char *)v326, "secretLoop.mp3");
HIBYTE(v326[1]) = 0;
if ( !qword_1406C2ED8 )
{
v298 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v298);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
GameManager::fadeInMusic(v13, (__int64)v326);
v14 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();
a1->m_mainLayer = v14;
a1->addChild_0(a1, v14, 0);
v15 = cocos2d::CCSprite::create("GJ_gradientBG.png");
a1->m_backgroundSprite = v15;
v16 = v15->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(4.5040475e30, 0.0);
v16->setAnchorPoint(a1->m_backgroundSprite, v17);
a1->addChild_0(a1, a1->m_backgroundSprite, -3);
((void (*)(void))a1->m_backgroundSprite->setScaleX)();
v18 = ((float (*)(void))a1->m_backgroundSprite->setScaleY)();
v19 = a1->m_backgroundSprite->__vftable;
v20 = cocos2d::CCPoint::CCPoint(v18, -5.0);
v19->setPosition_0(a1->m_backgroundSprite, v21);
v279[0] = 70;
LOBYTE(v279[1]) = 75;
a1->m_backgroundSprite->setColor(&a1->m_backgroundSprite->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v279);
v22 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomSpiderweb_001.png");
v23 = v22->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v20, 1.0);
v25 = ((float (__fastcall *)(struct cocos2d::CCSprite *, __int64))v23->setAnchorPoint)(v22, v24);
v26 = v22->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v25, v282 + 5.0);
v26->setPosition_0(v22, v27);
LOBYTE(v28) = 63;
v22->setOpacity(&v22->cocos2d::CCRGBAProtocol, v28);
v279[0] = 0;
LOBYTE(v279[1]) = 0;
v22->setColor(&v22->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v279);
v29 = ((double (__fastcall *)(SecretRewardsLayer *, struct cocos2d::CCSprite *, __int64))a1->addChild_0)(
a1,
v22,
0xFFFFFFFFLL);
((void (__fastcall *)(struct cocos2d::CCSprite *))v22->setScale_0)(v22);
v30 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomSpiderweb_001.png");
v31 = v30->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v29, 0.0);
v33 = ((float (__fastcall *)(struct cocos2d::CCSprite *, __int64))v31->setAnchorPoint)(v30, v32);
v34 = v30->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v33, -5.0);
v34->setPosition_0(v30, v35);
LOBYTE(v36) = 63;
v30->setOpacity(&v30->cocos2d::CCRGBAProtocol, v36);
cocos2d::CCSprite::setFlipX(v30, 1);
v279[0] = 0;
LOBYTE(v279[1]) = 0;
v30->setColor(&v30->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v279);
a1->addChild_0(a1, v30, -1);
((void (__fastcall *)(struct cocos2d::CCSprite *))v30->setScale_0)(v30);
v37 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
a1->m_backSprite = v37;
v38 = CCMenuItemSpriteExtra::create(v37, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretRewardsLayer::onBack);
HIDWORD(v38->m_pfnSelector.adj) = 1070386381;
v39 = cocos2d::CCMenu::create(v38, 0);
a1->addChild_0(a1, v39, 1);
v40 = v39->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v42 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v41);
cocos2d::CCDirector::getScreenTop(v42);
v44 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v43);
v45 = cocos2d::CCDirector::getScreenLeft(v44) + 24.0;
v46 = cocos2d::CCPoint::CCPoint(v45, v45);
v40->setPosition_0(v39, v47);
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v48) + 197) )
GameToolbox::addBackButton(a1, v38);
v49 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v281 = (void **)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v281);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v49 = (GameStatsManager *)qword_1406C2EE8;
}
Stat = GameStatsManager::getStat(v49, (const char *)&word_140543238);
v51 = cocos2d::CCString::createWithFormat("%i", Stat);
CString = cocos2d::CCString::getCString(v51);
v53 = cocos2d::CCLabelBMFont::create(CString, (const char *)&qword_14052A4D8);
a1->m_keysLabel = v53;
v54 = v53->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v46, v282 - 55.0);
v56 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v54->setPosition_0)(a1->m_keysLabel, v55);
v57 = a1->m_keysLabel->__vftable;
cocos2d::CCPoint::CCPoint(v56, 1.0);
v57->setAnchorPoint(a1->m_keysLabel, v58);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_keysLabel->setScale_0)(a1->m_keysLabel);
a1->addChild_1(a1, a1->m_keysLabel);
v59 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)&xmmword_140544228);
a1->m_keySprite = v59;
v60 = ((float (__fastcall *)(SecretRewardsLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v59, 3);
cocos2d::CCPoint::CCPoint(v60, 25.0);
v61 = a1->m_keysLabel->getPosition_0(a1->m_keysLabel);
cocos2d::CCPoint::operator+(v61, &v295);
a1->m_keySprite->setPosition_0(a1->m_keySprite, (const cocos2d::CCPoint *)&v295);
v62 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v298 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v298);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v62 = (GameStatsManager *)qword_1406C2EE8;
}
v63 = GameStatsManager::getStat(v62, "43");
v64 = cocos2d::CCString::createWithFormat("%i", v63);
v65 = cocos2d::CCString::getCString(v64);
v66 = cocos2d::CCLabelBMFont::create(v65, (const char *)&qword_14052A4D8);
a1->m_goldKeysLabel = v66;
v67 = v66->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v68 = a1->m_keysLabel->getPosition_0(a1->m_keysLabel);
v69 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, const cocos2d::CCPoint *))v67->setPosition_0)(
a1->m_goldKeysLabel,
v68);
v70 = a1->m_goldKeysLabel->__vftable;
cocos2d::CCPoint::CCPoint(v69, 1.0);
v70->setAnchorPoint(a1->m_goldKeysLabel, v71);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_goldKeysLabel->setScale_0)(a1->m_goldKeysLabel);
a1->addChild_1(a1, a1->m_goldKeysLabel);
v72 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)&xmmword_1405441F0);
a1->m_goldKeySprite = v72;
v73 = ((float (__fastcall *)(SecretRewardsLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v72, 3);
cocos2d::CCPoint::CCPoint(v73, 25.0);
v74 = a1->m_goldKeysLabel->getPosition_0(a1->m_goldKeysLabel);
cocos2d::CCPoint::operator+(v74, &v295);
a1->m_goldKeySprite->setPosition_0(a1->m_goldKeySprite, (const cocos2d::CCPoint *)&v295);
a1->m_goldKeysLabel->setVisible(a1->m_goldKeysLabel, 0);
a1->m_goldKeySprite->setVisible(a1->m_goldKeySprite, 0);
v75 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomLabel_001.png");
v76 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v75,
2);
v77 = v75->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v76, v282 * 0.5);
v77->setPosition_0(v75, v78);
v79 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomGround_001.png");
v80 = ((float (__fastcall *)(SecretRewardsLayer *, struct cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v79, 2);
v81 = v79->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v80, 0.0);
v83 = ((float (__fastcall *)(struct cocos2d::CCSprite *, __int64))v81->setAnchorPoint)(v79, v82);
v84 = v79->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v83, -10.0);
v84->setPosition_0(v79, v85);
v285 = 0x100000302LL;
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v79->setBlendFunc)(
&v79->cocos2d::CCTextureProtocol,
0x100000302LL);
((void (__fastcall *)(struct cocos2d::CCSprite *))v79->setScale_0)(v79);
LOBYTE(v86) = -106;
v79->setOpacity(&v79->cocos2d::CCRGBAProtocol, v86);
v88 = (cocos2d::CCArray *)cocos2d::CCArray::create(v87);
v295 = v88;
v90 = (cocos2d::CCArray *)cocos2d::CCArray::create(v89);
v281 = (void **)&v90->__vftable;
v92 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v91);
a1->m_chestCounters = v92;
cocos2d::CCObject::retain(v92);
v93 = 0;
v317[3] = (struct cocos2d::CCPoint)Src;
do
{
v94 = floorf((float)(int)v93 / 3.0);
v95 = (int)v94;
if ( cocos2d::CCArray::count(v88) < (int)v94 + 1 )
{
v96 = (struct cocos2d::CCObject *)cocos2d::CCLayer::create();
v98 = (struct cocos2d::CCObject *)cocos2d::CCMenu::create(v97);
v96->__vftable[6].isEqual(v96, v98);
cocos2d::CCArray::addObject(v88, v96);
cocos2d::CCArray::addObject(v90, v98);
}
v99 = cocos2d::CCArray::objectAtIndex(v88, v95);
v310 = v99;
v297 = cocos2d::CCArray::objectAtIndex(v90, v95);
v100 = v93 % 3;
if ( v93 == 3 * (v93 / 3) && v93 < 6 )
{
v101 = cocos2d::CCString::createWithFormat("tier%ilabel_001.png", (int)(float)(v94 + 1.0));
v102 = cocos2d::CCString::getCString(v101);
v103 = cocos2d::CCSprite::createWithSpriteFrameName(v102);
v104 = ((float (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCSprite *, _QWORD))v99->__vftable[6].~CCObject)(
v99,
v103,
v100 + 2);
v105 = v103->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v104, v282 * 0.5);
v105->setPosition_0(v103, v106);
((void (__fastcall *)(struct cocos2d::CCSprite *))v103->setScale_0)(v103);
}
cocos2d::CCPoint::CCPoint(v282 * 0.5, (float)((float)(int)(v100 - 1) * 100.0) + (float)(v282 * 0.5));
v107 = v93 + 3;
if ( v93 >= 6 )
v107 = 2;
v108 = cocos2d::CCString::createWithFormat("chest_0%i_price_001.png", v107);
v109 = cocos2d::CCString::getCString(v108);
*(_OWORD *)v326 = 0;
v327 = 0;
v328 = 0;
v110 = -1;
do
++v110;
while ( v109[v110] );
sub_14003A930(v326, v109, v110);
v111 = cocos2d::CCString::createWithFormat("chest_0%i_02_001.png", v107);
v112 = cocos2d::CCString::getCString(v111);
v329 = 0;
v330 = 0;
v331 = 0;
v113 = -1;
do
++v113;
while ( v112[v113] );
sub_14003A930(&v329, v112, v113);
isSpecialChestUnlocked = 0;
if ( v93 < 3 )
{
v286 = 14446;
v287 = 14446;
v288 = -126;
v279[0] = 14446;
LOBYTE(v279[1]) = -126;
goto LABEL_32;
}
v289 = 25700;
memset(v290, 100, 3);
memset(v279, 100, 3);
if ( v93 >= 6 )
{
v290[2] = 100;
v279[0] = 100;
LOBYTE(v279[1]) = -76;
v116 = cocos2d::CCString::createWithFormat("chestSpecial_0%i_price_001.png", v100 + 1);
v117 = (char *)cocos2d::CCString::getCString(v116);
v118 = -1;
do
++v118;
while ( v117[v118] );
sub_14003CCE0(v326, v117, v118);
if ( v100 )
{
if ( v100 == 1 )
{
v299 = v323;
*(_OWORD *)v323 = 0;
v324 = 4;
v325 = 15;
strcpy((char *)v323, "0005");
v119 = qword_1406C2EE8;
if ( qword_1406C2EE8 )
{
LABEL_46:
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v119, v323);
goto LABEL_32;
}
v319 = operator new(0x3E0u);
v120 = sub_1401D0AE0((__int64)v319);
}
else
{
if ( v100 != 2 )
goto LABEL_32;
v299 = v323;
*(_OWORD *)v323 = 0;
v324 = 4;
v325 = 15;
strcpy((char *)v323, "0006");
v119 = qword_1406C2EE8;
if ( qword_1406C2EE8 )
goto LABEL_46;
v318 = operator new(0x3E0u);
v120 = sub_1401D0AE0((__int64)v318);
}
}
else
{
v299 = v323;
*(_OWORD *)v323 = 0;
v324 = 4;
v325 = 15;
strcpy((char *)v323, "0004");
v119 = qword_1406C2EE8;
if ( qword_1406C2EE8 )
goto LABEL_46;
v320 = operator new(0x3E0u);
v120 = sub_1401D0AE0((__int64)v320);
}
qword_1406C2EE8 = v120;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v120 + 72LL))(v120);
v119 = qword_1406C2EE8;
goto LABEL_46;
}
LABEL_32:
v114 = GJChestSprite::create(v107);
((void (__fastcall *)(GJChestSprite *))v114->setScale_0)(v114);
v321 = (CCMenuItemSpriteExtra *)operator new(0x208u);
v115 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v321);
if ( v115 )
{
if ( CCMenuItemSpriteExtra::init(
v115,
v114,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SecretRewardsLayer::onChestType) )
{
cocos2d::CCObject::autorelease(v115);
goto LABEL_51;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v115->~CCMenuItemSpriteExtra)(v115, 1);
}
v115 = nullptr;
LABEL_51:
v301 = 0;
v302 = 14;
v303 = 15;
strcpy(Src, "chestClick.ogg");
if ( &v115->m_activateSound.m_data.m_capacity != (std::size_t *)Src )
sub_14003CCE0((void **)&v115->m_activateSound.m_data.m_capacity, Src, 0xEu);
sub_14003A830((__int64)Src);
v121 = v115->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v122 = cocos2d::CCSize::CCSize(&v322, 60.000004, 48.0);
v121->setContentSize(v115, v123);
v124 = v114->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v115->getContentSize(v115);
v125 = (float *)v115->getContentSize(v115);
cocos2d::CCPoint::CCPoint(*(float *)&v122, *v125 * 0.5);
v124->setPosition_0(v114, v126);
v127 = (cocos2d::CCNode *)v297;
v297->__vftable[6].isEqual(v297, v115);
LOWORD(v115->m_scaleMultiplier) = 256;
v128 = v115->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v129 = cocos2d::CCNode::convertToNodeSpace(v127, v317);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v128->setPosition_0)(v115, v129);
v115->setTag(v115, v93);
if ( isSpecialChestUnlocked )
SecretRewardsLayer::switchToOpenedState(v130, v115);
v131 = cocos2d::CCSprite::createWithSpriteFrameName("chestPlatform_01_001.png");
v132 = ((float (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCSprite *, __int64))v99->__vftable[6].~CCObject)(
v99,
v131,
2);
cocos2d::CCPoint::CCPoint(v132, 0.0);
cocos2d::CCPoint::operator+(&v285, &v314);
v131->setPosition_0(v131, &v314);
v131->setColor(&v131->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v279);
LOBYTE(v133) = -56;
v131->setOpacity(&v131->cocos2d::CCRGBAProtocol, v133);
v134 = v326;
if ( v328 > 0xF )
v134 = (void **)v326[0];
v135 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v134);
v297 = v135;
v136 = ((float (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCSprite *, __int64))v99->__vftable[6].~CCObject)(
v99,
v135,
2);
cocos2d::CCPoint::CCPoint(v136, 0.0);
v137 = (__int64)v131->getPosition_0(v131);
cocos2d::CCPoint::operator+(v137, v316);
v138 = ((double (__fastcall *)(struct cocos2d::CCSprite *, char *))v135->setPosition_0)(v135, v316);
((void (__fastcall *)(struct cocos2d::CCSprite *))v135->setScale_0)(v135);
if ( v93 >= 6 )
{
if ( v93 == 6 )
{
cocos2d::CCPoint::CCPoint(*(float *)&v138, (float)(v282 * 0.5) + 10.0);
v162 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_chestLabel = v162;
v163 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v162->setPosition_0)(v162, v307);
v164 = a1->m_chestLabel->__vftable;
cocos2d::CCPoint::CCPoint(v163, 1.0);
v164->setAnchorPoint(a1->m_chestLabel, v165);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_chestLabel->setScale_0)(a1->m_chestLabel);
v99->__vftable[6].isEqual(v99, a1->m_chestLabel);
v166 = cocos2d::CCSprite::createWithSpriteFrameName("chest03_small_001.png");
v167 = ((float (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCSprite *))v99->__vftable[6].isEqual)(
v99,
v166);
cocos2d::CCPoint::CCPoint(v167, 22.0);
v138 = cocos2d::CCPoint::operator+(v307, &v298);
v166->setPosition_0(v166, (const cocos2d::CCPoint *)&v298);
SecretRewardsLayer::updateUnlockedLabel(a1);
}
}
else
{
v139 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v311 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v311);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v139 = qword_1406C2EE8;
}
if ( v107 )
{
v140 = 0;
v148 = *(_QWORD *)(v139 + 856);
if ( v148 )
{
v149 = *(_QWORD *)(v148 + 56);
if ( v149 )
{
for ( i = *(_QWORD *)(v149 + 288); ; i = *(_QWORD *)(i + 288) )
{
v151 = v140++;
if ( *(_DWORD *)(*(_QWORD *)(v149 + 264) + 64LL) != v107 )
v140 = v151;
v149 = i;
if ( !i )
break;
}
}
}
}
else
{
v140 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v139 + 856));
v139 = qword_1406C2EE8;
}
if ( !v139 )
{
v312 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v312);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v139 = qword_1406C2EE8;
}
if ( v107 )
{
v141 = 0;
v152 = *(_QWORD *)(v139 + 352);
if ( v152 )
{
v153 = *(_QWORD *)(v152 + 56);
if ( v153 )
{
for ( j = *(_QWORD *)(v153 + 288); ; j = *(_QWORD *)(j + 288) )
{
v155 = v141++;
if ( *(_DWORD *)(*(_QWORD *)(v153 + 264) + 64LL) != v107 )
v141 = v155;
v153 = j;
if ( !j )
break;
}
}
}
}
else
{
v141 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v139 + 352));
}
v142 = cocos2d::CCString::createWithFormat("%i / %i", v140, v141);
v143 = cocos2d::CCString::getCString(v142);
v144 = cocos2d::CCLabelBMFont::create(v143, (const char *)&qword_14052A4D8);
v310->__vftable[6].isEqual(v310, v144);
v145 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *))v144->setScale_0)(v144);
cocos2d::CCPoint::CCPoint(v145, 0.0);
v146 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v297->__vftable[2].getTag)(v297);
v138 = cocos2d::CCPoint::operator+(v146, &v313);
v144->setPosition_0(v144, &v313);
if ( v140 < v141 )
{
v293 = 31419;
v283[0] = 31419;
LOBYTE(v283[1]) = 107;
v147 = v283;
}
else
{
v290[4] = -256;
v291 = -256;
v292 = 0;
v147 = &v291;
}
v144->setColor(&v144->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v147);
cocos2d::CCDictionary::setObject(a1->m_chestCounters, v144, v107);
}
sub_14003A830((__int64)&v329);
sub_14003A830((__int64)v326);
++v93;
v90 = (cocos2d::CCArray *)v281;
v88 = v295;
}
while ( (int)v93 < 9 );
cocos2d::CCPoint::CCPoint(*(float *)&v138, v282 * 0.5);
v156 = (struct cocos2d::CCObject *)cocos2d::CCLayer::create();
v157 = v88;
cocos2d::CCArray::addObject(v88, v156);
v159 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v158);
v156->__vftable[6].isEqual(v156, v159);
v160 = GJChestSprite::create(9);
((void (__fastcall *)(GJChestSprite *))v160->setScale_0)(v160);
v294.origin = (cocos2d::CCPoint)operator new(0x208u);
v161 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v294.origin);
if ( !v161 )
{
LABEL_91:
v161 = nullptr;
goto LABEL_92;
}
if ( !CCMenuItemSpriteExtra::init(
v161,
v160,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SecretRewardsLayer::onGoldChest) )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v161->~CCMenuItemSpriteExtra)(v161, 1);
goto LABEL_91;
}
cocos2d::CCObject::autorelease(v161);
LABEL_92:
v304[15] = 0;
v305 = 14;
v306 = 15;
strcpy(v304, "chestClick.ogg");
v294.origin = (cocos2d::CCPoint)v304;
if ( &v161->m_activateSound.m_data.m_capacity != (std::size_t *)v304 )
sub_14003CCE0((void **)&v161->m_activateSound.m_data.m_capacity, v304, 0xEu);
sub_14003A830((__int64)v304);
v168 = v161->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v169 = ((double (__fastcall *)(GJChestSprite *))v160->getScale)(v160);
v170 = *(float *)&v169 * 80.0;
v171 = ((double (__fastcall *)(GJChestSprite *))v160->getScale)(v160);
v172 = cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v294, *(float *)&v171 * 100.0, v170);
v168->setContentSize(v161, v173);
v174 = v160->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v161->getContentSize(v161);
v175 = (float *)v161->getContentSize(v161);
cocos2d::CCPoint::CCPoint(*(float *)&v172, *v175 * 0.5);
v174->setPosition_0(v160, v176);
v159->addChild_1(v159, v161);
LOWORD(v161->m_scaleMultiplier) = 256;
v177 = v161->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v178 = cocos2d::CCNode::convertToNodeSpace(v159, &v296);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v177->setPosition_0)(v161, v178);
v179 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v294.origin = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(*(_QWORD *)&v294.origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v179 = (GameStatsManager *)qword_1406C2EE8;
}
v180 = 6001;
while ( GameStatsManager::isSecretChestUnlocked(v179, v180) )
{
if ( ++v180 - 6001 >= 20 )
goto LABEL_101;
}
if ( v180 )
goto LABEL_102;
LABEL_101:
SecretRewardsLayer::switchToOpenedState(v181, v161);
LABEL_102:
v182 = cocos2d::CCSprite::createWithSpriteFrameName("chestPlatform_01_001.png");
v183 = ((float (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCSprite *, __int64))v156->__vftable[6].~CCObject)(
v156,
v182,
2);
cocos2d::CCPoint::CCPoint(v183, 0.0);
cocos2d::CCPoint::operator+(v308, &v281);
v182->setPosition_0(v182, (const cocos2d::CCPoint *)&v281);
qmemcpy(v283, "\\Pg", 3);
v182->setColor(&v182->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v283);
LOBYTE(v184) = -56;
v182->setOpacity(&v182->cocos2d::CCRGBAProtocol, v184);
((void (__fastcall *)(struct cocos2d::CCSprite *))v182->setScale_0)(v182);
v185 = cocos2d::CCSprite::createWithSpriteFrameName("chest_09_price_001.png");
v186 = ((float (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCSprite *, __int64))v156->__vftable[6].~CCObject)(
v156,
v185,
2);
cocos2d::CCPoint::CCPoint(v186, 0.0);
v187 = (__int64)v182->getPosition_0(v182);
cocos2d::CCPoint::operator+(v187, &v281);
v185->setPosition_0(v185, (const cocos2d::CCPoint *)&v281);
v188 = ((float (__fastcall *)(struct cocos2d::CCSprite *))v185->setScale_0)(v185);
cocos2d::CCPoint::CCPoint(v188, v282 * 0.5);
v189 = (cocos2d::CCSprite *)cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_goldPriceSprite = v189;
v190 = ((float (__fastcall *)(cocos2d::CCSprite *, char *))v189->setPosition_0)(v189, v315);
v191 = a1->m_goldPriceSprite->__vftable;
cocos2d::CCPoint::CCPoint(v190, 0.5);
v191->setAnchorPoint(a1->m_goldPriceSprite, v192);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_goldPriceSprite->setScale_0)(a1->m_goldPriceSprite);
v156->__vftable[6].isEqual(v156, a1->m_goldPriceSprite);
SecretRewardsLayer::updateUnlockedGoldLabel(a1);
v193 = (struct cocos2d::CCObject *)cocos2d::CCLayer::create();
cocos2d::CCArray::addObject(v157, v193);
v195 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v194);
v193->__vftable[6].isEqual(v193, v195);
v196 = 1;
while ( 2 )
{
v197 = 0x7FFFFFFFFFFFFFFFLL;
*(_OWORD *)v326 = 0;
v327 = 0;
v328 = 15;
v326[0] = sub_14003AA10(0x20u);
v327 = 17;
v328 = 31;
strcpy((char *)v326[0], "shopRope2_001.png");
*(_OWORD *)v323 = 0;
v324 = 0;
v325 = 15;
v323[0] = sub_14003AA10(0x20u);
v324 = 19;
v325 = 31;
strcpy((char *)v323[0], "shopRope2_2_001.png");
switch ( v196 )
{
case 2u:
v217 = v328;
if ( v328 < 0x11 )
{
v219 = v328 >> 1;
if ( v328 <= 0x7FFFFFFFFFFFFFFFLL - (v328 >> 1) )
{
v220 = 31;
if ( v219 + v328 > 0x1F )
v220 = v219 + v328;
}
else
{
v220 = 0x7FFFFFFFFFFFFFFFLL;
}
v221 = sub_14003AA10(v220 + 1);
v327 = 17;
v328 = v220;
*(_OWORD *)v221 = *(_OWORD *)"shopRope3_001.png";
*((_WORD *)v221 + 8) = (unsigned __int8)aShoprope3001Pn[16];
if ( v217 > 0xF )
{
v222 = v326[0];
if ( v217 + 1 >= 0x1000 )
{
v222 = *((void **)v326[0] - 1);
if ( (unsigned __int64)((char *)v326[0] - (char *)v222 - 8) > 0x1F )
LABEL_184:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v222);
}
v326[0] = v221;
v197 = 0x7FFFFFFFFFFFFFFFLL;
}
else
{
v218 = v326[0];
v327 = 17;
memmove(v326[0], "shopRope3_001.png", 0x11u);
v218[17] = 0;
}
v204 = v325;
if ( v325 < 0x13 )
{
v224 = v325 >> 1;
if ( v325 <= 0x7FFFFFFFFFFFFFFFLL - (v325 >> 1) )
{
v197 = 31;
if ( v224 + v325 > 0x1F )
v197 = v224 + v325;
}
v207 = sub_14003AA10(v197 + 1);
v324 = 19;
v325 = v197;
qmemcpy(v207, "shopRope3_2_001.pn", 18);
v208 = aShoprope32001P[18];
goto LABEL_157;
}
v223 = v323[0];
v324 = 19;
memmove(v323[0], "shopRope3_2_001.png", 0x13u);
v223[19] = 0;
break;
case 3u:
v209 = v328;
if ( v328 < 0x11 )
{
v211 = v328 >> 1;
if ( v328 <= 0x7FFFFFFFFFFFFFFFLL - (v328 >> 1) )
{
v212 = 31;
if ( v328 + v211 > 0x1F )
v212 = v328 + v211;
}
else
{
v212 = 0x7FFFFFFFFFFFFFFFLL;
}
v213 = sub_14003AA10(v212 + 1);
v327 = 17;
v328 = v212;
*(_OWORD *)v213 = *(_OWORD *)"shopRope4_001.png";
*((_WORD *)v213 + 8) = (unsigned __int8)aShoprope4001Pn[16];
if ( v209 > 0xF )
{
v214 = v326[0];
if ( v209 + 1 >= 0x1000 )
{
v214 = *((void **)v326[0] - 1);
if ( (unsigned __int64)((char *)v326[0] - (char *)v214 - 8) > 0x1F )
goto LABEL_184;
}
j_j_free(v214);
}
v326[0] = v213;
v197 = 0x7FFFFFFFFFFFFFFFLL;
}
else
{
v210 = v326[0];
v327 = 17;
memmove(v326[0], "shopRope4_001.png", 0x11u);
v210[17] = 0;
}
v204 = v325;
if ( v325 < 0x13 )
{
v216 = v325 >> 1;
if ( v325 <= 0x7FFFFFFFFFFFFFFFLL - (v325 >> 1) )
{
v197 = 31;
if ( v325 + v216 > 0x1F )
v197 = v325 + v216;
}
v207 = sub_14003AA10(v197 + 1);
v324 = 19;
v325 = v197;
qmemcpy(v207, "shopRope4_2_001.pn", 18);
v208 = aShoprope42001P[18];
goto LABEL_157;
}
v215 = v323[0];
v324 = 19;
memmove(v323[0], "shopRope4_2_001.png", 0x13u);
v215[19] = 0;
break;
case 4u:
v198 = v328;
if ( v328 < 0x11 )
{
v200 = v328 >> 1;
if ( v328 <= 0x7FFFFFFFFFFFFFFFLL - (v328 >> 1) )
{
v201 = 31;
if ( v328 + v200 > 0x1F )
v201 = v328 + v200;
}
else
{
v201 = 0x7FFFFFFFFFFFFFFFLL;
}
v202 = sub_14003AA10(v201 + 1);
v327 = 17;
v328 = v201;
*(_OWORD *)v202 = *(_OWORD *)"shopRope5_001.png";
*((_WORD *)v202 + 8) = (unsigned __int8)aShoprope5001Pn[16];
if ( v198 > 0xF )
{
v203 = v326[0];
if ( v198 + 1 >= 0x1000 )
{
v203 = *((void **)v326[0] - 1);
if ( (unsigned __int64)((char *)v326[0] - (char *)v203 - 8) > 0x1F )
goto LABEL_184;
}
j_j_free(v203);
}
v326[0] = v202;
v197 = 0x7FFFFFFFFFFFFFFFLL;
}
else
{
v199 = v326[0];
v327 = 17;
memmove(v326[0], "shopRope5_001.png", 0x11u);
v199[17] = 0;
}
v204 = v325;
if ( v325 >= 0x13 )
{
v205 = v323[0];
v324 = 19;
memmove(v323[0], "shopRope5_2_001.png", 0x13u);
v205[19] = 0;
break;
}
v206 = v325 >> 1;
if ( v325 <= 0x7FFFFFFFFFFFFFFFLL - (v325 >> 1) )
{
v197 = 31;
if ( v325 + v206 > 0x1F )
v197 = v325 + v206;
}
v207 = sub_14003AA10(v197 + 1);
v324 = 19;
v325 = v197;
qmemcpy(v207, "shopRope5_2_001.pn", 18);
v208 = aShoprope52001P[18];
LABEL_157:
v207[18] = v208;
v225 = v207;
v207[19] = 0;
if ( v204 > 0xF )
{
v226 = v323[0];
if ( v204 + 1 >= 0x1000 )
{
v226 = *((void **)v323[0] - 1);
if ( (unsigned __int64)((char *)v323[0] - (char *)v226 - 8) > 0x1F )
goto LABEL_184;
}
j_j_free(v226);
}
v323[0] = v225;
break;
default:
break;
}
v227 = v326;
if ( v328 > 0xF )
v227 = (void **)v326[0];
v228 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v227);
v294.origin = (cocos2d::CCPoint)operator new(0x208u);
v229 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v294.origin);
if ( v229 )
{
if ( CCMenuItemSpriteExtra::init(v229, v228, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretRewardsLayer::onShop) )
{
cocos2d::CCObject::autorelease(v229);
goto LABEL_169;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v229->~CCMenuItemSpriteExtra)(v229, 1);
}
v229 = nullptr;
LABEL_169:
v229->setTag(v229, v196);
v230 = ((float (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v195->addChild_1)(v195, v229);
HIDWORD(v229->m_pfnSelector.adj) = 1069547520;
v231 = v229->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v230, (float)(v282 * 0.5) + (float)((float)((float)(int)(v196 - 1) * 70.0) - 105.0));
v232 = cocos2d::CCNode::convertToNodeSpace(v195, &v309);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v231->setPosition_0)(v229, v232);
v233 = (__int64)v229->getNormalImage(v229);
v234 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v233 + 200LL))(v233);
v235 = cocos2d::CCPoint::operator=(&v229->m_unselectedDuration, v234);
LODWORD(v229->m_duration) = 1;
cocos2d::CCPoint::CCPoint(*(float *)&v235, 0.0);
v237 = cocos2d::CCPoint::operator=((char *)&v229->m_selectSound.m_data.m_capacity + 4, v236);
v229->m_offset.x = 0.30000001;
v229->m_offset.y = 0.30000001;
cocos2d::CCPoint::CCPoint(*(float *)&v237, 25.0);
switch ( v196 )
{
case 2u:
v238 = *(float *)&v285 + -2.25;
goto LABEL_175;
case 3u:
v238 = *(float *)&v285 + -3.5;
goto LABEL_175;
case 4u:
v238 = *(float *)&v285 + 0.0;
LABEL_175:
*(float *)&v285 = v238;
break;
}
for ( k = 0; k < 6; ++k )
{
v240 = v323;
if ( v325 > 0xF )
v240 = (void **)v323[0];
v241 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v240);
v242 = ((float (__fastcall *)(struct cocos2d::CCSprite *, struct cocos2d::CCSprite *))v228->addChild_1)(
v228,
v241);
cocos2d::CCPoint::CCPoint(v242, 0.0);
cocos2d::CCPoint::operator+(&v285, &v281);
v241->setPosition_0(v241, (const cocos2d::CCPoint *)&v281);
}
sub_14003A830((__int64)v323);
sub_14003A830((__int64)v326);
if ( (int)++v196 <= 4 )
continue;
break;
}
v244 = BoomScrollLayer::create(v157, v243, 1, nullptr, nullptr);
a1->m_mainScrollLayer = v244;
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v244);
v246 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v245);
ScreenBottom = cocos2d::CCDirector::getScreenBottom(v246);
cocos2d::CCPoint::CCPoint(ScreenBottom + 10.0, v282 * 0.5);
m_mainScrollLayer = a1->m_mainScrollLayer;
cocos2d::CCPoint::operator=(&m_mainScrollLayer->m_dotPosition, v249);
BoomScrollLayer::updateDots(m_mainScrollLayer, 0.0);
a1->m_mainScrollLayer->m_unkFloat2 = 0.89999998;
a1->m_mainScrollLayer->m_doVisit = 1;
v251 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v250);
ScreenTop = cocos2d::CCDirector::getScreenTop(v251);
v254 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v253);
ScreenRight = cocos2d::CCDirector::getScreenRight(v254);
cocos2d::CCRect::CCRect(&v294, 0.0, 0.0, ScreenRight, ScreenTop);
cocos2d::CCRect::operator=(&a1->m_mainScrollLayer->m_clippingRect, v256);
m_extendedLayer = a1->m_mainScrollLayer->m_extendedLayer;
m_extendedLayer->m_delegate = &a1->BoomScrollLayerDelegate;
v258 = (cocos2d::CCNode *)cocos2d::CCMenu::create(m_extendedLayer);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v258->__vftable[1].getTag)(v258, 4294967167LL);
v259 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v294.origin = (cocos2d::CCPoint)operator new(0x208u);
v260 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v294.origin);
v261 = v260;
if ( v260 )
{
if ( CCMenuItemSpriteExtra::init(
v260,
v259,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SecretRewardsLayer::onSwitchPage) )
{
cocos2d::CCObject::autorelease(v261);
goto LABEL_187;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v261->~CCMenuItemSpriteExtra)(v261, 1);
}
v261 = nullptr;
LABEL_187:
a1->m_leftButton = v261;
v258->addChild_1(v258, v261);
v262 = a1->m_leftButton->__vftable;
v264 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v263);
v265 = cocos2d::CCDirector::getScreenLeft(v264) + 24.0;
cocos2d::CCPoint::CCPoint(v265, v265);
v266 = cocos2d::CCNode::convertToNodeSpace(v258, &v296);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v262->setPosition_0)(a1->m_leftButton, v266);
a1->m_leftButton->setTag(a1->m_leftButton, 0);
HIDWORD(a1->m_leftButton->m_pfnSelector.adj) = 0x40000000;
v267 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v267, 1);
v294.origin = (cocos2d::CCPoint)operator new(0x208u);
v268 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v294.origin);
v269 = v268;
if ( v268 )
{
if ( CCMenuItemSpriteExtra::init(
v268,
v267,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SecretRewardsLayer::onSwitchPage) )
{
cocos2d::CCObject::autorelease(v269);
goto LABEL_192;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v269->~CCMenuItemSpriteExtra)(v269, 1);
}
v269 = nullptr;
LABEL_192:
a1->m_rightButton = v269;
v258->addChild_1(v258, v269);
v270 = a1->m_rightButton->__vftable;
v272 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v271);
v273 = cocos2d::CCDirector::getScreenRight(v272) - 24.0;
cocos2d::CCPoint::CCPoint(v273, v273);
v274 = cocos2d::CCNode::convertToNodeSpace(v258, &v296);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v270->setPosition_0)(a1->m_rightButton, v274);
a1->m_rightButton->setTag(a1->m_rightButton, 1);
HIDWORD(a1->m_rightButton->m_pfnSelector.adj) = 0x40000000;
a1->addChild_0(a1, v258, 10);
if ( v284 )
{
v275 = a1->m_mainScrollLayer;
if ( v275->m_dynamic )
m_dynamicObjects = v275->m_dynamicObjects;
else
m_dynamicObjects = v275->m_pages;
v277 = cocos2d::CCArray::count(m_dynamicObjects);
v278 = v277 - 1;
BoomScrollLayer::instantMoveToPage(a1->m_mainScrollLayer, v277 - 2);
BoomScrollLayer::instantMoveToPage(a1->m_mainScrollLayer, v278);
}
return 1;
}