//
// EndLevelLayer::customSetup from 0x1002f589c to 0x1002f6dac (5392 bytes)
//
// 1 xrefs:
// > ??> @ 0x1007e94e0
//
// 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)
{
cocos2d::CCDirector *v2; // x0
PlayLayer *m_playLayer; // x9
int m_isPlatformer; // w25
int v5; // w10
int32x4_t v6; // q0
__n128 v7; // q1
bool v8; // zf
bool v9; // cc
__n128 v10; // q0
float v11; // s8
float v12; // s3
__n128 v13; // q0
__n128 v14; // q1
__n128 v15; // q0
__n128 v16; // q1
__n128 v17; // q0
__n128 v18; // q1
const char *v19; // x0
cocos2d::CCSprite *v20; // x21
__n128 v21; // q0
__n128 v22; // q1
GameManager *v23; // x0
__n128 v24; // q0
__n128 v25; // q1
double v26; // d0
float32x2_t *v27; // x21
__n128 v28; // q1
__n128 v29; // q0
int PlayTimerMilli; // w0
int m_unkDouble3; // w8
int v32; // w20
cocos2d::CCString *v33; // x0
const char *CString; // x0
cocos2d::CCLabelBMFont *v35; // x22
cocos2d::CCString *v36; // x0
const char *v37; // x0
cocos2d::CCLabelBMFont *v38; // x21
int v39; // w10
unsigned int v40; // w11
cocos2d::CCString *v41; // x0
const char *v42; // x0
std::string *v43; // x8
cocos2d::CCString *v44; // x0
const char *v45; // x0
std::string *v46; // x8
cocos2d::CCString *v47; // x0
const char *v48; // x0
cocos2d::CCLabelBMFont *v49; // x21
__int64 m_points; // x0
std::string *v51; // x0
__int128 v52; // q0
const char *v53; // x0
cocos2d::CCLabelBMFont *v54; // x21
__n128 v55; // q0
__n128 v56; // q1
cocos2d::CCObject *v57; // x21
__n128 v58; // q0
__n128 v59; // q1
__n128 v60; // q0
__n128 v61; // q1
double v62; // d0
void *v63; // x0
__n128 v64; // q0
__n128 v65; // q1
cocos2d::CCObject *v66; // x21
__n128 v67; // q0
__n128 v68; // q1
const char *EndText; // x0
cocos2d::CCLabelBMFont *v70; // x21
__n128 v71; // q0
__n128 v72; // q1
char *v73; // x1
__n128 v74; // q0
float v75; // s9
cocos2d::CCMenu *m_sideMenu; // x21
cocos2d::CCLayer *m_mainLayer; // x22
__n128 v78; // q1
cocos2d::CCSprite *v79; // x0
CCMenuItemSpriteExtra *v80; // x20
__n128 v81; // q0
__n128 v82; // q1
double v83; // d0
cocos2d::CCSprite *v84; // x23
CCMenuItemSpriteExtra *v85; // x20
__n128 v86; // q0
__n128 v87; // q1
double v88; // d0
cocos2d::CCSprite *v89; // x24
float v90; // s10
float *v91; // x0
CCMenuItemSpriteExtra *v92; // x23
__n128 v93; // q0
__n128 v94; // q1
cocos2d::CCMenu *v95; // x24
double v96; // d0
cocos2d::CCSprite *v97; // x0
CCMenuItemSpriteExtra *v98; // x23
__n128 v99; // q0
__n128 v100; // q1
cocos2d::CCMenu *v101; // x24
double v102; // d0
GJLevelType m_levelType; // w8
cocos2d::CCSprite *v104; // x0
CCMenuItemSpriteExtra *v105; // x23
__n128 v106; // q0
cocos2d::CCMenu *v107; // x24
cocos2d::CCLayer *v108; // x25
__n128 v109; // q1
cocos2d::CCSprite *v110; // x23
CCMenuItemSpriteExtra *v111; // x0
cocos2d::CCMenu *v112; // x24
cocos2d::CCDirector *v113; // x0
float v114; // s9
float v115; // s10
cocos2d::CCDirector *v116; // x0
float v117; // s0
cocos2d::CCFadeTo *v118; // x0
GJLevelType v119; // w8
int m_coins; // w28
cocos2d::CCArray *v121; // x0
__n128 v122; // q0
__n128 v123; // q1
__n128 v124; // q0
__n128 v125; // q1
float v126; // s0
float v127; // s9
cocos2d::CCArray *v128; // x23
int v129; // w25
const char *v130; // x0
cocos2d::CCSprite *v131; // x24
unsigned int i; // w24
__int64 v133; // x25
GameStatsManager *v134; // x26
const char *CoinKey; // x0
bool hasUserCoin; // w0
GameStatsManager *v137; // x26
const char *v138; // x0
GameStatsManager *v139; // x26
const char *v140; // x0
bool v141; // w27
_BOOL4 hasItem; // w26
const char *v143; // x0
cocos2d::CCSprite *v144; // x27
__int64 v145; // x0
const char *v146; // x0
cocos2d::CCSprite *v147; // x26
__int64 v148; // x0
cocos2d::CCSprite *v149; // x20
cocos2d::CCLayer *v150; // x23
cocos2d::CCNode *v151; // x24
const cocos2d::CCPoint *v152; // x0
__n128 v153; // q0
__n128 v154; // q1
double v155; // d0
cocos2d::CCSprite *v156; // x20
cocos2d::CCLayer *v157; // x19
cocos2d::CCNode *v158; // x22
const cocos2d::CCPoint *v159; // x0
__n128 v160; // q0
__n128 v161; // q1
double v162; // d0
CCMenuItemSpriteExtra *v163; // [xsp+20h] [xbp-200h]
CCMenuItemSpriteExtra *v164; // [xsp+28h] [xbp-1F8h]
GJGameLevel *m_level; // [xsp+30h] [xbp-1F0h]
void *v166; // [xsp+38h] [xbp-1E8h] BYREF
char v167; // [xsp+4Fh] [xbp-1D1h]
float32x2_t v168; // [xsp+50h] [xbp-1D0h] BYREF
float32x2_t v169; // [xsp+58h] [xbp-1C8h] BYREF
const void *v170[2]; // [xsp+60h] [xbp-1C0h] BYREF
char v171; // [xsp+77h] [xbp-1A9h]
void *__p[2]; // [xsp+78h] [xbp-1A8h] BYREF
char v173; // [xsp+8Fh] [xbp-191h]
void *v174[2]; // [xsp+90h] [xbp-190h] BYREF
char v175; // [xsp+A7h] [xbp-179h]
void *v176[2]; // [xsp+A8h] [xbp-178h] BYREF
char v177; // [xsp+BFh] [xbp-161h]
const void *v178[2]; // [xsp+C0h] [xbp-160h] BYREF
char v179; // [xsp+D7h] [xbp-149h]
const void *v180[2]; // [xsp+D8h] [xbp-148h] BYREF
char v181; // [xsp+EFh] [xbp-131h]
const void *v182[2]; // [xsp+F0h] [xbp-130h] BYREF
char v183; // [xsp+107h] [xbp-119h]
const void *v184[2]; // [xsp+108h] [xbp-118h] BYREF
char v185; // [xsp+11Fh] [xbp-101h]
void *v186[2]; // [xsp+120h] [xbp-100h] BYREF
char v187; // [xsp+137h] [xbp-E9h]
std::string v188; // [xsp+138h] [xbp-E8h] BYREF
__int128 v189; // [xsp+150h] [xbp-D0h] BYREF
signed __int64 v190; // [xsp+160h] [xbp-C0h]
std::string v191; // [xsp+170h] [xbp-B0h] BYREF
float32x2_t v192; // [xsp+188h] [xbp-98h] BYREF
float32x2_t v193; // [xsp+190h] [xbp-90h] BYREF
float32x2_t v194; // [xsp+198h] [xbp-88h] BYREF
float v195; // [xsp+1A0h] [xbp-80h]
float v196; // [xsp+1A4h] [xbp-7Ch]
cocos2d::CCPoint v197; // 0:kr40_8.8
cocos2d::SEL_MenuHandler v198; // 0:x3.16
cocos2d::SEL_MenuHandler v199; // 0:x3.16
cocos2d::SEL_MenuHandler v200; // 0:x3.16
cocos2d::SEL_MenuHandler v201; // 0:x3.16
cocos2d::SEL_MenuHandler v202; // 0:x3.16
cocos2d::SEL_MenuHandler v203; // 0:x3.16
cocos2d::CCPoint v204; // 0:s1.4,4:s2.4
a1->m_coinsToAnimate = nullptr;
v2 = cocos2d::CCDirector::sharedDirector();
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 )
{
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;
}
v6.i64[0] = *(_QWORD *)&m_playLayer->m_orbs;
a1->m_orbs = v6.i32[0];
a1->m_diamonds = v6.i32[1];
v6.i64[1] = *(_QWORD *)&a1->m_stars;
v7 = (__n128)xmmword_100644BB0;
v10 = (__n128)vandq_s8((int8x16_t)vcgtzq_s32(v6), (int8x16_t)xmmword_100644BB0);
v10.n128_u32[0] = vaddvq_s32((int32x4_t)v10) & 0xF;
v10.n128_u64[0] = (unsigned __int64)vcnt_s8((int8x8_t)v10.n128_u64[0]);
v10.n128_u16[0] = vaddlv_u8((uint8x8_t)v10.n128_u64[0]);
v8 = v10.n128_u32[0] == 2;
v9 = v10.n128_u32[0] > 2;
v10.n128_u32[0] = 0;
if ( v8 )
v10.n128_f32[0] = 5.0;
if ( v9 )
v11 = -34.0;
else
v11 = -38.0;
v7.n128_u32[0] = 16.0;
if ( !v9 )
v7.n128_f32[0] = v10.n128_f32[0];
v12 = v196;
v10.n128_f32[0] = (float)(v195 * 0.5) + 120.0;
a1->m_secretKey = m_playLayer->m_secretKey;
v7.n128_f32[0] = (float)((float)(v12 * 0.5) + 18.0) + v7.n128_f32[0];
sub_100022980(v10, v7, &v194);
if ( a1->m_stars >= 1 || a1->m_moons >= 1 )
{
v13.n128_f64[0] = sub_1000229D0(&a1->m_starsPosition, (double *)&v194);
v13.n128_u32[0] = 0;
v14.n128_f32[0] = v11;
sub_100022980(v13, v14, &v189);
sub_1000229DC(&v194, (float32x2_t *)&v189, (float32x2_t *)&v191);
sub_1000229D0(&v194, (double *)&v191);
}
if ( a1->m_orbs >= 1 )
{
v15.n128_f64[0] = sub_1000229D0(&a1->m_orbsPosition, (double *)&v194);
v15.n128_u32[0] = 0;
v16.n128_f32[0] = v11;
sub_100022980(v15, v16, &v189);
sub_1000229DC(&v194, (float32x2_t *)&v189, (float32x2_t *)&v191);
sub_1000229D0(&v194, (double *)&v191);
}
if ( a1->m_diamonds >= 1 )
{
v17.n128_f64[0] = sub_1000229D0(&a1->m_diamondsPosition, (double *)&v194);
v17.n128_u32[0] = 0;
v18.n128_f32[0] = v11;
sub_100022980(v17, v18, &v189);
sub_1000229DC(&v194, (float32x2_t *)&v189, (float32x2_t *)&v191);
sub_1000229D0(&v194, (double *)&v191);
}
if ( a1->m_playLayer->m_isPracticeMode )
v19 = "GJ_practiceComplete_001.png";
else
v19 = "GJ_levelComplete_001.png";
v20 = cocos2d::CCSprite::createWithSpriteFrameName(v19);
((void (__fastcall *)(cocos2d::CCSprite *, float))v20->setScale)(v20, 0.8);
v21 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v20,
15);
v21.n128_f32[0] = v195 * 0.5;
v22.n128_f32[0] = (float)(v196 * 0.5) + 75.0;
sub_100022980(v21, v22, &v191);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v20->setPosition)(v20, &v191);
v23 = GameManager::sharedState();
if ( GameManager::getGameVariable(v23, "0095") )
cocos2d::CCSprite::setFlipX(v20, 1);
v24 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, _QWORD))a1->m_buttonMenu->setVisible)(a1->m_buttonMenu, 0);
v24.n128_u32[0] = 0;
v25.n128_u32[0] = 5.0;
sub_100022980(v24, v25, &v189);
sub_1000229DC((float32x2_t *)&a1->m_endPosition, (float32x2_t *)&v189, (float32x2_t *)&v191);
v26 = sub_1000229D0(&a1->m_endPosition, (double *)&v191);
v27 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCSprite *, double))v20->getPosition)(v20, v26);
v28.n128_u32[0] = -1038090240;
v29.n128_u32[0] = 0;
sub_100022980(v29, v28, &v191);
sub_1000229DC(v27, (float32x2_t *)&v191, &v193);
if ( m_isPlatformer )
{
v193.f32[1] = v193.f32[1] + -12.0;
sub_1000229B8((__int64 *)&v192, (__int64 *)&v193);
PlayTimerMilli = GJBaseGameLayer::getPlayTimerMilli(a1->m_playLayer);
m_unkDouble3 = PlayTimerMilli / 1000;
v32 = PlayTimerMilli % 1000;
}
else
{
sub_1000229B8((__int64 *)&v192, (__int64 *)&v193);
v33 = (cocos2d::CCString *)sub_100268F4C("Attempts: %i", a1->m_playLayer->m_attempts);
CString = cocos2d::CCString::getCString(v33);
v35 = cocos2d::CCLabelBMFont::create_1(CString, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v35,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v35->setPosition)(v35, &v192);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v35->setScale)(v35, 0.8);
v192.f32[1] = v192.f32[1] + -24.0;
v36 = (cocos2d::CCString *)sub_100268F4C("Jumps: %i", a1->m_playLayer->m_jumps);
v37 = cocos2d::CCString::getCString(v36);
v38 = cocos2d::CCLabelBMFont::create_1(v37, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v38,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v38->setPosition)(v38, &v192);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v38->setScale)(v38, 0.8);
v32 = 0;
v192.f32[1] = v192.f32[1] + -24.0;
m_unkDouble3 = (int)a1->m_playLayer->m_gameState.m_unkDouble3;
}
v39 = m_unkDouble3 / 60 % 60;
memset(&v191, 0, sizeof(v191));
v40 = m_unkDouble3 + 3599;
if ( !m_isPlatformer || v39 || v40 > 0x1C1E )
{
if ( v40 > 0x1C1E )
v41 = (cocos2d::CCString *)sub_100268F4C("%02d:%02d:%02d", m_unkDouble3 / 3600, v39, m_unkDouble3 % 60);
else
v41 = (cocos2d::CCString *)sub_100268F4C("%02d:%02d", m_unkDouble3 / 60 % 60, m_unkDouble3 % 60);
}
else
{
v41 = (cocos2d::CCString *)sub_100268F4C("%i", m_unkDouble3 % 60);
}
v42 = cocos2d::CCString::getCString(v41);
std::string::assign(&v191, v42);
if ( m_isPlatformer )
{
v43 = &v191;
if ( (v191.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v43 = (std::string *)v191.__r_.__value_.__r.__words[0];
v44 = (cocos2d::CCString *)sub_100268F4C("%s.%03d", (const char *)v43, v32);
v45 = cocos2d::CCString::getCString(v44);
std::string::assign(&v191, v45);
}
v46 = &v191;
if ( (v191.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v46 = (std::string *)v191.__r_.__value_.__r.__words[0];
v47 = (cocos2d::CCString *)sub_100268F4C("Time: %s", (const char *)v46);
v48 = cocos2d::CCString::getCString(v47);
v49 = cocos2d::CCLabelBMFont::create_1(v48, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v49,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v49->setPosition)(v49, &v192);
cocos2d::CCLabelBMFont::limitLabelWidth(v49, 150.0, 0.8, 0.0);
v192.f32[1] = v192.f32[1] + -24.0;
if ( m_isPlatformer )
{
m_points = (unsigned int)a1->m_playLayer->m_gameState.m_points;
if ( (_DWORD)m_points )
{
GameToolbox::pointsToString(m_points, (__int64)&v188);
v51 = std::string::insert(&v188, 0, "Points: ");
v52 = *(_OWORD *)&v51->__r_.__value_.__l.__data_;
v190 = v51->__r_.__value_.__r.__words[2];
v189 = v52;
v51->__r_.__value_.__l.__size_ = 0;
v51->__r_.__value_.__r.__words[2] = 0;
v51->__r_.__value_.__r.__words[0] = 0;
if ( SHIBYTE(v188.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v188.__r_.__value_.__l.__data_);
if ( v190 >= 0 )
v53 = (const char *)&v189;
else
v53 = (const char *)v189;
v54 = cocos2d::CCLabelBMFont::create_1(v53, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v54,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v54->setPosition)(v54, &v192);
cocos2d::CCLabelBMFont::limitLabelWidth(v54, 150.0, 0.8, 0.0);
v192.f32[1] = v192.f32[1] + -24.0;
if ( SHIBYTE(v190) < 0 )
operator delete((void *)v189);
}
}
if ( m_level->m_levelType == Editor )
{
sub_100009900(v186, " ");
v55.n128_u32[0] = 0.5;
v56.n128_u32[0] = 1.0;
sub_100022980(v55, v56, &v189);
v57 = TextArea::create((__int64)v186, (__int64)"bigFont.fnt", (__int64 *)&v189, 0, 1.0, 620.0, 20.0);
if ( v187 < 0 )
operator delete(v186[0]);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCObject *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v57);
v58 = ((__n128 (__fastcall *)(cocos2d::CCObject *, float))v57->__vftable[2].copyWithZone)(v57, 0.55);
v57[11].m_uAutoReleaseCount = 1107820544;
v58.n128_f32[0] = v195 * 0.5;
v59.n128_f32[0] = (float)(v196 * 0.5) + -51.0;
sub_100022980(v58, v59, &v189);
((void (__fastcall *)(cocos2d::CCObject *, __int128 *))v57->__vftable[2].isEqual)(v57, &v189);
if ( m_isPlatformer )
{
v60.n128_u32[0] = 0;
v61.n128_u32[0] = -12.0;
sub_100022980(v60, v61, &v188);
*(float32x2_t *)&v62 = sub_1000229DC(&v192, (float32x2_t *)&v188, (float32x2_t *)&v189);
((void (__fastcall *)(cocos2d::CCObject *, __int128 *, double))v57->__vftable[2].isEqual)(v57, &v189, v62);
}
if ( a1->m_playLayer->m_isIgnoreDamageEnabled )
{
sub_100009900(v184, "You cannot verify a level after using Ignore Damage.");
TextArea::setString((__int64)v57, v184);
if ( (v185 & 0x80000000) == 0 )
goto LABEL_85;
v63 = (void *)v184[0];
goto LABEL_84;
}
if ( a1->m_playLayer->m_isTestMode )
{
sub_100009900(v182, "You cannot verify a level if it has a start pos.");
TextArea::setString((__int64)v57, v182);
if ( (v183 & 0x80000000) == 0 )
goto LABEL_85;
v63 = (void *)v182[0];
goto LABEL_84;
}
if ( a1->m_playLayer->m_isPracticeMode && m_level->m_isVerified.random - m_level->m_isVerified.seed != 1 )
{
sub_100009900(v180, "Complete the level in normal mode to verify it!");
TextArea::setString((__int64)v57, v180);
if ( (v181 & 0x80000000) == 0 )
goto LABEL_85;
v63 = (void *)v180[0];
goto LABEL_84;
}
if ( GJGameLevel::areCoinsVerified(m_level) )
{
if ( m_level->m_coins < 1 )
{
sub_100009900(v176, "Level Verified!");
TextArea::setString((__int64)v57, (const void **)v176);
if ( (v177 & 0x80000000) == 0 )
goto LABEL_85;
v63 = v176[0];
}
else
{
sub_100009900(v178, "Level and Coins Verified!");
TextArea::setString((__int64)v57, v178);
if ( (v179 & 0x80000000) == 0 )
goto LABEL_85;
v63 = (void *)v178[0];
}
goto LABEL_84;
}
EndLevelLayer::getCoinString(&v189, a1);
if ( v190 >= 0 )
v73 = (char *)&v189;
else
v73 = (char *)v189;
sub_100009900(v174, v73);
TextArea::setString((__int64)v57, (const void **)v174);
if ( v175 < 0 )
operator delete(v174[0]);
if ( SHIBYTE(v190) < 0 )
{
v63 = (void *)v189;
goto LABEL_84;
}
}
else if ( a1->m_playLayer->m_isPracticeMode )
{
sub_100009900(__p, " ");
v64.n128_u32[0] = 0.5;
v65.n128_u32[0] = 1.0;
sub_100022980(v64, v65, &v189);
v66 = TextArea::create((__int64)__p, (__int64)"bigFont.fnt", (__int64 *)&v189, 0, 1.0, 620.0, 20.0);
if ( v173 < 0 )
operator delete(__p[0]);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCObject *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v66);
v67 = ((__n128 (__fastcall *)(cocos2d::CCObject *, float))v66->__vftable[2].copyWithZone)(v66, 0.55);
v66[11].m_uAutoReleaseCount = 1107820544;
v67.n128_f32[0] = v195 * 0.5;
v68.n128_f32[0] = (float)(v196 * 0.5) + -51.0;
sub_100022980(v67, v68, &v189);
((void (__fastcall *)(cocos2d::CCObject *, __int128 *))v66->__vftable[2].isEqual)(v66, &v189);
sub_100009900(v170, "Well done... Now try to complete it without any checkpoints!");
TextArea::setString((__int64)v66, v170);
if ( v171 < 0 )
{
v63 = (void *)v170[0];
LABEL_84:
operator delete(v63);
}
}
else if ( m_level->m_coins <= 0 )
{
EndText = EndLevelLayer::getEndText((EndLevelLayer *)m_points);
v70 = cocos2d::CCLabelBMFont::create_1(EndText, "bigFont.fnt");
cocos2d::CCLabelBMFont::limitLabelWidth(v70, 260.0, 0.9, 0.0);
v71 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v70,
3);
v71.n128_f32[0] = v195 * 0.5;
v72.n128_f32[0] = (float)(v196 * 0.5) + -65.0;
sub_100022980(v71, v72, &v189);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int128 *))v70->setPosition)(v70, &v189);
}
LABEL_85:
a1->m_sideMenu = cocos2d::CCMenu::create();
v74 = ((__n128 (__fastcall *)(cocos2d::CCLayer *))a1->m_mainLayer->addChild_0)(a1->m_mainLayer);
v75 = (float)((float)(v196 * 0.5) + -115.0) + -10.0;
m_sideMenu = a1->m_sideMenu;
m_mainLayer = a1->m_mainLayer;
v74.n128_f32[0] = v195 * 0.5;
v78.n128_f32[0] = v75;
sub_100022980(v74, v78, &v169);
cocos2d::CCNode::convertToWorldSpace(m_mainLayer, (const cocos2d::CCPoint *)&v169);
cocos2d::CCNode::convertToNodeSpace(m_sideMenu, (const cocos2d::CCPoint *)&v188);
v79 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_replayBtn_001.png");
v198.ptr = (void (__cdecl *)(cocos2d::CCObject *))EndLevelLayer::onReplay;
v198.adj = 0;
v80 = CCMenuItemSpriteExtra::create(v79, nullptr, a1, v198);
v81 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_sideMenu->addChild)(
a1->m_sideMenu,
v80);
v164 = v80;
v81.n128_u32[0] = -1027080192;
v82.n128_u32[0] = 0;
sub_100022980(v81, v82, &v169);
*(float32x2_t *)&v83 = sub_1000229DC((float32x2_t *)&v189, &v169, (float32x2_t *)&v188);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, double))v164->setPosition)(v164, &v188, v83);
v84 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
v199.ptr = (void (__cdecl *)(cocos2d::CCObject *))EndLevelLayer::onMenu;
v199.adj = 0;
v85 = CCMenuItemSpriteExtra::create(v84, nullptr, a1, v199);
v86 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_sideMenu->addChild)(
a1->m_sideMenu,
v85);
v163 = v85;
v86.n128_u32[0] = 1120403456;
v87.n128_u32[0] = 0;
sub_100022980(v86, v87, &v169);
*(float32x2_t *)&v88 = sub_1000229DC((float32x2_t *)&v189, &v169, (float32x2_t *)&v188);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, double))v163->setPosition)(v163, &v188, v88);
if ( m_level->m_levelType == Editor )
{
v89 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_editBtn_001.png");
v90 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v84->getContentSize)(v84);
v91 = (float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v89->getContentSize)(v89);
((void (__fastcall *)(cocos2d::CCSprite *, float))v89->setScale)(v89, v90 / *v91);
v200.ptr = (void (__cdecl *)(cocos2d::CCObject *))EndLevelLayer::onEdit;
v200.adj = 0;
v92 = CCMenuItemSpriteExtra::create(v89, nullptr, a1, v200);
v93 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_sideMenu->addChild)(
a1->m_sideMenu,
v92);
v93.n128_f32[0] = v195 * 0.5;
v94.n128_f32[0] = v75;
sub_100022980(v93, v94, &v188);
v95 = a1->m_sideMenu;
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, (const cocos2d::CCPoint *)&v188);
cocos2d::CCNode::convertToNodeSpace(v95, (const cocos2d::CCPoint *)&v168);
v96 = sub_1000229D0(&v188, (double *)&v169);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, double))v92->setPosition)(v92, &v188, v96);
}
if ( a1->m_playLayer->m_isPracticeMode )
{
v97 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_restartCheckBtn_001.png");
v201.ptr = (void (__cdecl *)(cocos2d::CCObject *))EndLevelLayer::onRestartCheckpoint;
v201.adj = 0;
v98 = CCMenuItemSpriteExtra::create(v97, nullptr, a1, v201);
v99 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_sideMenu->addChild)(
a1->m_sideMenu,
v98);
v99.n128_f32[0] = (float)(v195 * 0.5) + -180.0;
v100.n128_f32[0] = v75;
sub_100022980(v99, v100, &v188);
v101 = a1->m_sideMenu;
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, (const cocos2d::CCPoint *)&v188);
cocos2d::CCNode::convertToNodeSpace(v101, (const cocos2d::CCPoint *)&v168);
v102 = sub_1000229D0(&v188, (double *)&v169);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, double))v98->setPosition)(v98, &v188, v102);
}
m_levelType = m_level->m_levelType;
if ( ((m_levelType == Editor) & ~m_isPlatformer) == 0 && m_levelType != Main )
{
v104 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_levelLeaderboardBtn_001.png");
v202.ptr = (void (__cdecl *)(cocos2d::CCObject *))EndLevelLayer::onLevelLeaderboard;
v202.adj = 0;
v105 = CCMenuItemSpriteExtra::create(v104, nullptr, a1, v202);
v106 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_sideMenu->addChild)(
a1->m_sideMenu,
v105);
v107 = a1->m_sideMenu;
v108 = a1->m_mainLayer;
v106.n128_f32[0] = (float)(v195 * 0.5) + 178.0;
v109.n128_f32[0] = (float)(v196 * 0.5) + 115.0;
sub_100022980(v106, v109, &v168);
cocos2d::CCNode::convertToWorldSpace(v108, (const cocos2d::CCPoint *)&v168);
v197 = cocos2d::CCNode::convertToNodeSpace(v107, (const cocos2d::CCPoint *)&v169);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, float, float))v105->setPosition)(
v105,
&v188,
v197.x,
v197.y);
}
v110 = cocos2d::CCSprite::createWithSpriteFrameName("hideBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v110->setOpacity)(v110, 0);
v203.ptr = (void (__cdecl *)(cocos2d::CCObject *))EndLevelLayer::onHideLayer;
v203.adj = 0;
v111 = CCMenuItemSpriteExtra::create(v110, nullptr, a1, v203);
v112 = cocos2d::CCMenu::createWithItem(v111);
((void (__fastcall *)(EndLevelLayer *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v112, 100);
v113 = cocos2d::CCDirector::sharedDirector();
v114 = sub_1001768E0((__int64)v113);
if ( AppDelegate::get()->m_startupScriptFilename.m_data.m_short.shortStorage.__elems_[4] )
v115 = 10.0;
else
v115 = 0.0;
v116 = cocos2d::CCDirector::sharedDirector();
v117 = sub_1001768C8((__int64)v116);
((void (__fastcall *)(cocos2d::CCMenu *, float, float))v112->setPosition_0)(
v112,
(float)(v114 + -17.0) - v115,
v117 + -15.0);
v118 = cocos2d::CCFadeTo::create(1.0, 0x7Du);
cocos2d::CCNode::runAction(v110, v118);
v119 = m_level->m_levelType;
a1->m_notLocal = v119 != Main;
a1->m_coinsVerified = m_level->m_coinsVerified.random - m_level->m_coinsVerified.seed == 1;
m_coins = m_level->m_coins;
if ( m_coins >= 1 && !a1->m_playLayer->m_isPracticeMode && v119 != Editor )
{
v121 = (cocos2d::CCArray *)sub_10024A15C();
a1->m_coinsToAnimate = v121;
cocos2d::CCObject::retain(v121);
v122.n128_f32[0] = v195 * 0.5;
v123.n128_f32[0] = (float)(v196 * 0.5) + 126.0;
sub_100022980(v122, v123, &v188);
v124.n128_f32[0] = v195 * 0.5;
v125.n128_f32[0] = (float)(v196 * 0.5) + -64.0;
sub_100022980(v124, v125, &v169);
sub_1000229D0(&v188, (double *)&v169);
v126 = 20.0;
if ( m_coins == 4 )
v126 = 15.0;
if ( (unsigned int)m_coins <= 4 )
v127 = v126;
else
v127 = 13.0;
v128 = (cocos2d::CCArray *)sub_10024A15C();
v129 = m_coins;
do
{
if ( a1->m_notLocal )
v130 = "secretCoin_2_b_01_001.png";
else
v130 = "secretCoin_b_01_001.png";
v131 = cocos2d::CCSprite::createWithSpriteFrameName(v130);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v131,
8);
sub_10024A2D0((__int64)v128);
if ( a1->m_notLocal && !a1->m_coinsVerified )
{
v169.i16[0] = -20481;
v169.i8[2] = 75;
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v131->setColor)(v131, &v169);
}
--v129;
}
while ( v129 );
sub_1000229B8((__int64 *)&v169, (__int64 *)&v188);
GameToolbox::alignItemsHorisontally(v128, v127, v204, (bool)&v169);
for ( i = 0; i != m_coins; ++i )
{
v133 = sub_10024A388((__int64)v128, i);
if ( a1->m_notLocal )
{
if ( a1->m_coinsVerified )
{
v134 = GameStatsManager::sharedState();
CoinKey = GJGameLevel::getCoinKey(m_level, i + 1);
hasUserCoin = GameStatsManager::hasUserCoin(v134, CoinKey);
}
else
{
v139 = GameStatsManager::sharedState();
v140 = GJGameLevel::getCoinKey(m_level, i + 1);
hasUserCoin = GameStatsManager::hasPendingUserCoin(v139, v140);
}
}
else
{
v137 = GameStatsManager::sharedState();
v138 = GJGameLevel::getCoinKey(m_level, i + 1);
hasUserCoin = GameStatsManager::hasSecretCoin(v137, v138);
}
v141 = hasUserCoin;
hasItem = GJBaseGameLayer::hasItem(a1->m_playLayer, i + 1);
if ( !hasItem && v141 )
{
v143 = a1->m_notLocal ? "secretCoinUI2_001.png" : "secretCoinUI_001.png";
v144 = cocos2d::CCSprite::createWithSpriteFrameName(v143);
v145 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v133 + 192LL))(v133);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v144->setPosition)(v144, v145);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v144,
9);
if ( a1->m_notLocal && !a1->m_coinsVerified )
{
v169.i16[0] = -20481;
v169.i8[2] = 75;
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v144->setColor)(v144, &v169);
}
}
if ( hasItem )
{
v146 = a1->m_notLocal ? "secretCoinUI2_001.png" : "secretCoinUI_001.png";
v147 = cocos2d::CCSprite::createWithSpriteFrameName(v146);
v148 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v133 + 192LL))(v133);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v147->setPosition)(v147, v148);
sub_10024A2D0((__int64)a1->m_coinsToAnimate);
a1->m_animateCoins = 1;
if ( a1->m_notLocal && !a1->m_coinsVerified )
{
v169.i16[0] = -20481;
v169.i8[2] = 75;
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v147->setColor)(v147, &v169);
}
}
}
}
sub_100009900(&v166, "Geometry Dash");
PlatformToolbox::tryShowRateDialog();
if ( v167 < 0 )
operator delete(v166);
if ( PlatformToolbox::isControllerConnected() )
{
v149 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v149,
10);
v150 = a1->m_mainLayer;
v151 = (cocos2d::CCNode *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v164->getParent)(v164);
v152 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v164->getPosition)(v164);
cocos2d::CCNode::convertToWorldSpace(v151, v152);
cocos2d::CCNode::convertToNodeSpace(v150, (const cocos2d::CCPoint *)&v169);
v153.n128_u32[0] = 0;
v154.n128_u32[0] = -25.0;
sub_100022980(v153, v154, &v168);
*(float32x2_t *)&v155 = sub_1000229DC((float32x2_t *)&v188, &v168, &v169);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *, double))v149->setPosition)(v149, &v169, v155);
v156 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v156,
10);
v157 = a1->m_mainLayer;
v158 = (cocos2d::CCNode *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v163->getParent)(v163);
v159 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v163->getPosition)(v163);
cocos2d::CCNode::convertToWorldSpace(v158, v159);
cocos2d::CCNode::convertToNodeSpace(v157, (const cocos2d::CCPoint *)&v168);
v160.n128_f64[0] = sub_1000229D0(&v188, (double *)&v169);
v160.n128_u32[0] = 0;
v161.n128_u32[0] = -25.0;
sub_100022980(v160, v161, &v168);
*(float32x2_t *)&v162 = sub_1000229DC((float32x2_t *)&v188, &v168, &v169);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *, double))v156->setPosition)(v156, &v169, v162);
((void (__fastcall *)(cocos2d::CCSprite *, float))v156->setScale)(v156, 0.8);
}
if ( SHIBYTE(v191.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v191.__r_.__value_.__l.__data_);
}