//
// LevelCell::loadCustomLevelCell from 0x1400ae230 to 0x1400b0d66 (11062 bytes)
//
// 2 xrefs:
// > LevelCell::loadFromLevel @ 0x1400ae0b2
// > ??> @ 0x1406c79ec
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=22
void LevelCell::loadCustomLevelCell(LevelCell *a1)
{
GJGameLevel *m_level; // rdx
int v3; // r15d
float v4; // xmm6_4
float v5; // xmm9_4
const char *p_Buf2; // rcx
struct cocos2d::CCLabelBMFont *v7; // rdi
cocos2d::CCLabelBMFont_vtbl *v8; // rbx
const cocos2d::CCPoint *v9; // rax
char v10; // di
const char *v11; // rcx
struct cocos2d::CCLabelBMFont *v12; // r12
cocos2d::CCLabelBMFont_vtbl *v13; // rbx
const cocos2d::CCPoint *v14; // rax
cocos2d::CCLabelBMFont_vtbl *v15; // rbx
float v16; // xmm2_4
const cocos2d::CCPoint *v17; // rax
float v18; // xmm2_4
float v19; // xmm1_4
const cocos2d::CCPoint *v20; // rax
GameLevelManager *v21; // rcx
GJGameLevel *SavedLevel; // rax
GJGameLevel *v23; // r13
GJGameLevel *v24; // rdx
bool v25; // bl
unsigned __int64 v26; // rdi
char *v27; // rcx
const char *v28; // rax
unsigned __int64 v29; // rcx
__int64 v30; // rbx
char *v31; // r14
void *v32; // rcx
GJGameLevel *v33; // rax
unsigned __int64 v34; // rdi
char *v35; // rcx
unsigned __int64 v36; // rcx
__int64 v37; // rbx
char *v38; // r14
void *v39; // rcx
unsigned __int64 v40; // rdi
void **v41; // rbx
unsigned __int64 v42; // rcx
__int64 v43; // rbx
char *v44; // r14
void *v45; // rcx
unsigned __int64 v46; // rdi
void **v47; // rbx
unsigned __int64 v48; // rcx
__int64 v49; // rbx
char *v50; // r14
void *v51; // rcx
ButtonSprite *v52; // rbx
float v53; // xmm7_4
CCMenuItemSpriteExtra *v54; // rcx
int v55; // xmm0_4
float m_height; // xmm6_4
float *v57; // rax
__int64 v58; // rax
CCMenuItemSpriteExtra_vtbl *v59; // rbx
struct cocos2d::CCPoint v60; // rax
cocos2d::CCSprite *v61; // rdi
ButtonSprite *v62; // rbx
int v63; // r9d
void **v64; // rcx
int v65; // edx
GameStatsManager *v66; // rcx
bool hasCompletedLevel; // di
CCMenuItemSpriteExtra *v68; // rdi
const cocos2d::CCPoint *v69; // rax
cocos2d::CCSprite *v70; // rdi
ButtonSprite *v71; // rax
int v72; // r9d
cocos2d::CCNode *v73; // rbx
CCMenuItemSpriteExtra *v74; // rdi
const cocos2d::CCPoint *v75; // rax
cocos2d::CCSprite *v76; // rdi
ButtonSprite *v77; // rbx
int v78; // r9d
CCMenuItemSpriteExtra *v79; // rdi
const cocos2d::CCPoint *v80; // rax
ButtonSprite *v81; // rbx
CCMenuItemSpriteExtra *v82; // rdi
CCMenuItemSpriteExtra_vtbl *v83; // rbx
struct cocos2d::CCPoint v84; // rax
GJGameLevel *v85; // rax
int v86; // edi
int v87; // ebx
__int64 v88; // rcx
cocos2d::CCString *v89; // rax
__int128 *v90; // rdx
const char *p_Src; // rcx
struct cocos2d::CCLabelBMFont *v92; // r13
float v93; // xmm6_4
float v94; // xmm0_4
float v95; // xmm2_4
float width; // xmm6_4
double v97; // xmm0_8
float *v98; // rbx
__int64 v99; // rax
CCMenuItemSpriteExtra *v100; // r14
CCMenuItemSpriteExtra_vtbl *v101; // rbx
struct cocos2d::CCPoint v102; // rax
float v103; // xmm6_4
cocos2d::CCLabelBMFont_vtbl *v104; // rax
float *v105; // rax
__int64 v106; // rax
float v107; // xmm6_4
float *v108; // rax
__int64 v109; // rax
GJGameLevel *v110; // rbx
MusicDownloadManager *v111; // rax
SongInfoObject *SongInfoObject; // rax
SongInfoObject *v113; // rbx
float v114; // xmm12_4
int m_nongType; // eax
const char *v116; // rcx
struct cocos2d::CCSprite *v117; // rdi
__int64 SongName; // rax
struct cocos2d::CCLabelBMFont *v119; // rdi
cocos2d::CCLabelBMFont_vtbl *v120; // rbx
const cocos2d::CCPoint *v121; // rax
void (__fastcall *setColor)(cocos2d::CCRGBAProtocol *__hidden, const cocos2d::ccColor3B *); // r8
GJGameLevel *v123; // rax
bool v124; // cc
GJGameLevel *v125; // rbx
int AverageDifficulty; // edi
cocos2d::CCString *v127; // rax
cocos2d::CCNode *v128; // r13
cocos2d::CCNode_vtbl *v129; // rbx
const cocos2d::CCPoint *v130; // rax
__int64 v131; // rax
GJGameLevel *v132; // rcx
bool v133; // dl
float y; // xmm0_4
size_t v135; // r14
GJDifficultySprite *v136; // rax
GJDifficultySprite *v137; // rbx
GJGameLevel *v138; // rcx
GJFeatureState v139; // edx
int m_isEpic; // ecx
GJDifficultySprite *v141; // rcx
GameStatsManager *v142; // rcx
bool hasCompletedStarLevel; // r12
const char *v144; // rcx
struct cocos2d::CCSprite *v145; // rdi
cocos2d::CCString *v146; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v148; // r15
cocos2d::CCLabelBMFont_vtbl *v149; // rbx
const cocos2d::CCPoint *v150; // rax
__int64 v151; // rax
struct cocos2d::CCSprite *v152; // r13
int v153; // ebx
GameStatsManager *v154; // rcx
int v155; // edi
int AwardedDiamondsForLevel; // r12d
cocos2d::CCString *v157; // rax
char *v158; // rax
size_t v159; // r8
const char *v160; // rcx
struct cocos2d::CCLabelBMFont *v161; // r15
cocos2d::CCLabelBMFont_vtbl *v162; // rbx
const cocos2d::CCPoint *v163; // rax
float *v164; // rbx
double v165; // xmm0_8
__int64 v166; // rax
GJGameLevel *v167; // rcx
float v168; // xmm8_4
int v169; // r15d
float v170; // xmm7_4
int m_coins; // eax
const char *CoinKey; // rax
size_t v173; // r8
const char *v174; // rbx
GameStatsManager *v175; // rcx
const char *v176; // rbx
GameStatsManager *v177; // rcx
char v178; // r12
struct cocos2d::CCSprite *v179; // rdi
struct cocos2d::CCPoint *v180; // rdx
float *v181; // rbx
double v182; // xmm0_8
float v183; // xmm6_4
double v184; // xmm0_8
__int64 v185; // rax
__int16 *v186; // rdx
void *v187; // rcx
float *v188; // rax
bool m_compactView; // cl
int v190; // edx
float v191; // xmm6_4
int v192; // eax
float v193; // xmm13_4
struct cocos2d::CCSprite *v194; // r13
cocos2d::CCSprite_vtbl *v195; // rbx
const cocos2d::CCPoint *v196; // rax
struct cocos2d::CCSprite *v197; // r12
__int64 v198; // rax
struct cocos2d::CCSprite *v199; // r15
__int64 v200; // rax
bool v201; // r8
float v202; // xmm9_4
GJGameLevel *v203; // rdx
int v204; // ecx
float v205; // xmm10_4
__int64 v206; // rax
struct cocos2d::CCLabelBMFont *v207; // rdi
cocos2d::CCLabelBMFont_vtbl *v208; // rbx
const cocos2d::CCPoint *v209; // rax
__int64 v210; // rax
cocos2d::CCSprite_vtbl *v211; // rbx
float v212; // xmm8_4
float v213; // xmm6_4
double v214; // xmm0_8
float v215; // xmm7_4
const cocos2d::CCPoint *v216; // rax
const char *v217; // rax
struct cocos2d::CCLabelBMFont *v218; // rdi
cocos2d::CCLabelBMFont_vtbl *v219; // rbx
const cocos2d::CCPoint *v220; // rax
__int64 v221; // rax
int v222; // r12d
cocos2d::CCSprite_vtbl *v223; // rbx
cocos2d::CCSpriteFrameCache *v224; // rax
const char *v225; // rdx
struct cocos2d::CCSpriteFrame *v226; // rax
cocos2d::CCSprite_vtbl *v227; // rbx
float v228; // xmm8_4
float v229; // xmm6_4
double v230; // xmm0_8
float v231; // xmm7_4
const cocos2d::CCPoint *v232; // rax
const char *v233; // rax
struct cocos2d::CCLabelBMFont *v234; // rdi
cocos2d::CCLabelBMFont_vtbl *v235; // rbx
const cocos2d::CCPoint *v236; // rax
__int64 v237; // rax
struct cocos2d::CCSprite *v238; // r13
__int64 v239; // rax
cocos2d::CCSprite_vtbl *v240; // rbx
float v241; // xmm8_4
float v242; // xmm6_4
double v243; // xmm0_8
float v244; // xmm7_4
const cocos2d::CCPoint *v245; // rax
GameStatsManager *v246; // rcx
int BaseCurrencyForLevel; // eax
int v248; // r12d
GameStatsManager *v249; // rcx
int AwardedCurrencyForLevel; // eax
cocos2d::CCString *v251; // rax
char *v252; // rax
cocos2d::CCString *v253; // rax
const char *v254; // rcx
struct cocos2d::CCLabelBMFont *v255; // rdi
cocos2d::CCLabelBMFont_vtbl *v256; // rbx
const cocos2d::CCPoint *v257; // rax
__int64 v258; // rax
__int64 v259; // rax
struct cocos2d::CCLabelBMFont *v260; // rbx
float v261; // xmm8_4
float v262; // xmm6_4
double v263; // xmm0_8
float v264; // xmm7_4
__int64 v265; // rdx
__int64 v266; // rax
struct cocos2d::CCSprite *v267; // rax
cocos2d::CCNode *v268; // rdi
cocos2d::CCSprite_vtbl *v269; // rbx
const cocos2d::CCPoint *v270; // rax
cocos2d::CCString *v271; // rax
const char *v272; // rax
struct cocos2d::CCLabelBMFont *v273; // rdi
bool v274; // zf
cocos2d::CCLabelBMFont_vtbl *v275; // rbx
const cocos2d::CCPoint *v276; // rax
float v277; // xmm10_4
float v278; // xmm7_4
cocos2d::CCPoint v279; // rbx
float v280; // xmm6_4
double v281; // xmm0_8
struct cocos2d::CCSprite *v282; // rdi
cocos2d::CCSprite_vtbl *v283; // rbx
const cocos2d::CCPoint *v284; // rax
struct cocos2d::CCSprite *v285; // rdi
cocos2d::CCSprite_vtbl *v286; // rbx
const cocos2d::CCPoint *v287; // rax
bool v288; // [rsp+38h] [rbp-D0h]
__int16 v289; // [rsp+58h] [rbp-B0h] BYREF
char v290; // [rsp+5Ah] [rbp-AEh]
bool v291; // [rsp+5Ch] [rbp-ACh]
ButtonSprite *v292; // [rsp+60h] [rbp-A8h] BYREF
bool v293; // [rsp+68h] [rbp-A0h]
int v294; // [rsp+6Ch] [rbp-9Ch] BYREF
cocos2d::CCPoint v295; // [rsp+70h] [rbp-98h] BYREF
struct cocos2d::CCLabelBMFont *v296; // [rsp+78h] [rbp-90h] BYREF
cocos2d::CCNode *v297; // [rsp+80h] [rbp-88h] BYREF
_QWORD *v298; // [rsp+88h] [rbp-80h] BYREF
struct cocos2d::CCPoint v299; // [rsp+90h] [rbp-78h] BYREF
cocos2d::CCPoint v300; // [rsp+98h] [rbp-70h] BYREF
cocos2d::CCPoint v301; // [rsp+A0h] [rbp-68h] BYREF
cocos2d::CCPoint v302; // [rsp+A8h] [rbp-60h] BYREF
__int16 v303; // [rsp+B0h] [rbp-58h] BYREF
char v304; // [rsp+B2h] [rbp-56h]
__int16 v305; // [rsp+B4h] [rbp-54h]
cocos2d::CCPoint v306; // [rsp+B8h] [rbp-50h] BYREF
cocos2d::CCPoint v307; // [rsp+C0h] [rbp-48h] BYREF
cocos2d::CCPoint v308; // [rsp+C8h] [rbp-40h] BYREF
cocos2d::CCPoint v309; // [rsp+D0h] [rbp-38h] BYREF
cocos2d::CCPoint v310; // [rsp+D8h] [rbp-30h] BYREF
struct cocos2d::CCLabelBMFont *v311; // [rsp+E0h] [rbp-28h]
GJGameLevel *v312; // [rsp+E8h] [rbp-20h]
cocos2d::CCPoint v313; // [rsp+F0h] [rbp-18h] BYREF
__int128 Buf2; // [rsp+F8h] [rbp-10h] BYREF
size_t Size; // [rsp+108h] [rbp+0h]
unsigned __int64 v316; // [rsp+110h] [rbp+8h]
void *Block[2]; // [rsp+118h] [rbp+10h] BYREF
__int64 v318; // [rsp+128h] [rbp+20h]
unsigned __int64 v319; // [rsp+130h] [rbp+28h]
_QWORD Buf1[4]; // [rsp+138h] [rbp+30h] BYREF
__int128 Src; // [rsp+158h] [rbp+50h] BYREF
__int64 v322; // [rsp+168h] [rbp+60h]
unsigned __int64 v323; // [rsp+170h] [rbp+68h]
_QWORD v324[4]; // [rsp+178h] [rbp+70h] BYREF
LODWORD(v297) = 0;
m_level = a1->m_level;
v3 = m_level->m_dailyID.random - m_level->m_dailyID.seed;
v294 = v3;
LODWORD(v306.x) = m_level->m_levelLength;
v4 = (float)(a1->m_compactView ? 0xF : 0);
v5 = 0.44999999;
if ( a1->m_compactView )
{
GameToolbox::intToString(&Buf2, m_level->m_listPosition);
p_Buf2 = (const char *)&Buf2;
if ( v316 > 0xF )
p_Buf2 = (const char *)Buf2;
v7 = cocos2d::CCLabelBMFont::create(p_Buf2, (const char *)&qword_14052A4D8);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v7);
cocos2d::CCLabelBMFont::limitLabelWidth(v7, 20.0, 0.44999999, 0.0);
v8 = v7->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v298, 16.0, a1->m_height * 0.5);
v8->setPosition_0(v7, v9);
sub_14003A830((__int64)&Buf2);
}
sub_14003BDB0((__int64)v324, (__int64)&a1->m_level->m_levelName);
v10 = 8;
v11 = (const char *)v324;
if ( v324[3] > 0xFu )
v11 = (const char *)v324[0];
v12 = cocos2d::CCLabelBMFont::create(v11, (const char *)&qword_14052A4D8);
v311 = v12;
sub_14003A830((__int64)v324);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v12);
v13 = v12->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v298, 0.0, 0.5);
v13->setAnchorPoint(v12, v14);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v12->setScale_0)(v12);
v15 = v12->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v16 = a1->m_height * 0.5;
if ( a1->m_compactView )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v298, v4 + 50.0, v16 + 16.0);
v15->setPosition_0(v12, v20);
v18 = 0.5;
v19 = 120.0;
}
else
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v298, 50.0, v16 + 30.0);
v15->setPosition_0(v12, v17);
v18 = 0.80000001;
v19 = 190.0;
}
cocos2d::CCLabelBMFont::limitLabelWidth(v12, v19, v18, 0.0);
*(_OWORD *)Block = 0;
v318 = 0;
v319 = 15;
LOBYTE(Block[0]) = 0;
v21 = (GameLevelManager *)qword_1406C2EC0;
if ( v3 <= 0 )
{
if ( !qword_1406C2EC0 )
{
v298 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v298);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v21 = (GameLevelManager *)qword_1406C2EC0;
}
SavedLevel = GameLevelManager::getSavedLevel(v21, a1->m_level->m_levelID.random - a1->m_level->m_levelID.seed);
}
else
{
if ( !qword_1406C2EC0 )
{
v298 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v298);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v21 = (GameLevelManager *)qword_1406C2EC0;
}
SavedLevel = GameLevelManager::getSavedDailyLevel(v21, a1->m_level->m_dailyID.random - a1->m_level->m_dailyID.seed);
}
v23 = SavedLevel;
v312 = SavedLevel;
v24 = a1->m_level;
v25 = true;
if ( v24->m_levelType != Editor )
{
Buf2 = 0;
Size = 0;
v316 = 15;
LOBYTE(Buf2) = 0;
LODWORD(v297) = 9;
sub_14003BDB0((__int64)Buf1, (__int64)&v24->m_levelString);
v10 = 27;
if ( !sub_14003A760(Buf1, &Buf2)
&& (!v23 || v23->m_levelNotDownloaded || v23->m_levelVersion != a1->m_level->m_levelVersion) )
{
v25 = false;
}
}
if ( (v10 & 2) != 0 )
{
v10 &= ~2u;
sub_14003A830((__int64)Buf1);
}
if ( (v10 & 1) != 0 )
sub_14003A830((__int64)&Buf2);
if ( v25 )
{
v26 = v319;
if ( v319 >= 4 )
{
v27 = (char *)Block;
if ( v319 > 0xF )
v27 = (char *)Block[0];
v318 = 4;
strcpy(v27, "View");
v28 = "GJ_button_01.png";
goto LABEL_83;
}
v29 = v319 >> 1;
v30 = 0x7FFFFFFFFFFFFFFFLL;
if ( v319 <= 0x7FFFFFFFFFFFFFFFLL - (v319 >> 1) )
{
v30 = 15;
if ( v319 + v29 > 0xF )
v30 = v319 + v29;
}
v31 = (char *)sub_14003AA10(v30 + 1);
v318 = 4;
v319 = v30;
strcpy(v31, "View");
if ( v26 <= 0xF )
{
LABEL_40:
Block[0] = v31;
v28 = "GJ_button_01.png";
goto LABEL_83;
}
v32 = Block[0];
if ( v26 + 1 < 0x1000
|| (v32 = *((void **)Block[0] - 1), (unsigned __int64)((char *)Block[0] - (char *)v32 - 8) <= 0x1F) )
{
j_j_free(v32);
goto LABEL_40;
}
LABEL_79:
invalid_parameter_noinfo_noreturn();
}
v33 = a1->m_level;
if ( v33->m_gameVersion <= 22 )
{
if ( !v23 || v23->m_levelNotDownloaded || v23->m_levelVersion >= v33->m_levelVersion )
{
v46 = v319;
if ( v319 < 6 )
{
v48 = v319 >> 1;
v49 = 0x7FFFFFFFFFFFFFFFLL;
if ( v319 <= 0x7FFFFFFFFFFFFFFFLL - (v319 >> 1) )
{
v49 = 15;
if ( v319 + v48 > 0xF )
v49 = v319 + v48;
}
v50 = (char *)sub_14003AA10(v49 + 1);
v318 = 6;
v319 = v49;
strcpy(v50, "Get It");
if ( v46 > 0xF )
{
v51 = Block[0];
if ( v46 + 1 >= 0x1000 )
{
v51 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v51 - 8) > 0x1F )
goto LABEL_79;
}
j_j_free(v51);
}
Block[0] = v50;
}
else
{
v47 = Block;
if ( v319 > 0xF )
v47 = (void **)Block[0];
v318 = 6;
memmove(v47, "Get It", 6u);
*((_BYTE *)v47 + 6) = 0;
}
v28 = "GJ_button_02.png";
goto LABEL_83;
}
v40 = v319;
if ( v319 < 6 )
{
v42 = v319 >> 1;
v43 = 0x7FFFFFFFFFFFFFFFLL;
if ( v319 <= 0x7FFFFFFFFFFFFFFFLL - (v319 >> 1) )
{
v43 = 15;
if ( v319 + v42 > 0xF )
v43 = v319 + v42;
}
v44 = (char *)sub_14003AA10(v43 + 1);
v318 = 6;
v319 = v43;
strcpy(v44, "Update");
if ( v40 > 0xF )
{
v45 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v45 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v45 - 8) > 0x1F )
goto LABEL_79;
}
j_j_free(v45);
}
Block[0] = v44;
v28 = "GJ_button_03.png";
goto LABEL_83;
}
v41 = Block;
if ( v319 > 0xF )
v41 = (void **)Block[0];
v318 = 6;
memmove(v41, "Update", 6u);
*((_BYTE *)v41 + 6) = 0;
v28 = "GJ_button_03.png";
}
else
{
v34 = v319;
if ( v319 < 2 )
{
v36 = v319 >> 1;
v37 = 0x7FFFFFFFFFFFFFFFLL;
if ( v319 <= 0x7FFFFFFFFFFFFFFFLL - (v319 >> 1) )
{
v37 = 15;
if ( v319 + v36 > 0xF )
v37 = v319 + v36;
}
v38 = (char *)sub_14003AA10(v37 + 1);
v318 = 2;
v319 = v37;
strcpy(v38, "NA");
if ( v34 > 0xF )
{
v39 = Block[0];
if ( v34 + 1 >= 0x1000 )
{
v39 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v39 - 8) > 0x1F )
goto LABEL_79;
}
j_j_free(v39);
}
Block[0] = v38;
v28 = "GJ_button_04.png";
goto LABEL_83;
}
v35 = (char *)Block;
if ( v319 > 0xF )
v35 = (char *)Block[0];
v318 = 2;
strcpy(v35, "NA");
v28 = "GJ_button_04.png";
}
LABEL_83:
if ( v3 > 0 )
{
v52 = (ButtonSprite *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_playBtn2_001.png");
((void (__fastcall *)(ButtonSprite *))v52->setScale_0)(v52);
v53 = 18.0;
v291 = a1->m_level->m_orbCompletion.random - a1->m_level->m_orbCompletion.seed >= 100;
v54 = CCMenuItemSpriteExtra::create(v52, nullptr, a1, (cocos2d::SEL_MenuHandler *)LevelCell::onClick);
a1->m_button = v54;
LABEL_85:
v55 = 1065353216;
goto LABEL_86;
}
v64 = Block;
if ( v319 > 0xF )
v64 = (void **)Block[0];
v65 = 50;
if ( a1->m_compactView )
v65 = 40;
v52 = ButtonSprite::create_1((const char *)v64, v65, 0, 0.60000002, 1, (const char *)&qword_14052A4D8, v28, 30.0);
v66 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v298 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v298);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v66 = (GameStatsManager *)qword_1406C2EE8;
}
hasCompletedLevel = GameStatsManager::hasCompletedLevel(v66, a1->m_level);
v291 = hasCompletedLevel;
v54 = CCMenuItemSpriteExtra::create(v52, nullptr, a1, (cocos2d::SEL_MenuHandler *)LevelCell::onClick);
a1->m_button = v54;
v53 = 0.0;
if ( a1->m_level->m_localOrSaved )
goto LABEL_85;
v55 = 1068708659;
v291 = hasCompletedLevel;
LABEL_86:
HIDWORD(v54->m_pfnSelector.adj) = v55;
a1->m_button->setTag(a1->m_button, 0);
a1->m_mainMenu->addChild_1(a1->m_mainMenu, a1->m_button);
m_height = a1->m_height;
v57 = (float *)v52->getContentSize(v52);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v298,
(float)((float)(a1->m_width - (float)(*v57 * 0.5)) - 9.0) + v53,
m_height * 0.5);
cocos2d::CCPoint::operator=(&a1->m_point, v58);
v59 = a1->m_button->__vftable;
v60 = cocos2d::CCNode::convertToNodeSpace(a1->m_mainMenu, (const struct cocos2d::CCPoint *)&v298);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v59->setPosition_0)(a1->m_button, v60);
if ( a1->m_listType == Level4 )
{
v61 = cocos2d::CCSprite::createWithSpriteFrameName("edit_flipYBtn_001.png");
v292 = (ButtonSprite *)operator new(0x2C0u);
v62 = ButtonSprite::ButtonSprite(v292);
if ( v62 )
{
if ( ButtonSprite::init(v62, v61, 30, v63, 30.0, 1.0, v288, "GJ_button_05.png", 0) )
{
cocos2d::CCObject::autorelease(v62);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v62->~ButtonSprite)(v62, 1);
v62 = nullptr;
}
}
((void (__fastcall *)(ButtonSprite *))v62->setScale_0)(v62);
v68 = CCMenuItemSpriteExtra::create(v62, nullptr, a1, (cocos2d::SEL_MenuHandler *)LevelCell::onClick);
v68->setTag(v68, 3);
a1->m_mainMenu->addChild_1(a1->m_mainMenu, v68);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, 16.0, -8.0);
v69 = a1->m_button->getPosition_0(a1->m_button);
cocos2d::CCPoint::operator+(v69, &v296);
v68->setPosition_0(v68, (const cocos2d::CCPoint *)&v296);
v70 = cocos2d::CCSprite::createWithSpriteFrameName("edit_downBtn_001.png");
v292 = (ButtonSprite *)operator new(0x2C0u);
v71 = ButtonSprite::ButtonSprite(v292);
v73 = v71;
if ( v71 )
{
if ( ButtonSprite::init(v71, v70, 30, v72, 30.0, 1.0, v288, "GJ_button_06.png", 0) )
{
cocos2d::CCObject::autorelease(v73);
}
else
{
((void (__fastcall *)(cocos2d::CCNode *, __int64))v73->~CCNode)(v73, 1);
v73 = nullptr;
}
}
((void (__fastcall *)(cocos2d::CCNode *))v73->setScale_0)(v73);
v74 = CCMenuItemSpriteExtra::create(v73, nullptr, a1, (cocos2d::SEL_MenuHandler *)LevelCell::onClick);
v74->setTag(v74, 2);
a1->m_mainMenu->addChild_1(a1->m_mainMenu, v74);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, -12.0, -8.0);
v75 = a1->m_button->getPosition_0(a1->m_button);
cocos2d::CCPoint::operator+(v75, &v296);
v74->setPosition_0(v74, (const cocos2d::CCPoint *)&v296);
v76 = cocos2d::CCSprite::createWithSpriteFrameName("edit_upBtn_001.png");
v292 = (ButtonSprite *)operator new(0x2C0u);
v77 = ButtonSprite::ButtonSprite(v292);
if ( v77 )
{
if ( ButtonSprite::init(v77, v76, 30, v78, 30.0, 1.0, v288, "GJ_button_01.png", 0) )
{
cocos2d::CCObject::autorelease(v77);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v77->~ButtonSprite)(v77, 1);
v77 = nullptr;
}
}
((void (__fastcall *)(ButtonSprite *))v77->setScale_0)(v77);
v79 = CCMenuItemSpriteExtra::create(v77, nullptr, a1, (cocos2d::SEL_MenuHandler *)LevelCell::onClick);
v79->setTag(v79, 1);
a1->m_mainMenu->addChild_1(a1->m_mainMenu, v79);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, -40.0, -8.0);
v80 = a1->m_button->getPosition_0(a1->m_button);
cocos2d::CCPoint::operator+(v80, &v296);
v79->setPosition_0(v79, (const cocos2d::CCPoint *)&v296);
v292 = (ButtonSprite *)operator new(0x2C0u);
v81 = ButtonSprite::ButtonSprite(v292);
if ( v81 )
{
if ( ButtonSprite::init_1(
v81,
"Delete",
40,
0,
0.60000002,
1,
(const char *)&qword_14052A4D8,
"GJ_button_06.png",
30.0) )
{
cocos2d::CCObject::autorelease(v81);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v81->~ButtonSprite)(v81, 1);
v81 = nullptr;
}
}
v82 = CCMenuItemSpriteExtra::create(v81, nullptr, a1, (cocos2d::SEL_MenuHandler *)LevelCell::onClick);
v82->setTag(v82, 4);
a1->m_mainMenu->addChild_1(a1->m_mainMenu, v82);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, -v53, 0.0);
cocos2d::CCPoint::operator+(&a1->m_point, &v296);
v83 = v82->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v84 = cocos2d::CCNode::convertToNodeSpace(a1->m_mainMenu, &v299);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v83->setPosition_0)(v82, v84);
LevelCell::updateCellMode(a1, a1->m_cellMode);
}
v85 = a1->m_level;
v86 = v85->m_accountID.random - v85->m_accountID.seed;
if ( v86 <= 0 )
{
v87 = v85->m_userID.random - v85->m_userID.seed;
v88 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v292 = (ButtonSprite *)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v292);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v88 = qword_1406C2EC0;
}
v89 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(cocos2d::CCDictionary **)(v88 + 536), v87);
v86 = cocos2d::CCString::intValue(v89);
}
Src = 0;
v322 = 0;
v323 = 15;
LOBYTE(Src) = 0;
if ( !a1->m_compactView )
sub_140041270(&Src, "By ", 3u);
sub_14003BDB0((__int64)&Buf2, (__int64)&a1->m_level->m_creatorName);
v90 = &Buf2;
if ( v316 > 0xF )
v90 = (__int128 *)Buf2;
sub_140041270(&Src, v90, Size);
sub_14003A830((__int64)&Buf2);
p_Src = (const char *)&Src;
if ( v323 > 0xF )
p_Src = (const char *)Src;
v92 = cocos2d::CCLabelBMFont::create(p_Src, "goldFont.fnt");
v298 = &v92->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v308);
if ( a1->m_compactView )
{
cocos2d::CCLabelBMFont::limitLabelWidth(v92, 80.0, 0.44999999, 0.0);
width = v92->getContentSize(v92)->width;
v97 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v92->getScale)(v92);
v98 = (float *)v12->getContentSize(v12);
v94 = (float)((float)(v12->getScale(v12) * *v98) + (float)(*(float *)&v97 * (float)(width * 0.5))) + 5.0;
v95 = 0.0;
}
else
{
cocos2d::CCLabelBMFont::limitLabelWidth(v92, 140.0, 0.69999999, 0.0);
v93 = v92->getContentSize(v92)->width * 0.5;
v94 = (float)(v92->getScale(v92) * v93) + 2.0;
v95 = -22.0;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, v94, v95);
v99 = (__int64)v12->getPosition_0(v12);
cocos2d::CCPoint::operator+(v99, &v296);
cocos2d::CCPoint::operator=(&v308, &v296);
v100 = CCMenuItemSpriteExtra::create(v92, nullptr, a1, (cocos2d::SEL_MenuHandler *)LevelCell::onViewProfile);
a1->m_mainMenu->addChild_1(a1->m_mainMenu, v100);
v101 = v100->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v102 = cocos2d::CCNode::convertToNodeSpace(a1->m_mainMenu, (const struct cocos2d::CCPoint *)&v292);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v101->setPosition_0)(v100, v102);
if ( !v86 )
{
v289 = -166;
v290 = -1;
v92->setColor(&v92->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v289);
v100->setEnabled(v100, 0);
}
cocos2d::CCPoint::CCPoint(&v301);
v103 = a1->m_height;
v104 = v12->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( a1->m_compactView )
{
v108 = (float *)v104->getPosition_0(v12);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, *v108 + 1.0, (float)(v103 * 0.5) - 1.0);
cocos2d::CCPoint::operator=(&v301, v109);
v107 = 150.0;
v5 = 0.36000001;
}
else
{
v105 = (float *)v104->getPosition_0(v12);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, *v105 + 2.0, (float)(v103 * 0.5) - 12.0);
cocos2d::CCPoint::operator=(&v301, v106);
v107 = 195.0;
}
v110 = a1->m_level;
v111 = MusicDownloadManager::sharedState();
SongInfoObject = MusicDownloadManager::getSongInfoObject(v111, v110->m_songID);
v113 = SongInfoObject;
v114 = 14.0;
if ( SongInfoObject )
{
m_nongType = SongInfoObject->m_nongType;
if ( m_nongType > 0 )
{
v116 = "ncs_small_001.png";
if ( m_nongType == 2 )
v116 = "chompo_small_001.png";
v117 = cocos2d::CCSprite::createWithSpriteFrameName(v116);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v117);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, 14.0, -1.0);
cocos2d::CCPoint::operator+(&v301, &v297);
if ( v113->m_nongType == 2 )
{
*(float *)&v297 = *(float *)&v297 + 3.0;
*((float *)&v297 + 1) = *((float *)&v297 + 1) - 0.5;
v301.x = v301.x + 40.0;
v107 = v107 + -20.0;
}
else
{
v301.x = v301.x + 34.0;
v107 = v107 + -15.0;
}
v117->setPosition_0(v117, (const cocos2d::CCPoint *)&v297);
}
}
SongName = GJGameLevel::getSongName(a1->m_level, Buf1);
if ( *(_QWORD *)(SongName + 24) > 0xFu )
SongName = *(_QWORD *)SongName;
v119 = cocos2d::CCLabelBMFont::create((const char *)SongName, (const char *)&qword_14052A4D8);
v296 = v119;
sub_14003A830((__int64)Buf1);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v119);
v120 = v119->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, 0.0, 0.5);
v120->setAnchorPoint(v119, v121);
v119->setPosition_0(v119, &v301);
cocos2d::CCLabelBMFont::limitLabelWidth(v119, v107, v5, 0.0);
setColor = v119->setColor;
v123 = a1->m_level;
v290 = -1;
v124 = v123->m_songID <= 0;
v289 = -11736;
if ( !v124 )
v289 = -32001;
setColor(&v119->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v289);
v125 = a1->m_level;
AverageDifficulty = GJGameLevel::getAverageDifficulty(v125);
if ( v125->m_demon.random - v125->m_demon.seed == 1 )
{
switch ( v125->m_demonDifficulty )
{
case 3:
AverageDifficulty = 7;
break;
case 4:
AverageDifficulty = 8;
break;
case 5:
AverageDifficulty = 9;
break;
case 6:
AverageDifficulty = 10;
break;
default:
AverageDifficulty = 6;
break;
}
}
v127 = cocos2d::CCString::createWithFormat("difficulty_%02d_btn_001.png", AverageDifficulty);
cocos2d::CCString::getCString(v127);
v128 = (cocos2d::CCNode *)cocos2d::CCNode::create();
v297 = v128;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v128, 2);
v128->setContentSize(v128, &stru_1406C19A0);
v129 = v128->__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, 26.0, a1->m_height * 0.5);
v129->setPosition_0(v128, v130);
if ( a1->m_compactView )
{
((void (__fastcall *)(cocos2d::CCNode *))v128->setScale_0)(v128);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, 18.0, 1.0);
v131 = (__int64)v128->getPosition_0(v128);
cocos2d::CCPoint::operator+(v131, &v299);
v128->setPosition_0(v128, &v299);
}
cocos2d::CCPoint::CCPoint(&v300, 0.0, 0.0);
v132 = a1->m_level;
v133 = v132->m_coins > 0 && !a1->m_compactView;
if ( v132->m_stars.random - v132->m_stars.seed > 0 )
{
if ( v133 )
{
y = v300.y + 14.0;
v300.y = v300.y + 14.0;
goto LABEL_164;
}
goto LABEL_162;
}
if ( v133 )
{
LABEL_162:
y = v300.y + 5.0;
v300.y = v300.y + 5.0;
goto LABEL_164;
}
y = v300.y;
LABEL_164:
if ( v3 > 0 )
v300.y = y + 10.0;
v135 = -1;
if ( v132->m_autoLevel )
AverageDifficulty = -1;
v136 = GJDifficultySprite::create(AverageDifficulty, Short);
v137 = v136;
v138 = a1->m_level;
if ( v138 )
{
if ( v138->m_featured > 0 || v138->m_isEpic > 0 )
{
m_isEpic = v138->m_isEpic;
if ( m_isEpic <= 0 )
{
v139 = Featured;
}
else
{
if ( m_isEpic < 3 )
{
v124 = m_isEpic < 2;
v141 = v136;
if ( v124 )
v139 = Epic;
else
v139 = Legendary;
goto LABEL_180;
}
v139 = Mythic;
}
}
else
{
v139 = 0;
}
v141 = v136;
LABEL_180:
GJDifficultySprite::updateFeatureState(v141, v139);
}
v128->addChild_0(v128, v137, 3);
v137->setPosition_0(v137, &v300);
v142 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v292 = (ButtonSprite *)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v292);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v142 = (GameStatsManager *)qword_1406C2EE8;
}
hasCompletedStarLevel = GameStatsManager::hasCompletedStarLevel(v142, a1->m_level);
if ( a1->m_level->m_stars.random - a1->m_level->m_stars.seed > 0 )
{
v144 = "star_small01_001.png";
if ( LODWORD(v306.x) == 5 )
v144 = "moon_small01_001.png";
v145 = cocos2d::CCSprite::createWithSpriteFrameName(v144);
v128->addChild_1(v128, v145);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, 8.0, -30.0);
cocos2d::CCPoint::operator+(&v300, &v299);
v145->setPosition_0(v145, &v299);
v146 = cocos2d::CCString::createWithFormat("%i", a1->m_level->m_stars.random - a1->m_level->m_stars.seed);
CString = cocos2d::CCString::getCString(v146);
v148 = cocos2d::CCLabelBMFont::create(CString, (const char *)&qword_14052A4D8);
v128->addChild_1(v128, v148);
v149 = v148->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v306, 1.0, 0.5);
v149->setAnchorPoint(v148, v150);
cocos2d::CCPoint::CCPoint(&v309, -8.0, 0.0);
v151 = (__int64)v145->getPosition_0(v145);
cocos2d::CCPoint::operator+(v151, &v299);
v148->setPosition_0(v148, &v299);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v148->setScale_0)(v148);
if ( hasCompletedStarLevel )
{
v289 = -1;
v290 = 50;
v148->setColor(&v148->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v289);
}
v3 = v294;
}
if ( v3 > 0 )
{
v152 = cocos2d::CCSprite::createWithSpriteFrameName("diamond_small01_001.png");
v297->addChild_1(v297, v152);
Buf2 = 0;
Size = 0;
v316 = 15;
LOBYTE(Buf2) = 0;
v153 = a1->m_level->m_stars.random - a1->m_level->m_stars.seed;
v154 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v309 = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = ((__int64 (__fastcall *)(_QWORD))sub_1401D0AE0)(v309);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v154 = (GameStatsManager *)qword_1406C2EE8;
}
if ( (unsigned int)(v153 - 2) > 8 )
v155 = 0;
else
v155 = v153 + 2;
if ( !v154 )
{
v309 = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = ((__int64 (__fastcall *)(_QWORD))sub_1401D0AE0)(v309);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v154 = (GameStatsManager *)qword_1406C2EE8;
}
AwardedDiamondsForLevel = GameStatsManager::getAwardedDiamondsForLevel(v154, a1->m_level);
v157 = cocos2d::CCString::createWithFormat("%i/%i", AwardedDiamondsForLevel, v155);
v158 = (char *)cocos2d::CCString::getCString(v157);
v159 = -1;
do
++v159;
while ( v158[v159] );
sub_14003CCE0((void **)&Buf2, v158, v159);
v160 = (const char *)&Buf2;
if ( v316 > 0xF )
v160 = (const char *)Buf2;
v161 = cocos2d::CCLabelBMFont::create(v160, (const char *)&qword_14052A4D8);
v297->addChild_1(v297, v161);
v162 = v161->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v309, 1.0, 0.5);
v162->setAnchorPoint(v161, v163);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v161->setScale_0)(v161);
v164 = (float *)v161->getContentSize(v161);
v165 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v161->getScale)(v161);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v292, (float)((float)(*(float *)&v165 * *v164) * 0.5) + 2.0, -44.5);
cocos2d::CCPoint::operator+(&v300, &v299);
v152->setPosition_0(v152, &v299);
cocos2d::CCPoint::CCPoint(&v306, -8.0, 0.0);
v166 = (__int64)v152->getPosition_0(v152);
cocos2d::CCPoint::operator+(v166, &v299);
v161->setPosition_0(v161, &v299);
if ( AwardedDiamondsForLevel == v155 )
{
v289 = -156;
v290 = -1;
v161->setColor(&v161->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v289);
}
sub_14003A830((__int64)&Buf2);
v128 = v297;
v3 = v294;
}
v167 = a1->m_level;
if ( v167->m_coins > 0 )
{
if ( v3 <= 0 )
{
if ( v167->m_stars.random - v167->m_stars.seed <= 0 )
v168 = -31.5;
else
v168 = -45.5;
}
else
{
v168 = -60.0;
}
v293 = v167->m_coinsVerified.random != v167->m_coinsVerified.seed;
v169 = 0;
while ( 1 )
{
if ( v169 >= 3 )
goto LABEL_254;
v170 = 0.0;
if ( v169 )
{
if ( v169 == 1 )
{
if ( v167->m_coins == 2 )
v170 = 5.0;
}
else if ( v169 == 2 )
{
v170 = 10.0;
}
}
else
{
m_coins = v167->m_coins;
if ( m_coins == 2 )
{
v170 = -5.0;
}
else if ( m_coins >= 3 )
{
v170 = -10.0;
}
}
CoinKey = GJGameLevel::getCoinKey(v167, v169 + 1);
Buf2 = 0;
Size = 0;
v316 = 0;
v173 = -1;
do
++v173;
while ( CoinKey[v173] );
sub_14003A930(&Buf2, CoinKey, v173);
v174 = (const char *)&Buf2;
if ( v316 > 0xF )
v174 = (const char *)Buf2;
v175 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v309 = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = ((__int64 (__fastcall *)(_QWORD))sub_1401D0AE0)(v309);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v175 = (GameStatsManager *)qword_1406C2EE8;
}
if ( GameStatsManager::hasUserCoin(v175, v174) )
goto LABEL_236;
v176 = (const char *)&Buf2;
if ( v316 > 0xF )
v176 = (const char *)Buf2;
v177 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v313 = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = ((__int64 (__fastcall *)(_QWORD))sub_1401D0AE0)(v313);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v177 = (GameStatsManager *)qword_1406C2EE8;
}
if ( GameStatsManager::hasPendingUserCoin(v177, v176) )
LABEL_236:
v178 = 1;
else
v178 = 0;
v179 = cocos2d::CCSprite::createWithSpriteFrameName("usercoin_small01_001.png");
if ( a1->m_compactView )
{
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v179);
((void (__fastcall *)(struct cocos2d::CCSprite *))v179->setScale_0)(v179);
v181 = (float *)v296->getContentSize(v296);
v182 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v296->getScale)(v296);
v183 = (float)(*(float *)&v182 * *v181) + 18.0;
v184 = ((double (__fastcall *)(struct cocos2d::CCSprite *))v179->getScale)(v179);
cocos2d::CCPoint::CCPoint(&v295, (float)(*(float *)&v184 * v170) + v183, 0.0);
v185 = (__int64)v296->getPosition_0(v296);
cocos2d::CCPoint::operator+(v185, &v292);
v180 = (struct cocos2d::CCPoint *)&v292;
}
else
{
v128->addChild_1(v128, v179);
cocos2d::CCPoint::CCPoint(&v302, v170, v168);
cocos2d::CCPoint::operator+(&v300, &v299);
v180 = &v299;
}
v179->setPosition_0(v179, v180);
if ( !v293 )
break;
if ( !v178 )
{
LOWORD(v297) = -23131;
LOWORD(v294) = -23131;
BYTE2(v294) = -91;
v186 = (__int16 *)&v294;
LABEL_246:
v179->setColor(&v179->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v186);
}
if ( v316 > 0xF )
{
v187 = (void *)Buf2;
if ( v316 + 1 >= 0x1000 )
{
v187 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v187 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v187);
}
++v169;
v167 = a1->m_level;
if ( v169 >= v167->m_coins )
goto LABEL_254;
}
if ( v178 )
{
v289 = -20481;
v303 = -20481;
v304 = 75;
v186 = &v303;
}
else
{
v305 = 29093;
LOWORD(v306.x) = 29093;
BYTE2(v306.x) = 48;
v186 = (__int16 *)&v306;
}
goto LABEL_246;
}
LABEL_254:
v188 = (float *)v311->getPosition_0(v311);
m_compactView = a1->m_compactView;
v190 = 9;
if ( m_compactView )
v190 = 6;
v191 = (float)v190 + *v188;
v192 = 80;
if ( m_compactView )
v192 = 60;
v193 = (float)v192;
if ( m_compactView )
v114 = 8.5;
v194 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_timeIcon_001.png");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v194);
v195 = v194->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, v191, v114);
v195->setPosition_0(v194, v196);
((void (__fastcall *)(struct cocos2d::CCSprite *))v194->setScale_0)(v194);
v197 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_downloadsIcon_001.png");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v197);
cocos2d::CCPoint::CCPoint(&v302, v193, 0.0);
v198 = (__int64)v194->getPosition_0(v194);
cocos2d::CCPoint::operator+(v198, &v292);
v197->setPosition_0(v197, (const cocos2d::CCPoint *)&v292);
((void (__fastcall *)(struct cocos2d::CCSprite *))v197->setScale_0)(v197);
v199 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_likesIcon_001.png");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v199);
cocos2d::CCPoint::CCPoint(&v313, v193, 0.0);
v200 = (__int64)v197->getPosition_0(v197);
cocos2d::CCPoint::operator+(v200, &v292);
v199->setPosition_0(v199, (const cocos2d::CCPoint *)&v292);
((void (__fastcall *)(struct cocos2d::CCSprite *))v199->setScale_0)(v199);
v201 = a1->m_compactView;
if ( v201 )
v202 = 0.30000001;
else
v202 = 0.40000001;
v203 = a1->m_level;
v204 = 25;
if ( v203->m_stars.random - v203->m_stars.seed > 0 )
v204 = 18;
v205 = (float)v204;
if ( v201 )
v205 = v205 * 0.80000001;
v206 = GJGameLevel::lengthKeyToString(Buf1, (unsigned int)v203->m_levelLength);
if ( *(_QWORD *)(v206 + 24) > 0xFu )
v206 = *(_QWORD *)v206;
v207 = cocos2d::CCLabelBMFont::create((const char *)v206, (const char *)&qword_14052A4D8);
sub_14003A830((__int64)Buf1);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v207);
v208 = v207->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, 0.0, 0.5);
v208->setAnchorPoint(v207, v209);
cocos2d::CCPoint::CCPoint(&v302, 10.0, 0.0);
v210 = (__int64)v194->getPosition_0(v194);
cocos2d::CCPoint::operator+(v210, &v292);
v207->setPosition_0(v207, (const cocos2d::CCPoint *)&v292);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v207->setScale_0)(v207);
cocos2d::CCLabelBMFont::limitLabelWidth(v207, 50.0, v202, 0.0);
v211 = v197->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v212 = v197->getPosition_0(v197)->y;
v213 = v207->getContentSize(v207)->width;
v214 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v207->getScale)(v207);
v215 = (float)((float)(*(float *)&v214 * v213) + v207->getPosition_0(v207)->x) + v205;
cocos2d::CCPoint::CCPoint(&v295, v215, v212);
v211->setPosition_0(v197, v216);
v217 = (const char *)GameToolbox::intToShortString(Buf1, a1->m_level->m_downloads);
if ( *((_QWORD *)v217 + 3) > 0xFu )
v217 = *(const char **)v217;
v218 = cocos2d::CCLabelBMFont::create(v217, (const char *)&qword_14052A4D8);
sub_14003A830((__int64)Buf1);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v218);
v219 = v218->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, 0.0, 0.5);
v219->setAnchorPoint(v218, v220);
cocos2d::CCPoint::CCPoint(&v302, 9.0, 0.0);
v221 = (__int64)v197->getPosition_0(v197);
cocos2d::CCPoint::operator+(v221, &v292);
v218->setPosition_0(v218, (const cocos2d::CCPoint *)&v292);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v218->setScale_0)(v218);
cocos2d::CCLabelBMFont::limitLabelWidth(v218, 45.0, v202, 0.0);
v222 = a1->m_level->m_likes - a1->m_level->m_dislikes;
v223 = v199->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v224 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( v222 < 0 )
v225 = "GJ_dislikesIcon_001.png";
else
v225 = "GJ_likesIcon_001.png";
v226 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v224, v225);
v223->setDisplayFrame(v199, v226);
v227 = v199->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v228 = v199->getPosition_0(v199)->y;
v229 = v218->getContentSize(v218)->width;
v230 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v218->getScale)(v218);
v231 = (float)((float)(*(float *)&v230 * v229) + v218->getPosition_0(v218)->x) + v205;
cocos2d::CCPoint::CCPoint(&v295, v231, v228);
v227->setPosition_0(v199, v232);
v233 = (const char *)GameToolbox::intToShortString(Buf1, v222);
if ( *((_QWORD *)v233 + 3) > 0xFu )
v233 = *(const char **)v233;
v234 = cocos2d::CCLabelBMFont::create(v233, (const char *)&qword_14052A4D8);
sub_14003A830((__int64)Buf1);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v234);
v235 = v234->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, 0.0, 0.5);
v235->setAnchorPoint(v234, v236);
cocos2d::CCPoint::CCPoint(&v302, 10.0, 0.0);
v237 = (__int64)v199->getPosition_0(v199);
cocos2d::CCPoint::operator+(v237, &v292);
v234->setPosition_0(v234, (const cocos2d::CCPoint *)&v292);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v234->setScale_0)(v234);
cocos2d::CCLabelBMFont::limitLabelWidth(v234, 45.0, v202, 0.0);
if ( a1->m_level->m_stars.random - a1->m_level->m_stars.seed > 1 )
{
v238 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)&xmmword_14053DCE8);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v238);
cocos2d::CCPoint::CCPoint(&v295, v193, 0.0);
v239 = (__int64)v199->getPosition_0(v199);
cocos2d::CCPoint::operator+(v239, &v292);
v238->setPosition_0(v238, (const cocos2d::CCPoint *)&v292);
((void (__fastcall *)(struct cocos2d::CCSprite *))v238->setScale_0)(v238);
v240 = v238->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v241 = v238->getPosition_0(v238)->y;
v242 = v234->getContentSize(v234)->width;
v243 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v234->getScale)(v234);
v244 = (float)((float)(*(float *)&v243 * v242) + v234->getPosition_0(v234)->x) + v205;
cocos2d::CCPoint::CCPoint(&v295, v244, v241);
v240->setPosition_0(v238, v245);
v246 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v302 = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = ((__int64 (__fastcall *)(_QWORD))sub_1401D0AE0)(v302);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v246 = (GameStatsManager *)qword_1406C2EE8;
}
BaseCurrencyForLevel = GameStatsManager::getBaseCurrencyForLevel(v246, a1->m_level);
v248 = BaseCurrencyForLevel + (int)(float)((float)BaseCurrencyForLevel * 0.25);
v249 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v295 = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = ((__int64 (__fastcall *)(_QWORD))sub_1401D0AE0)(v295);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v249 = (GameStatsManager *)qword_1406C2EE8;
}
AwardedCurrencyForLevel = GameStatsManager::getAwardedCurrencyForLevel(v249, a1->m_level);
v294 = AwardedCurrencyForLevel;
Buf2 = 0;
Size = 0;
v316 = 15;
LOBYTE(Buf2) = 0;
if ( v248 <= AwardedCurrencyForLevel )
{
v253 = cocos2d::CCString::createWithFormat("%i", v248);
v252 = (char *)cocos2d::CCString::getCString(v253);
do
++v135;
while ( v252[v135] );
}
else
{
v251 = cocos2d::CCString::createWithFormat("%i/%i", AwardedCurrencyForLevel, v248);
v252 = (char *)cocos2d::CCString::getCString(v251);
do
++v135;
while ( v252[v135] );
}
sub_14003CCE0((void **)&Buf2, v252, v135);
v254 = (const char *)&Buf2;
if ( v316 > 0xF )
v254 = (const char *)Buf2;
v255 = cocos2d::CCLabelBMFont::create(v254, (const char *)&qword_14052A4D8);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v255);
v256 = v255->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, 0.0, 0.5);
v256->setAnchorPoint(v255, v257);
cocos2d::CCPoint::CCPoint(&v302, 10.0, 0.0);
v258 = (__int64)v238->getPosition_0(v238);
cocos2d::CCPoint::operator+(v258, &v292);
v255->setPosition_0(v255, (const cocos2d::CCPoint *)&v292);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v255->setScale_0)(v255);
if ( v248 == v294 )
{
LOWORD(v294) = -156;
BYTE2(v294) = -1;
v255->setColor(&v255->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v294);
}
cocos2d::CCLabelBMFont::limitLabelWidth(v255, 45.0, v202, 0.0);
sub_14003A830((__int64)&Buf2);
}
cocos2d::CCPoint::CCPoint(&v295, 0.0, 1.0);
v259 = (__int64)v199->getPosition_0(v199);
cocos2d::CCPoint::operator+(v259, &v292);
v199->setPosition_0(v199, (const cocos2d::CCPoint *)&v292);
v260 = v311;
v261 = v311->getPosition_0(v311)->y;
v262 = v260->getContentSize(v260)->width;
v263 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v260->getScale)(v260);
v264 = (float)((float)(*(float *)&v263 * v262) + v260->getPosition_0(v260)->x) + 10.0;
cocos2d::CCPoint::CCPoint(&v310, v264, v261 - 1.0);
if ( a1->m_compactView )
{
cocos2d::CCPoint::CCPoint(&v295, 16.0, 10.0);
cocos2d::CCPoint::operator=(&v310, v266);
}
if ( v291 )
{
v267 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_completesIcon_001.png");
v268 = v267;
if ( !a1->m_compactView )
{
v269 = v267->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, 0.0, 0.5);
v269->setAnchorPoint((cocos2d::CCSprite *)v268, v270);
}
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v268);
v268->setPosition_0(v268, &v310);
((void (__fastcall *)(cocos2d::CCNode *))v268->setScale_0)(v268);
}
else if ( v312 )
{
v265 = (unsigned int)(v312->m_normalPercent.random - v312->m_normalPercent.seed);
if ( (_DWORD)v265 )
{
v271 = cocos2d::CCString::createWithFormat("%i%%", v265);
v272 = cocos2d::CCString::getCString(v271);
v273 = cocos2d::CCLabelBMFont::create(v272, "goldFont.fnt");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v273, 10);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v273->setScale_0)(v273);
v274 = !a1->m_compactView;
if ( !a1->m_compactView )
{
v275 = v273->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, 0.0, 0.5);
v275->setAnchorPoint(v273, v276);
v274 = !a1->m_compactView;
}
cocos2d::CCPoint::CCPoint(&v295, (float)!v274, 0.0);
cocos2d::CCPoint::operator+(&v310, &v292);
v273->setPosition_0(v273, (const cocos2d::CCPoint *)&v292);
}
}
if ( a1->m_compactView )
v277 = 0.80000001;
else
v277 = 1.0;
v278 = v308.y - 1.0;
v279 = (cocos2d::CCPoint)v298;
v280 = *(float *)(*(__int64 (__fastcall **)(_QWORD *, __int64))(*v298 + 304LL))(v298, v265) * 0.5;
v281 = (*(double (__fastcall **)(cocos2d::CCPoint))(**(_QWORD **)&v279 + 168LL))(v279);
cocos2d::CCPoint::CCPoint(&v307, (float)((float)(*(float *)&v281 * v280) + v308.x) + (float)(v277 * 6.0), v278);
if ( a1->m_level->m_originalLevel.random != a1->m_level->m_originalLevel.seed )
{
v282 = cocos2d::CCSprite::createWithSpriteFrameName("collaborationIcon_001.png");
v283 = v282->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, 0.0, 0.5);
v283->setAnchorPoint(v282, v284);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v282);
v282->setPosition_0(v282, &v307);
((void (__fastcall *)(struct cocos2d::CCSprite *))v282->setScale_0)(v282);
cocos2d::CCPoint::CCPoint(&v302, 15.0, 0.0);
cocos2d::CCPoint::operator+(&v307, &v298);
cocos2d::CCPoint::operator=(&v307, &v298);
}
if ( a1->m_level->m_objectCount.random - a1->m_level->m_objectCount.seed > 40000 )
{
v285 = cocos2d::CCSprite::createWithSpriteFrameName("highObjectIcon_001.png");
v286 = v285->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v295, 0.0, 0.5);
v286->setAnchorPoint(v285, v287);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v285, 10);
v285->setPosition_0(v285, &v307);
((void (__fastcall *)(struct cocos2d::CCSprite *))v285->setScale_0)(v285);
cocos2d::CCPoint::CCPoint(&v302, v277 * 18.0, 0.0);
cocos2d::CCPoint::operator+(&v307, &v298);
cocos2d::CCPoint::operator=(&v307, &v298);
}
sub_14003A830((__int64)&Src);
sub_14003A830((__int64)Block);
}