//
// EndLevelLayer::customSetup from 0x140132e50 to 0x140134852 (6658 bytes)
//
// 2 xrefs:
// > ??> @ 0x140555460
// > ??> @ 0x1406c9e88
//
// 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=11
void EndLevelLayer::customSetup(EndLevelLayer *a1)
{
cocos2d::CCDirector *v2; // rax
PlayLayer *m_playLayer; // rax
GJGameLevel *m_level; // r13
bool m_isPlatformer; // r12
int v6; // ecx
int m_orbs; // edx
int m_diamonds; // ecx
unsigned int v9; // r8d
float v10; // xmm0_4
float v11; // xmm6_4
const char *v12; // rcx
struct cocos2d::CCSprite *v13; // rdi
cocos2d::CCSprite_vtbl *v14; // rbx
const cocos2d::CCPoint *v15; // rax
GameManager *v16; // rcx
__int64 v17; // rax
double v18; // xmm0_8
int m_unkDouble3; // r8d
int v20; // ebx
cocos2d::CCString *v21; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v23; // rbx
cocos2d::CCString *v24; // rax
const char *v25; // rax
struct cocos2d::CCLabelBMFont *v26; // rbx
int v27; // r9d
int v28; // r10d
int v29; // edx
cocos2d::CCString *v30; // rax
char *v31; // rax
size_t v32; // r8
cocos2d::CCString *v33; // rax
char *v34; // rax
size_t v35; // r8
cocos2d::CCString *v36; // rax
const char *v37; // rdx
cocos2d::CCString *v38; // rax
char *v39; // rax
size_t v40; // r8
const char *v41; // rdx
cocos2d::CCString *v42; // rax
const char *v43; // rax
struct cocos2d::CCLabelBMFont *v44; // rbx
float v45; // xmm3_4
EndLevelLayer *v46; // rcx
signed int m_points; // edx
__m128i *v48; // rax
__int64 v49; // rax
void **v50; // rcx
struct cocos2d::CCLabelBMFont *v51; // rbx
void *v52; // rcx
const struct cocos2d::CCPoint *v53; // rax
char *v54; // rdi
__int64 v55; // rbx
__int64 v56; // rax
PlayLayer *v57; // rax
_QWORD *CoinString; // rax
size_t v59; // r8
const struct cocos2d::CCPoint *v60; // rax
char *v61; // rdi
__int64 v62; // rbx
__int64 v63; // rax
const char *EndText; // rax
cocos2d::CCLabelBMFont *v65; // rdi
cocos2d::CCLabelBMFont_vtbl *v66; // rbx
const cocos2d::CCPoint *v67; // rax
cocos2d::CCMenu *v68; // rax
float v69; // xmm6_4
struct cocos2d::CCSprite *v70; // rax
CCMenuItemSpriteExtra *v71; // rbx
struct cocos2d::CCSprite *v72; // rbx
CCMenuItemSpriteExtra *v73; // rdi
GJLevelType m_levelType; // ecx
struct cocos2d::CCSprite *v75; // rsi
cocos2d::CCSprite_vtbl *v76; // rdi
CCMenuItemSpriteExtra *v77; // rbx
struct cocos2d::CCPoint v78; // rax
struct cocos2d::CCSprite *v79; // rax
CCMenuItemSpriteExtra *v80; // rbx
struct cocos2d::CCPoint v81; // rax
struct cocos2d::CCSprite *v82; // rax
CCMenuItemSpriteExtra *v83; // rdi
CCMenuItemSpriteExtra_vtbl *v84; // rbx
struct cocos2d::CCPoint v85; // rax
CCLightFlash *v86; // rsi
CCMenuItemSpriteExtra *v87; // rax
struct cocos2d::CCMenu *v88; // rdi
cocos2d::CCMenu_vtbl *v89; // rbx
__int64 v90; // rcx
cocos2d::CCDirector *v91; // rax
__int64 v92; // rcx
cocos2d::CCDirector *v93; // rax
struct cocos2d::CCFadeTo *v94; // rax
cocos2d::ccColor3B *v95; // r8
__int64 v96; // rcx
__int64 m_coins; // rbx
cocos2d::CCArray *v98; // rax
__int64 v99; // rax
__int64 v100; // rcx
float v101; // xmm6_4
__int64 v102; // rax
cocos2d::CCArray *v103; // r12
cocos2d::CCArray *v104; // rsi
__int64 v105; // rdi
const char *v106; // rcx
struct cocos2d::CCSprite *v107; // rbx
cocos2d::CCPoint v108; // rax
int v109; // r15d
struct cocos2d::CCObject *v110; // rsi
GameStatsManager *v111; // rbx
const char *v112; // rax
bool hasUserCoin; // al
const char *CoinKey; // rax
const char *v115; // rax
bool v116; // bl
PlayLayer *v117; // rdi
cocos2d::CCString *v118; // rax
const char *v119; // rax
size_t v120; // r8
__int64 v121; // rdi
void *v122; // rcx
const char *v123; // rcx
struct cocos2d::CCSprite *v124; // rdi
cocos2d::CCSprite_vtbl *v125; // rbx
__int64 v126; // rax
__int16 *v127; // rdx
const char *v128; // rcx
cocos2d::CCSprite_vtbl *v129; // rbx
__int64 v130; // rax
__int64 v131; // rdx
__int64 v132; // rcx
struct cocos2d::CCSprite *v133; // rdi
cocos2d::CCPoint v134; // rsi
cocos2d::CCNode *v135; // rax
struct cocos2d::CCSprite *v136; // rdi
cocos2d::CCPoint v137; // rsi
cocos2d::CCNode *v138; // rax
struct cocos2d::CCPoint v139; // rax
float v140; // [rsp+28h] [rbp-E0h]
__m128i *v141; // [rsp+48h] [rbp-C0h] BYREF
cocos2d::CCPoint v142; // [rsp+50h] [rbp-B8h] BYREF
float v143; // [rsp+58h] [rbp-B0h]
float v144; // [rsp+5Ch] [rbp-ACh]
cocos2d::CCPoint v145; // [rsp+60h] [rbp-A8h] BYREF
__int16 v146; // [rsp+68h] [rbp-A0h] BYREF
char v147; // [rsp+6Ah] [rbp-9Eh]
__int16 v148; // [rsp+6Ch] [rbp-9Ch] BYREF
char v149; // [rsp+6Eh] [rbp-9Ah]
cocos2d::CCPoint v150; // [rsp+70h] [rbp-98h] BYREF
cocos2d::CCPoint v151; // [rsp+78h] [rbp-90h] BYREF
__int16 v152; // [rsp+80h] [rbp-88h]
__int16 v153; // [rsp+84h] [rbp-84h] BYREF
char v154; // [rsp+86h] [rbp-82h]
_QWORD *v155; // [rsp+88h] [rbp-80h] BYREF
cocos2d::CCPoint v156; // [rsp+90h] [rbp-78h] BYREF
char v157[4]; // [rsp+98h] [rbp-70h] BYREF
float v158; // [rsp+9Ch] [rbp-6Ch]
__int64 v159; // [rsp+A0h] [rbp-68h] BYREF
struct cocos2d::CCPoint v160; // [rsp+A8h] [rbp-60h] BYREF
struct cocos2d::CCPoint v161; // [rsp+B0h] [rbp-58h] BYREF
void *Block[2]; // [rsp+B8h] [rbp-50h] BYREF
__int128 v163; // [rsp+C8h] [rbp-40h]
__m128i v164; // [rsp+D8h] [rbp-30h] BYREF
__int64 v165; // [rsp+E8h] [rbp-20h]
unsigned __int64 v166; // [rsp+F0h] [rbp-18h]
__int128 v167; // [rsp+F8h] [rbp-10h] BYREF
__int64 v168; // [rsp+108h] [rbp+0h]
unsigned __int64 v169; // [rsp+110h] [rbp+8h]
_BYTE v170[32]; // [rsp+118h] [rbp+10h] BYREF
a1->m_coinsToAnimate = nullptr;
v2 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2);
m_playLayer = a1->m_playLayer;
m_level = m_playLayer->m_level;
m_isPlatformer = m_playLayer->m_isPlatformer;
if ( m_playLayer->m_endLayerStars )
{
v6 = m_level->m_stars.random - m_level->m_stars.seed;
if ( m_level->m_levelLength == 5 )
a1->m_moons = v6;
else
a1->m_stars = v6;
}
m_orbs = m_playLayer->m_orbs;
a1->m_orbs = m_orbs;
m_diamonds = m_playLayer->m_diamonds;
a1->m_diamonds = m_diamonds;
a1->m_secretKey = m_playLayer->m_secretKey;
v9 = (m_orbs > 0) + (m_diamonds > 0) + (a1->m_moons > 0) + (a1->m_stars > 0);
v10 = 0.0;
v11 = -38.0;
if ( v9 < 3 )
{
if ( v9 == 2 )
v10 = 5.0;
}
else
{
v11 = -34.0;
v10 = 16.0;
}
cocos2d::CCPoint::CCPoint(&v151, (float)(v143 * 0.5) + 120.0, (float)((float)(v144 * 0.5) + 18.0) + v10);
if ( a1->m_stars > 0 || a1->m_moons > 0 )
{
cocos2d::CCPoint::operator=(&a1->m_starsPosition, &v151);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, 0.0, v11);
cocos2d::CCPoint::operator+(&v151, &v142);
cocos2d::CCPoint::operator=(&v151, &v142);
}
if ( a1->m_orbs > 0 )
{
cocos2d::CCPoint::operator=(&a1->m_orbsPosition, &v151);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, 0.0, v11);
cocos2d::CCPoint::operator+(&v151, &v142);
cocos2d::CCPoint::operator=(&v151, &v142);
}
if ( a1->m_diamonds > 0 )
{
cocos2d::CCPoint::operator=(&a1->m_diamondsPosition, &v151);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, 0.0, v11);
cocos2d::CCPoint::operator+(&v151, &v142);
cocos2d::CCPoint::operator=(&v151, &v142);
}
v12 = "GJ_practiceComplete_001.png";
if ( !a1->m_playLayer->m_isPracticeMode )
v12 = "GJ_levelComplete_001.png";
v13 = cocos2d::CCSprite::createWithSpriteFrameName(v12);
((void (__fastcall *)(struct cocos2d::CCSprite *))v13->setScale_0)(v13);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v13, 15);
v14 = v13->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, v143 * 0.5, (float)(v144 * 0.5) + 75.0);
v14->setPosition_0(v13, v15);
v16 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v155 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v155);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v16 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v16, "0095") )
cocos2d::CCSprite::setFlipX(v13, 1);
a1->m_buttonMenu->setVisible(a1->m_buttonMenu, 0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, 0.0, 5.0);
cocos2d::CCPoint::operator+(&a1->m_endPosition, &v142);
cocos2d::CCPoint::operator=(&a1->m_endPosition, &v142);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, 0.0, -40.0);
v17 = (__int64)v13->getPosition_0(v13);
cocos2d::CCPoint::operator+(v17, v157);
if ( m_isPlatformer )
{
v158 = v158 + -12.0;
cocos2d::CCPoint::CCPoint(&v150);
v18 = a1->m_playLayer->m_timePlayed * 1000.0;
m_unkDouble3 = (int)v18 / 1000;
v20 = (int)v18 % 1000;
}
else
{
cocos2d::CCPoint::CCPoint(&v150);
v21 = cocos2d::CCString::createWithFormat("Attempts: %i", a1->m_playLayer->m_attempts);
CString = cocos2d::CCString::getCString(v21);
v23 = cocos2d::CCLabelBMFont::create(CString, "goldFont.fnt");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v23, 3);
v23->setPosition_0(v23, &v150);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v23->setScale_0)(v23);
v150.y = v150.y + -24.0;
v24 = cocos2d::CCString::createWithFormat("Jumps: %i", a1->m_playLayer->m_jumps);
v25 = cocos2d::CCString::getCString(v24);
v26 = cocos2d::CCLabelBMFont::create(v25, "goldFont.fnt");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v26, 3);
v26->setPosition_0(v26, &v150);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v26->setScale_0)(v26);
v150.y = v150.y + -24.0;
v20 = 0;
m_unkDouble3 = (int)a1->m_playLayer->m_gameState.m_unkDouble3;
}
v27 = m_unkDouble3 % 60;
v28 = m_unkDouble3 / 60 % 60;
v29 = m_unkDouble3 / 3600;
v167 = 0;
v168 = 0;
v169 = 15;
LOBYTE(v167) = 0;
if ( !m_isPlatformer || v28 )
{
if ( !v29 )
{
v33 = cocos2d::CCString::createWithFormat("%02d:%02d", v28, v27);
v34 = (char *)cocos2d::CCString::getCString(v33);
v35 = -1;
do
++v35;
while ( v34[v35] );
LABEL_37:
sub_14003CCE0((void **)&v167, v34, v35);
if ( !m_isPlatformer )
goto LABEL_43;
goto LABEL_38;
}
LABEL_35:
v36 = cocos2d::CCString::createWithFormat("%02d:%02d:%02d", v29, v28, v27);
v34 = (char *)cocos2d::CCString::getCString(v36);
v35 = -1;
do
++v35;
while ( v34[v35] );
goto LABEL_37;
}
if ( v29 )
goto LABEL_35;
v30 = cocos2d::CCString::createWithFormat("%i", v27);
v31 = (char *)cocos2d::CCString::getCString(v30);
v32 = -1;
do
++v32;
while ( v31[v32] );
sub_14003CCE0((void **)&v167, v31, v32);
LABEL_38:
v37 = (const char *)&v167;
if ( v169 > 0xF )
v37 = (const char *)v167;
v38 = cocos2d::CCString::createWithFormat("%s.%03d", v37, v20);
v39 = (char *)cocos2d::CCString::getCString(v38);
v40 = -1;
do
++v40;
while ( v39[v40] );
sub_14003CCE0((void **)&v167, v39, v40);
LABEL_43:
v41 = (const char *)&v167;
if ( v169 > 0xF )
v41 = (const char *)v167;
v42 = cocos2d::CCString::createWithFormat("Time: %s", v41);
v43 = cocos2d::CCString::getCString(v42);
v44 = cocos2d::CCLabelBMFont::create(v43, "goldFont.fnt");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v44, 3);
v44->setPosition_0(v44, &v150);
v45 = 0.0;
cocos2d::CCLabelBMFont::limitLabelWidth(v44, 150.0, 0.80000001, 0.0);
v150.y = v150.y + -24.0;
if ( m_isPlatformer )
{
m_points = a1->m_playLayer->m_gameState.m_points;
if ( m_points )
{
v48 = GameToolbox::pointsToString(&v164, m_points);
v49 = sub_140137610(v48);
*(_OWORD *)Block = 0;
v163 = 0u;
*(_OWORD *)Block = *(_OWORD *)v49;
v163 = *(_OWORD *)(v49 + 16);
*(_QWORD *)(v49 + 16) = 0;
*(_QWORD *)(v49 + 24) = 15;
*(_BYTE *)v49 = 0;
sub_14003A830((__int64)&v164);
v50 = Block;
if ( *((_QWORD *)&v163 + 1) > 0xFu )
v50 = (void **)Block[0];
v51 = cocos2d::CCLabelBMFont::create((const char *)v50, "goldFont.fnt");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v51, 3);
v51->setPosition_0(v51, &v150);
v45 = 0.0;
cocos2d::CCLabelBMFont::limitLabelWidth(v51, 150.0, 0.80000001, 0.0);
v150.y = v150.y + -24.0;
if ( *((_QWORD *)&v163 + 1) > 0xFu )
{
v52 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v163 + 1) + 1LL) >= 0x1000 )
{
v52 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v52 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v52);
}
}
}
v159 = 1;
if ( m_level->m_levelType == Editor )
{
v141 = &v164;
v164 = 0;
v165 = 1;
v166 = 15;
v164.m128i_i16[0] = (unsigned __int8)asc_140518984[0];
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v155, 0.5, 1.0);
v45 = 620.0;
v54 = TextArea::create((__int64)&v164, &qword_14052A4D8, 1.0, 620.0, v53, 1101004800, 0);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, (cocos2d::CCNode *)v54);
(*(void (__fastcall **)(char *))(*(_QWORD *)v54 + 160LL))(v54);
*((_DWORD *)v54 + 164) = 1107820544;
v55 = *(_QWORD *)v54;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, v143 * 0.5, (float)(v144 * 0.5) - 51.0);
(*(void (__fastcall **)(char *, __int64))(v55 + 184))(v54, v56);
if ( m_isPlatformer )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, 0.0, -12.0);
cocos2d::CCPoint::operator+(&v150, &v142);
(*(void (__fastcall **)(char *, cocos2d::CCPoint *))(*(_QWORD *)v54 + 184LL))(v54, &v142);
}
v57 = a1->m_playLayer;
if ( v57->m_isIgnoreDamageEnabled )
{
*(_OWORD *)Block = 0;
*(_QWORD *)&v163 = 0;
*((_QWORD *)&v163 + 1) = 15;
Block[0] = sub_14003AA10(0x40u);
*(_QWORD *)&v163 = 52;
*((_QWORD *)&v163 + 1) = 63;
strcpy((char *)Block[0], "You cannot verify a level after using Ignore Damage.");
TextArea::setString((TextArea *)v54, (__int64)Block);
}
else if ( v57->m_isTestMode )
{
*(_OWORD *)Block = 0;
*(_QWORD *)&v163 = 0;
*((_QWORD *)&v163 + 1) = 15;
Block[0] = sub_14003AA10(0x40u);
*(_QWORD *)&v163 = 48;
*((_QWORD *)&v163 + 1) = 63;
strcpy((char *)Block[0], "You cannot verify a level if it has a start pos.");
TextArea::setString((TextArea *)v54, (__int64)Block);
}
else if ( !v57->m_isPracticeMode || m_level->m_isVerified.random - m_level->m_isVerified.seed == 1 )
{
if ( GJGameLevel::areCoinsVerified(m_level) )
{
*((_QWORD *)&v163 + 1) = 15;
if ( m_level->m_coins <= 0 )
{
*(_QWORD *)&v163 = 15;
strcpy((char *)Block, "Level Verified!");
}
else
{
*(_OWORD *)Block = 0;
*(_QWORD *)&v163 = 0;
Block[0] = sub_14003AA10(0x20u);
*(_QWORD *)&v163 = 25;
*((_QWORD *)&v163 + 1) = 31;
strcpy((char *)Block[0], "Level and Coins Verified!");
}
TextArea::setString((TextArea *)v54, (__int64)Block);
}
else
{
CoinString = (_QWORD *)EndLevelLayer::getCoinString(a1, v170);
if ( CoinString[3] > 0xFu )
CoinString = (_QWORD *)*CoinString;
*(_OWORD *)Block = 0;
v163 = 0u;
v59 = -1;
do
++v59;
while ( *((_BYTE *)CoinString + v59) );
sub_14003A930(Block, CoinString, v59);
TextArea::setString((TextArea *)v54, (__int64)Block);
sub_14003A830((__int64)v170);
}
}
else
{
*(_OWORD *)Block = 0;
*(_QWORD *)&v163 = 0;
*((_QWORD *)&v163 + 1) = 15;
Block[0] = sub_14003AA10(0x30u);
*(_QWORD *)&v163 = 47;
*((_QWORD *)&v163 + 1) = 47;
strcpy((char *)Block[0], "Complete the level in normal mode to verify it!");
TextArea::setString((TextArea *)v54, (__int64)Block);
}
}
else if ( a1->m_playLayer->m_isPracticeMode )
{
v141 = &v164;
v164 = 0;
v165 = 1;
v166 = 15;
v164.m128i_i16[0] = (unsigned __int8)asc_140518984[0];
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v155, 0.5, 1.0);
v45 = 620.0;
v61 = TextArea::create((__int64)&v164, &qword_14052A4D8, 1.0, 620.0, v60, 1101004800, 0);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, (cocos2d::CCNode *)v61);
(*(void (__fastcall **)(char *))(*(_QWORD *)v61 + 160LL))(v61);
*((_DWORD *)v61 + 164) = 1107820544;
v62 = *(_QWORD *)v61;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, v143 * 0.5, (float)(v144 * 0.5) - 51.0);
(*(void (__fastcall **)(char *, __int64))(v62 + 184))(v61, v63);
*(_OWORD *)Block = 0;
*(_QWORD *)&v163 = 0;
*((_QWORD *)&v163 + 1) = 15;
Block[0] = sub_14003AA10(0x40u);
*(_QWORD *)&v163 = 60;
*((_QWORD *)&v163 + 1) = 63;
strcpy((char *)Block[0], "Well done... Now try to complete it without any checkpoints!");
TextArea::setString((TextArea *)v61, (__int64)Block);
}
else if ( m_level->m_coins <= 0 )
{
EndText = EndLevelLayer::getEndText(v46);
v65 = cocos2d::CCLabelBMFont::create(EndText, (const char *)&qword_14052A4D8);
v45 = 0.0;
cocos2d::CCLabelBMFont::limitLabelWidth(v65, 260.0, 0.89999998, 0.0);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v65, 3);
v66 = v65->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, v143 * 0.5, (float)(v144 * 0.5) - 65.0);
v66->setPosition_0(v65, v67);
}
v68 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v46);
a1->m_sideMenu = v68;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v68, 1);
v69 = (float)((float)(v144 * 0.5) - 115.0) - 10.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, v143 * 0.5, v69);
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, (const struct cocos2d::CCPoint *)&v155);
cocos2d::CCNode::convertToNodeSpace(a1->m_sideMenu, &v161);
v70 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_replayBtn_001.png");
v71 = CCMenuItemSpriteExtra::create(v70, nullptr, a1, (cocos2d::SEL_MenuHandler *)EndLevelLayer::onReplay);
v155 = &v71->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_sideMenu->addChild_1(a1->m_sideMenu, v71);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v141, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v161, &v142);
v71->setPosition_0(v71, &v142);
v72 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
v73 = CCMenuItemSpriteExtra::create(v72, nullptr, a1, (cocos2d::SEL_MenuHandler *)EndLevelLayer::onMenu);
v141 = (__m128i *)v73;
a1->m_sideMenu->addChild_1(a1->m_sideMenu, v73);
cocos2d::CCPoint::CCPoint(&v145, 100.0, 0.0);
cocos2d::CCPoint::operator+(&v161, &v142);
v73->setPosition_0(v73, &v142);
m_levelType = m_level->m_levelType;
if ( m_levelType == Editor )
{
v75 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_editBtn_001.png");
v76 = v75->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v72->getContentSize(v72);
v75->getContentSize(v75);
((void (__fastcall *)(struct cocos2d::CCSprite *))v76->setScale_0)(v75);
v77 = CCMenuItemSpriteExtra::create(v75, nullptr, a1, (cocos2d::SEL_MenuHandler *)EndLevelLayer::onEdit);
a1->m_sideMenu->addChild_1(a1->m_sideMenu, v77);
cocos2d::CCPoint::CCPoint(&v145, v143 * 0.5, v69);
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, &v142);
v78 = cocos2d::CCNode::convertToNodeSpace(a1->m_sideMenu, &v156);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v145, v78);
v77->setPosition_0(v77, &v145);
m_levelType = m_level->m_levelType;
}
if ( a1->m_playLayer->m_isPracticeMode )
{
v79 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_restartCheckBtn_001.png");
v80 = CCMenuItemSpriteExtra::create(
v79,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)EndLevelLayer::onRestartCheckpoint);
a1->m_sideMenu->addChild_1(a1->m_sideMenu, v80);
cocos2d::CCPoint::CCPoint(&v145, (float)(v143 * 0.5) - 180.0, v69);
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, &v156);
v81 = cocos2d::CCNode::convertToNodeSpace(a1->m_sideMenu, &v142);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v145, v81);
v80->setPosition_0(v80, &v145);
m_levelType = m_level->m_levelType;
}
if ( (m_isPlatformer || m_levelType != Editor) && m_levelType != Main )
{
v82 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_levelLeaderboardBtn_001.png");
v83 = CCMenuItemSpriteExtra::create(v82, nullptr, a1, (cocos2d::SEL_MenuHandler *)EndLevelLayer::onLevelLeaderboard);
a1->m_sideMenu->addChild_1(a1->m_sideMenu, v83);
v84 = v83->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v156, (float)(v143 * 0.5) + 178.0, (float)(v144 * 0.5) + 115.0);
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, &v142);
v85 = cocos2d::CCNode::convertToNodeSpace(a1->m_sideMenu, &v145);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v84->setPosition_0)(v83, v85);
}
v86 = (CCLightFlash *)cocos2d::CCSprite::createWithSpriteFrameName("hideBtn_001.png");
(*(void (__fastcall **)(cocos2d::CCArray **, _QWORD))&v86->m_lightStripArray->m_unknown2)(&v86->m_lightStripArray, 0);
v87 = CCMenuItemSpriteExtra::create(v86, nullptr, a1, (cocos2d::SEL_MenuHandler *)EndLevelLayer::onHideLayer);
v88 = cocos2d::CCMenu::createWithItem(v87);
a1->addChild_0(a1, v88, 100);
v89 = v88->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v91 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v90);
cocos2d::CCDirector::getScreenTop(v91);
v93 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v92);
cocos2d::CCDirector::getScreenRight(v93);
((void (__fastcall *)(struct cocos2d::CCMenu *))v89->setPosition)(v88);
v94 = cocos2d::CCFadeTo::create(1.0, 0x7Du);
cocos2d::CCNode::runAction(v86, (cocos2d::CCPoint)v94, v95, v45, v140);
a1->m_notLocal = m_level->m_levelType != Main;
a1->m_coinsVerified = m_level->m_coinsVerified.random - m_level->m_coinsVerified.seed == 1;
m_coins = (unsigned int)m_level->m_coins;
LODWORD(v145.x) = m_coins;
if ( (int)m_coins > 0 && !a1->m_playLayer->m_isPracticeMode && m_level->m_levelType != Editor )
{
v98 = (cocos2d::CCArray *)cocos2d::CCArray::create(v96);
a1->m_coinsToAnimate = v98;
cocos2d::CCObject::retain(v98);
cocos2d::CCPoint::CCPoint(&v142, v143 * 0.5, (float)(v144 * 0.5) + 126.0);
cocos2d::CCPoint::CCPoint(&v156, v143 * 0.5, (float)(v144 * 0.5) - 64.0);
cocos2d::CCPoint::operator=(&v142, v99);
if ( (int)m_coins < 5 )
{
if ( (int)m_coins >= 4 )
{
v102 = cocos2d::CCArray::create(v100);
v101 = 15.0;
goto LABEL_95;
}
v101 = 20.0;
}
else
{
v101 = 13.0;
}
v102 = cocos2d::CCArray::create(v100);
LABEL_95:
v103 = (cocos2d::CCArray *)v102;
v104 = (cocos2d::CCArray *)v102;
v105 = m_coins;
do
{
v106 = "secretCoin_b_01_001.png";
if ( a1->m_notLocal )
v106 = "secretCoin_2_b_01_001.png";
v107 = cocos2d::CCSprite::createWithSpriteFrameName(v106);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v107, 8);
cocos2d::CCArray::addObject(v103, v107);
if ( a1->m_notLocal && !a1->m_coinsVerified )
{
v146 = -20481;
v148 = -20481;
v149 = 75;
v107->setColor(&v107->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v148);
}
--v105;
}
while ( v105 );
cocos2d::CCPoint::CCPoint(&v156);
GameToolbox::alignItemsHorisontally(v104, v101, v108, 0);
v109 = v159;
while ( 1 )
{
v110 = cocos2d::CCArray::objectAtIndex(v103, v109 - 1);
v111 = (GameStatsManager *)qword_1406C2EE8;
if ( a1->m_notLocal )
{
if ( a1->m_coinsVerified )
{
if ( !qword_1406C2EE8 )
{
v159 = (__int64)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v159);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v111 = (GameStatsManager *)qword_1406C2EE8;
}
CoinKey = GJGameLevel::getCoinKey(m_level, v109);
hasUserCoin = GameStatsManager::hasUserCoin(v111, CoinKey);
}
else
{
if ( !qword_1406C2EE8 )
{
v160 = (struct cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = ((__int64 (__fastcall *)(_QWORD))sub_1401D0AE0)(v160);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v111 = (GameStatsManager *)qword_1406C2EE8;
}
v115 = GJGameLevel::getCoinKey(m_level, v109);
hasUserCoin = GameStatsManager::hasPendingUserCoin(v111, v115);
}
}
else
{
if ( !qword_1406C2EE8 )
{
v156 = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = ((__int64 (__fastcall *)(_QWORD))sub_1401D0AE0)(v156);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v111 = (GameStatsManager *)qword_1406C2EE8;
}
v112 = GJGameLevel::getCoinKey(m_level, v109);
hasUserCoin = GameStatsManager::hasSecretCoin(v111, v112);
}
v116 = hasUserCoin;
v117 = a1->m_playLayer;
v118 = cocos2d::CCString::createWithFormat("%i", v109);
v119 = cocos2d::CCString::getCString(v118);
v164 = 0;
v165 = 0;
v166 = 0;
v120 = -1;
do
++v120;
while ( v119[v120] );
sub_14003A930(&v164, v119, v120);
v121 = cocos2d::CCDictionary::objectForKey(v117->m_collectedItems, &v164);
if ( v166 > 0xF )
{
v122 = (void *)v164.m128i_i64[0];
if ( v166 + 1 >= 0x1000 )
{
v122 = *(void **)(v164.m128i_i64[0] - 8);
if ( (unsigned __int64)(v164.m128i_i64[0] - (_QWORD)v122 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v122);
}
if ( v116 )
break;
if ( v121 )
goto LABEL_128;
LABEL_134:
if ( ++v109 > SLODWORD(v145.x) )
goto LABEL_135;
}
if ( v121 )
{
LABEL_128:
v128 = "secretCoinUI_001.png";
if ( a1->m_notLocal )
v128 = "secretCoinUI2_001.png";
v124 = cocos2d::CCSprite::createWithSpriteFrameName(v128);
v129 = v124->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v130 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v110->__vftable[2].getTag)(v110);
v129->setPosition_0(v124, (const cocos2d::CCPoint *)v130);
cocos2d::CCArray::addObject(a1->m_coinsToAnimate, v124);
a1->m_animateCoins = 1;
if ( !a1->m_notLocal || a1->m_coinsVerified )
goto LABEL_134;
v152 = -20481;
v153 = -20481;
v154 = 75;
v127 = &v153;
}
else
{
v123 = "secretCoinUI_001.png";
if ( a1->m_notLocal )
v123 = "secretCoinUI2_001.png";
v124 = cocos2d::CCSprite::createWithSpriteFrameName(v123);
v125 = v124->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v126 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v110->__vftable[2].getTag)(v110);
v125->setPosition_0(v124, (const cocos2d::CCPoint *)v126);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v124, 9);
if ( !a1->m_notLocal || a1->m_coinsVerified )
goto LABEL_134;
v148 = -20481;
v146 = -20481;
v147 = 75;
v127 = &v146;
}
v124->setColor(&v124->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v127);
goto LABEL_134;
}
LABEL_135:
*(_QWORD *)&v163 = 13;
*((_QWORD *)&v163 + 1) = 15;
strcpy((char *)Block, "Geometry Dash");
HIWORD(Block[1]) = 0;
sub_14003A830((__int64)Block);
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v132, v131) + 197) )
{
v133 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v133, 10);
v134 = (cocos2d::CCPoint)v155;
(*(void (__fastcall **)(_QWORD *))(*v155 + 200LL))(v155);
v135 = (cocos2d::CCNode *)(*(__int64 (__fastcall **)(cocos2d::CCPoint))(**(_QWORD **)&v134 + 488LL))(v134);
cocos2d::CCNode::convertToWorldSpace(v135, &v160);
cocos2d::CCNode::convertToNodeSpace(a1->m_mainLayer, &v145);
cocos2d::CCPoint::CCPoint(&v156, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v145, &v155);
v133->setPosition_0(v133, (const cocos2d::CCPoint *)&v155);
v136 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v136, 10);
v137 = (cocos2d::CCPoint)v141;
(*(void (__fastcall **)(__m128i *))(v141->m128i_i64[0] + 200))(v141);
v138 = (cocos2d::CCNode *)(*(__int64 (__fastcall **)(cocos2d::CCPoint))(**(_QWORD **)&v137 + 488LL))(v137);
cocos2d::CCNode::convertToWorldSpace(v138, &v160);
v139 = cocos2d::CCNode::convertToNodeSpace(a1->m_mainLayer, &v156);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v145, v139);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v159, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v145, &v141);
v136->setPosition_0(v136, (const cocos2d::CCPoint *)&v141);
((void (__fastcall *)(struct cocos2d::CCSprite *))v136->setScale_0)(v136);
}
sub_14003A830((__int64)&v167);
}