//
// LevelEditorLayer::init from 0x1402d1dd0 to 0x1402d2f5a (4490 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::create @ 0x1402d1d7e
// > ??> @ 0x1406d2f24
//
// 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=15
bool LevelEditorLayer::init(LevelEditorLayer *a1, GJGameLevel *a2, bool a3)
{
bool result; // al
MusicDownloadManager *v6; // rax
MusicDownloadManager *v7; // rbx
cocos2d::CCDictionary *m_sfxObjects; // rcx
cocos2d::CCDictionary *m_musicObjects; // rcx
UILayer *m_uiLayer; // rbx
GameManager *v11; // rcx
GameManager *v12; // rcx
GameManager *v13; // rcx
GameManager *v14; // rcx
bool GameVariable; // al
int v16; // eax
__int64 v17; // rbx
__int64 v18; // rcx
__int64 v19; // rax
cocos2d::CCArray *v20; // rax
__int64 v21; // rcx
cocos2d::CCDictionary *v22; // rax
__int64 v23; // rcx
cocos2d::CCDictionary *v24; // rax
__int64 v25; // rcx
cocos2d::CCDictionary *v26; // rax
__int64 v27; // rcx
cocos2d::CCArray *v28; // rax
__int64 v29; // rcx
cocos2d::CCArray *v30; // rax
__int64 v31; // rcx
cocos2d::CCArray *v32; // rax
__int64 v33; // rcx
cocos2d::CCArray *v34; // rax
__int64 v35; // rcx
cocos2d::CCArray *v36; // rax
__int64 v37; // rcx
cocos2d::CCArray *v38; // rax
__int64 v39; // rcx
cocos2d::CCArray *v40; // rax
__int64 v41; // rcx
cocos2d::CCDictionary *v42; // rax
__int64 v43; // rcx
cocos2d::CCArray *v44; // rax
__int64 v45; // rcx
cocos2d::CCArray *v46; // rax
__int64 v47; // rcx
cocos2d::CCArray *v48; // rax
__int64 v49; // rcx
cocos2d::CCArray *v50; // rax
__int64 v51; // rcx
cocos2d::CCArray *v52; // rax
__int64 v53; // rcx
cocos2d::CCArray *v54; // rax
__int64 v55; // rcx
cocos2d::CCArray *v56; // rax
std::_Vector_val>::pointer Mylast; // r14
std::_Vector_val>::pointer Myfirst; // rdx
unsigned __int64 v59; // rcx
__int64 v60; // rsi
std::_Simple_types::value_type *v61; // rax
size_t v62; // rbx
std::_Vector_val>::pointer v63; // r9
std::_Vector_val>::pointer v64; // rdx
__int64 v65; // rcx
std::_Simple_types::value_type *v66; // rax
__int64 v67; // rbx
__int64 v68; // r9
unsigned __int64 v69; // r10
unsigned __int64 v70; // r8
int v71; // edx
cocos2d::CCArray *v72; // rsi
unsigned int i; // ebx
cocos2d::CCString *v74; // rax
int v75; // eax
std::vector *p_m_savedPositions; // r15
std::_Vector_val>::pointer v77; // rbx
std::_Vector_val>::pointer v78; // rdx
unsigned __int64 v79; // rcx
unsigned __int64 v80; // rsi
std::_Vector_val>::pointer v81; // rbx
std::_Simple_types::value_type *j; // rsi
double v83; // xmm0_8
int v84; // r14d
int v85; // r12d
void *v86; // rsi
char *v87; // r13
signed __int64 v88; // rcx
char *v89; // rsi
const char *v90; // rcx
const char *v91; // rcx
__int64 v92; // rbx
__int64 v93; // rax
__int64 k; // rbx
char *v95; // rax
cocos2d::CCPoint v96; // rax
OBB2D *v97; // rax
__int64 v98; // rcx
cocos2d::CCDirector *v99; // rax
GameManager *v100; // rcx
cocos2d::CCLayer_vtbl *v101; // rbx
bool v102; // al
__int64 v103; // r8
cocos2d::CCDrawNode *v104; // rax
cocos2d::CCSprite *v105; // rax
__int64 v106; // rax
LevelSettingsObject *v107; // rax
GJEffectManager *m_effectManager; // r14
ColorAction *v109; // rsi
ColorActionSprite *ColorSprite; // rax
PlayerObject *m_player1; // rcx
GJEffectManager *v112; // rsi
ColorAction *v113; // rbx
ColorActionSprite *v114; // rax
PlayerObject *v115; // rcx
EditorUI *v116; // rax
EditorUI *v117; // rbx
EditorUI *m_editorUI; // rcx
EditorUI *v119; // rcx
cocos2d::CCArray *m_objects; // rax
cocos2d::ccArray *data; // rsi
__int64 num; // rax
cocos2d::CCPoint *arr; // rsi
cocos2d::CCPoint *m; // r14
cocos2d::CCPoint v125; // rbx
std::unordered_map> *p_m_timeLabelObjects; // rcx
cocos2d::CCPoint *v127; // rdx
__int64 v128; // rax
_QWORD *v129; // rcx
cocos2d::CCPoint *v130; // rdx
std::_List_val>>>::_Nodeptr Myhead; // r15
_QWORD *n; // rbx
LabelGameObject **v133; // rsi
LabelGameObject **ii; // r14
std::_List_val>>>::_Nodeptr v135; // r15
_QWORD *jj; // rbx
LabelGameObject **v137; // rsi
LabelGameObject **kk; // r14
cocos2d::CCArray *m_batchNodes; // rcx
cocos2d::ccArray *v140; // rcx
__int64 v141; // rax
cocos2d::CCObject **v142; // rcx
cocos2d::CCObject **mm; // rdx
cocos2d::CCArray *v144; // rsi
cocos2d::ccArray *v145; // rsi
__int64 v146; // rax
cocos2d::CCObject **v147; // rsi
cocos2d::CCObject **nn; // r14
cocos2d::CCObject *v149; // rbx
__int64 v150; // rdx
GameManager *v151; // rcx
bool v152; // al
std::_Vector_val>::pointer v153; // [rsp+20h] [rbp-A9h] BYREF
bool v154; // [rsp+28h] [rbp-A1h]
int v155; // [rsp+2Ch] [rbp-9Dh] BYREF
struct cocos2d::_ccBlendFunc v156; // [rsp+30h] [rbp-99h] BYREF
cocos2d::CCPoint v157[2]; // [rsp+38h] [rbp-91h] BYREF
void *Block[2]; // [rsp+50h] [rbp-79h] BYREF
__int64 v159; // [rsp+60h] [rbp-69h]
cocos2d::CCPoint v160[4]; // [rsp+70h] [rbp-59h] BYREF
__int64 v161[4]; // [rsp+90h] [rbp-39h] BYREF
__int64 v162[4]; // [rsp+B0h] [rbp-19h] BYREF
v154 = a3;
v157[0] = (cocos2d::CCPoint)a2;
result = GJBaseGameLayer::init(a1);
if ( !result )
return result;
v6 = MusicDownloadManager::sharedState();
v7 = v6;
if ( !v6->m_triedToLoadLibraries )
{
v6->m_triedToLoadLibraries = 1;
m_sfxObjects = v6->m_sfxObjects;
if ( !m_sfxObjects || !cocos2d::CCDictionary::count(m_sfxObjects) )
MusicDownloadManager::parseSFXLibrary(v7);
m_musicObjects = v7->m_musicObjects;
if ( !m_musicObjects || !cocos2d::CCDictionary::count(m_musicObjects) )
MusicDownloadManager::parseMusicLibrary(v7);
}
m_uiLayer = a1->m_uiLayer;
m_uiLayer->m_editorMode = 1;
m_uiLayer->m_pauseBtn->setVisible(m_uiLayer->m_pauseBtn, 0);
m_uiLayer->m_pauseBtn->setEnabled(m_uiLayer->m_pauseBtn, 0);
*(_QWORD *)&m_uiLayer->m_p1TouchId = -1;
*(_WORD *)&m_uiLayer->m_p1Jumping = 0;
m_uiLayer->m_checkpointBtnDown = 0;
UILayer::resetUINodeState(m_uiLayer);
UILayer::toggleMenuVisibility(m_uiLayer, 0);
m_uiLayer->setVisible(m_uiLayer, 0);
*(_BYTE *)(cocos2d::CCEGLView::sharedOpenGLView() + 237) = 0;
a1->m_isEditor = 1;
a1->m_initializing = 1;
v11 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v153 = (std::_Vector_val>::pointer)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v153);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = (GameManager *)qword_1406C2ED8;
}
a1->m_playTestSmoothFix = GameManager::getGameVariable(v11, "0102");
v12 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v153 = (std::_Vector_val>::pointer)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v153);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v12 = (GameManager *)qword_1406C2ED8;
}
a1->m_previewParticles = GameManager::getGameVariable(v12, "0117");
v13 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v153 = (std::_Vector_val>::pointer)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v153);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v13 = (GameManager *)qword_1406C2ED8;
}
a1->m_previewAnimations = GameManager::getGameVariable(v13, "0118");
if ( a1->m_alwaysHideParticleIcons )
goto LABEL_19;
v14 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v153 = (std::_Vector_val>::pointer)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v153);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v14 = (GameManager *)qword_1406C2ED8;
}
GameVariable = GameManager::getGameVariable(v14, "0137");
if ( GameVariable )
LABEL_19:
GameVariable = 1;
a1->m_hideParticleIcons = GameVariable;
LevelEditorLayer::updateOptions(a1);
a1->m_objectCount.value = 0;
v16 = (int)(float)((float)((float)rand() / 32767.0) * 1000.0);
a1->m_objectCount.seed = v16;
a1->m_objectCount.random = v16;
v17 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v153 = (std::_Vector_val>::pointer)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine((FMODAudioEngine *)v153);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v17 = qword_1406C2E88;
}
if ( *(_QWORD *)(v17 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v17 + 552));
sub_14005E0D0((_QWORD *)(v17 + 1064));
sub_14005E0D0((_QWORD *)(v17 + 1128));
sub_14005E0D0((_QWORD *)(v17 + 1192));
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
v19 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v153 = (std::_Vector_val>::pointer)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v153);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v19 = qword_1406C2ED8;
}
*(_BYTE *)(v19 + 698) = 1;
*(_QWORD *)(v19 + 528) = a1;
v20 = (cocos2d::CCArray *)cocos2d::CCArray::create(v18);
a1->m_durationObjects = v20;
cocos2d::CCObject::retain(v20);
v22 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v21);
a1->m_triggerGroupsDict = v22;
cocos2d::CCObject::retain(v22);
v24 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v23);
a1->m_unk3778 = v24;
cocos2d::CCObject::retain(v24);
v26 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v25);
a1->m_unk3780 = v26;
cocos2d::CCObject::retain(v26);
v28 = (cocos2d::CCArray *)cocos2d::CCArray::create(v27);
a1->m_pulseTriggers = v28;
cocos2d::CCObject::retain(v28);
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create(v29);
a1->m_colorTriggers = v30;
cocos2d::CCObject::retain(v30);
v32 = (cocos2d::CCArray *)cocos2d::CCArray::create(v31);
a1->m_alphaTriggers = v32;
cocos2d::CCObject::retain(v32);
v34 = (cocos2d::CCArray *)cocos2d::CCArray::create(v33);
a1->m_spawnTriggers = v34;
cocos2d::CCObject::retain(v34);
v36 = (cocos2d::CCArray *)cocos2d::CCArray::create(v35);
a1->m_playtestTriggers = v36;
cocos2d::CCObject::retain(v36);
v38 = (cocos2d::CCArray *)cocos2d::CCDictionary::create(v37);
a1->m_spawnOrderTriggers = v38;
cocos2d::CCObject::retain(v38);
v40 = (cocos2d::CCArray *)cocos2d::CCArray::create(v39);
a1->m_spawnOrderObjects = v40;
cocos2d::CCObject::retain(v40);
v42 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v41);
a1->m_unk3740 = v42;
cocos2d::CCObject::retain(v42);
v44 = (cocos2d::CCArray *)cocos2d::CCArray::create(v43);
a1->m_unk3748 = v44;
cocos2d::CCObject::retain(v44);
a1->m_unk3751 = 1;
v46 = (cocos2d::CCArray *)cocos2d::CCArray::create(v45);
a1->m_moveTriggers = v46;
cocos2d::CCObject::retain(v46);
v48 = (cocos2d::CCArray *)cocos2d::CCArray::create(v47);
a1->m_undoObjects = v48;
cocos2d::CCObject::retain(v48);
v50 = (cocos2d::CCArray *)cocos2d::CCArray::create(v49);
a1->m_redoObjects = v50;
cocos2d::CCObject::retain(v50);
v52 = (cocos2d::CCArray *)cocos2d::CCArray::create(v51);
a1->m_cameraGuideTriggers = v52;
cocos2d::CCObject::retain(v52);
v54 = (cocos2d::CCArray *)cocos2d::CCArray::create(v53);
a1->m_particleObjects = v54;
cocos2d::CCObject::retain(v54);
v56 = (cocos2d::CCArray *)cocos2d::CCArray::create(v55);
a1->m_keyframeObjects = v56;
cocos2d::CCObject::retain(v56);
Mylast = a1->m_objectVector._Mypair._Myval2._Mylast;
Myfirst = a1->m_objectVector._Mypair._Myval2._Myfirst;
v59 = Mylast - Myfirst;
v60 = 10000;
if ( v59 <= 0x2710 )
{
if ( v59 >= 0x2710 )
goto LABEL_33;
if ( (unsigned __int64)(a1->m_objectVector._Mypair._Myval2._Myend - Myfirst) < 0x2710 )
{
sub_1402F2DF0(&a1->m_objectVector);
goto LABEL_33;
}
v62 = 10000 - v59;
memset(a1->m_objectVector._Mypair._Myval2._Mylast, 0, v62 * 8);
v61 = &Mylast[v62];
}
else
{
v61 = Myfirst + 10000;
}
a1->m_objectVector._Mypair._Myval2._Mylast = v61;
LABEL_33:
sub_14024AD80((__int64 *)&a1->m_toggledGroups, 0x2710u);
sub_14024AD80((__int64 *)&a1->m_lockedLayers, 0x2710u);
v63 = a1->m_toggledGroupStates._Mypair._Myval2._Mylast;
v153 = v63;
v64 = a1->m_toggledGroupStates._Mypair._Myval2._Myfirst;
v65 = v63 - v64;
if ( (unsigned __int64)(v63 - v64) <= 0x2710 )
{
if ( (unsigned __int64)(v63 - v64) >= 0x2710 )
goto LABEL_40;
if ( (std::_Vector_val>::pointer)(a1->m_toggledGroupStates._Mypair._Myval2._Myend
- v64) < (std::_Vector_val>::pointer)0x2710 )
{
sub_1402F2AC0(&a1->m_toggledGroupStates);
goto LABEL_40;
}
v67 = 10000 - v65;
memset(v63, 0, 10000 - v65);
v66 = &v153[v67];
}
else
{
v66 = v64 + 10000;
}
a1->m_toggledGroupStates._Mypair._Myval2._Mylast = v66;
LABEL_40:
sub_14024AD80((__int64 *)&a1->m_blendingColors2, 0x2710u);
sub_14024AD80((__int64 *)&a1->m_blendingColors, 0x2710u);
sub_140249A30((__int64 *)&a1->m_triggerGroups);
sub_14024AD80((__int64 *)&a1->m_sortedGroups, 0x2710u);
sub_14018AD60((__int64 *)&a1->m_spawnGroupDelays, 0x2710u);
v68 = 0;
v69 = 0;
do
{
a1->m_objectVector._Mypair._Myval2._Myfirst[v68] = nullptr;
v70 = v69 >> 5;
v71 = ~(1 << (v69 & 0x1F));
a1->m_toggledGroups._Myvec._Mypair._Myval2._Myfirst[v70] &= v71;
a1->m_blendingColors2._Myvec._Mypair._Myval2._Myfirst[v70] &= v71;
a1->m_lockedLayers._Myvec._Mypair._Myval2._Myfirst[v70] &= v71;
a1->m_blendingColors._Myvec._Mypair._Myval2._Myfirst[v70] &= v71;
a1->m_sortedGroups._Myvec._Mypair._Myval2._Myfirst[v70] &= v71;
a1->m_toggledGroupStates._Mypair._Myval2._Myfirst[v68] = 0;
a1->m_triggerGroups._Mypair._Myval2._Myfirst[v68] = nullptr;
a1->m_spawnGroupDelays._Mypair._Myval2._Myfirst[v68] = 0.0;
++v69;
++v68;
--v60;
}
while ( v60 );
sub_14003BDB0((__int64)v162, (__int64)&a1->m_level->m_lockedEditorLayers);
if ( v162[2] )
{
v72 = sub_140063EF0(v162);
for ( i = 0; i < cocos2d::CCArray::count(v72); ++i )
{
v74 = cocos2d::CCArray::stringAtIndex(v72, i);
v75 = cocos2d::CCString::intValue(v74);
if ( v75 <= 9999 )
a1->m_lockedLayers._Myvec._Mypair._Myval2._Myfirst[(unsigned __int64)v75 >> 5] |= 1 << (v75 & 0x1F);
}
}
p_m_savedPositions = &a1->m_savedPositions;
v77 = a1->m_savedPositions._Mypair._Myval2._Mylast;
v78 = a1->m_savedPositions._Mypair._Myval2._Myfirst;
v79 = v77 - v78;
if ( v79 <= 0xA )
{
if ( v79 < 0xA )
{
if ( (unsigned __int64)(a1->m_savedPositions._Mypair._Myval2._Myend - v78) >= 0xA )
{
v80 = 10 - v79;
do
{
cocos2d::CCPoint::CCPoint(v77++);
--v80;
}
while ( v80 );
a1->m_savedPositions._Mypair._Myval2._Mylast = v77;
}
else
{
sub_1402F2B70(&a1->m_savedPositions);
}
}
}
else
{
a1->m_savedPositions._Mypair._Myval2._Mylast = v78 + 10;
}
v81 = a1->m_savedPositions._Mypair._Myval2._Mylast;
for ( j = p_m_savedPositions->_Mypair._Myval2._Myfirst; j != v81; ++j )
cocos2d::CCPoint::operator=(j, &dword_1406C2128);
sub_14003BDB0((__int64)v161, (__int64)&a1->m_level->m_savedCameraPositions);
if ( v161[2] )
{
LODWORD(v83) = 0;
*(_OWORD *)Block = 0;
v159 = 0;
sub_1400DE660(v161, ",", (__int64 *)Block);
v84 = 0;
v85 = 0;
v86 = Block[1];
v87 = (char *)Block[0];
v88 = ((char *)Block[1] - (char *)Block[0]) >> 5;
if ( v88 != 1 )
{
v153 = (std::_Vector_val>::pointer)(v88 - 1);
v89 = (char *)Block[0] + 32;
do
{
if ( v84 >= 10 )
break;
v90 = v89 - 32;
if ( *((_QWORD *)v89 - 1) > 0xFu )
v90 = *(const char **)v90;
v155 = atoi(v90);
v91 = v89;
if ( *((_QWORD *)v89 + 3) > 0xFu )
v91 = *(const char **)v89;
atoi(v91);
v92 = (__int64)&p_m_savedPositions->_Mypair._Myval2._Myfirst[v84];
cocos2d::CCPoint::CCPoint(*(float *)&v83, (float)v155);
v83 = cocos2d::CCPoint::operator=(v92, v93);
++v84;
v85 += 2;
v89 += 64;
}
while ( v85 < (unsigned __int64)v153 );
v86 = Block[1];
}
if ( v87 )
{
for ( k = (__int64)v87; (void *)k != v86; k += 32 )
sub_14003A830(k);
v95 = v87;
if ( ((v159 - (_QWORD)v87) & 0xFFFFFFFFFFFFFFE0uLL) >= 0x1000 )
{
v87 = *((char **)v87 - 1);
if ( (unsigned __int64)(v95 - v87 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v87);
}
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v153);
cocos2d::CCPoint::operator=(&a1->m_previewPosition, &v153);
cocos2d::CCPoint::CCPoint(v160);
v97 = OBB2D::create(v96, 1.0, 1.0, 0.0);
a1->m_currentOBB2D = v97;
cocos2d::CCObject::retain(v97);
v99 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v98);
cocos2d::CCDirector::getWinSize(v99);
GJBaseGameLayer::setupLayers(a1);
a1->m_drawGridLayer = DrawGridLayer::create(a1->m_objectLayer, a1);
v100 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v160[0] = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)v160);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v100 = (GameManager *)qword_1406C2ED8;
}
v101 = a1->m_objectLayer->GJBaseGameLayer::__vftable;
v102 = GameManager::getGameVariable(v100, "0039");
v103 = 4294965697LL;
if ( v102 )
v103 = 1399;
v101->addChild_0(a1->m_objectLayer, a1->m_drawGridLayer, v103);
v104 = (cocos2d::CCDrawNode *)cocos2d::CCDrawNode::create();
a1->m_debugDrawNode = v104;
v156.src = 770;
v156.dst = 771;
cocos2d::CCDrawNode::setBlendFunc(v104, &v156);
a1->m_debugDrawNode->setTag(a1->m_debugDrawNode, -9999);
a1->m_aboveShaderObjectLayer->addChild_0(a1->m_aboveShaderObjectLayer, a1->m_debugDrawNode, 1401);
GJBaseGameLayer::createPlayer(a1);
v105 = cocos2d::CCSprite::createWithSpriteFrameName("d_cross_01_001.png");
a1->m_playtestDeathSprite = v105;
a1->m_gameLayerT1->addChild_0(a1->m_gameLayerT1, v105, 10);
a1->m_playtestDeathSprite->setColor(&a1->m_playtestDeathSprite->cocos2d::CCRGBAProtocol, &stru_140529B24);
a1->m_playtestDeathSprite->setVisible(a1->m_playtestDeathSprite, 0);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_playtestDeathSprite->setScale_0)(a1->m_playtestDeathSprite);
GJBaseGameLayer::createPlayerCollisionBlock(a1);
a1->m_collisionBlocksAdded = 0;
GJBaseGameLayer::removeObjectFromSection(a1, a1->m_player1CollisionBlock);
GJBaseGameLayer::removeObjectFromSection(a1, a1->m_player2CollisionBlock);
sub_14003BDB0((__int64)Block, (__int64)&a1->m_level->GJBaseGameLayer::m_levelString);
v106 = cocos2d::ZipUtils::decompressString(v160, Block, 0, 11);
sub_140051590((__int64)&a1->m_levelString, v106);
sub_14003A830((__int64)v160);
sub_14003A830((__int64)Block);
LevelEditorLayer::createObjectsFromSetup(a1, &a1->m_levelString);
GJBaseGameLayer::createTextLayers(a1);
GJBaseGameLayer::increaseBatchNodeCapacity(a1);
if ( !a1->m_levelSettings )
{
v107 = LevelSettingsObject::create();
a1->m_levelSettings = v107;
v107->m_level = a1->m_level;
cocos2d::CCObject::retain(a1->m_levelSettings);
GJBaseGameLayer::loadLevelSettings(a1);
}
m_effectManager = a1->m_levelSettings->GJBaseGameLayer::m_effectManager;
v109 = m_effectManager->m_colorActionVector._Mypair._Myval2._Myfirst[1005];
if ( !v109 )
{
v109 = ColorAction::create();
v109->m_colorID = 1005;
cocos2d::CCDictionary::setObject(m_effectManager->m_unkObject148, v109, 1005);
*((_QWORD *)m_effectManager->m_colorActionVector._Mypair._Myval2._Myfirst + 1005) = v109;
ColorSprite = GJEffectManager::getColorSprite(m_effectManager, 1005);
v109->m_colorSprite = ColorSprite;
ColorSprite->m_colorAction = v109;
}
v109->m_duration = 0.0;
m_player1 = a1->m_player1;
*(_WORD *)&v109->m_fromColor.r = *(_WORD *)&m_player1->m_playerColor1.r;
v109->m_fromColor.b = m_player1->m_playerColor1.b;
v109->m_blending = 1;
v112 = a1->m_levelSettings->GJBaseGameLayer::m_effectManager;
v113 = v112->m_colorActionVector._Mypair._Myval2._Myfirst[1006];
if ( !v113 )
{
v113 = ColorAction::create();
v113->m_colorID = 1006;
cocos2d::CCDictionary::setObject(v112->m_unkObject148, v113, 1006);
*((_QWORD *)v112->m_colorActionVector._Mypair._Myval2._Myfirst + 1006) = v113;
v114 = GJEffectManager::getColorSprite(v112, 1006);
v113->m_colorSprite = v114;
v114->m_colorAction = v113;
}
v113->m_duration = 0.0;
v115 = a1->m_player1;
*(_WORD *)&v113->m_fromColor.r = *(_WORD *)&v115->m_playerColor2.r;
v113->m_fromColor.b = v115->m_playerColor2.b;
v113->m_blending = 1;
if ( !v154 )
{
v160[0] = (cocos2d::CCPoint)operator new(0x5A8u);
v116 = EditorUI::EditorUI(*(EditorUI **)v160);
v117 = v116;
if ( v116 )
{
if ( EditorUI::init(v116, a1) )
{
cocos2d::CCObject::autorelease(v117);
}
else
{
((void (__fastcall *)(EditorUI *, __int64))v117->~EditorUI)(v117, 1);
v117 = nullptr;
}
}
a1->m_editorUI = v117;
a1->addChild_0(a1, v117, 100);
}
GJBaseGameLayer::createGroundLayer(a1, a1->m_levelSettings->m_groundIndex, a1->m_levelSettings->m_groundLineIndex);
a1->m_spawnOrderObjectsChanged = 1;
GJBaseGameLayer::createBackground(a1, a1->m_levelSettings->m_backgroundIndex);
GJBaseGameLayer::createMiddleground(a1, a1->m_levelSettings->m_middleGroundIndex);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v153);
if ( *(float *)&v153 != *(float *)&dword_1406C2128
|| (cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v153), *((float *)&v153 + 1) != *(float *)&dword_1406C212C) )
{
cocos2d::CCPoint::CCPoint(v157);
a1->m_objectLayer->setPosition_0(a1->m_objectLayer, v157);
m_editorUI = a1->m_editorUI;
if ( m_editorUI )
EditorUI::updateSlider(m_editorUI);
}
if ( a1->m_level->m_lastEditorZoom != 0.0 )
{
((void (__fastcall *)(cocos2d::CCLayer *))a1->m_objectLayer->setScale_0)(a1->m_objectLayer);
v119 = a1->m_editorUI;
if ( v119 )
EditorUI::updateSlider(v119);
}
m_objects = a1->m_objects;
if ( m_objects )
{
data = m_objects->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (cocos2d::CCPoint *)data->arr;
for ( m = &arr[num - 1]; arr <= m; ++arr )
{
v125 = *arr;
if ( !*(_QWORD *)arr )
break;
if ( *(_DWORD *)(*(_QWORD *)&v125 + 1036LL) == 1615 )
{
v153 = (std::_Vector_val>::pointer)*arr;
v155 = *(_DWORD *)(*(_QWORD *)&v125 + 1696LL);
if ( *(int *)(*(_QWORD *)&v125 + 1916LL) < 0 )
v155 = *(_DWORD *)(*(_QWORD *)&v125 + 1916LL);
if ( *(_BYTE *)(*(_QWORD *)&v125 + 1920LL) )
{
p_m_timeLabelObjects = &a1->m_timeLabelObjects;
v127 = v160;
}
else
{
p_m_timeLabelObjects = &a1->m_labelObjects;
v127 = v157;
}
v128 = sub_14024EAF0((__int64)p_m_timeLabelObjects, (__int64)v127, (unsigned __int8 *)&v155);
v129 = (_QWORD *)(*(_QWORD *)v128 + 24LL);
v130 = *(cocos2d::CCPoint **)(*(_QWORD *)v128 + 32LL);
if ( v130 == *(cocos2d::CCPoint **)(*(_QWORD *)v128 + 40LL) )
{
sub_140063110(v129, v130, &v153);
}
else
{
*v130 = v125;
v129[1] += 8LL;
}
}
}
}
}
Myhead = a1->m_labelObjects._List._Mypair._Myval2._Myhead;
for ( n = *(_QWORD **)Myhead; n != (_QWORD *)Myhead; n = (_QWORD *)*n )
{
v133 = (LabelGameObject **)n[3];
for ( ii = (LabelGameObject **)n[4]; v133 != ii; ++v133 )
LabelGameObject::updatePreviewLabel(*v133);
}
v135 = a1->m_timeLabelObjects._List._Mypair._Myval2._Myhead;
for ( jj = *(_QWORD **)v135; jj != (_QWORD *)v135; jj = (_QWORD *)*jj )
{
v137 = (LabelGameObject **)jj[3];
for ( kk = (LabelGameObject **)jj[4]; v137 != kk; ++v137 )
LabelGameObject::updatePreviewLabel(*v137);
}
GJBaseGameLayer::sortStickyGroups(a1);
a1->levelSettingsUpdated(&a1->LevelSettingsDelegate);
m_batchNodes = a1->m_batchNodes;
if ( m_batchNodes )
{
v140 = m_batchNodes->data;
v141 = v140->num;
if ( (_DWORD)v141 )
{
v142 = v140->arr;
for ( mm = &v142[v141 - 1]; v142 <= mm; ++v142 )
{
if ( !*v142 )
break;
LOBYTE((*v142)[6].m_nTag) = 1;
}
}
}
cocos2d::CCNode::schedule(a1, LevelEditorLayer::updateEditor);
a1->m_previewMode = 1;
LevelEditorLayer::updateGameObjects(a1);
LevelEditorLayer::updateEditorMode(a1);
GJBaseGameLayer::refreshKeyframeAnims(a1);
v144 = a1->m_objects;
if ( v144 )
{
v145 = v144->data;
v146 = v145->num;
if ( (_DWORD)v146 )
{
v147 = v145->arr;
for ( nn = &v147[v146 - 1]; v147 <= nn; ++v147 )
{
v149 = *v147;
if ( !*v147 )
break;
if ( v149->__vftable[21].canEncode(*v147) )
{
LOBYTE(v150) = 1;
((void (__fastcall *)(cocos2d::CCObject *, __int64))v149->__vftable[23].update)(v149, v150);
}
}
}
}
a1->m_initializing = 0;
v151 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v160[0] = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)v160);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v151 = (GameManager *)qword_1406C2ED8;
}
v152 = GameManager::getGameVariable(v151, "0037");
a1->m_hideGround = !v152;
a1->m_groundLayer->setVisible(a1->m_groundLayer, v152);
a1->m_loadingProgress = 1.0;
sub_14003A830((__int64)v161);
sub_14003A830((__int64)v162);
return 1;
}