//
// EditorPauseLayer::init from 0x10039bb9c to 0x10039c08c (1264 bytes)
//
// 1 xrefs:
// > EditorPauseLayer::create @ 0x10039bb50
//
// 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
//
bool __fastcall EditorPauseLayer::init(EditorPauseLayer *a1, LevelEditorLayer *a2)
{
_BOOL4 v3; // w19
GJLevelType m_levelType; // w21
cocos2d::CCDirector *v5; // x0
LevelEditorLayer *m_editorLayer; // x8
GJGameLevel *m_level; // x10
_BOOL4 m_highObjectsEnabled; // w9
_BOOL4 m_unlimitedObjectsEnabled; // w10
int v11; // w22
int v12; // w8
int v13; // w9
cocos2d::CCString *v14; // x0
const char *CString; // x0
cocos2d::CCString *v16; // x0
const char *v17; // x0
__int64 v18; // x8
unsigned __int8 *v19; // x9
int v20; // w10
int v21; // t1
int v22; // w8
__int64 v23; // x9
unsigned __int8 *v24; // x10
int v25; // w11
int v26; // t1
cocos2d::CCString *v27; // x0
const char *v28; // x0
std::string *v29; // x0
cocos2d::CCLabelBMFont *v30; // x21
__n128 v31; // q0
__n128 v32; // q1
cocos2d::CCDirector *v33; // x0
float v34; // s8
float v35; // s9
cocos2d::CCDirector *v36; // x0
__n128 v37; // q1
__n128 v38; // q0
__n128 v39; // q0
DrawGridLayer *m_drawGridLayer; // x22
__n128 v41; // q1
float v42; // s8
LevelEditorLayer *v43; // x8
int m_timestamp; // w9
unsigned int LengthKey; // w0
char *v46; // x1
const char *v47; // x0
int v48; // w8
float v49; // s0
void **v50; // x10
cocos2d::CCString *v51; // x0
cocos2d::CCLabelBMFont *v52; // x22
__n128 v53; // q0
__n128 v54; // q1
float32x2_t *v55; // x20
__n128 v56; // q0
__n128 v57; // q1
double v58; // d0
float32x2_t v60; // [xsp+20h] [xbp-C0h] BYREF
void *__p[2]; // [xsp+28h] [xbp-B8h] BYREF
char v62; // [xsp+3Fh] [xbp-A1h]
void *v63[2]; // [xsp+40h] [xbp-A0h] BYREF
char v64; // [xsp+57h] [xbp-89h]
void *v65; // [xsp+58h] [xbp-88h] BYREF
__int64 v66; // [xsp+60h] [xbp-80h]
char v67; // [xsp+6Fh] [xbp-71h]
void *v68; // [xsp+70h] [xbp-70h] BYREF
__int64 v69; // [xsp+78h] [xbp-68h]
char v70; // [xsp+87h] [xbp-59h]
bool v71; // [xsp+8Fh] [xbp-51h] BYREF
std::string v72; // [xsp+90h] [xbp-50h] BYREF
cocos2d::CCPoint v73; // 0:s0.4,4:s1.4
a1->m_editorLayer = a2;
v3 = CCBlockLayer::init(a1);
if ( !v3 )
return v3;
m_levelType = a1->m_editorLayer->m_level->m_levelType;
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
m_editorLayer = a1->m_editorLayer;
m_level = m_editorLayer->m_level;
m_highObjectsEnabled = m_level->m_highObjectsEnabled;
m_unlimitedObjectsEnabled = m_level->m_unlimitedObjectsEnabled;
memset(&v72, 0, sizeof(v72));
if ( !m_highObjectsEnabled || !m_unlimitedObjectsEnabled )
{
v11 = m_highObjectsEnabled || m_unlimitedObjectsEnabled;
v12 = m_editorLayer->m_objectCount.random - m_editorLayer->m_objectCount.seed;
v13 = 40000;
if ( v11 )
v13 = 80000;
v14 = (cocos2d::CCString *)sub_100268F4C("Objects: %i/%i", v12, v13);
CString = cocos2d::CCString::getCString(v14);
std::string::assign(&v72, CString);
if ( v11 )
std::string::append(&v72, " (high)");
}
else
{
v16 = (cocos2d::CCString *)sub_100268F4C(
"Objects: %i (Unlimited)",
m_editorLayer->m_objectCount.random - m_editorLayer->m_objectCount.seed);
v17 = cocos2d::CCString::getCString(v16);
std::string::assign(&v72, v17);
}
v71 = 0;
LevelEditorLayer::getSongIDs((__int64)a1->m_editorLayer, &v71, &v68);
LevelEditorLayer::getSFXIDs((__int64)a1->m_editorLayer, &v65);
v18 = v70;
if ( (v70 & 0x8000000000000000LL) == 0 )
{
if ( v70 )
{
v19 = (unsigned __int8 *)&v68;
goto LABEL_16;
}
LABEL_21:
v22 = 1;
goto LABEL_22;
}
v18 = v69;
if ( !v69 )
goto LABEL_21;
v19 = (unsigned __int8 *)v68;
LABEL_16:
v20 = 0;
do
{
v21 = *v19++;
if ( v21 == 44 )
++v20;
--v18;
}
while ( v18 );
v22 = v20 + 1;
LABEL_22:
v23 = v67;
if ( (v67 & 0x8000000000000000LL) != 0 )
{
v23 = v66;
if ( v66 )
{
v24 = (unsigned __int8 *)v65;
LABEL_27:
v25 = 0;
do
{
v26 = *v24++;
if ( v26 == 44 )
++v25;
--v23;
}
while ( v23 );
LODWORD(v23) = v25 + 1;
}
}
else if ( v67 )
{
v24 = (unsigned __int8 *)&v65;
goto LABEL_27;
}
if ( v71 || (int)v23 >= 1 )
{
v27 = (cocos2d::CCString *)sub_100268F4C(", Songs: %i, SFX: %i", v22, v23);
v28 = cocos2d::CCString::getCString(v27);
std::string::append(&v72, v28);
}
if ( m_levelType != Editor )
std::string::append(&v72, " (Read-Only)");
if ( (v72.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v29 = &v72;
else
v29 = (std::string *)v72.__r_.__value_.__r.__words[0];
v30 = cocos2d::CCLabelBMFont::create_1((const char *)v29, "goldFont.fnt");
v31.n128_u32[0] = 0;
v32.n128_u32[0] = 1.0;
sub_100022980(v31, v32, v63);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v30->setAnchorPoint)(v30, v63);
((void (__fastcall *)(EditorPauseLayer *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v30);
v33 = cocos2d::CCDirector::sharedDirector();
v34 = sub_1001768D8((__int64)v33);
if ( AppDelegate::get()->m_startupScriptFilename.m_data.m_short.shortStorage.__elems_[4] )
v35 = 25.0;
else
v35 = 0.0;
v36 = cocos2d::CCDirector::sharedDirector();
v37.n128_f32[0] = sub_1001768C8((__int64)v36) + -5.0;
v38.n128_f32[0] = (float)(v34 + 10.0) + v35;
sub_100022980(v38, v37, v63);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v30->setPosition)(v30, v63);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v30->setScale)(v30, 0.5);
v39.n128_f32[0] = LevelEditorLayer::getLastObjectX(a1->m_editorLayer) + 340.0;
m_drawGridLayer = a1->m_editorLayer->m_drawGridLayer;
v41.n128_u32[0] = 0;
sub_100022980(v39, v41, v63);
v42 = DrawGridLayer::timeForPos(m_drawGridLayer, v73, (int)v63, 0, 0, 0, 0, 0);
v43 = a1->m_editorLayer;
m_timestamp = v43->m_level->GJBaseGameLayer::m_timestamp;
if ( m_timestamp >= 1 && (float)((float)(unsigned int)m_timestamp / 240.0) > v42 )
v42 = (float)(unsigned int)m_timestamp / 240.0;
LengthKey = GJGameLevel::getLengthKey((int)v42, v43->m_levelSettings->m_platformerMode);
GJGameLevel::lengthKeyToString(LengthKey, __p);
if ( v62 >= 0 )
v46 = (char *)__p;
else
v46 = (char *)__p[0];
sub_100009900(v63, v46);
if ( v62 < 0 )
operator delete(__p[0]);
if ( a1->m_editorLayer->m_levelSettings->m_platformerMode )
{
v47 = "Length: Platformer";
}
else
{
v48 = vcvtms_s32_f32(v42 / 60.0);
v49 = v42 - (float)(60 * v48);
v50 = v63;
if ( v64 < 0 )
v50 = (void **)v63[0];
if ( v48 < 1 )
v51 = (cocos2d::CCString *)sub_100268F4C("Length: %i seconds (%s)", (int)v49, (const char *)v50);
else
v51 = (cocos2d::CCString *)sub_100268F4C("Length: %imin %is (%s)", v48, (int)v49, (const char *)v50);
v47 = cocos2d::CCString::getCString(v51);
}
v52 = cocos2d::CCLabelBMFont::create_1(v47, "goldFont.fnt");
v53.n128_u32[0] = 0;
v54.n128_u32[0] = 1.0;
sub_100022980(v53, v54, __p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **))v52->setAnchorPoint)(v52, __p);
((void (__fastcall *)(EditorPauseLayer *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v52);
v55 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v30->getPosition)(v30);
v56.n128_u32[0] = 0;
v57.n128_u32[0] = -20.0;
sub_100022980(v56, v57, &v60);
*(float32x2_t *)&v58 = sub_1000229DC(v55, &v60, (float32x2_t *)__p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **, double))v52->setPosition)(v52, __p, v58);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v52->setScale)(v52, 0.5);
if ( v64 < 0 )
operator delete(v63[0]);
if ( v67 < 0 )
operator delete(v65);
if ( v70 < 0 )
operator delete(v68);
if ( SHIBYTE(v72.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v72.__r_.__value_.__l.__data_);
return v3;
}