//
// EndLevelLayer::customSetup from 0x1004c0010 to 0x1004c1950 (6464 bytes)
//
// 1 xrefs:
// > ??> @ 0x10094f360
//
// 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 __fastcall EndLevelLayer::customSetup(EndLevelLayer *a1)
{
EndLevelLayer *v1; // rbx
PlayLayer *m_playLayer; // rax
bool m_isPlatformer; // si
bool m_endLayerStars; // zf
int v5; // ecx
unsigned __int64 v6; // rcx
unsigned __int64 v7; // rax
float v8; // xmm2_4
EndLevelLayer *v9; // r13
const char *v10; // rdi
cocos2d::CCSprite *v11; // r12
GameManager *v12; // rax
EndLevelLayer *v13; // r15
double v14; // xmm0_8
unsigned __int64 *v15; // rbx
char v16; // r13
int m_unkDouble3; // eax
double v18; // xmm0_8
cocos2d::CCString *v19; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *v21; // r14
cocos2d::CCString *v22; // rax
const char *v23; // rax
cocos2d::CCLabelBMFont *v24; // rbx
int v25; // edx
unsigned int v26; // eax
cocos2d::CCString *v27; // rax
const char *v28; // rax
cocos2d::CCString *v29; // rax
const char *v30; // rax
cocos2d::CCString *v31; // rax
const char *v32; // rax
cocos2d::CCLabelBMFont *v33; // rbx
EndLevelLayer *v34; // rdi
std::string *v35; // rax
const char *v36; // rdi
cocos2d::CCLabelBMFont *v37; // rbx
char *v38; // r15
double v39; // xmm0_8
double v40; // xmm1_8
PlayLayer *v41; // rax
void *data; // rdi
char *v43; // r15
double v44; // xmm1_8
const char *EndText; // rax
cocos2d::CCLabelBMFont *v46; // r14
const char *v47; // r14
size_t v48; // rax
std::string::size_type v49; // r12
char *v50; // rbx
size_t v51; // r13
cocos2d::CCMenu *v52; // rax
EndLevelLayer *v53; // rcx
const cocos2d::CCPoint *m_sideMenu; // rbx
const cocos2d::CCPoint *m_mainLayer; // r14
cocos2d::CCSprite *v56; // rax
EndLevelLayer *v57; // rbx
CCMenuItemSpriteExtra *v58; // r14
cocos2d::CCSprite *v59; // r15
EndLevelLayer *v60; // rbx
CCMenuItemSpriteExtra *v61; // r14
cocos2d::CCSprite *v62; // rbx
float *v63; // rax
cocos2d::CCNode *v64; // rdi
EndLevelLayer *v65; // rbx
CCMenuItemSpriteExtra *v66; // r14
const cocos2d::CCPoint *v67; // rbx
double v68; // xmm0_8
cocos2d::CCSprite *v69; // rax
EndLevelLayer *v70; // rbx
CCMenuItemSpriteExtra *v71; // r14
const cocos2d::CCPoint *v72; // rbx
double v73; // xmm0_8
cocos2d::CCSprite *v74; // rax
EndLevelLayer *v75; // r15
CCMenuItemSpriteExtra *v76; // r14
const cocos2d::CCPoint *v77; // rbx
const cocos2d::CCPoint *v78; // r15
cocos2d::CCSprite *v79; // r15
CCMenuItemSpriteExtra *v80; // rax
cocos2d::CCMenu *v81; // r14
cocos2d::CCDirector *v82; // rax
cocos2d::CCDirector *v83; // rax
float v84; // xmm0_4
cocos2d::CCFadeTo *v85; // rax
GJGameLevel *v86; // rsi
GJLevelType m_levelType; // eax
EndLevelLayer *v88; // rdx
cocos2d::CCObject *v89; // rax
__int64 v91; // rax
int v92; // xmm0_4
cocos2d::CCArray *v93; // r13
int v94; // r14d
const char *v95; // rdi
cocos2d::CCSprite *v96; // rbx
unsigned int v97; // r15d
__int64 v98; // r12
GameStatsManager *v99; // rbx
const char *CoinKey; // rax
bool hasUserCoin; // al
GameStatsManager *v102; // rbx
const char *v103; // rax
GameStatsManager *v104; // rbx
const char *v105; // rax
bool v106; // bl
bool hasItem; // r14
const char *v108; // rdi
cocos2d::CCSprite *v109; // rbx
__int64 v110; // rax
const char *v111; // rdi
cocos2d::CCSprite *v112; // rbx
__int64 v113; // rax
EndLevelLayer *v114; // rax
cocos2d::CCSprite *v115; // rax
EndLevelLayer *v116; // rbx
cocos2d::CCSprite *v117; // r14
const cocos2d::CCPoint *v118; // rbx
CCMenuItemSpriteExtra *v119; // r12
const cocos2d::CCPoint *v120; // r15
cocos2d::CCSprite *v121; // rax
EndLevelLayer *v122; // rbx
cocos2d::CCSprite *v123; // r14
const cocos2d::CCPoint *v124; // rbx
CCMenuItemSpriteExtra *v125; // r12
const cocos2d::CCPoint *v126; // r15
char v127; // [rsp+0h] [rbp-1D0h]
char v128; // [rsp+0h] [rbp-1D0h]
char v129; // [rsp+0h] [rbp-1D0h]
std::string v130; // [rsp+8h] [rbp-1C8h] BYREF
__int128 v131; // [rsp+20h] [rbp-1B0h] BYREF
void *v132; // [rsp+30h] [rbp-1A0h]
__int128 v133; // [rsp+38h] [rbp-198h] BYREF
void *v134; // [rsp+48h] [rbp-188h]
std::string v135; // [rsp+50h] [rbp-180h] BYREF
std::string v136; // [rsp+68h] [rbp-168h] BYREF
std::string v137; // [rsp+80h] [rbp-150h] BYREF
std::string v138; // [rsp+98h] [rbp-138h] BYREF
std::string v139; // [rsp+B0h] [rbp-120h] BYREF
char v140; // [rsp+C8h] [rbp-108h] BYREF
_BYTE v141[23]; // [rsp+C9h] [rbp-107h] BYREF
CCMenuItemSpriteExtra *v142; // [rsp+E0h] [rbp-F0h]
CCMenuItemSpriteExtra *v143; // [rsp+E8h] [rbp-E8h]
std::string __dst; // [rsp+F0h] [rbp-E0h] BYREF
float v145; // [rsp+10Ch] [rbp-C4h]
unsigned __int64 v146; // [rsp+110h] [rbp-C0h] BYREF
double v147; // [rsp+118h] [rbp-B8h] BYREF
std::string v148; // [rsp+120h] [rbp-B0h] BYREF
std::string v149; // [rsp+138h] [rbp-98h] BYREF
unsigned __int64 v150; // [rsp+154h] [rbp-7Ch] BYREF
float v151; // [rsp+15Ch] [rbp-74h]
__int128 v152; // [rsp+160h] [rbp-70h] BYREF
void *__p; // [rsp+170h] [rbp-60h]
unsigned __int64 v154; // [rsp+178h] [rbp-58h] BYREF
GJGameLevel *m_level; // [rsp+180h] [rbp-50h]
float v156; // [rsp+18Ch] [rbp-44h] BYREF
float v157; // [rsp+190h] [rbp-40h]
int m_coins; // [rsp+194h] [rbp-3Ch]
unsigned __int64 v159; // [rsp+198h] [rbp-38h] BYREF
EndLevelLayer *v160; // [rsp+1A0h] [rbp-30h]
double v161; // 0:xmm0_8.8
double v162; // 0:xmm0_8.8
cocos2d::CCPoint v163; // 0:xmm1_8.8
v1 = a1;
a1->m_coinsToAnimate = nullptr;
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v156);
m_playLayer = a1->m_playLayer;
m_level = m_playLayer->m_level;
m_isPlatformer = m_playLayer->m_isPlatformer;
m_endLayerStars = m_playLayer->m_endLayerStars;
v160 = a1;
if ( m_endLayerStars )
{
v5 = m_level->m_stars.random - m_level->m_stars.seed;
v1 = v160;
if ( m_level->m_levelLength == 5 )
v160->m_moons = v5;
else
v160->m_stars = v5;
}
v6 = *(_QWORD *)&m_playLayer->m_orbs;
v1->m_orbs = v6;
v1->m_diamonds = HIDWORD(v6);
v1->m_secretKey = m_playLayer->m_secretKey;
v7 = (0x4332322132212110uLL >> (4
* (unsigned __int8)_mm_movemask_ps((__m128)_mm_cmpgt_epi32(
_mm_unpacklo_epi64(
(__m128i)v6,
_mm_loadl_epi64((const __m128i *)&v1->m_stars)),
(__m128i)0LL))))
& 7;
if ( (_BYTE)v7 == 2 )
v8 = 5.0;
else
v8 = 0.0;
LOBYTE(v151) = m_isPlatformer;
if ( (unsigned __int8)v7 >= 3u )
v8 = 16.0;
m_coins = SLODWORD(flt_10081D808[(unsigned __int8)v7 >= 3u]);
sub_10028CBE0((float *)&v146, (float)(v156 * 0.5) + 120.0, (float)((float)(v157 * 0.5) + 18.0) + v8);
v9 = v160;
if ( v160->m_stars > 0 || v160->m_moons > 0 )
{
sub_10028CC90(&v160->m_starsPosition, (double *)&v146);
sub_10028CBE0((float *)&v152, 0.0, *(float *)&m_coins);
sub_10028CCE0((double *)&v148, &v146, (unsigned __int64 *)&v152);
sub_10028CC90(&v146, (double *)&v148);
}
if ( v9->m_orbs > 0 )
{
sub_10028CC90(&v9->m_orbsPosition, (double *)&v146);
sub_10028CBE0((float *)&v152, 0.0, *(float *)&m_coins);
sub_10028CCE0((double *)&v148, &v146, (unsigned __int64 *)&v152);
sub_10028CC90(&v146, (double *)&v148);
}
if ( v9->m_diamonds > 0 )
{
sub_10028CC90(&v9->m_diamondsPosition, (double *)&v146);
sub_10028CBE0((float *)&v152, 0.0, *(float *)&m_coins);
sub_10028CCE0((double *)&v148, &v146, (unsigned __int64 *)&v152);
sub_10028CC90(&v146, (double *)&v148);
}
v10 = "GJ_levelComplete_001.png";
if ( v9->m_playLayer->m_isPracticeMode )
v10 = "GJ_practiceComplete_001.png";
v11 = cocos2d::CCSprite::createWithSpriteFrameName(v10);
((void (__fastcall *)(cocos2d::CCSprite *, float))v11->setScale)(v11, 0.80000001);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))v9->m_mainLayer->addChild_0)(
v9->m_mainLayer,
v11,
15);
sub_10028CBE0((float *)&v148, v156 * 0.5, (float)(v157 * 0.5) + 75.0);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v11->setPosition)(v11, &v148);
v12 = GameManager::sharedState();
if ( GameManager::getGameVariable(v12, "0095") )
cocos2d::CCSprite::setFlipX(v11, 1);
v13 = v160;
((void (__fastcall *)(cocos2d::CCMenu *, _QWORD))v160->m_buttonMenu->setVisible)(v160->m_buttonMenu, 0);
sub_10028CBE0((float *)&v152, 0.0, 5.0);
sub_10028CCE0((double *)&v148, (unsigned __int64 *)&v13->m_endPosition, (unsigned __int64 *)&v152);
v14 = sub_10028CC90(&v13->m_endPosition, (double *)&v148);
v15 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCSprite *, double))v11->getPosition)(v11, v14);
sub_10028CBE0((float *)&v148, 0.0, -40.0);
sub_10028CCE0(&v147, v15, (unsigned __int64 *)&v148);
v16 = LOBYTE(v151);
if ( LOBYTE(v151) )
{
*((float *)&v147 + 1) = *((float *)&v147 + 1) + -12.0;
sub_10028CC60(&v154, &v147);
m_unkDouble3 = GJBaseGameLayer::getPlayTimerMilli(v13->m_playLayer) / 1000;
}
else
{
v18 = sub_10028CC60(&v154, &v147);
v19 = (cocos2d::CCString *)sub_1007AB580("Attempts: %i", v127);
CString = cocos2d::CCString::getCString(v19);
v21 = cocos2d::CCLabelBMFont::create_3(CString, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64, double))v13->m_mainLayer->addChild_0)(
v13->m_mainLayer,
v21,
3,
v18);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v21->setPosition)(v21, &v154);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v21->setScale)(v21, 0.80000001);
*((float *)&v154 + 1) = *((float *)&v154 + 1) + -24.0;
v22 = (cocos2d::CCString *)sub_1007AB580("Jumps: %i", v128);
v23 = cocos2d::CCString::getCString(v22);
v24 = cocos2d::CCLabelBMFont::create_3(v23, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))v13->m_mainLayer->addChild_0)(
v13->m_mainLayer,
v24,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v24->setPosition)(v24, &v154);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v24->setScale)(v24, 0.80000001);
*((float *)&v154 + 1) = *((float *)&v154 + 1) + -24.0;
m_unkDouble3 = (int)v13->m_playLayer->m_gameState.m_unkDouble3;
}
v25 = m_unkDouble3 / 60 % 60;
memset(&v148, 0, sizeof(v148));
v26 = m_unkDouble3 + 3599;
if ( !v16 || v25 || v26 > 0x1C1E )
{
if ( v26 > 0x1C1E )
v27 = (cocos2d::CCString *)sub_1007AB580("%02d:%02d:%02d", v127);
else
v27 = (cocos2d::CCString *)sub_1007AB580("%02d:%02d", v127);
}
else
{
v27 = (cocos2d::CCString *)sub_1007AB580("%i", v127);
}
v28 = cocos2d::CCString::getCString(v27);
std::string::assign(&v148, v28);
if ( v16 )
{
v29 = (cocos2d::CCString *)sub_1007AB580("%s.%03d", v129);
v30 = cocos2d::CCString::getCString(v29);
std::string::assign(&v148, v30);
}
v31 = (cocos2d::CCString *)sub_1007AB580("Time: %s", v129);
v32 = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCLabelBMFont::create_3(v32, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))v160->m_mainLayer->addChild_0)(
v160->m_mainLayer,
v33,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v33->setPosition)(v33, &v154);
v34 = (EndLevelLayer *)v33;
cocos2d::CCLabelBMFont::limitLabelWidth(v33, 150.0, 0.80000001, 0.0);
*((float *)&v154 + 1) = *((float *)&v154 + 1) + -24.0;
if ( v16 && v160->m_playLayer->m_gameState.m_points )
{
GameToolbox::pointsToString(&v149);
v35 = std::string::insert(&v149, 0, "Points: ");
__p = v35->__r_.__value_.__l.__data_;
v152 = *(_OWORD *)&v35->__r_.__value_.__l.0;
*(_OWORD *)&v35->__r_.__value_.__l.0 = 0;
v35->__r_.__value_.__r.__words[2] = 0;
if ( (*(_BYTE *)&v149.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v149.__r_.__value_.__l.__data_);
if ( (v152 & 1) != 0 )
v36 = (const char *)__p;
else
v36 = (char *)&v152 + 1;
v37 = cocos2d::CCLabelBMFont::create_3(v36, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))v160->m_mainLayer->addChild_0)(
v160->m_mainLayer,
v37,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v37->setPosition)(v37, &v154);
v34 = (EndLevelLayer *)v37;
cocos2d::CCLabelBMFont::limitLabelWidth(v37, 150.0, 0.80000001, 0.0);
*((float *)&v154 + 1) = *((float *)&v154 + 1) + -24.0;
if ( (v152 & 1) != 0 )
{
v34 = (EndLevelLayer *)__p;
operator delete(__p);
}
}
if ( m_level->m_levelType == Editor )
{
LOWORD(v131) = 8194;
BYTE2(v131) = 0;
sub_10028CBE0((float *)&v152, 0.5, 1.0);
v38 = TextArea::create(&v131, (__int64)"bigFont.fnt", (double *)&v152, 0, 1.0, 620.0, 20.0);
if ( (v131 & 1) != 0 )
operator delete(v132);
((void (__fastcall *)(cocos2d::CCLayer *, char *))v160->m_mainLayer->addChild)(v160->m_mainLayer, v38);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v38 + 160LL))(v38, 0.55000001);
*((_DWORD *)v38 + 160) = 1107820544;
*(_QWORD *)&v39 = LODWORD(v156);
HIDWORD(v40) = 0;
*(float *)&v39 = v156 * 0.5;
*(float *)&v40 = (float)(0.5 * v157) + -51.0;
sub_10028CBE0((float *)&v152, v156 * 0.5, *(float *)&v40);
(*(void (__fastcall **)(char *, __int128 *))(*(_QWORD *)v38 + 184LL))(v38, &v152);
if ( v16 )
{
*(_QWORD *)&v40 = 3242196992LL;
v39 = 0.0;
sub_10028CBE0((float *)&v149, 0.0, -12.0);
sub_10028CCE0((double *)&v152, &v154, (unsigned __int64 *)&v149);
(*(void (__fastcall **)(char *, __int128 *))(*(_QWORD *)v38 + 184LL))(v38, &v152);
}
v41 = v160->m_playLayer;
if ( v41->m_isIgnoreDamageEnabled )
{
v135.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v135.__r_.__value_.__r.__words[0] = 57;
v135.__r_.__value_.__l.__size_ = 52;
strcpy(v135.__r_.__value_.__l.__data_, "You cannot verify a level after using Ignore Damage.");
TextArea::setString((__int64)v38, &v135, 8.785380021880852e223, v40, (__m128)0x41A00000u, (__m128)0x3F000000u);
if ( (*(_BYTE *)&v135.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_86;
data = v135.__r_.__value_.__l.__data_;
goto LABEL_85;
}
if ( v41->m_isTestMode )
{
v136.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x38u);
v136.__r_.__value_.__r.__words[0] = 57;
v136.__r_.__value_.__l.__size_ = 48;
strcpy(v136.__r_.__value_.__l.__data_, "You cannot verify a level if it has a start pos.");
TextArea::setString((__int64)v38, &v136, 8.785380021880852e223, v40, (__m128)0x41A00000u, (__m128)0x3F000000u);
if ( (*(_BYTE *)&v136.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_86;
data = v136.__r_.__value_.__l.__data_;
goto LABEL_85;
}
if ( v41->m_isPracticeMode && m_level->m_isVerified.random - m_level->m_isVerified.seed != 1 )
{
v137.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x30u);
v137.__r_.__value_.__r.__words[0] = 49;
v137.__r_.__value_.__l.__size_ = 47;
strcpy(v137.__r_.__value_.__l.__data_, "Complete the level in normal mode to verify it!");
TextArea::setString((__int64)v38, &v137, 5.289643183723649e180, v40, (__m128)0x41A00000u, (__m128)0x3F000000u);
if ( (*(_BYTE *)&v137.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_86;
data = v137.__r_.__value_.__l.__data_;
goto LABEL_85;
}
if ( GJGameLevel::areCoinsVerified(m_level) )
{
if ( m_level->m_coins <= 0 )
{
sub_100030790(&v130, "Level Verified!", v39);
TextArea::setString((__int64)v38, &v130, v39, v40, (__m128)0x41A00000u, (__m128)0x3F000000u);
if ( (*(_BYTE *)&v130.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_86;
data = v130.__r_.__value_.__l.__data_;
}
else
{
v138.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x20u);
v138.__r_.__value_.__r.__words[0] = 33;
v138.__r_.__value_.__l.__size_ = 25;
strcpy(v138.__r_.__value_.__l.__data_, "Level and Coins Verified!");
TextArea::setString((__int64)v38, &v138, 4.952669179195559e223, v40, (__m128)0x41A00000u, (__m128)0x3F000000u);
if ( (*(_BYTE *)&v138.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_86;
data = v138.__r_.__value_.__l.__data_;
}
goto LABEL_85;
}
EndLevelLayer::getCoinString(&v152, v160);
if ( (v152 & 1) != 0 )
v47 = (const char *)__p;
else
v47 = (char *)&v152 + 1;
v48 = strlen(v47);
if ( v48 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v39);
v49 = v48;
if ( v48 >= 0x17 )
{
v51 = 26;
if ( (v48 | 7) != 0x17 )
v51 = (v48 | 7) + 1;
v50 = (char *)operator new(v51);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v50;
__dst.__r_.__value_.__r.__words[0] = v51 | 1;
__dst.__r_.__value_.__l.__size_ = v49;
v16 = LOBYTE(v151);
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v48);
v50 = __dst.__r_.__value_.__s.__data_;
if ( !v48 )
{
LABEL_79:
v50[v49] = 0;
TextArea::setString((__int64)v38, &__dst, v39, v40, (__m128)0x41A00000u, (__m128)0x3F000000u);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( (v152 & 1) != 0 )
{
data = __p;
goto LABEL_85;
}
goto LABEL_86;
}
}
memmove(v50, v47, v49);
goto LABEL_79;
}
if ( v160->m_playLayer->m_isPracticeMode )
{
LOWORD(v133) = 8194;
BYTE2(v133) = 0;
sub_10028CBE0((float *)&v152, 0.5, 1.0);
v43 = TextArea::create(&v133, (__int64)"bigFont.fnt", (double *)&v152, 0, 1.0, 620.0, 20.0);
if ( (v133 & 1) != 0 )
operator delete(v134);
((void (__fastcall *)(cocos2d::CCLayer *, char *))v160->m_mainLayer->addChild)(v160->m_mainLayer, v43);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v43 + 160LL))(v43, 0.55000001);
*((_DWORD *)v43 + 160) = 1107820544;
HIDWORD(v44) = 0;
*(float *)&v44 = (float)(0.5 * v157) + -51.0;
sub_10028CBE0((float *)&v152, v156 * 0.5, *(float *)&v44);
(*(void (__fastcall **)(char *, __int128 *))(*(_QWORD *)v43 + 184LL))(v43, &v152);
v139.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v139.__r_.__value_.__r.__words[0] = 65;
v139.__r_.__value_.__l.__size_ = 60;
strcpy(v139.__r_.__value_.__l.__data_, "Well done... Now try to complete it without any checkpoints!");
TextArea::setString((__int64)v43, &v139, 9.077653538400533e223, v44, (__m128)0x41A00000u, (__m128)0x3F000000u);
if ( (*(_BYTE *)&v139.__r_.__value_.__s.0 & 1) != 0 )
{
data = v139.__r_.__value_.__l.__data_;
LABEL_85:
operator delete(data);
}
}
else if ( m_level->m_coins <= 0 )
{
EndText = EndLevelLayer::getEndText(v34);
v46 = cocos2d::CCLabelBMFont::create_3(EndText, "bigFont.fnt");
cocos2d::CCLabelBMFont::limitLabelWidth(v46, 260.0, 0.89999998, 0.0);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))v160->m_mainLayer->addChild_0)(
v160->m_mainLayer,
v46,
3);
sub_10028CBE0((float *)&v152, v156 * 0.5, (float)(v157 * 0.5) + -65.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int128 *))v46->setPosition)(v46, &v152);
}
LABEL_86:
v52 = cocos2d::CCMenu::create();
v53 = v160;
v160->m_sideMenu = v52;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))v53->m_mainLayer->addChild_0)(
v53->m_mainLayer,
v52,
1);
m_sideMenu = (const cocos2d::CCPoint *)v160->m_sideMenu;
m_mainLayer = (const cocos2d::CCPoint *)v160->m_mainLayer;
*(float *)&m_coins = (float)((float)(v157 * 0.5) + -115.0) + -10.0;
sub_10028CBE0((float *)&v159, v156 * 0.5, *(float *)&m_coins);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v149, m_mainLayer);
*(cocos2d::CCPoint *)&v161 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v152, m_sideMenu);
v56 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_replayBtn_001.png");
v57 = v160;
v58 = CCMenuItemSpriteExtra::create(
v56,
nullptr,
v160,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EndLevelLayer::onReplay);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *, double))v57->m_sideMenu->addChild)(
v57->m_sideMenu,
v58,
v161);
v142 = v58;
sub_10028CBE0((float *)&v159, -100.0, 0.0);
sub_10028CCE0((double *)&v149, (unsigned __int64 *)&v152, &v159);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *))v142->setPosition)(v142, &v149);
v59 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
v60 = v160;
v61 = CCMenuItemSpriteExtra::create(
v59,
nullptr,
v160,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EndLevelLayer::onMenu);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v60->m_sideMenu->addChild)(v60->m_sideMenu, v61);
v143 = v61;
sub_10028CBE0((float *)&v159, 100.0, 0.0);
sub_10028CCE0((double *)&v149, (unsigned __int64 *)&v152, &v159);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *))v143->setPosition)(v143, &v149);
if ( m_level->m_levelType == Editor )
{
v62 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_editBtn_001.png");
v145 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v59->getContentSize)(v59);
v63 = (float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v62->getContentSize)(v62);
((void (__fastcall *)(cocos2d::CCSprite *, float))v62->setScale)(v62, v145 / *v63);
v64 = v62;
v65 = v160;
v66 = CCMenuItemSpriteExtra::create(
v64,
nullptr,
v160,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EndLevelLayer::onEdit);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v65->m_sideMenu->addChild)(v65->m_sideMenu, v66);
sub_10028CBE0((float *)&v149, v156 * 0.5, *(float *)&m_coins);
v67 = (const cocos2d::CCPoint *)v160->m_sideMenu;
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v150, (const cocos2d::CCPoint *)v160->m_mainLayer);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v159, v67);
v68 = sub_10028CC90(&v149, (double *)&v159);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, double))v66->setPosition)(v66, &v149, v68);
}
if ( v160->m_playLayer->m_isPracticeMode )
{
v69 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_restartCheckBtn_001.png");
v70 = v160;
v71 = CCMenuItemSpriteExtra::create(
v69,
nullptr,
v160,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EndLevelLayer::onRestartCheckpoint);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v70->m_sideMenu->addChild)(v70->m_sideMenu, v71);
sub_10028CBE0((float *)&v149, (float)(v156 * 0.5) + -180.0, *(float *)&m_coins);
v72 = (const cocos2d::CCPoint *)v160->m_sideMenu;
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v150, (const cocos2d::CCPoint *)v160->m_mainLayer);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v159, v72);
v73 = sub_10028CC90(&v149, (double *)&v159);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, double))v71->setPosition)(v71, &v149, v73);
}
if ( !((unsigned __int8)~v16 & (m_level->m_levelType == Editor) | (m_level->m_levelType == Main)) )
{
v74 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_levelLeaderboardBtn_001.png");
v75 = v160;
v76 = CCMenuItemSpriteExtra::create(
v74,
nullptr,
v160,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EndLevelLayer::onLevelLeaderboard);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v75->m_sideMenu->addChild)(v75->m_sideMenu, v76);
v77 = (const cocos2d::CCPoint *)v75->m_sideMenu;
v78 = (const cocos2d::CCPoint *)v75->m_mainLayer;
sub_10028CBE0((float *)&v150, (float)(v156 * 0.5) + 178.0, (float)(v157 * 0.5) + 115.0);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v159, v78);
*(cocos2d::CCPoint *)&v162 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v149, v77);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, double))v76->setPosition)(v76, &v149, v162);
}
v79 = cocos2d::CCSprite::createWithSpriteFrameName("hideBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v79->setOpacity)(v79, 0);
v80 = CCMenuItemSpriteExtra::create(
v79,
nullptr,
v160,
(cocos2d::SEL_MenuHandler)(unsigned __int64)EndLevelLayer::onHideLayer);
v81 = cocos2d::CCMenu::createWithItem(v80);
((void (__fastcall *)(EndLevelLayer *, cocos2d::CCMenu *, __int64))v160->addChild_0)(v160, v81, 100);
v82 = cocos2d::CCDirector::sharedDirector();
*(float *)&m_coins = sub_100484DA0((__int64)v82);
v83 = cocos2d::CCDirector::sharedDirector();
v84 = sub_100484D70((__int64)v83);
((void (__fastcall *)(cocos2d::CCMenu *, float, float))v81->setPosition_0)(
v81,
*(float *)&m_coins + -17.0,
v84 + -15.0);
v85 = cocos2d::CCFadeTo::create(1.0, 0x7Du);
cocos2d::CCNode::runAction(v79, v85);
v86 = m_level;
m_levelType = m_level->m_levelType;
v88 = v160;
v160->m_notLocal = m_levelType != Main;
v88->m_coinsVerified = v86->m_coinsVerified.random - v86->m_coinsVerified.seed == 1;
m_coins = v86->m_coins;
if ( m_coins > 0 && !v160->m_playLayer->m_isPracticeMode && m_levelType != Editor )
{
v89 = (cocos2d::CCObject *)sub_10071F9E0(v79, v86);
v160->m_coinsToAnimate = (cocos2d::CCArray *)v89;
cocos2d::CCObject::retain(v89);
sub_10028CBE0((float *)&v149, v156 * 0.5, (float)(v157 * 0.5) + 126.0);
v163.y = 0.0;
v163.x = (float)(0.5 * v157) + -64.0;
sub_10028CBE0((float *)&v159, v156 * 0.5, v163.x);
sub_10028CC90(&v149, (double *)&v159);
v91 = 0;
if ( (unsigned int)m_coins > 4 )
{
v92 = 1095761920;
}
else
{
LOBYTE(v91) = m_coins == 4;
v92 = dword_10081D810[v91];
}
v151 = *(float *)&v92;
v93 = (cocos2d::CCArray *)sub_10071F9E0(&v149, &v159);
v94 = m_coins;
do
{
v95 = "secretCoin_2_b_01_001.png";
if ( !v160->m_notLocal )
v95 = "secretCoin_b_01_001.png";
v96 = cocos2d::CCSprite::createWithSpriteFrameName(v95);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))v160->m_mainLayer->addChild_0)(
v160->m_mainLayer,
v96,
8);
sub_10071FCD0(v93, v96);
if ( v160->m_notLocal && !v160->m_coinsVerified )
{
BYTE2(v159) = 75;
LOWORD(v159) = -20481;
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v96->setColor)(v96, &v159);
}
--v94;
}
while ( v94 );
sub_10028CC60(&v159, (double *)&v149);
v97 = 0;
GameToolbox::alignItemsHorisontally(v93, v151, v163, (bool)&v159);
do
{
v98 = sub_1007200C0(v93, v97++);
if ( v160->m_notLocal )
{
if ( v160->m_coinsVerified )
{
v99 = GameStatsManager::sharedState();
CoinKey = GJGameLevel::getCoinKey(m_level, v97);
hasUserCoin = GameStatsManager::hasUserCoin(v99, CoinKey);
}
else
{
v104 = GameStatsManager::sharedState();
v105 = GJGameLevel::getCoinKey(m_level, v97);
hasUserCoin = GameStatsManager::hasPendingUserCoin(v104, v105);
}
}
else
{
v102 = GameStatsManager::sharedState();
v103 = GJGameLevel::getCoinKey(m_level, v97);
hasUserCoin = GameStatsManager::hasSecretCoin(v102, v103);
}
v106 = hasUserCoin;
hasItem = GJBaseGameLayer::hasItem(v160->m_playLayer, v97);
if ( !hasItem && v106 )
{
v108 = "secretCoinUI_001.png";
if ( v160->m_notLocal )
v108 = "secretCoinUI2_001.png";
v109 = cocos2d::CCSprite::createWithSpriteFrameName(v108);
v110 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v98 + 192LL))(v98);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v109->setPosition)(v109, v110);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))v160->m_mainLayer->addChild_0)(
v160->m_mainLayer,
v109,
9);
if ( v160->m_notLocal && !v160->m_coinsVerified )
{
BYTE2(v159) = 75;
LOWORD(v159) = -20481;
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v109->setColor)(v109, &v159);
}
}
if ( hasItem )
{
v111 = "secretCoinUI_001.png";
if ( v160->m_notLocal )
v111 = "secretCoinUI2_001.png";
v112 = cocos2d::CCSprite::createWithSpriteFrameName(v111);
v113 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v98 + 192LL))(v98);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v112->setPosition)(v112, v113);
sub_10071FCD0(v160->m_coinsToAnimate, v112);
v114 = v160;
v160->m_animateCoins = 1;
if ( v114->m_notLocal && !v160->m_coinsVerified )
{
BYTE2(v159) = 75;
LOWORD(v159) = -20481;
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v112->setColor)(v112, &v159);
}
}
}
while ( m_coins != v97 );
}
v140 = 26;
strcpy(v141, "Geometry Dash");
PlatformToolbox::tryShowRateDialog(&v140);
if ( (v140 & 1) != 0 )
operator delete(*(void **)&v141[15]);
if ( PlatformToolbox::isControllerConnected() )
{
v115 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
v116 = v160;
v117 = v115;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))v160->m_mainLayer->addChild_0)(
v160->m_mainLayer,
v115,
10);
v118 = (const cocos2d::CCPoint *)v116->m_mainLayer;
v119 = v142;
v120 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v142->getParent)(v142);
((void (__fastcall *)(CCMenuItemSpriteExtra *))v119->getPosition)(v119);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v159, v120);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v149, v118);
sub_10028CBE0((float *)&v150, 0.0, -25.0);
sub_10028CCE0((double *)&v159, (unsigned __int64 *)&v149, &v150);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v117->setPosition)(v117, &v159);
v121 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
v122 = v160;
v123 = v121;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))v160->m_mainLayer->addChild_0)(
v160->m_mainLayer,
v121,
10);
v124 = (const cocos2d::CCPoint *)v122->m_mainLayer;
v125 = v143;
v126 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v143->getParent)(v143);
((void (__fastcall *)(CCMenuItemSpriteExtra *))v125->getPosition)(v125);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v150, v126);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v159, v124);
sub_10028CC90(&v149, (double *)&v159);
sub_10028CBE0((float *)&v150, 0.0, -25.0);
sub_10028CCE0((double *)&v159, (unsigned __int64 *)&v149, &v150);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v123->setPosition)(v123, &v159);
((void (__fastcall *)(cocos2d::CCSprite *, float))v123->setScale)(v123, 0.80000001);
}
if ( (*(_BYTE *)&v148.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v148.__r_.__value_.__l.__data_);
}