//
// SecretRewardsLayer::init from 0xa62320 to 0xa641dc (7868 bytes)
//
// 2 xrefs:
// > SecretRewardsLayer::create @ 0xa642ec
// > ??> @ 0x75c78
//
// 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 SecretRewardsLayer::init(SecretRewardsLayer *a1, bool a2)
{
cocos2d::CCTextureCache *v4; // x0
cocos2d::CCSpriteFrameCache *v5; // x0
cocos2d::CCDirector *v6; // x0
GameManager *v7; // x0
GameManager *v8; // x0
GameManager *v9; // x21
void *v10; // x0
cocos2d::CCLayer *v11; // x0
const char *v12; // x1
cocos2d::CCSprite *v13; // x21
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCSprite *m_backgroundSprite; // x21
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCSprite *v17; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCSprite *v19; // x21
void (__fastcall *v20)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
void (__fastcall *v21)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
void (__fastcall *v22)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCSprite *v23; // x21
void (__fastcall *v24)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *v25)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *v26)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCSprite *v27; // x0
CCMenuItemSpriteExtra *v28; // x21
cocos2d::CCNode *v29; // x22
void (__fastcall *v30)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCDirector *v31; // x0
float v32; // s0
float v33; // s8
cocos2d::CCDirector *v34; // x0
float v35; // s0
GameStatsManager *v36; // x0
int v37; // w20
unsigned int Stat; // w0
cocos2d::CCString *v39; // x0
cocos2d::CCLabelBMFont *v40; // x23
float v41; // s1
void (__fastcall *v42)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCLabelBMFont *m_keysLabel; // x23
void (__fastcall *v44)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCSprite *v45; // x0
cocos2d::CCSprite *m_keySprite; // x23
void (__fastcall *v47)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
const cocos2d::CCPoint *v48; // x25
GameStatsManager *v49; // x0
unsigned int v50; // w0
cocos2d::CCString *v51; // x0
cocos2d::CCLabelBMFont *v52; // x0
cocos2d::CCLabelBMFont_vtbl *v53; // x2
cocos2d::CCLabelBMFont *v54; // x1
cocos2d::CCLabelBMFont *v55; // x21
void (__fastcall *v56)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
__int64 v57; // x0
cocos2d::CCLabelBMFont *m_goldKeysLabel; // x21
void (__fastcall *v59)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCSprite *v60; // x0
cocos2d::CCSprite *m_goldKeySprite; // x21
void (__fastcall *v62)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
const cocos2d::CCPoint *v63; // x23
cocos2d::CCSprite *v64; // x21
void (__fastcall *v65)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCSprite *v66; // x21
void (__fastcall *v67)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *v68)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCArray *v69; // x0
cocos2d::CCDictionary *v70; // x0
float v71; // s8
unsigned int v72; // w22
__int64 v73; // x21
int v74; // w24
cocos2d::CCNode *v75; // x25
GJRewardType v76; // w22
cocos2d::CCString *v77; // x0
char *v78; // x0
cocos2d::CCString *v79; // x0
char *v80; // x0
unsigned int v81; // w24
cocos2d::CCString *v82; // x0
size_t v83; // x0
GameStatsManager *v84; // x23
char *v85; // x1
char *v86; // x0
float v87; // s9
GJChestSprite *v88; // x23
CCMenuItemSpriteExtra *v89; // x24
void *v90; // x0
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x26
void (__fastcall *v92)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
float width; // s8
__int64 v94; // x0
CCMenuItemSpriteExtra_vtbl *v95; // x2
void (__fastcall *v96)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v97; // x23
void (__fastcall *v98)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCSprite *v99; // x24
cocos2d::CCSprite *v100; // x0
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v102)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
__int64 v103; // x25
const char *v104; // x1
char *v105; // x0
char *v106; // x0
cocos2d::CCLayer *v107; // x21
cocos2d::CCMenu *v108; // x22
GJChestSprite *v109; // x23
CCMenuItemSpriteExtra *v110; // x20
void *v111; // x0
void (__fastcall *v112)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x24
float v113; // s9
float v114; // s0
void (__fastcall *v115)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
__int64 v116; // x0
CCMenuItemSpriteExtra_vtbl *v117; // x2
cocos2d::CCNode *v118; // x0
void (__fastcall *v119)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
GameStatsManager *v120; // x0
unsigned int v121; // w25
cocos2d::CCSprite *v122; // x20
void (__fastcall *v123)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *v124)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCSprite *v125; // x22
cocos2d::CCSprite *v126; // x0
const cocos2d::CCPoint *(__fastcall *v127)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v128)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x20
__int64 v129; // x23
cocos2d::CCSprite *v130; // x0
cocos2d::CCSprite_vtbl *v131; // x2
cocos2d::CCSprite *m_goldPriceSprite; // x20
void (__fastcall *v133)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCLayer *v134; // x20
cocos2d::CCMenu *v135; // x26
cocos2d::CCSprite *v136; // x0
cocos2d::CCSprite *v137; // x22
CCMenuItemSpriteExtra *v138; // x20
void (__fastcall *v139)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
float v140; // s0
float v141; // s1
int i; // w20
cocos2d::CCSprite *v143; // x21
void (__fastcall *v144)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
char *v145; // x0
char *v146; // x0
BoomScrollLayer *v147; // x0
cocos2d::CCLayer *m_mainLayer; // x2
BoomScrollLayer *m_mainScrollLayer; // x20
float v150; // s9
cocos2d::CCDirector *v151; // x0
float v152; // s0
BoomScrollLayer *v153; // x20
cocos2d::CCDirector *v154; // x0
float v155; // s0
cocos2d::CCDirector *v156; // x0
float v157; // s0
cocos2d::CCMenu *v158; // x20
float v159; // s8
cocos2d::CCSprite *v160; // x0
CCMenuItemSpriteExtra *v161; // x0
cocos2d::CCMenu_vtbl *v162; // x2
CCMenuItemSpriteExtra *m_leftButton; // x24
void (__fastcall *v164)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCDirector *v165; // x0
float v166; // s0
cocos2d::CCSprite *v167; // x23
CCMenuItemSpriteExtra *v168; // x0
cocos2d::CCMenu_vtbl *v169; // x2
CCMenuItemSpriteExtra *m_rightButton; // x21
void (__fastcall *v171)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCDirector *v172; // x0
float v173; // s0
int TotalPages; // w19
GameStatsManager *v175; // x0
unsigned int v176; // w23
GameStatsManager *v177; // x0
int v178; // w25
cocos2d::CCString *v179; // x0
cocos2d::CCLabelBMFont *v180; // x23
void (__fastcall *v181)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
__int64 v182; // x24
void (__fastcall *v183)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // x2
unsigned int *v184; // x1
int v185; // w2
cocos2d::CCLayer *v186; // x21
cocos2d::CCMenu *v187; // x23
cocos2d::CCString *v188; // x0
const char *CString; // x0
cocos2d::CCSprite *v190; // x23
void (__fastcall *v191)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
GameStatsManager *v192; // x23
unsigned int *v193; // x1
int v194; // w2
double v195; // d0
double v196; // d0
double v197; // d0
unsigned int *v198; // x1
int v199; // w2
unsigned int *v200; // x1
int v201; // w2
GameStatsManager *v202; // x23
unsigned int *v203; // x1
unsigned int *v204; // x1
int v205; // w2
unsigned int *v206; // x1
int v207; // w2
unsigned int *v208; // x1
unsigned int *v209; // x1
int v210; // w2
unsigned int *v211; // x1
int v212; // w2
cocos2d::CCLabelBMFont *v213; // x0
cocos2d::CCLabelBMFont_vtbl *v214; // x2
cocos2d::CCLabelBMFont *m_chestLabel; // x23
void (__fastcall *v216)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCSprite *v217; // x22
void (__fastcall *v218)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x21
_BOOL4 v219; // [xsp+A0h] [xbp+A0h]
bool v220; // [xsp+A7h] [xbp+A7h]
cocos2d::CCArray *v221; // [xsp+A8h] [xbp+A8h]
const char *v222; // [xsp+B0h] [xbp+B0h]
int isSpecialChestUnlocked; // [xsp+B0h] [xbp+B0h]
signed int v224; // [xsp+B0h] [xbp+B0h]
unsigned int v225; // [xsp+C0h] [xbp+C0h]
float v226; // [xsp+C0h] [xbp+C0h]
cocos2d::CCArray *v227; // [xsp+D0h] [xbp+D0h]
float v228; // [xsp+F0h] [xbp+F0h]
_BYTE v229[8]; // [xsp+108h] [xbp+108h] BYREF
float v230; // [xsp+110h] [xbp+110h]
float v231; // [xsp+114h] [xbp+114h]
cocos2d::CCPoint v232; // [xsp+118h] [xbp+118h] BYREF
const char *v233; // [xsp+120h] [xbp+120h] BYREF
const char *v234; // [xsp+128h] [xbp+128h] BYREF
char *v235; // [xsp+130h] [xbp+130h] BYREF
char *v236; // [xsp+138h] [xbp+138h] BYREF
char *v237; // [xsp+140h] [xbp+140h] BYREF
cocos2d::CCRect v238; // [xsp+148h] [xbp+148h] BYREF
cocos2d::CCPoint v239; // 0:kr08_8.8
cocos2d::CCPoint v240; // 0:kr10_8.8
cocos2d::CCPoint v241; // 0:kr18_8.8
cocos2d::CCPoint v242; // 0:kr20_8.8
cocos2d::CCPoint v243; // 0:kr28_8.8
cocos2d::SEL_MenuHandler v244; // 0:x2.16
cocos2d::SEL_MenuHandler v245; // 0:x2.16
cocos2d::SEL_MenuHandler v246; // 0:x2.16
cocos2d::SEL_MenuHandler v247; // 0:x2.16
cocos2d::SEL_MenuHandler v248; // 0:x2.16
cocos2d::SEL_MenuHandler v249; // 0:x2.16
cocos2d::CCPoint v250; // 0:s0.4,4:s1.4
v219 = a2;
v220 = cocos2d::CCLayer::init(a1);
if ( !v220 )
return v220;
a1->m_inMainLayer = 1;
v4 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v4, "TreasureRoomSheet.png", 0);
v5 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v5, "TreasureRoomSheet.plist");
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = GameManager::sharedState();
if ( GameManager::getUGV(v7, "10") )
a1->m_scratchDialogIndex = (unsigned int)&byte_4;
v8 = GameManager::sharedState();
if ( GameManager::getUGV(v8, "21") )
a1->m_potborDialogIndex = 3;
v9 = GameManager::sharedState();
sub_D153B8((int)&v238, "secretLoop.mp3");
GameManager::fadeInMusic((__int64)v9, &v238);
v10 = (void *)(*(_QWORD *)&v238.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v238.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v209 = (unsigned int *)(*(_QWORD *)&v238.origin - 8LL);
do
v210 = __ldaxr(v209);
while ( __stlxr(v210 - 1, v209) );
}
else
{
v210 = *(_DWORD *)(*(_QWORD *)&v238.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v238.origin - 8LL) = v210 - 1;
}
if ( v210 <= 0 )
operator delete(v10);
}
v11 = cocos2d::CCLayer::create();
a1->m_mainLayer = v11;
a1->addChild_0(a1, v11, 0);
v13 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v12);
a1->m_backgroundSprite = v13;
setAnchorPoint = v13->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v238.origin, 0.0, 0.0);
setAnchorPoint(v13, &v238.origin);
a1->addChild_0(a1, a1->m_backgroundSprite, -3);
a1->m_backgroundSprite->setScaleX(
a1->m_backgroundSprite,
(float)(v230 + 10.0) / a1->m_backgroundSprite->m_obRect.size.width);
a1->m_backgroundSprite->setScaleY(
a1->m_backgroundSprite,
(float)(v231 + 10.0) / a1->m_backgroundSprite->m_obRect.size.height);
m_backgroundSprite = a1->m_backgroundSprite;
setPosition = m_backgroundSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v238.origin, -5.0, -5.0);
setPosition(m_backgroundSprite, &v238.origin);
v17 = a1->m_backgroundSprite;
setColor = v17->setColor;
LOWORD(v238.origin.x) = 70;
BYTE2(v238.origin.x) = 75;
setColor(v17, (const cocos2d::ccColor3B *)&v238);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomSpiderweb_001.png");
v20 = v19->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v238.origin, 1.0, 1.0);
v20(v19, &v238.origin);
v21 = v19->setPosition;
cocos2d::CCPoint::CCPoint(&v238.origin, v230 + 5.0, v231 + 5.0);
v21(v19, &v238.origin);
v19->setOpacity(v19, 63);
v22 = v19->setColor;
LOWORD(v238.origin.x) = 0;
BYTE2(v238.origin.x) = 0;
v22(v19, (const cocos2d::ccColor3B *)&v238);
a1->addChild_0(a1, v19, -1);
v19->setScale(v19, 1.1);
v23 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomSpiderweb_001.png");
v24 = v23->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v238.origin, 0.0, 1.0);
v24(v23, &v238.origin);
v25 = v23->setPosition;
cocos2d::CCPoint::CCPoint(&v238.origin, -5.0, v231 + 5.0);
v25(v23, &v238.origin);
v23->setOpacity(v23, 63);
cocos2d::CCSprite::setFlipX(v23, 1);
v26 = v23->setColor;
LOWORD(v238.origin.x) = 0;
BYTE2(v238.origin.x) = 0;
v26(v23, (const cocos2d::ccColor3B *)&v238);
a1->addChild_0(a1, v23, -1);
v23->setScale(v23, 1.1);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
a1->m_backSprite = v27;
v244.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v244.adj = (size_t)SecretRewardsLayer::onBack;
v28 = CCMenuItemSpriteExtra::create(v27, nullptr, v244);
CCMenuItemSpriteExtra::setSizeMult(v28, 1.6);
v29 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v28, nullptr);
a1->addChild_0(a1, v29, 1);
v30 = v29->setPosition;
v31 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v31);
v33 = v32;
v34 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v34);
cocos2d::CCPoint::CCPoint(&v238.origin, v33 + 24.0, v35 - 23.0);
v30(v29, &v238.origin);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v28);
v36 = GameStatsManager::sharedState();
v225 = 3;
v37 = 0;
Stat = GameStatsManager::getStat(v36, "21");
v39 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)Stat);
cocos2d::CCString::getCString(v39);
v40 = cocos2d::CCLabelBMFont::create();
v41 = v230;
a1->m_keysLabel = v40;
v42 = v40->setPosition;
cocos2d::CCPoint::CCPoint(&v238.origin, v41 - 55.0, v231 - 18.0);
v42(v40, &v238.origin);
m_keysLabel = a1->m_keysLabel;
v44 = m_keysLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v238.origin, 1.0, 0.5);
v44(m_keysLabel, &v238.origin);
a1->m_keysLabel->setScale(a1->m_keysLabel, 0.6);
a1->addChild(a1, a1->m_keysLabel);
v45 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigKey_001.png");
a1->m_keySprite = v45;
a1->addChild_0(a1, v45, 3);
m_keySprite = a1->m_keySprite;
v47 = m_keySprite->setPosition;
v48 = a1->m_keysLabel->getPosition(a1->m_keysLabel);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 25.0, -0.5);
cocos2d::CCPoint::operator+(&v238, v48, &v237);
v47(m_keySprite, &v238.origin);
v49 = GameStatsManager::sharedState();
v50 = GameStatsManager::getStat(v49, "43");
v51 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v50);
cocos2d::CCString::getCString(v51);
v52 = cocos2d::CCLabelBMFont::create();
v53 = v52->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v54 = a1->m_keysLabel;
v55 = v52;
a1->m_goldKeysLabel = v52;
v56 = v53->setPosition;
v57 = (__int64)v54->getPosition(v54);
v56(v55, (const cocos2d::CCPoint *)v57);
m_goldKeysLabel = a1->m_goldKeysLabel;
v59 = m_goldKeysLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v238.origin, 1.0, 0.5);
v59(m_goldKeysLabel, &v238.origin);
a1->m_goldKeysLabel->setScale(a1->m_goldKeysLabel, 0.6);
a1->addChild(a1, a1->m_goldKeysLabel);
v60 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigGoldKey_001.png");
a1->m_goldKeySprite = v60;
a1->addChild_0(a1, v60, 3);
m_goldKeySprite = a1->m_goldKeySprite;
v62 = m_goldKeySprite->setPosition;
v63 = a1->m_goldKeysLabel->getPosition(a1->m_goldKeysLabel);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 25.0, -0.5);
cocos2d::CCPoint::operator+(&v238, v63, &v237);
v62(m_goldKeySprite, &v238.origin);
a1->m_goldKeysLabel->setVisible(a1->m_goldKeysLabel, 0);
a1->m_goldKeySprite->setVisible(a1->m_goldKeySprite, 0);
v64 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomLabel_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v64, 2);
v65 = v64->setPosition;
cocos2d::CCPoint::CCPoint(&v238.origin, v230 * 0.5, v231 - 42.0);
v65(v64, &v238.origin);
v66 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomGround_001.png");
a1->addChild_0(a1, v66, 2);
v67 = v66->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v238.origin, 0.0, 1.0);
v67(v66, &v238.origin);
v68 = v66->setPosition;
cocos2d::CCPoint::CCPoint(&v238.origin, -10.0, 35.0);
v68(v66, &v238.origin);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v66->setBlendFunc)(v66, 0x100000302LL);
v66->setScale(v66, (float)(v230 + 20.0) / v66->m_obRect.size.width);
v69 = (cocos2d::CCArray *)((__int64 (__fastcall *)(cocos2d::CCSprite *, __int64))v66->setOpacity)(v66, 4294967190LL);
v227 = (cocos2d::CCArray *)cocos2d::CCArray::create(v69);
v221 = (cocos2d::CCArray *)cocos2d::CCArray::create(v227);
v70 = cocos2d::CCDictionary::create();
a1->m_chestCounters = v70;
cocos2d::CCObject::retain(v70);
do
{
v71 = floorf((float)v37 / 3.0);
v72 = (int)v71;
if ( (unsigned int)cocos2d::CCArray::count(v227) < (int)v71 + 1 )
{
v186 = cocos2d::CCLayer::create();
v187 = cocos2d::CCMenu::create();
v186->addChild(v186, v187);
cocos2d::CCArray::addObject(v227, v186);
cocos2d::CCArray::addObject(v221, v187);
}
v73 = cocos2d::CCArray::objectAtIndex(v227, v72);
v74 = v37 % 3;
v75 = (cocos2d::CCNode *)cocos2d::CCArray::objectAtIndex(v221, v72);
if ( v37 % 3 )
{
cocos2d::CCPoint::CCPoint(
&v232,
(float)((float)(v74 - 1) * 100.0) + (float)(v230 * 0.5),
(float)(v231 * 0.5) + 10.0);
if ( v37 >= 6 )
{
v76 = Large;
v77 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"chest_0%i_price_001.png",
(_BYTE *)&dword_0 + 2);
}
else
{
v76 = v225;
v77 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"chest_0%i_price_001.png",
(const char *)v225);
}
}
else if ( v37 <= 5 )
{
v76 = v225;
v188 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"tier%ilabel_001.png",
(const char *)(unsigned int)(int)(float)(v71 + 1.0));
CString = cocos2d::CCString::getCString(v188);
v190 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
(*(void (__fastcall **)(__int64, cocos2d::CCSprite *, __int64))(*(_QWORD *)v73 + 448LL))(v73, v190, 2);
v191 = v190->setPosition;
cocos2d::CCPoint::CCPoint(&v238.origin, v230 * 0.5, (float)(v231 * 0.5) + 70.0);
v191(v190, &v238.origin);
v190->setScale(v190, 0.8);
cocos2d::CCPoint::CCPoint(&v232, (float)(v230 * 0.5) + -100.0, (float)(v231 * 0.5) + 10.0);
v77 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"chest_0%i_price_001.png",
(const char *)v225);
}
else
{
v76 = Large;
cocos2d::CCPoint::CCPoint(&v232, (float)(v230 * 0.5) + -100.0, (float)(v231 * 0.5) + 10.0);
v77 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"chest_0%i_price_001.png",
(_BYTE *)&dword_0 + 2);
}
v78 = (char *)cocos2d::CCString::getCString(v77);
sub_D153B8((int)&v233, v78);
v79 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"chest_0%i_02_001.png",
(const char *)(unsigned int)v76);
v80 = (char *)cocos2d::CCString::getCString(v79);
sub_D153B8((int)&v234, v80);
if ( v37 <= 2 )
{
qmemcpy(v229, "n8", 2);
isSpecialChestUnlocked = 0;
v87 = 0.8;
v229[2] = -126;
goto LABEL_22;
}
memset(v229, 100, 3);
if ( v37 <= 5 )
{
v87 = 0.8;
isSpecialChestUnlocked = 0;
goto LABEL_22;
}
v81 = v74 + 1;
v229[1] = 0;
v229[2] = -76;
v82 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"chestSpecial_0%i_price_001.png",
(const char *)v81);
v222 = cocos2d::CCString::getCString(v82);
v83 = strlen(v222);
sub_D1798C(&v233, v222, v83);
if ( v81 == 2 )
{
v202 = GameStatsManager::sharedState();
sub_D153B8((int)&v236, "0005");
isSpecialChestUnlocked = (unsigned __int8)GameStatsManager::isSpecialChestUnlocked((__int64)v202, &v236);
v85 = v236;
v86 = v236 - 24;
if ( v236 - 24 == (char *)&qword_124B6B0 )
goto LABEL_21;
if ( !&pthread_create )
goto LABEL_116;
v203 = (unsigned int *)(v236 - 8);
do
v194 = __ldaxr(v203);
while ( __stlxr(v194 - 1, v203) );
LABEL_102:
if ( v194 <= 0 )
operator delete(v86);
goto LABEL_21;
}
if ( v81 != 3 )
{
v192 = GameStatsManager::sharedState();
sub_D153B8((int)&v235, "0004");
isSpecialChestUnlocked = (unsigned __int8)GameStatsManager::isSpecialChestUnlocked((__int64)v192, &v235);
v85 = v235;
v86 = v235 - 24;
if ( v235 - 24 == (char *)&qword_124B6B0 )
goto LABEL_21;
if ( !&pthread_create )
goto LABEL_116;
v193 = (unsigned int *)(v235 - 8);
do
v194 = __ldaxr(v193);
while ( __stlxr(v194 - 1, v193) );
goto LABEL_102;
}
v84 = GameStatsManager::sharedState();
sub_D153B8((int)&v237, "0006");
isSpecialChestUnlocked = (unsigned __int8)GameStatsManager::isSpecialChestUnlocked((__int64)v84, &v237);
v85 = v237;
v86 = v237 - 24;
if ( v237 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v208 = (unsigned int *)(v237 - 8);
do
v194 = __ldaxr(v208);
while ( __stlxr(v194 - 1, v208) );
goto LABEL_102;
}
LABEL_116:
v194 = *((_DWORD *)v85 - 2);
*((_DWORD *)v85 - 2) = v194 - 1;
goto LABEL_102;
}
LABEL_21:
v87 = 1.0;
LABEL_22:
v88 = GJChestSprite::create(v76);
v88->setScale(v88, 0.6);
v245.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v245.adj = (size_t)SecretRewardsLayer::onChestType;
v89 = CCMenuItemSpriteExtra::create(v88, nullptr, v245);
sub_D153B8((int)&v238, "chestClick.ogg");
sub_D18EA8(&v89->m_selectSound, &v238);
v90 = (void *)(*(_QWORD *)&v238.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v238.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v198 = (unsigned int *)(*(_QWORD *)&v238.origin - 8LL);
do
v199 = __ldaxr(v198);
while ( __stlxr(v199 - 1, v198) );
}
else
{
v199 = *(_DWORD *)(*(_QWORD *)&v238.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v238.origin - 8LL) = v199 - 1;
}
if ( v199 <= 0 )
operator delete(v90);
}
setContentSize = v89->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v238, 60.0, 48.0);
setContentSize(v89, (const cocos2d::CCSize *)&v238);
v92 = v88->setPosition;
width = v89->getContentSize(v89)->width;
v94 = (__int64)v89->getContentSize(v89);
cocos2d::CCPoint::CCPoint(&v238.origin, width * 0.5, *(float *)(v94 + 4) * 0.5);
v92(v88, &v238.origin);
v75->addChild(v75, v89);
v95 = v89->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v89->m_colorEnabled = 1;
v89->m_animationEnabled = 0;
v96 = v95->setPosition;
v239 = cocos2d::CCNode::convertToNodeSpace(v75, &v232);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v96)(v89, &v238, v239.x, v239.y);
v89->setTag(v89, v37);
if ( isSpecialChestUnlocked )
SecretRewardsLayer::switchToOpenedState(a1, v89);
v97 = cocos2d::CCSprite::createWithSpriteFrameName("chestPlatform_01_001.png");
(*(void (__fastcall **)(__int64, cocos2d::CCSprite *, __int64))(*(_QWORD *)v73 + 448LL))(v73, v97, 2);
v98 = v97->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 0.0, -34.0);
cocos2d::CCPoint::operator+(&v238, &v232, &v237);
v98(v97, &v238.origin);
v97->setColor(v97, (const cocos2d::ccColor3B *)v229);
v97->setOpacity(v97, 4294967240LL);
v99 = cocos2d::CCSprite::createWithSpriteFrameName(v233);
(*(void (__fastcall **)(__int64, cocos2d::CCSprite *, __int64))(*(_QWORD *)v73 + 448LL))(v73, v99, 2);
v100 = v97;
getPosition = v97->getPosition;
v102 = v99->setPosition;
v103 = (__int64)getPosition(v100);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 0.0, -20.0);
cocos2d::CCPoint::operator+(&v238, v103, &v237);
v102(v99, &v238.origin);
v99->setScale(v99, v87);
if ( v37 <= 5 )
{
v175 = GameStatsManager::sharedState();
v176 = GameStatsManager::countUnlockedSecretChests(v175, v76);
v177 = GameStatsManager::sharedState();
v178 = GameStatsManager::countSecretChests(v177, v76);
v224 = v176;
v179 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i / %i",
(const char *)v176,
(unsigned int)v178);
cocos2d::CCString::getCString(v179);
v180 = cocos2d::CCLabelBMFont::create();
(*(void (__fastcall **)(__int64, cocos2d::CCLabelBMFont *))(*(_QWORD *)v73 + 440LL))(v73, v180);
v180->setScale(v180, 0.4);
v181 = v180->setPosition;
v182 = (__int64)v99->getPosition(v99);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v238, v182, &v237);
v181(v180, &v238.origin);
v183 = v180->setColor;
if ( v224 < v178 )
{
LOWORD(v238.origin.x) = 31419;
BYTE2(v238.origin.x) = 107;
}
else
{
LOWORD(v238.origin.x) = -256;
BYTE2(v238.origin.x) = 0;
}
v183(v180, (const cocos2d::ccColor3B *)&v238);
cocos2d::CCDictionary::setObject(a1->m_chestCounters, v180, v76);
v104 = v234;
v105 = (char *)(v234 - 24);
if ( v234 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_29;
LABEL_55:
if ( &pthread_create )
{
v184 = (unsigned int *)(v104 - 8);
do
v185 = __ldaxr(v184);
while ( __stlxr(v185 - 1, v184) );
}
else
{
v185 = *((_DWORD *)v104 - 2);
*((_DWORD *)v104 - 2) = v185 - 1;
}
if ( v185 <= 0 )
operator delete(v105);
goto LABEL_29;
}
if ( v37 == 6 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v236, (float)(v230 * 0.5) + 10.0, (float)(v231 * 0.5) + 72.0);
v213 = cocos2d::CCLabelBMFont::create();
v214 = v213->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_chestLabel = v213;
v214->setPosition(v213, (const cocos2d::CCPoint *)&v236);
m_chestLabel = a1->m_chestLabel;
v216 = m_chestLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v238.origin, 1.0, 0.5);
v216(m_chestLabel, &v238.origin);
a1->m_chestLabel->setScale(a1->m_chestLabel, 0.5);
(*(void (__fastcall **)(__int64, cocos2d::CCLabelBMFont *))(*(_QWORD *)v73 + 440LL))(v73, a1->m_chestLabel);
v217 = cocos2d::CCSprite::createWithSpriteFrameName("chest03_small_001.png");
(*(void (__fastcall **)(__int64, cocos2d::CCSprite *))(*(_QWORD *)v73 + 440LL))(v73, v217);
v218 = v217->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 22.0, 0.0);
cocos2d::CCPoint::operator+(&v238, &v236, &v237);
v218(v217, &v238.origin);
SecretRewardsLayer::updateUnlockedLabel(a1);
}
v104 = v234;
v105 = (char *)(v234 - 24);
if ( v234 - 24 != (const char *)&qword_124B6B0 )
goto LABEL_55;
LABEL_29:
v106 = (char *)(v233 - 24);
if ( v233 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v200 = (unsigned int *)(v233 - 8);
do
v201 = __ldaxr(v200);
while ( __stlxr(v201 - 1, v200) );
}
else
{
v201 = *((_DWORD *)v233 - 2);
*((_DWORD *)v233 - 2) = v201 - 1;
}
if ( v201 <= 0 )
operator delete(v106);
}
++v37;
++v225;
}
while ( v37 != 9 );
cocos2d::CCPoint::CCPoint(&v232, v230 * 0.5, (float)(v231 * 0.5) + 12.0);
v107 = cocos2d::CCLayer::create();
cocos2d::CCArray::addObject(v227, v107);
v108 = cocos2d::CCMenu::create();
v107->addChild(v107, v108);
v109 = GJChestSprite::create(9);
v109->setScale(v109, 0.72);
v246.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v246.adj = (size_t)SecretRewardsLayer::onGoldChest;
v110 = CCMenuItemSpriteExtra::create(v109, nullptr, v246);
sub_D153B8((int)&v238, "chestClick.ogg");
sub_D18EA8(&v110->m_selectSound, &v238);
v111 = (void *)(*(_QWORD *)&v238.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v238.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v211 = (unsigned int *)(*(_QWORD *)&v238.origin - 8LL);
do
v212 = __ldaxr(v211);
while ( __stlxr(v212 - 1, v211) );
}
else
{
v212 = *(_DWORD *)(*(_QWORD *)&v238.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v238.origin - 8LL) = v212 - 1;
}
if ( v212 <= 0 )
operator delete(v111);
}
v112 = v110->setContentSize;
v113 = v109->getScale(v109);
v114 = v109->getScale(v109);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v238, v113 * 100.0, v114 * 80.0);
v112(v110, (const cocos2d::CCSize *)&v238);
v115 = v109->setPosition;
v226 = v110->getContentSize(v110)->width * 0.5;
v116 = (__int64)v110->getContentSize(v110);
cocos2d::CCPoint::CCPoint(&v238.origin, v226, *(float *)(v116 + 4) * 0.5);
v115(v109, &v238.origin);
v108->addChild(v108, v110);
v110->m_animationEnabled = 0;
v117 = v110->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v110->m_colorEnabled = 1;
v118 = v108;
v119 = v117->setPosition;
v240 = cocos2d::CCNode::convertToNodeSpace(v118, &v232);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v119)(v110, &v238, v240.x, v240.y);
v120 = GameStatsManager::sharedState();
if ( !GameStatsManager::getNextGoldChestID(v120) )
SecretRewardsLayer::switchToOpenedState(a1, v110);
v121 = 1;
v122 = cocos2d::CCSprite::createWithSpriteFrameName("chestPlatform_01_001.png");
v107->addChild_0(v107, v122, 2);
v123 = v122->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 0.0, -40.8);
cocos2d::CCPoint::operator+(&v238, &v232, &v237);
v123(v122, &v238.origin);
v124 = v122->setColor;
qmemcpy(&v238, "\\Pg", 3);
v124(v122, (const cocos2d::ccColor3B *)&v238);
v122->setOpacity(v122, 4294967240LL);
v122->setScale(v122, 1.2);
v125 = cocos2d::CCSprite::createWithSpriteFrameName("chest_09_price_001.png");
v107->addChild_0(v107, v125, 2);
v126 = v122;
v127 = v122->getPosition;
v128 = v125->setPosition;
v129 = (__int64)v127(v126);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 0.0, -24.0);
cocos2d::CCPoint::operator+(&v238, v129, &v237);
v128(v125, &v238.origin);
v125->setScale(v125, 0.96);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v233, v230 * 0.5, (float)(v231 * 0.5) + 72.0);
v130 = (cocos2d::CCSprite *)cocos2d::CCLabelBMFont::create();
v131 = v130->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_goldPriceSprite = v130;
v131->setPosition(v130, (const cocos2d::CCPoint *)&v233);
m_goldPriceSprite = a1->m_goldPriceSprite;
v133 = m_goldPriceSprite->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v238.origin, 0.5, 0.5);
v133(m_goldPriceSprite, &v238.origin);
a1->m_goldPriceSprite->setScale(a1->m_goldPriceSprite, 0.5);
v107->addChild(v107, a1->m_goldPriceSprite);
SecretRewardsLayer::updateUnlockedGoldLabel(a1);
v134 = cocos2d::CCLayer::create();
cocos2d::CCArray::addObject(v227, v134);
v135 = cocos2d::CCMenu::create();
v134->addChild(v134, v135);
do
{
sub_D153B8((int)&v234, "shopRope2_001.png");
sub_D153B8((int)&v235, "shopRope2_2_001.png");
switch ( v121 )
{
case 3u:
*(_QWORD *)&v197 = sub_D1798C(&v234, "shopRope4_001.png", 17).n128_u64[0];
sub_D1798C(&v235, "shopRope4_2_001.png", 19, v197);
break;
case 4u:
*(_QWORD *)&v196 = sub_D1798C(&v234, "shopRope5_001.png", 17).n128_u64[0];
sub_D1798C(&v235, "shopRope5_2_001.png", 19, v196);
break;
case 2u:
*(_QWORD *)&v195 = sub_D1798C(&v234, "shopRope3_001.png", 17).n128_u64[0];
sub_D1798C(&v235, "shopRope3_2_001.png", 19, v195);
break;
}
v136 = cocos2d::CCSprite::createWithSpriteFrameName(v234);
v247.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v137 = v136;
v247.adj = (size_t)SecretRewardsLayer::onShop;
v138 = CCMenuItemSpriteExtra::create(v136, nullptr, v247);
v138->setTag(v138, v121);
v135->addChild(v135, v138);
CCMenuItemSpriteExtra::setSizeMult(v138, 1.5);
v139 = v138->setPosition;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v237,
(float)((float)((float)(int)(v121 - 1) * 70.0) + -105.0) + (float)(v230 * 0.5),
v231 - 100.0);
v241 = cocos2d::CCNode::convertToNodeSpace(v135, (const cocos2d::CCPoint *)&v237);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v139)(v138, &v238, v241.x, v241.y);
CCMenuItemSpriteExtra::useAnimationType(v138, Move);
cocos2d::CCPoint::CCPoint(&v238.origin, 0.0, -15.0);
cocos2d::CCPoint::operator=(&v138->m_offset, v140, v141);
v138->m_duration = 0.3;
v138->m_unselectedDuration = 0.3;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v236, 25.0, 76.0);
if ( v121 == 2 )
{
*(float *)&v236 = *(float *)&v236 - 2.25;
}
else if ( v121 == 3 )
{
*(float *)&v236 = *(float *)&v236 - 3.5;
}
for ( i = 0; i != 6; ++i )
{
v143 = cocos2d::CCSprite::createWithSpriteFrameName(v235);
v137->addChild(v137, v143);
v144 = v143->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, 0.0, (float)i * 20.5);
cocos2d::CCPoint::operator+(&v238, &v236, &v237);
v144(v143, &v238.origin);
}
v145 = v235 - 24;
if ( v235 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v206 = (unsigned int *)(v235 - 8);
do
v207 = __ldaxr(v206);
while ( __stlxr(v207 - 1, v206) );
}
else
{
v207 = *((_DWORD *)v235 - 2);
*((_DWORD *)v235 - 2) = v207 - 1;
}
if ( v207 <= 0 )
operator delete(v145);
}
v146 = (char *)(v234 - 24);
if ( v234 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v204 = (unsigned int *)(v234 - 8);
do
v205 = __ldaxr(v204);
while ( __stlxr(v205 - 1, v204) );
}
else
{
v205 = *((_DWORD *)v234 - 2);
*((_DWORD *)v234 - 2) = v205 - 1;
}
if ( v205 <= 0 )
operator delete(v146);
}
++v121;
}
while ( v121 != 5 );
v147 = (BoomScrollLayer *)BoomScrollLayer::create(v227, 0, 1, nullptr, nullptr);
m_mainLayer = a1->m_mainLayer;
a1->m_mainScrollLayer = v147;
m_mainLayer->addChild(m_mainLayer, v147);
m_mainScrollLayer = a1->m_mainScrollLayer;
v150 = v230 * 0.5;
v151 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v151);
cocos2d::CCPoint::CCPoint(&v238.origin, v150, v152 + 10.0);
BoomScrollLayer::setPagesIndicatorPosition(m_mainScrollLayer, v250);
v153 = a1->m_mainScrollLayer;
v153->m_doVisit = 1;
v153->m_unkFloat2 = 0.9;
v154 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v154);
v228 = v155;
v156 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v156);
cocos2d::CCRect::CCRect(&v238, 0.0, 0.0, v228, v157);
cocos2d::CCRect::operator=(&v153->m_clippingRect, &v238);
a1->m_mainScrollLayer->m_extendedLayer->m_delegate = &a1->BoomScrollLayerDelegate;
v158 = cocos2d::CCMenu::create();
v158->setTouchPriority(v158, -129);
v159 = (float)(v231 * 0.5) + -30.0;
v160 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v248.adj = (size_t)SecretRewardsLayer::onSwitchPage;
v248.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v161 = CCMenuItemSpriteExtra::create(v160, nullptr, v248);
v162 = v158->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_leftButton = v161;
v162->addChild(v158, v161);
m_leftButton = a1->m_leftButton;
v164 = m_leftButton->setPosition;
v165 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v165);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, v166 + 24.0, v159);
v242 = cocos2d::CCNode::convertToNodeSpace(v158, (const cocos2d::CCPoint *)&v237);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v164)(
m_leftButton,
&v238,
v242.x,
v242.y);
a1->m_leftButton->setTag(a1->m_leftButton, 0);
CCMenuItemSpriteExtra::setSizeMult(a1->m_leftButton, 2.0);
v167 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v167, 1);
v249.adj = (size_t)SecretRewardsLayer::onSwitchPage;
v249.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v168 = CCMenuItemSpriteExtra::create(v167, nullptr, v249);
v169 = v158->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_rightButton = v168;
v169->addChild(v158, v168);
m_rightButton = a1->m_rightButton;
v171 = m_rightButton->setPosition;
v172 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v172);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v237, v173 - 24.0, v159);
v243 = cocos2d::CCNode::convertToNodeSpace(v158, (const cocos2d::CCPoint *)&v237);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))v171)(
m_rightButton,
&v238,
v243.x,
v243.y);
a1->m_rightButton->setTag(a1->m_rightButton, 1);
CCMenuItemSpriteExtra::setSizeMult(a1->m_rightButton, 2.0);
a1->addChild_0(a1, v158, 10);
if ( v219 )
{
TotalPages = BoomScrollLayer::getTotalPages(a1->m_mainScrollLayer);
BoomScrollLayer::instantMoveToPage(a1->m_mainScrollLayer, TotalPages - 2);
BoomScrollLayer::instantMoveToPage(a1->m_mainScrollLayer, TotalPages - 1);
}
return v220;
}