//
// SecretRewardsLayer::init from 0x1002e7fb8 to 0x1002e988c (6356 bytes)
//
// 1 xrefs:
// > SecretRewardsLayer::create @ 0x1002e7f6c
//
// 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 __fastcall SecretRewardsLayer::init(SecretRewardsLayer *a1, bool a2)
{
_BOOL4 v4; // w21
cocos2d::CCTextureCache *v5; // x0
cocos2d::CCSpriteFrameCache *v6; // x0
cocos2d::CCDirector *v7; // x0
GameManager *v8; // x0
GameManager *v9; // x0
GameManager *v10; // x19
cocos2d::CCLayer *v11; // x0
cocos2d::CCSprite *v12; // x19
__n128 v13; // q0
__n128 v14; // q1
__n128 v15; // q0
cocos2d::CCSprite *m_backgroundSprite; // x19
__n128 v17; // q1
cocos2d::CCSprite *v18; // x0
cocos2d::CCSprite *v19; // x21
__n128 v20; // q0
__n128 v21; // q1
__n128 v22; // q0
__n128 v23; // q1
cocos2d::CCSprite *v24; // x19
__n128 v25; // q0
__n128 v26; // q1
__n128 v27; // q0
__n128 v28; // q1
cocos2d::CCSprite *v29; // x0
CCMenuItemSpriteExtra *v30; // x19
__int64 v31; // x1
__int64 v32; // x2
__int64 v33; // x3
__int64 v34; // x4
__int64 v35; // x5
__int64 v36; // x6
__int64 v37; // x7
cocos2d::CCMenu *v38; // x21
cocos2d::CCDirector *v39; // x0
float v40; // s8
cocos2d::CCDirector *v41; // x0
__n128 v42; // q1
__n128 v43; // q0
GameStatsManager *v44; // x0
int Stat; // w0
cocos2d::CCString *v46; // x0
const char *CString; // x0
cocos2d::CCLabelBMFont *v48; // x21
__n128 v49; // q0
__n128 v50; // q1
__n128 v51; // q0
cocos2d::CCLabelBMFont *m_keysLabel; // x21
__n128 v53; // q1
cocos2d::CCSprite *v54; // x0
cocos2d::CCSprite *m_keySprite; // x21
float32x2_t *v56; // x22
__n128 v57; // q0
__n128 v58; // q1
double v59; // d0
GameStatsManager *v60; // x0
int v61; // w0
cocos2d::CCString *v62; // x0
const char *v63; // x0
cocos2d::CCLabelBMFont *v64; // x19
__int64 v65; // x0
__n128 v66; // q0
cocos2d::CCLabelBMFont *m_goldKeysLabel; // x19
__n128 v68; // q1
cocos2d::CCSprite *v69; // x0
cocos2d::CCSprite *m_goldKeySprite; // x19
float32x2_t *v71; // x21
__n128 v72; // q0
__n128 v73; // q1
double v74; // d0
cocos2d::CCSprite *v75; // x19
__n128 v76; // q0
__n128 v77; // q1
cocos2d::CCSprite *v78; // x19
__n128 v79; // q0
__n128 v80; // q1
__n128 v81; // q0
__n128 v82; // q1
cocos2d::CCArray *v83; // x22
cocos2d::CCObject *v84; // x24
cocos2d::CCDictionary *v85; // x0
unsigned __int64 i; // x25
float v87; // s12
unsigned int v88; // w19
cocos2d::CCLayer *v89; // x21
cocos2d::CCMenu *v90; // x0
__int64 v91; // x23
cocos2d::CCNode *v92; // x28
__n128 v93; // q0
__n128 v94; // q1
int v95; // w21
cocos2d::CCString *v96; // x0
const char *v97; // x0
cocos2d::CCSprite *v98; // x19
__n128 v99; // q0
__n128 v100; // q1
int v101; // w19
cocos2d::CCString *v102; // x0
char *v103; // x0
cocos2d::CCString *v104; // x0
char *v105; // x0
int isSpecialChestUnlocked; // w21
cocos2d::CCString *v107; // x0
const char *v108; // x0
GameStatsManager *v109; // x21
float v110; // s12
void *v111; // x0
GJChestSprite *v112; // x26
CCMenuItemSpriteExtra *v113; // x19
float v114; // s14
__int64 v115; // x0
__n128 v116; // q0
__n128 v117; // q1
SecretRewardsLayer *v118; // x0
cocos2d::CCSprite *v119; // x21
__n128 v120; // q0
__n128 v121; // q1
double v122; // d0
std::string *v123; // x0
cocos2d::CCSprite *v124; // x19
float32x2_t *v125; // x21
__n128 v126; // q0
__n128 v127; // q1
double v128; // d0
__n128 v129; // q0
__n128 v130; // q1
GameStatsManager *v131; // x0
int v132; // w21
GameStatsManager *v133; // x0
int v134; // w26
cocos2d::CCString *v135; // x0
const char *v136; // x0
cocos2d::CCLabelBMFont *v137; // x28
float32x2_t *v138; // x19
__n128 v139; // q1
__n128 v140; // q0
double v141; // d0
int v142; // w8
cocos2d::CCLabelBMFont *v143; // x0
__n128 v144; // q0
cocos2d::CCLabelBMFont *m_chestLabel; // x19
__n128 v146; // q1
cocos2d::CCSprite *v147; // x19
__n128 v148; // q0
__n128 v149; // q1
double v150; // d0
GameStatsManager *v151; // x21
GameStatsManager *v152; // x21
cocos2d::CCLayer *v153; // x19
cocos2d::CCMenu *v154; // x21
GJChestSprite *v155; // x24
CCMenuItemSpriteExtra *v156; // x23
float v157; // s8
float v158; // s0
float v159; // s8
__n128 v160; // q1
__n128 v161; // q0
GameStatsManager *v162; // x0
SecretRewardsLayer *NextGoldChestID; // x0
cocos2d::CCSprite *v164; // x21
__n128 v165; // q0
__n128 v166; // q1
double v167; // d0
cocos2d::CCSprite *v168; // x23
float32x2_t *v169; // x21
__n128 v170; // q0
__n128 v171; // q1
double v172; // d0
__n128 v173; // q0
__n128 v174; // q1
cocos2d::CCSprite *v175; // x0
__n128 v176; // q0
cocos2d::CCSprite *m_goldPriceSprite; // x21
__n128 v178; // q1
cocos2d::CCLayer *v179; // x21
cocos2d::CCMenu *v180; // x19
__int64 v181; // x21
const std::string::value_type *v182; // x1
std::string *v183; // x0
cocos2d::CCSprite *v184; // x25
CCMenuItemSpriteExtra *v185; // x27
__n128 v186; // q0
__n128 v187; // q1
__n128 v188; // q0
__n128 v189; // q1
__n128 v190; // q0
__n128 v191; // q1
float v192; // s0
unsigned int j; // w23
std::string *p_p; // x0
cocos2d::CCSprite *v195; // x27
__n128 v196; // q0
__n128 v197; // q1
double v198; // d0
BoomScrollLayer *v199; // x0
BoomScrollLayer *m_mainScrollLayer; // x19
float v201; // s8
cocos2d::CCDirector *v202; // x0
__n128 v203; // q1
__n128 v204; // q0
BoomScrollLayer *v205; // x19
cocos2d::CCDirector *v206; // x0
float v207; // s8
cocos2d::CCDirector *v208; // x0
float v209; // s0
cocos2d::CCMenu *v210; // x19
unsigned __int32 v211; // s8
float v212; // s9
cocos2d::CCSprite *v213; // x0
CCMenuItemSpriteExtra *v214; // x0
CCMenuItemSpriteExtra *m_leftButton; // x23
cocos2d::CCDirector *v216; // x0
__n128 v217; // q0
__n128 v218; // q1
cocos2d::CCSprite *v219; // x22
CCMenuItemSpriteExtra *v220; // x0
CCMenuItemSpriteExtra *m_rightButton; // x21
cocos2d::CCDirector *v222; // x0
__n128 v223; // q0
__n128 v224; // q1
int TotalPages; // w0
int v226; // w19
bool v228; // [xsp+20h] [xbp-190h]
bool v229; // [xsp+24h] [xbp-18Ch]
float32x2_t v230; // [xsp+28h] [xbp-188h] BYREF
std::string v231; // [xsp+30h] [xbp-180h] BYREF
float32x2_t v232; // [xsp+48h] [xbp-168h] BYREF
float32x2_t v233; // [xsp+50h] [xbp-160h] BYREF
float32x2_t v234; // [xsp+58h] [xbp-158h] BYREF
std::string __str; // [xsp+60h] [xbp-150h] BYREF
void *v236[2]; // [xsp+78h] [xbp-138h] BYREF
char v237; // [xsp+8Fh] [xbp-121h]
_QWORD v238[2]; // [xsp+90h] [xbp-120h] BYREF
char v239; // [xsp+A7h] [xbp-109h]
_QWORD v240[2]; // [xsp+A8h] [xbp-108h] BYREF
char v241; // [xsp+BFh] [xbp-F1h]
std::string __p; // [xsp+C0h] [xbp-F0h] BYREF
std::string v243; // [xsp+D8h] [xbp-D8h] BYREF
float32x2_t v244; // [xsp+F0h] [xbp-C0h] BYREF
void *v245[2]; // [xsp+F8h] [xbp-B8h] BYREF
char v246; // [xsp+10Fh] [xbp-A1h]
float v247; // [xsp+110h] [xbp-A0h]
float v248; // [xsp+114h] [xbp-9Ch]
cocos2d::CCPoint v249; // 0:kr08_8.8
cocos2d::CCPoint v250; // 0:kr10_8.8
cocos2d::CCPoint v251; // 0:kr18_8.8
cocos2d::CCPoint v252; // 0:kr20_8.8
cocos2d::CCPoint v253; // 0:kr28_8.8
cocos2d::SEL_MenuHandler v254; // 0:x3.16
cocos2d::SEL_MenuHandler v255; // 0:x3.16
cocos2d::SEL_MenuHandler v256; // 0:x3.16
cocos2d::SEL_MenuHandler v257; // 0:x3.16
cocos2d::SEL_MenuHandler v258; // 0:x3.16
cocos2d::SEL_MenuHandler v259; // 0:x3.16
cocos2d::CCPoint v260; // 0:s0.4,4:s1.4
v4 = cocos2d::CCLayer::init(a1);
if ( !v4 )
return v4;
a1->m_inMainLayer = 1;
v5 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v5, "TreasureRoomSheet.png", 0);
v6 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v6, "TreasureRoomSheet.plist");
((void (__fastcall *)(SecretRewardsLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(SecretRewardsLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v7);
v8 = GameManager::sharedState();
if ( GameManager::getUGV(v8, "10") )
a1->m_scratchDialogIndex = 4;
v9 = GameManager::sharedState();
if ( GameManager::getUGV(v9, "21") )
a1->m_potborDialogIndex = 3;
v10 = GameManager::sharedState();
sub_100009900(v245, "secretLoop.mp3");
GameManager::fadeInMusic(v10, v245);
v229 = v4;
if ( v246 < 0 )
operator delete(v245[0]);
v228 = a2;
v11 = cocos2d::CCLayer::create();
a1->m_mainLayer = v11;
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCLayer *, _QWORD))a1->addChild_0)(a1, v11, 0);
v12 = cocos2d::CCSprite::create("GJ_gradientBG.png");
a1->m_backgroundSprite = v12;
v13.n128_u32[0] = 0;
v14.n128_u32[0] = 0;
sub_100022980(v13, v14, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v12->setAnchorPoint)(v12, &v243);
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(
a1,
a1->m_backgroundSprite,
4294967293LL);
((void (__fastcall *)(cocos2d::CCSprite *, float))a1->m_backgroundSprite->setScaleX)(
a1->m_backgroundSprite,
(float)(v247 + 10.0) / a1->m_backgroundSprite->m_obRect.size.width);
v15 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))a1->m_backgroundSprite->setScaleY)(
a1->m_backgroundSprite,
(float)(v248 + 10.0) / a1->m_backgroundSprite->m_obRect.size.height);
m_backgroundSprite = a1->m_backgroundSprite;
v15.n128_u32[0] = -5.0;
v17.n128_u32[0] = -5.0;
sub_100022980(v15, v17, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))m_backgroundSprite->setPosition)(m_backgroundSprite, &v243);
v18 = a1->m_backgroundSprite;
v243.__r_.__value_.__s.__data_[2] = 75;
LOWORD(v243.__r_.__value_.__l.__data_) = 70;
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v18->setColor)(v18, &v243);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomSpiderweb_001.png");
v20.n128_u32[0] = 1.0;
v21.n128_u32[0] = 1.0;
sub_100022980(v20, v21, &v243);
v22 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, std::string *))v19->setAnchorPoint)(v19, &v243);
v22.n128_f32[0] = v247 + 5.0;
v23.n128_f32[0] = v248 + 5.0;
sub_100022980(v22, v23, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v19->setPosition)(v19, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v19->setOpacity)(v19, 63);
v243.__r_.__value_.__s.__data_[2] = 0;
LOWORD(v243.__r_.__value_.__l.__data_) = 0;
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v19->setColor)(v19, &v243);
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v19, 0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::CCSprite *, float))v19->setScale)(v19, 1.1);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomSpiderweb_001.png");
v25.n128_u32[0] = 0;
v26.n128_u32[0] = 1.0;
sub_100022980(v25, v26, &v243);
v27 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, std::string *))v24->setAnchorPoint)(v24, &v243);
v28.n128_f32[0] = v248 + 5.0;
v27.n128_u32[0] = -5.0;
sub_100022980(v27, v28, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v24->setPosition)(v24, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v24->setOpacity)(v24, 63);
cocos2d::CCSprite::setFlipX(v24, 1);
v243.__r_.__value_.__s.__data_[2] = 0;
LOWORD(v243.__r_.__value_.__l.__data_) = 0;
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v24->setColor)(v24, &v243);
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v24, 0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::CCSprite *, float))v24->setScale)(v24, 1.1);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
a1->m_backSprite = v29;
v254.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretRewardsLayer::onBack;
v254.adj = 0;
v30 = CCMenuItemSpriteExtra::create(v29, nullptr, a1, v254);
CCMenuItemSpriteExtra::setSizeMult(v30, 1.6);
v38 = sub_1001D7ED0(v30, v31, v32, v33, v34, v35, v36, v37, 0);
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v38, 1);
v39 = cocos2d::CCDirector::sharedDirector();
v40 = sub_1001768D8((__int64)v39) + 24.0;
v41 = cocos2d::CCDirector::sharedDirector();
v42.n128_f32[0] = sub_1001768C8((__int64)v41) + -23.0;
v43.n128_f32[0] = v40;
sub_100022980(v43, v42, &v243);
((void (__fastcall *)(cocos2d::CCMenu *, std::string *))v38->setPosition)(v38, &v243);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v30);
v44 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v44, "21");
v46 = (cocos2d::CCString *)sub_100268F4C("%i", Stat);
CString = cocos2d::CCString::getCString(v46);
v48 = cocos2d::CCLabelBMFont::create_1(CString, "bigFont.fnt");
a1->m_keysLabel = v48;
v49.n128_f32[0] = v247 + -55.0;
v50.n128_f32[0] = v248 + -18.0;
sub_100022980(v49, v50, &v243);
v51 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v48->setPosition)(v48, &v243);
m_keysLabel = a1->m_keysLabel;
v51.n128_u32[0] = 1.0;
v53.n128_u32[0] = 0.5;
sub_100022980(v51, v53, &v243);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))m_keysLabel->setAnchorPoint)(m_keysLabel, &v243);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_keysLabel->setScale)(a1->m_keysLabel, 0.6);
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, a1->m_keysLabel);
v54 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigKey_001.png");
a1->m_keySprite = v54;
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v54, 3);
m_keySprite = a1->m_keySprite;
v56 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_keysLabel->getPosition)(a1->m_keysLabel);
v57.n128_u32[0] = 25.0;
v58.n128_u32[0] = -0.5;
sub_100022980(v57, v58, &__p);
*(float32x2_t *)&v59 = sub_1000229DC(v56, (float32x2_t *)&__p, (float32x2_t *)&v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *, double))m_keySprite->setPosition)(m_keySprite, &v243, v59);
v60 = GameStatsManager::sharedState();
v61 = GameStatsManager::getStat(v60, "43");
v62 = (cocos2d::CCString *)sub_100268F4C("%i", v61);
v63 = cocos2d::CCString::getCString(v62);
v64 = cocos2d::CCLabelBMFont::create_1(v63, "bigFont.fnt");
a1->m_goldKeysLabel = v64;
v65 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_keysLabel->getPosition)(a1->m_keysLabel);
v66 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v64->setPosition)(v64, v65);
m_goldKeysLabel = a1->m_goldKeysLabel;
v66.n128_u32[0] = 1.0;
v68.n128_u32[0] = 0.5;
sub_100022980(v66, v68, &v243);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))m_goldKeysLabel->setAnchorPoint)(
m_goldKeysLabel,
&v243);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_goldKeysLabel->setScale)(a1->m_goldKeysLabel, 0.6);
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, a1->m_goldKeysLabel);
v69 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigGoldKey_001.png");
a1->m_goldKeySprite = v69;
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v69, 3);
m_goldKeySprite = a1->m_goldKeySprite;
v71 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_goldKeysLabel->getPosition)(a1->m_goldKeysLabel);
v72.n128_u32[0] = 25.0;
v73.n128_u32[0] = -0.5;
sub_100022980(v72, v73, &__p);
*(float32x2_t *)&v74 = sub_1000229DC(v71, (float32x2_t *)&__p, (float32x2_t *)&v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *, double))m_goldKeySprite->setPosition)(
m_goldKeySprite,
&v243,
v74);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_goldKeysLabel->setVisible)(a1->m_goldKeysLabel, 0);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_goldKeySprite->setVisible)(a1->m_goldKeySprite, 0);
v75 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomLabel_001.png");
v76 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v75,
2);
v76.n128_f32[0] = v247 * 0.5;
v77.n128_f32[0] = v248 + -42.0;
sub_100022980(v76, v77, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v75->setPosition)(v75, &v243);
v78 = cocos2d::CCSprite::createWithSpriteFrameName("treasureRoomGround_001.png");
v79 = ((__n128 (__fastcall *)(SecretRewardsLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v78, 2);
v79.n128_u32[0] = 0;
v80.n128_u32[0] = 1.0;
sub_100022980(v79, v80, &v243);
v81 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, std::string *))v78->setAnchorPoint)(v78, &v243);
v82.n128_u32[0] = 1108082688;
v81.n128_u32[0] = -10.0;
sub_100022980(v81, v82, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v78->setPosition)(v78, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v78->setBlendFunc)(v78, 0x100000302LL);
((void (__fastcall *)(cocos2d::CCSprite *, float))v78->setScale)(v78, (float)(v247 + 20.0) / v78->m_obRect.size.width);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v78->setOpacity)(v78, 150);
v83 = (cocos2d::CCArray *)sub_10024A15C();
v84 = sub_10024A15C();
v85 = cocos2d::CCDictionary::create();
a1->m_chestCounters = v85;
cocos2d::CCObject::retain(v85);
for ( i = 0; i != 9; ++i )
{
v87 = (float)(unsigned int)i / 3.0;
v88 = vcvtms_s32_f32(v87);
if ( (unsigned int)sub_10024A36C((__int64)v83) < v88 + 1 )
{
v89 = cocos2d::CCLayer::create();
v90 = cocos2d::CCMenu::create();
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *))v89->addChild)(v89, v90);
sub_10024A2D0((__int64)v83);
sub_10024A2D0((__int64)v84);
}
v91 = sub_10024A388((__int64)v83, v88);
v92 = (cocos2d::CCNode *)sub_10024A388((__int64)v84, v88);
v95 = (unsigned __int8)i - 3 * ((1431655766 * (unsigned __int64)(unsigned __int8)i) >> 32);
if ( i <= 5 && !v95 )
{
v96 = (cocos2d::CCString *)sub_100268F4C("tier%ilabel_001.png", (int)(float)(floorf(v87) + 1.0));
v97 = cocos2d::CCString::getCString(v96);
v98 = cocos2d::CCSprite::createWithSpriteFrameName(v97);
v99 = ((__n128 (__fastcall *)(__int64, cocos2d::CCSprite *, __int64))*(_QWORD *)(*(_QWORD *)v91 + 448LL))(
v91,
v98,
2);
v99.n128_f32[0] = v247 * 0.5;
v100.n128_f32[0] = (float)(v248 * 0.5) + 70.0;
sub_100022980(v99, v100, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v98->setPosition)(v98, &v243);
v93 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))v98->setScale)(v98, 0.8);
}
v93.n128_f32[0] = (float)(v247 * 0.5) + (float)((float)(v95 - 1) * 100.0);
v94.n128_f32[0] = (float)(v248 * 0.5) + 10.0;
sub_100022980(v93, v94, &v244);
if ( i <= 5 )
v101 = i + 3;
else
v101 = 2;
v102 = (cocos2d::CCString *)sub_100268F4C("chest_0%i_price_001.png", v101);
v103 = (char *)cocos2d::CCString::getCString(v102);
sub_100009900(&v243, v103);
v104 = (cocos2d::CCString *)sub_100268F4C("chest_0%i_02_001.png", v101);
v105 = (char *)cocos2d::CCString::getCString(v104);
sub_100009900(&__p, v105);
if ( i <= 2 )
{
isSpecialChestUnlocked = 0;
v230.i8[2] = -126;
v230.i16[0] = 14446;
LABEL_27:
v110 = 0.8;
goto LABEL_28;
}
memset(&v230, 100, 3);
if ( i < 6 )
{
isSpecialChestUnlocked = 0;
goto LABEL_27;
}
v230.i8[2] = -76;
v230.i16[0] = 100;
v107 = (cocos2d::CCString *)sub_100268F4C("chestSpecial_0%i_price_001.png", v95 + 1);
v108 = cocos2d::CCString::getCString(v107);
std::string::assign(&v243, v108);
if ( v95 )
{
if ( v95 == 1 )
{
v109 = GameStatsManager::sharedState();
sub_100009900(v238, "0005");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v109, v238);
v110 = 1.0;
if ( (v239 & 0x80000000) == 0 )
goto LABEL_28;
v111 = (void *)v238[0];
}
else
{
v152 = GameStatsManager::sharedState();
sub_100009900(v236, "0006");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v152, v236);
v110 = 1.0;
if ( (v237 & 0x80000000) == 0 )
goto LABEL_28;
v111 = v236[0];
}
}
else
{
v151 = GameStatsManager::sharedState();
sub_100009900(v240, "0004");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v151, v240);
v110 = 1.0;
if ( (v241 & 0x80000000) == 0 )
goto LABEL_28;
v111 = (void *)v240[0];
}
operator delete(v111);
LABEL_28:
v112 = GJChestSprite::create(v101);
((void (__fastcall *)(GJChestSprite *, float))v112->setScale)(v112, 0.6);
v255.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretRewardsLayer::onChestType;
v255.adj = 0;
v113 = CCMenuItemSpriteExtra::create(v112, nullptr, a1, v255);
sub_100009900(&__str, "chestClick.ogg");
std::string::operator=((std::string *)&v113->m_selectSound, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
sub_100022988((float *)&v234, 60.0, 48.0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *))v113->setContentSize)(v113, &v234);
v114 = *(float *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v113->getContentSize)(v113);
v115 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v113->getContentSize)(v113);
v116.n128_f32[0] = v114 * 0.5;
v117.n128_f32[0] = *(float *)(v115 + 4) * 0.5;
sub_100022980(v116, v117, &v234);
((void (__fastcall *)(GJChestSprite *, float32x2_t *))v112->setPosition)(v112, &v234);
((void (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v92->addChild)(v92, v113);
*(_WORD *)&v113->m_animationEnabled = 256;
v249 = cocos2d::CCNode::convertToNodeSpace(v92, (const cocos2d::CCPoint *)&v244);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))v113->setPosition)(
v113,
&v234,
v249.x,
v249.y);
v118 = (SecretRewardsLayer *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64))v113->setTag)(
v113,
i);
if ( isSpecialChestUnlocked )
SecretRewardsLayer::switchToOpenedState(v118, v113);
v119 = cocos2d::CCSprite::createWithSpriteFrameName("chestPlatform_01_001.png");
v120 = ((__n128 (__fastcall *)(__int64, cocos2d::CCSprite *, __int64))*(_QWORD *)(*(_QWORD *)v91 + 448LL))(
v91,
v119,
2);
v121.n128_u32[0] = -1039663104;
v120.n128_u32[0] = 0;
sub_100022980(v120, v121, &v233);
*(float32x2_t *)&v122 = sub_1000229DC(&v244, &v233, &v234);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *, double))v119->setPosition)(v119, &v234, v122);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v119->setColor)(v119, &v230);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v119->setOpacity)(v119, 200);
if ( (v243.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v123 = &v243;
else
v123 = (std::string *)v243.__r_.__value_.__r.__words[0];
v124 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v123);
(*(void (__fastcall **)(__int64, cocos2d::CCSprite *, __int64))(*(_QWORD *)v91 + 448LL))(v91, v124, 2);
v125 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v119->getPosition)(v119);
v126.n128_u32[0] = 0;
v127.n128_u32[0] = -20.0;
sub_100022980(v126, v127, &v233);
*(float32x2_t *)&v128 = sub_1000229DC(v125, &v233, &v234);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *, double))v124->setPosition)(v124, &v234, v128);
((void (__fastcall *)(cocos2d::CCSprite *, float))v124->setScale)(v124, v110);
if ( i > 5 )
{
if ( i == 6 )
{
v129.n128_f32[0] = (float)(v247 * 0.5) + 10.0;
v130.n128_f32[0] = (float)(v248 * 0.5) + 72.0;
sub_100022980(v129, v130, &v234);
v143 = cocos2d::CCLabelBMFont::create_1(" ", "bigFont.fnt");
a1->m_chestLabel = v143;
v144 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v143->setPosition)(v143, &v234);
m_chestLabel = a1->m_chestLabel;
v144.n128_u32[0] = 1.0;
v146.n128_u32[0] = 0.5;
sub_100022980(v144, v146, &v233);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))m_chestLabel->setAnchorPoint)(
m_chestLabel,
&v233);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_chestLabel->setScale)(a1->m_chestLabel, 0.5);
(*(void (__fastcall **)(__int64, cocos2d::CCLabelBMFont *))(*(_QWORD *)v91 + 440LL))(v91, a1->m_chestLabel);
v147 = cocos2d::CCSprite::createWithSpriteFrameName("chest03_small_001.png");
v148 = ((__n128 (__fastcall *)(__int64, cocos2d::CCSprite *))*(_QWORD *)(*(_QWORD *)v91 + 440LL))(v91, v147);
v148.n128_u32[0] = 22.0;
v149.n128_u32[0] = 0;
sub_100022980(v148, v149, &v232);
*(float32x2_t *)&v150 = sub_1000229DC(&v234, &v232, &v233);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *, double))v147->setPosition)(v147, &v233, v150);
SecretRewardsLayer::updateUnlockedLabel(a1);
}
}
else
{
v131 = GameStatsManager::sharedState();
v132 = GameStatsManager::countUnlockedSecretChests(v131, (GJRewardType)(i + 3));
v133 = GameStatsManager::sharedState();
v134 = GameStatsManager::countSecretChests(v133, (GJRewardType)(i + 3));
v135 = (cocos2d::CCString *)sub_100268F4C("%i / %i", v132, v134);
v136 = cocos2d::CCString::getCString(v135);
v137 = cocos2d::CCLabelBMFont::create_1(v136, "bigFont.fnt");
(*(void (__fastcall **)(__int64, cocos2d::CCLabelBMFont *))(*(_QWORD *)v91 + 440LL))(v91, v137);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v137->setScale)(v137, 0.4);
v138 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v124->getPosition)(v124);
v139.n128_u32[0] = -1039400960;
v140.n128_u32[0] = 0;
sub_100022980(v140, v139, &v233);
*(float32x2_t *)&v141 = sub_1000229DC(v138, &v233, &v234);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *, double))v137->setPosition)(v137, &v234, v141);
if ( v132 >= v134 )
v142 = 65280;
else
v142 = 7043771;
v234.i16[0] = v142;
v234.i8[2] = BYTE2(v142);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v137->setColor)(v137, &v234);
cocos2d::CCDictionary::setObject(a1->m_chestCounters, v137, i + 3);
}
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
if ( SHIBYTE(v243.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v243.__r_.__value_.__l.__data_);
}
v129.n128_f32[0] = v247 * 0.5;
v130.n128_f32[0] = (float)(v248 * 0.5) + 12.0;
sub_100022980(v129, v130, &v244);
v153 = cocos2d::CCLayer::create();
sub_10024A2D0((__int64)v83);
v154 = cocos2d::CCMenu::create();
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *))v153->addChild)(v153, v154);
v155 = GJChestSprite::create(9);
((void (__fastcall *)(GJChestSprite *, float))v155->setScale)(v155, 0.72);
v256.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretRewardsLayer::onGoldChest;
v256.adj = 0;
v156 = CCMenuItemSpriteExtra::create(v155, nullptr, a1, v256);
sub_100009900(&v231, "chestClick.ogg");
std::string::operator=((std::string *)&v156->m_selectSound, &v231);
if ( SHIBYTE(v231.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v231.__r_.__value_.__l.__data_);
v157 = ((float (__fastcall *)(GJChestSprite *))v155->getScale)(v155) * 100.0;
v158 = ((float (__fastcall *)(GJChestSprite *))v155->getScale)(v155);
sub_100022988((float *)&v243, v157, v158 * 80.0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *))v156->setContentSize)(v156, &v243);
v159 = *(float *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v156->getContentSize)(v156) * 0.5;
v160.n128_f32[0] = *(float *)(((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v156->getContentSize)(v156) + 4) * 0.5;
v161.n128_f32[0] = v159;
sub_100022980(v161, v160, &v243);
((void (__fastcall *)(GJChestSprite *, std::string *))v155->setPosition)(v155, &v243);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v154->addChild)(v154, v156);
*(_WORD *)&v156->m_animationEnabled = 256;
v250 = cocos2d::CCNode::convertToNodeSpace(v154, (const cocos2d::CCPoint *)&v244);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, float, float))v156->setPosition)(
v156,
&v243,
v250.x,
v250.y);
v162 = GameStatsManager::sharedState();
NextGoldChestID = (SecretRewardsLayer *)GameStatsManager::getNextGoldChestID(v162);
if ( !(_DWORD)NextGoldChestID )
SecretRewardsLayer::switchToOpenedState(NextGoldChestID, v156);
v164 = cocos2d::CCSprite::createWithSpriteFrameName("chestPlatform_01_001.png");
v165 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))v153->addChild_0)(v153, v164, 2);
v166.n128_u32[0] = -1037880524;
v165.n128_u32[0] = 0;
sub_100022980(v165, v166, &__p);
*(float32x2_t *)&v167 = sub_1000229DC(&v244, (float32x2_t *)&__p, (float32x2_t *)&v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *, double))v164->setPosition)(v164, &v243, v167);
qmemcpy(&v243, "\\Pg", 3);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v164->setColor)(v164, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v164->setOpacity)(v164, 200);
((void (__fastcall *)(cocos2d::CCSprite *, float))v164->setScale)(v164, 1.2);
v168 = cocos2d::CCSprite::createWithSpriteFrameName("chest_09_price_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))v153->addChild_0)(v153, v168, 2);
v169 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v164->getPosition)(v164);
v170.n128_u32[0] = 0;
v171.n128_u32[0] = -24.0;
sub_100022980(v170, v171, &__p);
*(float32x2_t *)&v172 = sub_1000229DC(v169, (float32x2_t *)&__p, (float32x2_t *)&v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *, double))v168->setPosition)(v168, &v243, v172);
v173 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))v168->setScale)(v168, 0.96);
v173.n128_f32[0] = v247 * 0.5;
v174.n128_f32[0] = (float)(v248 * 0.5) + 72.0;
sub_100022980(v173, v174, &v234);
v175 = (cocos2d::CCSprite *)cocos2d::CCLabelBMFont::create_1(" ", "bigFont.fnt");
a1->m_goldPriceSprite = v175;
v176 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v175->setPosition)(v175, &v234);
m_goldPriceSprite = a1->m_goldPriceSprite;
v176.n128_u32[0] = 0.5;
v178.n128_u32[0] = 0.5;
sub_100022980(v176, v178, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))m_goldPriceSprite->setAnchorPoint)(m_goldPriceSprite, &v243);
((void (__fastcall *)(cocos2d::CCSprite *, float))a1->m_goldPriceSprite->setScale)(a1->m_goldPriceSprite, 0.5);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *))v153->addChild)(v153, a1->m_goldPriceSprite);
SecretRewardsLayer::updateUnlockedGoldLabel(a1);
v179 = cocos2d::CCLayer::create();
sub_10024A2D0((__int64)v83);
v180 = cocos2d::CCMenu::create();
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *))v179->addChild)(v179, v180);
v181 = 1;
while ( 2 )
{
sub_100009900(&v243, "shopRope2_001.png");
sub_100009900(&__p, "shopRope2_2_001.png");
switch ( (_DWORD)v181 )
{
case 2:
std::string::assign(&v243, "shopRope3_001.png");
v182 = "shopRope3_2_001.png";
goto LABEL_64;
case 3:
std::string::assign(&v243, "shopRope4_001.png");
v182 = "shopRope4_2_001.png";
LABEL_64:
std::string::assign(&__p, v182);
break;
case 4:
std::string::assign(&v243, "shopRope5_001.png");
v182 = "shopRope5_2_001.png";
goto LABEL_64;
}
if ( (v243.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v183 = &v243;
else
v183 = (std::string *)v243.__r_.__value_.__r.__words[0];
v184 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v183);
v257.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretRewardsLayer::onShop;
v257.adj = 0;
v185 = CCMenuItemSpriteExtra::create(v184, nullptr, a1, v257);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v185->setTag)(v185, v181);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v180->addChild)(v180, v185);
CCMenuItemSpriteExtra::setSizeMult(v185, 1.5);
v186.n128_f32[0] = (float)((float)((float)(unsigned int)(v181 - 1) * 70.0) + -105.0) + (float)(v247 * 0.5);
v187.n128_f32[0] = v248 + -100.0;
sub_100022980(v186, v187, &v232);
v251 = cocos2d::CCNode::convertToNodeSpace(v180, (const cocos2d::CCPoint *)&v232);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))v185->setPosition)(
v185,
&v233,
v251.x,
v251.y);
CCMenuItemSpriteExtra::useAnimationType(v185, Move);
v188.n128_u32[0] = 0;
v189.n128_u32[0] = -15.0;
sub_100022980(v188, v189, &v233);
v190.n128_f64[0] = sub_1000229D0(&v185->m_offset, (double *)&v233);
*(_QWORD *)&v185->m_duration = 0x3E99999A3E99999ALL;
v191.n128_u32[0] = 1117257728;
v190.n128_u32[0] = 25.0;
sub_100022980(v190, v191, &v233);
if ( (_DWORD)v181 == 3 )
{
v192 = v233.f32[0] + -3.5;
LABEL_72:
v233.f32[0] = v192;
}
else if ( (_DWORD)v181 == 2 )
{
v192 = v233.f32[0] + -2.25;
goto LABEL_72;
}
for ( j = 0; j != 6; ++j )
{
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
v195 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)p_p);
v196 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *))v184->addChild)(v184, v195);
v197.n128_f32[0] = (float)j * 20.5;
v196.n128_u32[0] = 0;
sub_100022980(v196, v197, &v230);
*(float32x2_t *)&v198 = sub_1000229DC(&v233, &v230, &v232);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *, double))v195->setPosition)(v195, &v232, v198);
}
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
if ( SHIBYTE(v243.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v243.__r_.__value_.__l.__data_);
v181 = (unsigned int)(v181 + 1);
if ( (_DWORD)v181 != 5 )
continue;
break;
}
v199 = BoomScrollLayer::create(v83, 0, 1, nullptr, nullptr);
a1->m_mainScrollLayer = v199;
((void (__fastcall *)(cocos2d::CCLayer *, BoomScrollLayer *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v199);
m_mainScrollLayer = a1->m_mainScrollLayer;
v201 = v247 * 0.5;
v202 = cocos2d::CCDirector::sharedDirector();
v203.n128_f32[0] = sub_1001768D0((__int64)v202) + 10.0;
v204.n128_f32[0] = v201;
sub_100022980(v204, v203, &v243);
BoomScrollLayer::setPagesIndicatorPosition(m_mainScrollLayer, v260);
v205 = a1->m_mainScrollLayer;
v205->m_unkFloat2 = 0.9;
v205->m_doVisit = 1;
v206 = cocos2d::CCDirector::sharedDirector();
v207 = sub_1001768E0((__int64)v206);
v208 = cocos2d::CCDirector::sharedDirector();
v209 = sub_1001768C8((__int64)v208);
sub_100022990((float *)&v243, 0.0, 0.0, v207, v209);
sub_100022BB0(&v205->m_clippingRect.origin, (__int64)&v243);
a1->m_mainScrollLayer->m_extendedLayer->m_delegate = &a1->BoomScrollLayerDelegate;
v210 = cocos2d::CCMenu::create();
((void (__fastcall *)(cocos2d::CCMenu *, __int64))v210->setTouchPriority)(v210, 4294967167LL);
*(float *)&v211 = (float)(v248 * 0.5) + -30.0;
if ( AppDelegate::get()->m_startupScriptFilename.m_data.m_short.shortStorage.__elems_[4] )
v212 = 49.0;
else
v212 = 24.0;
v213 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v258.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretRewardsLayer::onSwitchPage;
v258.adj = 0;
v214 = CCMenuItemSpriteExtra::create(v213, nullptr, a1, v258);
a1->m_leftButton = v214;
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v210->addChild)(v210, v214);
m_leftButton = a1->m_leftButton;
v216 = cocos2d::CCDirector::sharedDirector();
v217.n128_f32[0] = v212 + sub_1001768D8((__int64)v216);
v218.n128_u32[0] = v211;
sub_100022980(v217, v218, &__p);
v252 = cocos2d::CCNode::convertToNodeSpace(v210, (const cocos2d::CCPoint *)&__p);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, float, float))m_leftButton->setPosition)(
m_leftButton,
&v243,
v252.x,
v252.y);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_leftButton->setTag)(a1->m_leftButton, 0);
CCMenuItemSpriteExtra::setSizeMult(a1->m_leftButton, 2.0);
v219 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v219, 1);
v259.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretRewardsLayer::onSwitchPage;
v259.adj = 0;
v220 = CCMenuItemSpriteExtra::create(v219, nullptr, a1, v259);
a1->m_rightButton = v220;
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v210->addChild)(v210, v220);
m_rightButton = a1->m_rightButton;
v222 = cocos2d::CCDirector::sharedDirector();
v223.n128_f32[0] = sub_1001768E0((__int64)v222) - v212;
v224.n128_u32[0] = v211;
sub_100022980(v223, v224, &__p);
v253 = cocos2d::CCNode::convertToNodeSpace(v210, (const cocos2d::CCPoint *)&__p);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, float, float))m_rightButton->setPosition)(
m_rightButton,
&v243,
v253.x,
v253.y);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_rightButton->setTag)(a1->m_rightButton, 1);
CCMenuItemSpriteExtra::setSizeMult(a1->m_rightButton, 2.0);
((void (__fastcall *)(SecretRewardsLayer *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v210, 10);
if ( v228 )
{
TotalPages = BoomScrollLayer::getTotalPages(a1->m_mainScrollLayer);
v226 = TotalPages - 1;
BoomScrollLayer::instantMoveToPage(a1->m_mainScrollLayer, TotalPages - 2);
BoomScrollLayer::instantMoveToPage(a1->m_mainScrollLayer, v226);
}
LOBYTE(v4) = v229;
return v4;
}