//
// EndLevelLayer::customSetup from 0x429158 to 0x42a16a (4114 bytes)
//
// 0 xrefs:
//
// 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
//
void EndLevelLayer::customSetup(EndLevelLayer *a1)
{
cocos2d::CCDirector *v2; // r0
PlayLayer *m_playLayer; // r3
GJGameLevel *m_level; // r8
int v5; // r2
int m_orbs; // r0
int m_diamonds; // r2
bool m_secretKey; // r3
int m_stars; // r1
int v10; // r3
float v11; // r9
float v12; // s15
int v13; // r2
int m_moons; // r3
int v15; // r2
bool v16; // r3
int v17; // r3
int v18; // r2
bool v19; // r3
int v20; // r3
int v21; // r2
bool v22; // r3
const char *v23; // r0
cocos2d::CCSprite *v24; // r7
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
GameManager *v26; // r0
int v27; // r2
bool v28; // r3
int v29; // r9
cocos2d::CCString *v30; // r0
cocos2d::CCLabelBMFont *v31; // r7
const char *m_jumps; // r1
cocos2d::CCString *v33; // r0
cocos2d::CCLabelBMFont *v34; // r7
PlayLayer *v35; // r3
int v36; // r11
int v37; // r1
cocos2d::CCString *v38; // r0
char *v39; // r0
cocos2d::CCString *v40; // r0
char *v41; // r0
cocos2d::CCString *v42; // r0
char *CString; // r0
cocos2d::CCString *v44; // r0
cocos2d::CCLabelBMFont *v45; // r9
unsigned int m_points; // r1
float *v47; // r0
cocos2d::CCLabelBMFont *v48; // r7
cocos2d::CCNode *v49; // r7
float width; // s15
float height; // s14
void (__fastcall *v52)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
void (__fastcall *v53)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
PlayLayer *v54; // r3
char **v55; // r10
char **v56; // r0
cocos2d::CCNode *v57; // r7
float v58; // s15
float v59; // s14
void (__fastcall *v60)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCLabelBMFont *v61; // r7
void (__fastcall *v62)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCMenu *v63; // r0
cocos2d::CCMenu *m_sideMenu; // r10
cocos2d::CCLayer *m_mainLayer; // r7
float v66; // s13
cocos2d::CCSprite *v67; // r0
void (__fastcall *v68)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCSprite *v69; // r10
void (__fastcall *v70)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCSprite *v71; // r7
void (__fastcall *setScale)(cocos2d::CCSprite *__hidden, float); // r11
float v73; // s16
float *v74; // r0
CCMenuItemSpriteExtra *v75; // r10
cocos2d::CCMenu *v76; // r11
int v77; // r2
bool v78; // r3
cocos2d::CCSprite *v79; // r0
CCMenuItemSpriteExtra *v80; // r7
cocos2d::CCMenu *v81; // r10
int v82; // r2
bool v83; // r3
GJLevelType m_levelType; // r3
cocos2d::CCSprite *v85; // r0
CCMenuItemSpriteExtra *v86; // r6
cocos2d::CCLayer *v87; // r10
void (__fastcall *v88)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCSprite *v89; // r5
CCMenuItemSpriteExtra *v90; // r0
cocos2d::CCMenu *v91; // r6
void (__fastcall *setPosition_0)(cocos2d::CCNode *__hidden, float, float); // r7
cocos2d::CCDirector *v93; // r0
float v94; // s16
cocos2d::CCDirector *v95; // r0
float v96; // r0
cocos2d::CCFadeTo *v97; // r0
cocos2d::CCAction *v98; // r0
GJLevelType v99; // r2
int seed; // r1
int m_coins; // r9
cocos2d::CCArray *v102; // r0
int v103; // r2
bool v104; // r3
cocos2d::CCArray *v105; // r0
int v106; // r7
const char *v107; // r0
cocos2d::CCSprite *v108; // r5
int v109; // r7
int v110; // r6
GameStatsManager *v111; // r5
const char *v112; // r0
_BOOL4 hasUserCoin; // r0
_BOOL4 v114; // r5
_BOOL4 hasItem; // r0
cocos2d::CCSprite *v116; // r6
cocos2d::CCLayer *v117; // r7
cocos2d::CCNode *v118; // r8
const cocos2d::CCPoint *v119; // r0
void (__fastcall *v120)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCSprite *v121; // r6
cocos2d::CCLayer *v122; // r4
cocos2d::CCNode *v123; // r7
const cocos2d::CCPoint *v124; // r0
int v125; // r2
bool v126; // r3
void (__fastcall *v127)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r4
int PlayTimerMilli; // r7
float v129; // r6
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
GameStatsManager *v131; // r5
const char *CoinKey; // r0
GameStatsManager *v133; // r5
const char *v134; // r0
const char *v135; // r0
cocos2d::CCSprite *v136; // r5
int v137; // r0
const char *v138; // r0
int v139; // r0
void (__fastcall *v140)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
_BOOL4 m_isPlatformer; // [sp+18h] [bp-C4h]
cocos2d::CCMenu *v142; // [sp+18h] [bp-C4h]
cocos2d::CCArray *v143; // [sp+18h] [bp-C4h]
int m_unkDouble3; // [sp+1Ch] [bp-C0h]
CCMenuItemSpriteExtra *v145; // [sp+1Ch] [bp-C0h]
char *v146; // [sp+20h] [bp-BCh]
CCMenuItemSpriteExtra *v147; // [sp+20h] [bp-BCh]
int v148; // [sp+24h] [bp-B8h]
cocos2d::CCSprite *v149; // [sp+24h] [bp-B8h]
cocos2d::CCSprite *v150; // [sp+24h] [bp-B8h]
char *v151; // [sp+3Ch] [bp-A0h] BYREF
GameToolbox v152; // [sp+40h] [bp-9Ch] BYREF
char v153; // [sp+44h] [bp-98h] BYREF
int v154; // [sp+48h] [bp-94h] BYREF
int v155; // [sp+4Ch] [bp-90h] BYREF
int v156; // [sp+50h] [bp-8Ch] BYREF
int v157; // [sp+54h] [bp-88h] BYREF
int v158; // [sp+58h] [bp-84h] BYREF
char *v159; // [sp+5Ch] [bp-80h] BYREF
int v160; // [sp+60h] [bp-7Ch] BYREF
cocos2d::CCSize v161; // [sp+64h] [bp-78h] BYREF
cocos2d::CCPoint v162; // [sp+6Ch] [bp-70h] BYREF
cocos2d::CCPoint v163; // [sp+74h] [bp-68h] BYREF
cocos2d::CCPoint v164; // [sp+7Ch] [bp-60h] BYREF
cocos2d::CCPoint v165; // [sp+84h] [bp-58h] BYREF
cocos2d::CCPoint v166; // [sp+8Ch] [bp-50h] BYREF
cocos2d::CCPoint v167; // [sp+94h] [bp-48h] BYREF
cocos2d::CCPoint v168; // [sp+9Ch] [bp-40h] BYREF
void (*v169)(EndLevelLayer *, cocos2d::CCObject *); // [sp+A4h] [bp-38h]
int v170; // [sp+A8h] [bp-34h]
void (*v171)(EndLevelLayer *, cocos2d::CCObject *); // [sp+ACh] [bp-30h]
int v172; // [sp+B0h] [bp-2Ch]
void (*v173)(EndLevelLayer *, cocos2d::CCObject *); // [sp+B4h] [bp-28h]
int v174; // [sp+B8h] [bp-24h]
cocos2d::CCPoint v175; // [sp+BCh] [bp-20h] BYREF
cocos2d::CCPoint v176; // [sp+C4h] [bp-18h] BYREF
cocos2d::CCPoint v177; // [sp+CCh] [bp-10h] BYREF
a1->m_coinsToAnimate = nullptr;
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v161, v2);
m_playLayer = a1->m_playLayer;
m_level = m_playLayer->m_level;
m_isPlatformer = m_playLayer->m_isPlatformer;
if ( m_playLayer->m_endLayerStars )
{
v5 = m_level->m_stars.random - m_level->m_stars.seed;
if ( m_level->m_levelLength == 5 )
a1->m_moons = v5;
else
a1->m_stars = v5;
}
m_orbs = m_playLayer->m_orbs;
a1->m_orbs = m_orbs;
m_diamonds = m_playLayer->m_diamonds;
m_secretKey = m_playLayer->m_secretKey;
m_stars = a1->m_stars;
a1->m_diamonds = m_diamonds;
a1->m_secretKey = m_secretKey;
v10 = a1->m_moons > 0;
if ( m_stars > 0 )
++v10;
if ( m_orbs > 0 )
++v10;
if ( m_diamonds > 0 )
++v10;
if ( v10 > 2 )
{
v11 = -34.0;
v12 = 16.0;
}
else
{
v11 = -38.0;
if ( v10 == 2 )
v12 = 5.0;
else
v12 = 0.0;
}
cocos2d::CCPoint::CCPoint(&v162, (float)(v161.width * 0.5) + 120.0, (float)((float)(v161.height * 0.5) + 18.0) + v12);
m_moons = a1->m_stars;
if ( m_moons > 0 || (m_moons = a1->m_moons, m_moons > 0) )
{
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_starsPosition, COERCE_FLOAT(&v162), v13, m_moons);
cocos2d::CCPoint::CCPoint(&v176, 0.0, v11);
cocos2d::CCPoint::operator+(&v177, &v162, &v176);
cocos2d::CCPoint::operator=((PlayerObject *)&v162, COERCE_FLOAT(&v177), v15, v16);
}
v17 = a1->m_orbs;
if ( v17 > 0 )
{
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_orbsPosition, COERCE_FLOAT(&v162), v13, v17);
cocos2d::CCPoint::CCPoint(&v176, 0.0, v11);
cocos2d::CCPoint::operator+(&v177, &v162, &v176);
cocos2d::CCPoint::operator=((PlayerObject *)&v162, COERCE_FLOAT(&v177), v18, v19);
}
v20 = a1->m_diamonds;
if ( v20 > 0 )
{
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_diamondsPosition, COERCE_FLOAT(&v162), v13, v20);
cocos2d::CCPoint::CCPoint(&v176, 0.0, v11);
cocos2d::CCPoint::operator+(&v177, &v162, &v176);
cocos2d::CCPoint::operator=((PlayerObject *)&v162, COERCE_FLOAT(&v177), v21, v22);
}
if ( a1->m_playLayer->m_isPracticeMode )
v23 = "GJ_practiceComplete_001.png";
else
v23 = "GJ_levelComplete_001.png";
v24 = cocos2d::CCSprite::createWithSpriteFrameName(v23);
((void (__fastcall *)(cocos2d::CCSprite *, int))v24->setScale)(v24, 1061997773);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v24, 15);
setPosition = v24->setPosition;
cocos2d::CCPoint::CCPoint(&v177, v161.width * 0.5, (float)(v161.height * 0.5) + 75.0);
setPosition(v24, &v177);
v26 = GameManager::sharedState();
if ( GameManager::getGameVariable(v26, "0095") )
cocos2d::CCSprite::setFlipX(v24, 1);
a1->m_buttonMenu->setVisible(a1->m_buttonMenu, 0);
cocos2d::CCPoint::CCPoint(&v176, 0.0, 5.0);
cocos2d::CCPoint::operator+(&v177, &a1->m_endPosition, &v176);
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_endPosition, COERCE_FLOAT(&v177), v27, v28);
v29 = (int)v24->getPosition(v24);
cocos2d::CCPoint::CCPoint(&v177, 0.0, -40.0);
cocos2d::CCPoint::operator+(&v163, v29, &v177);
if ( m_isPlatformer )
v163.y = v163.y - 12.0;
cocos2d::CCPoint::CCPoint(&v164, &v163);
if ( m_isPlatformer )
{
PlayTimerMilli = GJBaseGameLayer::getPlayTimerMilli(a1->m_playLayer);
m_unkDouble3 = PlayTimerMilli / 1000;
v36 = PlayTimerMilli % 1000;
}
else
{
v30 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Attempts: %i",
(const char *)a1->m_playLayer->m_attempts);
cocos2d::CCString::getCString(v30);
v31 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v31, 3);
v31->setPosition(v31, &v164);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v31->setScale)(v31, 1061997773);
m_jumps = (const char *)a1->m_playLayer->m_jumps;
v164.y = v164.y - 24.0;
v33 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Jumps: %i", m_jumps);
cocos2d::CCString::getCString(v33);
v34 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v34, 3);
v34->setPosition(v34, &v164);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v34->setScale)(v34, 1061997773);
v35 = a1->m_playLayer;
v36 = 0;
v164.y = v164.y - 24.0;
m_unkDouble3 = (int)v35->m_gameState.m_unkDouble3;
}
v148 = m_unkDouble3 % 60;
v146 = (char *)(m_unkDouble3 / 60 % 60);
v37 = m_unkDouble3 / 3600;
v151 = (char *)&unk_ACDDA8;
if ( !m_isPlatformer || v146 )
{
if ( !v37 )
{
v42 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%02d:%02d", v146, v148);
goto LABEL_39;
}
LABEL_41:
v42 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%02d:%02d:%02d",
(const char *)v37,
m_unkDouble3 / 60 % 60,
m_unkDouble3 % 60);
LABEL_39:
CString = (char *)cocos2d::CCString::getCString(v42);
sub_7753D4((int)&v151, CString);
if ( !m_isPlatformer )
goto LABEL_42;
goto LABEL_36;
}
if ( v37 )
goto LABEL_41;
v38 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v148, 0);
v39 = (char *)cocos2d::CCString::getCString(v38);
sub_7753D4((int)&v151, v39);
LABEL_36:
v40 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s.%03d", v151, v36);
v41 = (char *)cocos2d::CCString::getCString(v40);
sub_7753D4((int)&v151, v41);
LABEL_42:
v44 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Time: %s", v151);
cocos2d::CCString::getCString(v44);
v45 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v45, 3);
v45->setPosition(v45, &v164);
cocos2d::CCLabelBMFont::limitLabelWidth(v45, 150.0, 0.8, 0.0);
v164.y = v164.y - 24.0;
if ( m_isPlatformer )
{
m_points = a1->m_playLayer->m_gameState.m_points;
if ( m_points )
{
GameToolbox::pointsToString(&v152, m_points);
v47 = (float *)sub_775570((int)&v152, 0, "Points: ");
v177.x = *v47;
*(_DWORD *)v47 = &unk_ACDDA8;
sub_774008(&v152);
v48 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v48, 3);
v48->setPosition(v48, &v164);
cocos2d::CCLabelBMFont::limitLabelWidth(v48, 150.0, 0.8, 0.0);
v164.y = v164.y - 24.0;
sub_774008(&v177);
}
}
if ( m_level->m_levelType == Editor )
{
sub_776584((int)&v153, " ");
cocos2d::CCPoint::CCPoint(&v177, 0.5, 1.0);
v49 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v153,
(std::string)"bigFont.fnt",
(const char *)0x3F800000,
1142620160,
&v177,
(cocos2d::CCPoint)1101004800LL);
sub_774008(&v153);
a1->m_mainLayer->addChild(a1->m_mainLayer, v49);
((void (__fastcall *)(cocos2d::CCNode *, int))v49->setScale)(v49, 1057803469);
width = v161.width;
height = v161.height;
v49[2].__vftable = (cocos2d::CCNode_vtbl *)1107820544;
v52 = v49->setPosition;
cocos2d::CCPoint::CCPoint(&v177, width * 0.5, (float)(height * 0.5) - 51.0);
v52(v49, &v177);
if ( m_isPlatformer )
{
v53 = v49->setPosition;
cocos2d::CCPoint::CCPoint(&v176, 0.0, -12.0);
cocos2d::CCPoint::operator+(&v177, &v164, &v176);
v53(v49, &v177);
}
v54 = a1->m_playLayer;
if ( v54->m_isIgnoreDamageEnabled )
{
v55 = (char **)&v154;
sub_776584((int)&v154, "You cannot verify a level after using Ignore Damage.");
TextArea::setString((int)v49, &v154);
}
else if ( v54->m_isTestMode )
{
v55 = (char **)&v155;
sub_776584((int)&v155, "You cannot verify a level if it has a start pos.");
TextArea::setString((int)v49, &v155);
}
else if ( !v54->m_isPracticeMode || m_level->m_isVerified.random - m_level->m_isVerified.seed == 1 )
{
if ( !GJGameLevel::areCoinsVerified(m_level) )
{
EndLevelLayer::getCoinString((EndLevelLayer *)&v159, (int)a1);
sub_776584((int)&v160, v159);
TextArea::setString((int)v49, &v160);
sub_774008(&v160);
v56 = &v159;
goto LABEL_58;
}
if ( m_level->m_coins <= 0 )
{
v55 = (char **)&v158;
sub_776584((int)&v158, "Level Verified!");
TextArea::setString((int)v49, &v158);
}
else
{
v55 = (char **)&v157;
sub_776584((int)&v157, "Level and Coins Verified!");
TextArea::setString((int)v49, &v157);
}
}
else
{
v55 = (char **)&v156;
sub_776584((int)&v156, "Complete the level in normal mode to verify it!");
TextArea::setString((int)v49, &v156);
}
v56 = v55;
LABEL_58:
sub_774008(v56);
goto LABEL_63;
}
if ( a1->m_playLayer->m_isPracticeMode )
{
sub_776584((int)&v166, " ");
cocos2d::CCPoint::CCPoint(&v177, 0.5, 1.0);
v57 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v166,
(std::string)"bigFont.fnt",
(const char *)0x3F800000,
1142620160,
&v177,
(cocos2d::CCPoint)1101004800LL);
sub_774008(&v166);
a1->m_mainLayer->addChild(a1->m_mainLayer, v57);
((void (__fastcall *)(cocos2d::CCNode *, int))v57->setScale)(v57, 1057803469);
v58 = v161.width;
v59 = v161.height;
v57[2].__vftable = (cocos2d::CCNode_vtbl *)1107820544;
v60 = v57->setPosition;
cocos2d::CCPoint::CCPoint(&v177, v58 * 0.5, (float)(v59 * 0.5) - 51.0);
v60(v57, &v177);
sub_776584((int)&v167, "Well done... Now try to complete it without any checkpoints!");
TextArea::setString((int)v57, &v167);
v56 = (char **)&v167;
goto LABEL_58;
}
if ( m_level->m_coins <= 0 )
{
EndLevelLayer::getEndText(a1);
v61 = cocos2d::CCLabelBMFont::create();
cocos2d::CCLabelBMFont::limitLabelWidth(v61, 260.0, 0.9, 0.0);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v61, 3);
v62 = v61->setPosition;
cocos2d::CCPoint::CCPoint(&v177, v161.width * 0.5, (float)(v161.height * 0.5) - 65.0);
v62(v61, &v177);
}
LABEL_63:
v63 = cocos2d::CCMenu::create();
a1->m_sideMenu = v63;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v63, 1);
m_sideMenu = a1->m_sideMenu;
m_mainLayer = a1->m_mainLayer;
v66 = (float)(v161.height * 0.5) - 115.0;
cocos2d::CCPoint::CCPoint(&v176, v161.width * 0.5, v66 - 10.0);
cocos2d::CCNode::convertToWorldSpace(&v177, m_mainLayer, &v176);
cocos2d::CCNode::convertToNodeSpace(&v165, m_sideMenu, &v177);
v67 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_replayBtn_001.png");
v170 = 0;
v169 = EndLevelLayer::onReplay;
v145 = CCMenuItemSpriteExtra::create(
v67,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(EndLevelLayer::onReplay, (unsigned int)a1));
a1->m_sideMenu->addChild(a1->m_sideMenu, v145);
v68 = v145->setPosition;
cocos2d::CCPoint::CCPoint(&v176, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v177, &v165, &v176);
v68(v145, &v177);
v69 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
v172 = 0;
v171 = EndLevelLayer::onMenu;
v147 = CCMenuItemSpriteExtra::create(
v69,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(EndLevelLayer::onMenu, (unsigned int)a1));
a1->m_sideMenu->addChild(a1->m_sideMenu, v147);
v70 = v147->setPosition;
cocos2d::CCPoint::CCPoint(&v176, 100.0, 0.0);
cocos2d::CCPoint::operator+(&v177, &v165, &v176);
v70(v147, &v177);
if ( m_level->m_levelType == Editor )
{
v71 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_editBtn_001.png");
setScale = v71->setScale;
v73 = v69->getContentSize(v69)->width;
v74 = (float *)v71->getContentSize(v71);
((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))setScale)(v71, v73 / *v74);
v174 = 0;
v173 = EndLevelLayer::onEdit;
v75 = CCMenuItemSpriteExtra::create(
v71,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(EndLevelLayer::onEdit, (unsigned int)a1));
a1->m_sideMenu->addChild(a1->m_sideMenu, v75);
cocos2d::CCPoint::CCPoint(&v175, v161.width * 0.5, v66 - 10.0);
v76 = a1->m_sideMenu;
cocos2d::CCNode::convertToWorldSpace(&v176, a1->m_mainLayer, &v175);
cocos2d::CCNode::convertToNodeSpace(&v177, v76, &v176);
cocos2d::CCPoint::operator=((PlayerObject *)&v175, COERCE_FLOAT(&v177), v77, v78);
v75->setPosition(v75, &v175);
}
if ( a1->m_playLayer->m_isPracticeMode )
{
v79 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_restartCheckBtn_001.png");
v175.y = 0.0;
LODWORD(v175.x) = EndLevelLayer::onRestartCheckpoint;
v80 = CCMenuItemSpriteExtra::create(
v79,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(EndLevelLayer::onRestartCheckpoint, (unsigned int)a1));
a1->m_sideMenu->addChild(a1->m_sideMenu, v80);
cocos2d::CCPoint::CCPoint(&v168, (float)(v161.width * 0.5) - 180.0, v66 - 10.0);
v81 = a1->m_sideMenu;
cocos2d::CCNode::convertToWorldSpace(&v176, a1->m_mainLayer, &v168);
cocos2d::CCNode::convertToNodeSpace(&v177, v81, &v176);
cocos2d::CCPoint::operator=((PlayerObject *)&v168, COERCE_FLOAT(&v177), v82, v83);
v80->setPosition(v80, &v168);
}
m_levelType = m_level->m_levelType;
if ( (m_isPlatformer || m_levelType != Editor) && m_levelType != Main )
{
v85 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_levelLeaderboardBtn_001.png");
v176.y = 0.0;
LODWORD(v176.x) = EndLevelLayer::onLevelLeaderboard;
v86 = CCMenuItemSpriteExtra::create(
v85,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(EndLevelLayer::onLevelLeaderboard, (unsigned int)a1));
a1->m_sideMenu->addChild(a1->m_sideMenu, v86);
v87 = a1->m_mainLayer;
v88 = v86->setPosition;
v142 = a1->m_sideMenu;
cocos2d::CCPoint::CCPoint(&v167, (float)(v161.width * 0.5) + 178.0, (float)(v161.height * 0.5) + 115.0);
cocos2d::CCNode::convertToWorldSpace(&v168, v87, &v167);
cocos2d::CCNode::convertToNodeSpace(&v177, v142, &v168);
v88(v86, &v177);
}
v89 = cocos2d::CCSprite::createWithSpriteFrameName("hideBtn_001.png");
v89->setOpacity(v89, 0);
v177.y = 0.0;
LODWORD(v177.x) = EndLevelLayer::onHideLayer;
v90 = CCMenuItemSpriteExtra::create(
v89,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(EndLevelLayer::onHideLayer, (unsigned int)a1));
v91 = cocos2d::CCMenu::createWithItem(v90);
a1->addChild_0(a1, v91, 100);
setPosition_0 = v91->setPosition_0;
v93 = cocos2d::CCDirector::sharedDirector();
v94 = COERCE_FLOAT(cocos2d::CCDirector::getScreenRight(v93)) - 17.0;
v95 = cocos2d::CCDirector::sharedDirector();
v96 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v95));
((void (__fastcall *)(cocos2d::CCMenu *, _DWORD, _DWORD))setPosition_0)(v91, LODWORD(v94), v96 - 15.0);
v97 = cocos2d::CCFadeTo::create(1.0, 0x7Du);
v98 = cocos2d::CCNode::runAction(v89, v97);
v99 = m_level->m_levelType;
seed = m_level->m_coinsVerified.seed;
m_coins = m_level->m_coins;
a1->m_notLocal = v99 != Main;
a1->m_coinsVerified = m_level->m_coinsVerified.random - seed == 1;
if ( m_coins > 0 && !a1->m_playLayer->m_isPracticeMode && v99 != Editor )
{
v102 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v98);
a1->m_coinsToAnimate = v102;
cocos2d::CCObject::retain(v102);
cocos2d::CCPoint::CCPoint(&v167, v161.width * 0.5, (float)(v161.height * 0.5) + 126.0);
cocos2d::CCPoint::CCPoint(&v168, v161.width * 0.5, (float)(v161.height * 0.5) - 64.0);
cocos2d::CCPoint::operator=((PlayerObject *)&v167, COERCE_FLOAT(&v168), v103, v104);
if ( m_coins > 4 )
{
v129 = 13.0;
}
else if ( m_coins == 4 )
{
v129 = 15.0;
}
else
{
v129 = 20.0;
}
v106 = 1;
v143 = (cocos2d::CCArray *)cocos2d::CCArray::create(v105);
do
{
if ( a1->m_notLocal )
v107 = "secretCoin_2_b_01_001.png";
else
v107 = "secretCoin_b_01_001.png";
v108 = cocos2d::CCSprite::createWithSpriteFrameName(v107);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v108, 8);
cocos2d::CCArray::addObject(v143, v108);
if ( a1->m_notLocal && !a1->m_coinsVerified )
{
setColor = v108->setColor;
LOWORD(v168.x) = -20481;
BYTE2(v168.x) = 75;
setColor(v108, (const cocos2d::ccColor3B *)&v168);
}
++v106;
}
while ( v106 <= m_coins );
cocos2d::CCPoint::CCPoint(&v168, &v167);
GameToolbox::alignItemsHorisontally(v143, v129, (cocos2d::CCPoint)(unsigned int)&v168, 0);
v109 = 1;
while ( 1 )
{
v110 = cocos2d::CCArray::objectAtIndex(v143, v109 - 1);
if ( a1->m_notLocal )
{
if ( a1->m_coinsVerified )
{
v131 = GameStatsManager::sharedState();
CoinKey = GJGameLevel::getCoinKey(m_level, v109);
hasUserCoin = GameStatsManager::hasUserCoin(v131, CoinKey);
}
else
{
v133 = GameStatsManager::sharedState();
v134 = GJGameLevel::getCoinKey(m_level, v109);
hasUserCoin = GameStatsManager::hasPendingUserCoin(v133, v134);
}
}
else
{
v111 = GameStatsManager::sharedState();
v112 = GJGameLevel::getCoinKey(m_level, v109);
hasUserCoin = GameStatsManager::hasSecretCoin(v111, v112);
}
v114 = hasUserCoin;
hasItem = GJBaseGameLayer::hasItem(a1->m_playLayer, v109);
if ( v114 )
break;
if ( hasItem )
goto LABEL_108;
LABEL_89:
if ( ++v109 > m_coins )
goto LABEL_90;
}
if ( hasItem )
{
LABEL_108:
if ( a1->m_notLocal )
v138 = "secretCoinUI2_001.png";
else
v138 = "secretCoinUI_001.png";
v136 = cocos2d::CCSprite::createWithSpriteFrameName(v138);
v150 = (cocos2d::CCSprite *)v136->setPosition;
v139 = (*(int (__fastcall **)(int))(*(_DWORD *)v110 + 96))(v110);
((void (__fastcall *)(cocos2d::CCSprite *, int))v150)(v136, v139);
cocos2d::CCArray::addObject(a1->m_coinsToAnimate, v136);
a1->m_animateCoins = 1;
}
else
{
if ( a1->m_notLocal )
v135 = "secretCoinUI2_001.png";
else
v135 = "secretCoinUI_001.png";
v136 = cocos2d::CCSprite::createWithSpriteFrameName(v135);
v149 = (cocos2d::CCSprite *)v136->setPosition;
v137 = (*(int (__fastcall **)(int))(*(_DWORD *)v110 + 96))(v110);
((void (__fastcall *)(cocos2d::CCSprite *, int))v149)(v136, v137);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v136, 9);
}
if ( a1->m_notLocal && !a1->m_coinsVerified )
{
v140 = v136->setColor;
LOWORD(v168.x) = -20481;
BYTE2(v168.x) = 75;
v140(v136, (const cocos2d::ccColor3B *)&v168);
}
goto LABEL_89;
}
LABEL_90:
sub_776584((int)&v168, "Geometry Dash");
PlatformToolbox::tryShowRateDialog((const char **)&v168);
sub_774008(&v168);
if ( PlatformToolbox::isControllerConnected() )
{
v116 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v116, 10);
v117 = a1->m_mainLayer;
v118 = v145->getParent(v145);
v119 = v145->getPosition(v145);
cocos2d::CCNode::convertToWorldSpace(&v168, v118, v119);
cocos2d::CCNode::convertToNodeSpace(&v166, v117, &v168);
v120 = v116->setPosition;
cocos2d::CCPoint::CCPoint(&v167, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v168, &v166, &v167);
v120(v116, &v168);
v121 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v121, 10);
v122 = a1->m_mainLayer;
v123 = v147->getParent(v147);
v124 = v147->getPosition(v147);
cocos2d::CCNode::convertToWorldSpace(&v167, v123, v124);
cocos2d::CCNode::convertToNodeSpace(&v168, v122, &v167);
cocos2d::CCPoint::operator=((PlayerObject *)&v166, COERCE_FLOAT(&v168), v125, v126);
v127 = v121->setPosition;
cocos2d::CCPoint::CCPoint(&v167, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v168, &v166, &v167);
v127(v121, &v168);
((void (__fastcall *)(cocos2d::CCSprite *, int))v121->setScale)(v121, 1061997773);
}
sub_774008(&v151);
}