//
// GJShopLayer::init from 0x92dd70 to 0x92f4ec (6012 bytes)
//
// 2 xrefs:
// > GJShopLayer::create @ 0x92f608
// > ??> @ 0x55698
//
// 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 GJShopLayer::init(GJShopLayer *a1, ShopType a2)
{
cocos2d::CCDirector *v5; // x0
cocos2d::CCTouchDispatcher *v6; // x0
cocos2d::CCTextureCache *v7; // x21
char *v8; // x0
cocos2d::CCSpriteFrameCache *v9; // x20
char *v10; // x0
cocos2d::CCDirector *v11; // x0
CCSpriteWithHue *v12; // x19
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x20
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x20
cocos2d::CCSprite *v15; // x20
void (__fastcall *v16)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x21
AnimatedShopKeeper *v17; // x0
GJShopLayer_vtbl *v18; // x3
AnimatedShopKeeper *m_shopKeeper; // x20
void (__fastcall *v20)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x21
AnimatedShopKeeper *v21; // x21
cocos2d::CCSequence *v22; // x20
cocos2d::CCFiniteTimeAction *v23; // x0
cocos2d::CCAction *v24; // x0
CCSpriteWithHue *v25; // x20
void (__fastcall *v26)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x21
cocos2d::CCMenu *v27; // x19
void (__fastcall *v28)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
cocos2d::CCSprite *v29; // x0
CCMenuItemSpriteExtra *v30; // x20
cocos2d::CCSprite *v31; // x0
CCMenuItemSpriteExtra *v32; // x21
cocos2d::CCNode *v33; // x19
void (__fastcall *v34)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
cocos2d::CCDirector *v35; // x0
float v36; // s0
float v37; // s8
cocos2d::CCDirector *v38; // x0
float v39; // s0
FMODAudioEngine *v40; // x19
void *v41; // x0
GameStatsManager *v42; // x0
int Stat; // w0
CCCounterLabel *v44; // x0
GJShopLayer_vtbl *v45; // x3
CCCounterLabel *m_currencyLabel; // x19
void (__fastcall *v47)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
CCCounterLabel *v48; // x19
void (__fastcall *v49)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x20
char *v50; // x1
cocos2d::CCSprite *v51; // x21
void (__fastcall *v52)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x20
const cocos2d::CCPoint *v53; // x19
bool v54; // w2
cocos2d::CCParticleSystem *v55; // x19
void (__fastcall *setStartColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // x2
void (__fastcall *setEndColor)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // x2
void (__fastcall *setStartColorVar)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // x2
void (__fastcall *setEndColorVar)(cocos2d::CCParticleSystem *__hidden, const cocos2d::ccColor4F *); // x2
void (__fastcall *setPosVar)(cocos2d::CCParticleSystem *__hidden, const cocos2d::CCPoint *); // x20
void (__fastcall *v61)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
__int64 v62; // x0
cocos2d::CCArray *v63; // x0
GameStatsManager *v64; // x0
cocos2d::CCArray *m_storeItemArray; // x20
cocos2d::CCArray *v66; // x27
GameManager *v67; // x0
_BOOL4 UGV; // w21
unsigned int v69; // w19
__int64 v70; // x1
ShopType m_type; // w0
cocos2d::CCSprite *v72; // x19
CCMenuItemSpriteExtra *v73; // x0
cocos2d::CCMenu *v74; // x19
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
__int64 v76; // x20
double v77; // d0
double v78; // d0
double v79; // d0
double v80; // d0
double v81; // d0
double v82; // d0
double v83; // d0
double v84; // d0
double v85; // d0
double v86; // d0
cocos2d::CCDictionary *v87; // x0
cocos2d::CCSprite *v88; // x0
unsigned int i; // w24
_DWORD *v90; // x19
int v91; // w20
UnlockType v92; // w21
GameStatsManager *v93; // x0
bool isStoreItemUnlocked; // w22
GJItemIcon *StoreItem; // x20
CCMenuItemSpriteExtra *v96; // x22
cocos2d::CCLabelBMFont *v97; // x21
void (__fastcall *v98)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
float *v99; // x0
char *v100; // x1
cocos2d::CCSprite *v101; // x25
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
__int64 v103; // x20
float width; // s8
float v105; // s0
float v106; // s1
cocos2d::CCPoint *v107; // x21
cocos2d::CCSprite *v108; // x1
float *v109; // x0
__int64 v110; // x1
__int64 (__fastcall *v111)(int, int, int, int, int, int, int, int, char); // x0
unsigned int *v112; // x1
int v113; // w2
unsigned int *v114; // x1
int v115; // w2
float v116; // s4
float v117; // s5
ListButtonBar *v118; // x19
BoomScrollLayer *m_scrollLayer; // x2
BoomScrollLayer_vtbl *v120; // x3
cocos2d::CCPoint *v121; // x0
BoomScrollLayer *v122; // x19
char *v123; // x0
void *v124; // x0
char *v125; // x0
char *v126; // x0
char *v127; // x25
unsigned int *v128; // x20
int v129; // w0
void *v130; // x0
GameStatsManager *v131; // x0
char *p_m_fBrVertexMod; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x3
void (__fastcall *v134)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x3
void (__fastcall *v135)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x3
unsigned int *v136; // x1
int v137; // w2
void (__fastcall *v138)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x3
unsigned int *v139; // x1
int v140; // w2
unsigned int *v141; // x1
int v142; // w2
unsigned int *v143; // x1
int v144; // w2
unsigned int *v145; // x1
int v146; // w2
unsigned int *v147; // x1
int v148; // w2
unsigned int *v149; // x1
int v150; // w2
unsigned int *p_m_fTextureTop; // x1
int m_fTextureTop_low; // w2
unsigned int *v153; // x1
int v154; // w2
_QWORD v155[2]; // [xsp+0h] [xbp+0h] BYREF
bool v156; // [xsp+97h] [xbp+97h]
cocos2d::CCArray *v157; // [xsp+98h] [xbp+98h]
cocos2d::CCPoint *v158; // [xsp+A0h] [xbp+A0h]
cocos2d::CCSprite **v159; // [xsp+A8h] [xbp+A8h]
__int64 *v160; // [xsp+B0h] [xbp+B0h]
cocos2d::CCArray *v161; // [xsp+B8h] [xbp+B8h]
__int64 (__fastcall **v162)(int, int, int, int, int, int, int, int, char); // [xsp+C0h] [xbp+C0h]
void (__fastcall *v163)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+C8h] [xbp+C8h]
__int64 v164; // [xsp+E0h] [xbp+E0h]
cocos2d::CCSprite *v165; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCSprite *v166; // [xsp+F0h] [xbp+F0h] BYREF
cocos2d::CCSprite *v167; // [xsp+F8h] [xbp+F8h] BYREF
__int64 v168; // [xsp+100h] [xbp+100h] BYREF
char *v169; // [xsp+108h] [xbp+108h] BYREF
float v170; // [xsp+110h] [xbp+110h]
float v171; // [xsp+114h] [xbp+114h]
cocos2d::CCSprite *v172; // [xsp+118h] [xbp+118h] BYREF
char *v173; // [xsp+120h] [xbp+120h] BYREF
cocos2d::CCSprite *v174; // [xsp+128h] [xbp+128h] BYREF
cocos2d::CCPoint v175; // [xsp+130h] [xbp+130h] BYREF
cocos2d::CCRect v176; // [xsp+138h] [xbp+138h] BYREF
cocos2d::SEL_MenuHandler v177; // 0:x2.16
cocos2d::SEL_MenuHandler v178; // 0:x2.16
cocos2d::SEL_MenuHandler v179; // 0:x2.16
cocos2d::SEL_MenuHandler v180; // 0:x2.16
cocos2d::CCPoint v181; // 0:s0.4,4:s1.4
v156 = cocos2d::CCLayer::init(a1);
if ( v156 )
{
v5 = cocos2d::CCDirector::sharedDirector();
v6 = v5->getTouchDispatcher(v5);
cocos2d::CCTouchDispatcher::registerForcePrio(v6, a1, 2);
a1->m_type = a2;
sub_D153B8((unsigned int)v155 + 232, "shopBG_001.png");
sub_D153B8((unsigned int)v155 + 240, "storeDesk_001.png");
sub_D153B8((int)&v167, "shopSign_001.png");
sub_D1798C(&a1->m_sheetName, "GJ_ShopSheet01", 14);
sub_D153B8((int)&v168, "shop.mp3");
switch ( a1->m_type )
{
case Secret:
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v82 = sub_D1798C(&v167, "shopSign2_001.png", 17).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
sub_D1798C(&v168, "secretShop.mp3", 14, v82);
break;
case Community:
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v81 = sub_D1798C(&v167, "shopSign3_001.png", 17).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
sub_D1798C(&v168, "shop3.ogg", 9, v81);
break;
case Mechanic:
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v77 = sub_D1798C(&a1->m_sheetName, "GJ_ShopSheet02", 14).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v78 = sub_D1798C(&v165, "shopBG_02_001.png", 17, v77).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v79 = sub_D1798C(&v166, "storeDesk_02_001.png", 20, v78).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v80 = sub_D1798C(&v167, "shopSign4_001.png", 17, v79).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
sub_D1798C(&v168, "shop4.mp3", 9, v80);
break;
case Diamond:
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v83 = sub_D1798C(&a1->m_sheetName, "GJ_ShopSheet03", 14).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v84 = sub_D1798C(&v165, "shopBG_03_001.png", 17, v83).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v85 = sub_D1798C(&v166, "storeDesk_03_001.png", 20, v84).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
*(_QWORD *)&v86 = sub_D1798C(&v167, "shopSign5_001.png", 17, v85).n128_u64[0];
v162 = &jpeg_idct_9x9_ptr;
sub_D1798C(&v168, "shop5.ogg", 9, v86);
break;
default:
break;
}
v162 = &jpeg_idct_9x9_ptr;
v7 = cocos2d::CCTextureCache::sharedTextureCache();
v162 = &jpeg_idct_9x9_ptr;
sub_D18D28(&v169);
sub_D15FD4(&v169, ".png", 4);
cocos2d::CCTextureCache::addImage(v7, v169, 0);
v162 = &jpeg_idct_9x9_ptr;
v8 = v169 - 24;
if ( v169 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v136 = (unsigned int *)(v169 - 8);
do
v137 = __ldaxr(v136);
while ( __stlxr(v137 - 1, v136) );
}
else
{
v137 = *((_DWORD *)v169 - 2);
*((_DWORD *)v169 - 2) = v137 - 1;
}
if ( v137 <= 0 )
operator delete(v8);
}
v9 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v160 = (__int64 *)&v173;
sub_D18D28(&v173);
sub_D15FD4(&v173, ".plist", 6);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v9, v173);
v10 = v173 - 24;
if ( v173 - 24 != (char *)v162[509] )
{
if ( &pthread_create )
{
v149 = (unsigned int *)(v173 - 8);
do
v150 = __ldaxr(v149);
while ( __stlxr(v150 - 1, v149) );
}
else
{
v150 = *((_DWORD *)v173 - 2);
*((_DWORD *)v173 - 2) = v150 - 1;
}
if ( v150 <= 0 )
operator delete(v10);
}
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
a1->setTouchEnabled(a1, 1);
a1->setMouseEnabled(a1, 1);
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v11);
if ( a1->m_type == Community )
{
sub_D153B8((int)&v174, (char *)v165);
v12 = CCSpriteWithHue::createWithSpriteFrameName((const char **)&v174);
p_m_fBrVertexMod = (char *)&v174[-1].m_fBrVertexMod;
if ( (char *)&v174[-1].m_fBrVertexMod != (char *)v162[509] )
{
if ( &pthread_create )
{
p_m_fTextureTop = (unsigned int *)&v174[-1].m_fTextureTop;
do
m_fTextureTop_low = __ldaxr(p_m_fTextureTop);
while ( __stlxr(m_fTextureTop_low - 1, p_m_fTextureTop) );
}
else
{
m_fTextureTop_low = LODWORD(v174[-1].m_fTextureTop);
LODWORD(v174[-1].m_fTextureTop) = m_fTextureTop_low - 1;
}
if ( m_fTextureTop_low <= 0 )
operator delete(p_m_fBrVertexMod);
}
CCSpriteWithHue::setHueDegrees(v12, -110.0);
setColor = v12->setColor;
LOWORD(v176.origin.x) = 240;
BYTE2(v176.origin.x) = -16;
setColor(v12, (const cocos2d::ccColor3B *)&v176);
}
else
{
v12 = (CCSpriteWithHue *)cocos2d::CCSprite::createWithSpriteFrameName((const char *)v165);
}
setAnchorPoint = v12->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v176.origin, 0.0, 0.0);
setAnchorPoint(v12, &v176.origin);
a1->addChild_0(a1, v12, -2);
v12->setScaleX(v12, (float)(v170 + 5.0) / v12->m_obRect.size.width);
v12->setScaleY(v12, (float)(v171 + 5.0) / v12->m_obRect.size.height);
setPosition = v12->setPosition;
cocos2d::CCPoint::CCPoint(&v176.origin, -2.5, -2.5);
setPosition(v12, &v176.origin);
v15 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v167);
v16 = v15->setPosition;
cocos2d::CCPoint::CCPoint(&v176.origin, (float)(v170 * 0.5) + -70.0, v171 - 38.0);
v16(v15, &v176.origin);
a1->addChild(a1, v15);
v17 = AnimatedShopKeeper::create(a2);
v18 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_shopKeeper = v17;
v18->addChild_0(a1, v17, 3);
m_shopKeeper = a1->m_shopKeeper;
v20 = m_shopKeeper->setPosition;
cocos2d::CCPoint::CCPoint(&v176.origin, (float)((float)(v170 * 0.5) + 100.0) + 0.0, 230.0);
v20(m_shopKeeper, &v176.origin);
v21 = a1->m_shopKeeper;
v22 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(0.1);
v23 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(
a1->m_shopKeeper,
AnimatedShopKeeper::startAnimating,
0);
v24 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v22, v23, 0);
cocos2d::CCNode::runAction(v21, v24);
if ( a1->m_type == Community )
{
sub_D153B8((int)&v175, (char *)v166);
v25 = CCSpriteWithHue::createWithSpriteFrameName((const char **)&v175);
v130 = (void *)(*(_QWORD *)&v175 - 24LL);
if ( (__int64 (__fastcall *)(int, int, int, int, int, int, int, int, char))(*(_QWORD *)&v175 - 24LL) != v162[509] )
{
if ( &pthread_create )
{
v153 = (unsigned int *)(*(_QWORD *)&v175 - 8LL);
do
v154 = __ldaxr(v153);
while ( __stlxr(v154 - 1, v153) );
}
else
{
v154 = *(_DWORD *)(*(_QWORD *)&v175 - 8LL);
*(_DWORD *)(*(_QWORD *)&v175 - 8LL) = v154 - 1;
}
if ( v154 <= 0 )
operator delete(v130);
}
CCSpriteWithHue::setHueDegrees(v25, -120.0);
}
else
{
v25 = (CCSpriteWithHue *)cocos2d::CCSprite::createWithSpriteFrameName((const char *)v166);
}
a1->addChild_0(a1, v25, 1);
v26 = v25->setPosition;
cocos2d::CCPoint::CCPoint(&v176.origin, v170 * 0.5, 95.0);
v26(v25, &v176.origin);
v25->setScaleX(v25, 0.96);
if ( a2 == Secret )
{
v134 = v12->setColor;
LOWORD(v176.origin.x) = -256;
BYTE2(v176.origin.x) = -1;
v134(v12, (const cocos2d::ccColor3B *)&v176);
v135 = v25->setColor;
LOWORD(v176.origin.x) = -256;
BYTE2(v176.origin.x) = -1;
v135(v25, (const cocos2d::ccColor3B *)&v176);
}
else if ( a2 == Mechanic )
{
v138 = v12->setColor;
LOWORD(v176.origin.x) = -20561;
BYTE2(v176.origin.x) = -81;
v138(v12, (const cocos2d::ccColor3B *)&v176);
}
else if ( a2 )
{
if ( a2 == Community )
{
v27 = cocos2d::CCMenu::create();
a1->addChild_0(a1, v27, -1);
v28 = v27->setPosition;
cocos2d::CCPoint::CCPoint(&v176.origin, v170 - 40.0, v171 - 60.0);
v28(v27, &v176.origin);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("communityCreditsBtn_001.png");
v177.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v177.adj = (size_t)GJShopLayer::onCommunityCredits;
v30 = CCMenuItemSpriteExtra::create(v29, nullptr, v177);
CCMenuItemSpriteExtra::setSizeMult(v30, 1.2);
v27->addChild(v27, v30);
}
}
else
{
v72 = cocos2d::CCSprite::createWithSpriteFrameName("plushies_001.png");
v72->setScale(v72, 1.1);
v179.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v179.adj = (size_t)GJShopLayer::onPlushies;
v73 = CCMenuItemSpriteExtra::create(v72, nullptr, v179);
v73->m_animationEnabled = 0;
v73->m_colorEnabled = 1;
v74 = cocos2d::CCMenu::createWithItem(v73);
a1->addChild_0(a1, v74, 0);
v75 = v74->setPosition;
v76 = (__int64)v25->getPosition(v25);
cocos2d::CCPoint::CCPoint(&v175, -130.0, 120.0);
cocos2d::CCPoint::operator+(&v176, v76, &v175);
v75(v74, &v176.origin);
v74->setEnabled(v74, 0);
}
v31 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v178.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v178.adj = (size_t)GJShopLayer::onBack;
v32 = CCMenuItemSpriteExtra::create(v31, nullptr, v178);
CCMenuItemSpriteExtra::setSizeMult(v32, 1.6);
v33 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v32, nullptr);
a1->addChild_0(a1, v33, 1);
v34 = v33->setPosition;
v35 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v35);
v37 = v36 + 24.0;
v38 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v38);
cocos2d::CCPoint::CCPoint(&v176.origin, v37, v39 - 23.0);
v34(v33, &v176.origin);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v32);
v40 = FMODAudioEngine::sharedEngine();
sub_D18D28(&v176);
FMODAudioEngine::playMusic(v40, (__int64)&v176, 1u, 0, 0.0);
v41 = (void *)(*(_QWORD *)&v176.origin - 24LL);
if ( (__int64 (__fastcall *)(int, int, int, int, int, int, int, int, char))(*(_QWORD *)&v176.origin - 24LL) != v162[509] )
{
if ( &pthread_create )
{
v143 = (unsigned int *)(*(_QWORD *)&v176.origin - 8LL);
do
v144 = __ldaxr(v143);
while ( __stlxr(v144 - 1, v143) );
}
else
{
v144 = *(_DWORD *)(*(_QWORD *)&v176.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v176.origin - 8LL) = v144 - 1;
}
if ( v144 <= 0 )
operator delete(v41);
}
if ( a1->m_type == Diamond )
{
v131 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v131, "29");
}
else
{
v42 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v42, "14");
}
v44 = CCCounterLabel::create(Stat, "bigFont.fnt", Integer);
v45 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_currencyLabel = v44;
v45->addChild_0(a1, v44, 3);
m_currencyLabel = a1->m_currencyLabel;
v47 = m_currencyLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v176.origin, v170 - 34.0, v171 - 15.0);
v47(m_currencyLabel, &v176.origin);
v48 = a1->m_currencyLabel;
v49 = v48->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v176.origin, 1.0, 0.5);
v49(v48, &v176.origin);
a1->m_currencyLabel->setScale(a1->m_currencyLabel, 0.6);
if ( a1->m_type == Diamond )
v50 = "currencyDiamondIcon_001.png";
else
v50 = "currencyOrbIcon_001.png";
sub_D153B8((int)&v172, v50);
v51 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v172);
a1->addChild_0(a1, v51, 3);
v52 = v51->setPosition;
v53 = a1->m_currencyLabel->getPosition(a1->m_currencyLabel);
v158 = &v175;
cocos2d::CCPoint::CCPoint(&v175, 13.0, -0.5);
cocos2d::CCPoint::operator+(&v176, v53, &v175);
v52(v51, &v176.origin);
v55 = (cocos2d::CCParticleSystem *)cocos2d::CCParticleSystemQuad::create(
(cocos2d::CCParticleSystemQuad *)"keyEffect.plist",
nullptr,
v54);
v55->setTotalParticles(v55, 8u);
setStartColor = v55->setStartColor;
v176.origin = (cocos2d::CCPoint)0x3F48C8C900000000LL;
v176.size.width = 1.0;
v176.size.height = 1.0;
setStartColor(v55, (const cocos2d::ccColor4F *)&v176);
setEndColor = v55->setEndColor;
v176.origin = 0;
v176.size.width = 0.58824;
v176.size.height = 1.0;
setEndColor(v55, (const cocos2d::ccColor4F *)&v176);
setStartColorVar = v55->setStartColorVar;
v176.origin = 0;
v176.size.width = 0.0;
v176.size.height = 0.0;
setStartColorVar(v55, (const cocos2d::ccColor4F *)&v176);
setEndColorVar = v55->setEndColorVar;
v176.origin = 0;
v176.size.width = 0.0;
v176.size.height = 0.0;
setEndColorVar(v55, (const cocos2d::ccColor4F *)&v176);
v55->setLife(v55, 1.0);
v55->setLifeVar(v55, 0.2);
setPosVar = v55->setPosVar;
cocos2d::CCPoint::CCPoint(&v176.origin, 12.0, 10.0);
setPosVar(v55, &v176.origin);
a1->addChild_0(a1, v55, 100);
v61 = v55->setPosition;
v62 = (__int64)v51->getPosition(v51);
v61(v55, (const cocos2d::CCPoint *)v62);
v55->setPositionType(v55, kCCPositionTypeGrouped);
cocos2d::CCParticleSystem::resetSystem(v55);
v161 = (cocos2d::CCArray *)cocos2d::CCArray::create(v63);
v64 = GameStatsManager::sharedState();
m_storeItemArray = v64->m_storeItemArray;
v66 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v64);
v67 = GameManager::sharedState();
UGV = GameManager::getUGV(v67, "7");
v69 = 0;
while ( v69 < (unsigned int)cocos2d::CCArray::count(m_storeItemArray) )
{
v70 = cocos2d::CCArray::objectAtIndex(m_storeItemArray, v69);
m_type = a1->m_type;
if ( m_type != *(_DWORD *)(v70 + 364)
|| !UGV && m_type == Secret && *(_DWORD *)(v70 + 316) - *(_DWORD *)(v70 + 320) == 20 )
{
++v69;
}
else
{
cocos2d::CCArray::addObject(v66, (cocos2d::CCObject *)v70);
++v69;
}
}
v87 = cocos2d::CCDictionary::create();
a1->m_shopItems = v87;
cocos2d::CCObject::retain(v87);
v88 = cocos2d::CCSprite::createWithSpriteFrameName("playerSquare_001.png");
v157 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v88);
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v66); ++i )
{
v90 = (_DWORD *)cocos2d::CCArray::objectAtIndex(v66, i);
v91 = v90[82] - v90[83];
v92 = v90[85] - v90[86];
v93 = GameStatsManager::sharedState();
isStoreItemUnlocked = GameStatsManager::isStoreItemUnlocked(v93, v90[79] - v90[80]);
LODWORD(v163) = isStoreItemUnlocked;
*(cocos2d::ccColor3B *)&v164 = GJItemIcon::unlockedColorForType(a2);
StoreItem = GJItemIcon::createStoreItem(v92, v91, isStoreItemUnlocked, (cocos2d::ccColor3B)v164);
StoreItem->setScale(StoreItem, 1.1);
v180.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v180.adj = (size_t)GJShopLayer::onSelectItem;
v96 = CCMenuItemSpriteExtra::create(StoreItem, nullptr, v180);
CCMenuItemSpriteExtra::setSizeMult(v96, 2.0);
cocos2d::CCArray::addObject(v161, v96);
v96->setTag(v96, v90[79] - v90[80]);
StoreItem->setTag(StoreItem, v92);
if ( (unsigned int)(v92 - 8) > 1 && v92 != 1 )
cocos2d::CCArray::addObject(v157, v96);
if ( (_DWORD)v163 )
{
v96->setEnabled(v96, 0);
GJItemIcon::darkenStoreItem(StoreItem, a1->m_type);
}
else
{
GameToolbox::pointsToString((GameToolbox *)(unsigned int)(v90[88] - v90[89]), v160);
v97 = cocos2d::CCLabelBMFont::create();
StoreItem->addChild(StoreItem, v97);
v98 = v97->setPosition;
v99 = (float *)StoreItem->getContentSize(StoreItem);
cocos2d::CCPoint::CCPoint(&v176.origin, (float)(*v99 * 0.5) + -4.0, -6.5);
v98(v97, &v176.origin);
v97->setScale(v97, 0.35);
v97->setTag(v97, 1234);
if ( a2 == Diamond )
v100 = "currencyDiamondIcon_001.png";
else
v100 = "currencyOrbIcon_001.png";
v159 = &v174;
sub_D153B8((int)&v174, v100);
v101 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v174);
StoreItem->addChild(StoreItem, v101);
getPosition = v97->getPosition;
v163 = v101->setPosition;
v103 = (__int64)getPosition(v97);
width = v97->getContentSize(v97)->width;
v105 = (float)((float)(width * 0.5) * v97->getScale(v97)) + 6.0;
if ( a2 == Diamond )
v106 = 1.0;
else
v106 = 0.0;
v107 = v158;
cocos2d::CCPoint::CCPoint(v158, v105 + v106, -0.5);
cocos2d::CCPoint::operator+(&v176, v103, v107);
v163(v101, &v176.origin);
v101->setScale(v101, 0.5);
v101->setTag(v101, 1234);
v108 = *v159;
v109 = &(*v159)[-1].m_fBrVertexMod;
if ( v109 != (float *)v162[509] )
{
if ( &pthread_create )
{
v114 = (unsigned int *)&v108[-1].m_fTextureTop;
do
v115 = __ldaxr(v114);
while ( __stlxr(v115 - 1, v114) );
}
else
{
v115 = LODWORD(v108[-1].m_fTextureTop);
LODWORD(v108[-1].m_fTextureTop) = v115 - 1;
}
if ( v115 <= 0 )
operator delete(v109);
}
v110 = *v160;
v111 = (__int64 (__fastcall *)(int, int, int, int, int, int, int, int, char))(*v160 - 24);
if ( v111 != v162[509] )
{
if ( &pthread_create )
{
v112 = (unsigned int *)(v110 - 8);
do
v113 = __ldaxr(v112);
while ( __stlxr(v113 - 1, v112) );
}
else
{
v113 = *(_DWORD *)(v110 - 8);
*(_DWORD *)(v110 - 8) = v113 - 1;
}
if ( v113 <= 0 )
operator delete(v111);
}
}
cocos2d::CCDictionary::setObject(a1->m_shopItems, v96, v90[79] - v90[80]);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v174, v170 * 0.5, 93.0);
cocos2d::CCPoint::CCPoint(&v176.origin, (const cocos2d::CCPoint *)&v174);
v181.x = 25.0;
v181.y = 15.0;
v118 = ListButtonBar::create(v161, v181, (int)&v176, 4, 60.0, 221.0, v116, v117, 2);
a1->addChild_0(a1, v118, 100);
m_scrollLayer = v118->m_scrollLayer;
v118->m_useMoveAnimation = 1;
v120 = m_scrollLayer->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_scrollLayer->m_unkFloat2 = 0.6;
v120->setTouchEnabled(m_scrollLayer, 1);
ListButtonBar::goToPage(v118, 0);
v121 = v158;
v118->m_scrollLayer->m_doVisit = 1;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v121, 406.0, 200.0);
v122 = v118->m_scrollLayer;
cocos2d::CCRect::CCRect(
&v176,
*(float *)&v174 - (float)(v175.x * 0.5),
*((float *)&v174 + 1) - (float)(v175.y * 0.5),
v175.x,
v175.y);
cocos2d::CCRect::operator=(&v122->m_clippingRect, &v176);
v123 = (char *)&v172[-1].m_fBrVertexMod;
if ( (char *)&v172[-1].m_fBrVertexMod != (char *)v162[509] )
{
if ( &pthread_create )
{
v145 = (unsigned int *)&v172[-1].m_fTextureTop;
do
v146 = __ldaxr(v145);
while ( __stlxr(v146 - 1, v145) );
}
else
{
v146 = LODWORD(v172[-1].m_fTextureTop);
LODWORD(v172[-1].m_fTextureTop) = v146 - 1;
}
if ( v146 <= 0 )
operator delete(v123);
}
v124 = (void *)(v168 - 24);
if ( (__int64 (__fastcall *)(int, int, int, int, int, int, int, int, char))(v168 - 24) != v162[509] )
{
if ( &pthread_create )
{
v147 = (unsigned int *)(v168 - 8);
do
v148 = __ldaxr(v147);
while ( __stlxr(v148 - 1, v147) );
}
else
{
v148 = *(_DWORD *)(v168 - 8);
*(_DWORD *)(v168 - 8) = v148 - 1;
}
if ( v148 <= 0 )
operator delete(v124);
}
v125 = (char *)&v167[-1].m_fBrVertexMod;
if ( (char *)&v167[-1].m_fBrVertexMod != (char *)v162[509] )
{
if ( &pthread_create )
{
v141 = (unsigned int *)&v167[-1].m_fTextureTop;
do
v142 = __ldaxr(v141);
while ( __stlxr(v142 - 1, v141) );
}
else
{
v142 = LODWORD(v167[-1].m_fTextureTop);
LODWORD(v167[-1].m_fTextureTop) = v142 - 1;
}
if ( v142 <= 0 )
operator delete(v125);
}
v126 = (char *)&v166[-1].m_fBrVertexMod;
if ( (char *)&v166[-1].m_fBrVertexMod != (char *)v162[509] )
{
if ( &pthread_create )
{
v139 = (unsigned int *)&v166[-1].m_fTextureTop;
do
v140 = __ldaxr(v139);
while ( __stlxr(v140 - 1, v139) );
}
else
{
v140 = LODWORD(v166[-1].m_fTextureTop);
LODWORD(v166[-1].m_fTextureTop) = v140 - 1;
}
if ( v140 <= 0 )
operator delete(v126);
}
v127 = (char *)&v165[-1].m_fBrVertexMod;
if ( (char *)&v165[-1].m_fBrVertexMod != (char *)v162[509] )
{
if ( &pthread_create )
{
v128 = (unsigned int *)&v165[-1].m_fTextureTop;
do
v129 = __ldaxr(v128);
while ( __stlxr(v129 - 1, v128) );
}
else
{
v129 = LODWORD(v165[-1].m_fTextureTop);
LODWORD(v165[-1].m_fTextureTop) = v129 - 1;
}
if ( v129 <= 0 )
operator delete(v127);
}
}
return v156;
}