//
// LevelEditorLayer::init from 0x67c170 to 0x67d3f8 (4744 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::create @ 0x67ea0c
// > ??> @ 0x7b510
//
// 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 LevelEditorLayer::init(LevelEditorLayer *a1, GJGameLevel *a2, bool a3)
{
MusicDownloadManager *v5; // x0
GameManager *v6; // x0
GameManager *v7; // x0
GameManager *v8; // x0
bool m_alwaysHideParticleIcons; // w1
int v10; // w0
FMODAudioEngine *v11; // x0
cocos2d::CCObject *v12; // x0
GameManager *v13; // x0
cocos2d::CCArray *v14; // x0
cocos2d::CCDictionary *v15; // x0
cocos2d::CCDictionary *v16; // x0
cocos2d::CCDictionary *v17; // x0
cocos2d::CCArray *v18; // x0
cocos2d::CCArray *v19; // x0
cocos2d::CCArray *v20; // x0
cocos2d::CCArray *v21; // x0
cocos2d::CCArray *v22; // x0
cocos2d::CCArray *v23; // x0
cocos2d::CCArray *v24; // x0
cocos2d::CCArray *v25; // x0
cocos2d::CCArray *v26; // x0
cocos2d::CCArray *v27; // x0
cocos2d::CCDictionary *v28; // x0
cocos2d::CCArray *v29; // x0
cocos2d::CCArray *v30; // x0
cocos2d::CCDictionary *v31; // x0
cocos2d::CCArray *v32; // x0
cocos2d::CCArray *v33; // x0
cocos2d::CCArray *v34; // x0
cocos2d::CCArray *v35; // x0
cocos2d::CCArray *v36; // x0
cocos2d::CCArray *v37; // x0
cocos2d::CCArray *v38; // x0
cocos2d::CCArray *v39; // x0
cocos2d::CCArray *v40; // x0
cocos2d::CCArray *v41; // x0
cocos2d::CCArray *v42; // x0
cocos2d::CCArray *v43; // x0
cocos2d::CCArray *v44; // x0
cocos2d::CCArray *v45; // x0
GameObject **m_start; // x0
unsigned __int64 v47; // x1
std::uintptr_t *m_bitptr; // x5
unsigned int m_offset; // w6
std::uintptr_t *v50; // x4
__int64 v51; // x1
unsigned __int64 v52; // x2
__int64 v53; // x1
std::uintptr_t *v54; // x5
unsigned int v55; // w6
std::uintptr_t *v56; // x4
__int64 v57; // x1
unsigned __int64 v58; // x2
__int64 v59; // x1
unsigned __int8 *v60; // x2
unsigned __int8 *m_finish; // x0
unsigned __int64 v62; // x1
std::uintptr_t *v63; // x5
unsigned int v64; // w6
std::uintptr_t *v65; // x4
__int64 v66; // x1
unsigned __int64 v67; // x2
__int64 v68; // x1
std::uintptr_t *v69; // x5
unsigned int v70; // w6
std::uintptr_t *v71; // x4
__int64 v72; // x1
unsigned __int64 v73; // x2
__int64 v74; // x1
cocos2d::CCArray **v75; // x0
unsigned __int64 v76; // x1
std::uintptr_t *v77; // x5
unsigned int v78; // w6
std::uintptr_t *v79; // x4
__int64 v80; // x1
unsigned __int64 v81; // x2
__int64 v82; // x1
float *v83; // x0
unsigned __int64 v84; // x1
unsigned __int64 i; // x2
__int64 v86; // x0
std::uintptr_t *v87; // x7
std::uintptr_t *v88; // x6
std::uintptr_t *v89; // x5
unsigned __int8 *v90; // x8
std::uintptr_t *v91; // x4
float v92; // s0
float v93; // s1
cocos2d::CCArray *v94; // x0
cocos2d::CCPoint *v95; // x21
cocos2d::CCPoint *v96; // x22
unsigned __int64 v97; // x20
cocos2d::CCPoint *v98; // x21
float v99; // s0
float v100; // s1
float v101; // s3
float v102; // s4
OBB2D *v103; // x0
cocos2d::CCDirector *v104; // x0
DrawGridLayer *v105; // x0
cocos2d::CCLayer *m_objectLayer; // x22
DrawGridLayer *v107; // x21
void (__fastcall *addChild_0)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int); // x23
GameManager *v109; // x0
__int64 v110; // x2
cocos2d::CCDrawNode *v111; // x0
cocos2d::CCSprite *v112; // x0
cocos2d::CCSpriteBatchNode *m_gameLayerT1; // x3
int v114; // w3
void *v115; // x0
void *v116; // x0
LevelSettingsObject *m_levelSettings; // x0
ColorAction *ColorAction; // x0
PlayerObject *m_player1; // x2
GLubyte r; // w4
GLubyte g; // w3
ColorAction *v122; // x0
PlayerObject *v123; // x1
GLubyte v124; // w3
GLubyte v125; // w2
EditorUI *v126; // x0
LevelEditorLayer_vtbl *v127; // x3
LevelSettingsObject *v128; // x1
cocos2d::CCLayer *v129; // x20
cocos2d::CCPoint *v130; // x22
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
EditorUI *m_editorUI; // x0
cocos2d::CCArray *m_objects; // x0
cocos2d::ccArray *data; // x1
LabelGameObject **arr; // x20
LabelGameObject **k; // x21
LabelGameObject *v137; // x1
cocos2d::CCArray *m_batchNodes; // x0
cocos2d::ccArray *v139; // x0
unsigned int num; // w1
cocos2d::CCObject **v141; // x0
cocos2d::CCObject **v142; // x2
cocos2d::CCObject *m; // x1
GameManager *v144; // x0
bool GameVariable; // w0
__int64 v146; // x1
void *v147; // x0
void *v148; // x0
unsigned int *v149; // x19
int v150; // w1
size_t v151; // x20
unsigned __int8 *v152; // x22
unsigned __int64 v153; // x21
unsigned __int64 v154; // x21
unsigned __int8 *v155; // x0
unsigned __int8 *v156; // x23
unsigned __int8 *v157; // x1
unsigned __int8 *v158; // x2
size_t v159; // x2
unsigned __int8 *v160; // x20
unsigned __int8 *v161; // x0
cocos2d::CCPoint *v162; // x22
cocos2d::CCPoint *v163; // x2
unsigned __int64 v164; // x20
__int64 v165; // x23
unsigned __int64 v166; // x25
int v167; // w27
int v168; // w28
int v169; // w0
cocos2d::CCPoint *v170; // x22
float v171; // s0
float v172; // s1
bool v173; // cf
char v174; // w1
cocos2d::CCPoint v175; // x1
__int64 *v176; // x0
unsigned int *v177; // x1
int v178; // w3
EditorUI *v179; // x0
GameManager *v180; // x0
cocos2d::CCArray *v181; // x25
__int64 v182; // x22
__int64 v183; // x3
unsigned __int64 v184; // x20
__int64 v185; // x28
const std::string *v186; // x1
cocos2d::CCObject *v187; // x0
char *v188; // x0
void *v189; // x0
unsigned int *v190; // x1
int v191; // w2
unsigned int *v192; // x1
int v193; // w2
void *v194; // x0
unsigned int j; // w20
cocos2d::CCString *v196; // x0
int v197; // w0
LevelSettingsObject *v198; // x0
unsigned int *v199; // x1
int v200; // w2
unsigned int *v201; // x1
int v202; // w2
unsigned int *v203; // x1
int v204; // w2
unsigned int *v205; // x1
int v206; // w2
cocos2d::CCObject *v207[14]; // [xsp+0h] [xbp+0h] BYREF
cocos2d::CCObject *v208; // [xsp+70h] [xbp+70h]
_BOOL4 v209; // [xsp+78h] [xbp+78h]
bool v210; // [xsp+7Fh] [xbp+7Fh]
cocos2d::CCPoint *v211; // [xsp+80h] [xbp+80h]
cocos2d::CCPoint *p_p; // [xsp+88h] [xbp+88h]
__int64 v213; // [xsp+98h] [xbp+98h] BYREF
__int64 v214; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::ccBlendFunc v215; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v216; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v217; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v218; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCPoint v219; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCPoint v220[2]; // [xsp+D8h] [xbp+D8h] BYREF
__int64 v221; // [xsp+E8h] [xbp+E8h]
std::uintptr_t *v222; // [xsp+F0h] [xbp+F0h]
__int64 v223; // [xsp+F8h] [xbp+F8h]
std::uintptr_t *v224; // [xsp+100h] [xbp+100h]
__int64 v225; // [xsp+108h] [xbp+108h]
std::uintptr_t *v226; // [xsp+110h] [xbp+110h]
__int64 v227; // [xsp+118h] [xbp+118h]
std::uintptr_t *v228; // [xsp+120h] [xbp+120h]
__int64 v229; // [xsp+128h] [xbp+128h]
void *p; // [xsp+130h] [xbp+130h] BYREF
cocos2d::CCPoint *v231; // [xsp+138h] [xbp+138h]
__int64 v232; // [xsp+140h] [xbp+140h]
cocos2d::CCPoint v233; // 0:s0.4,4:s1.4
v208 = a2;
v209 = a3;
v210 = GJBaseGameLayer::init(a1);
if ( !v210 )
return v210;
v5 = MusicDownloadManager::sharedState();
MusicDownloadManager::tryLoadLibraries(v5);
UILayer::enableEditorMode(a1->m_uiLayer);
a1->m_isEditor = (unsigned __int8)&dword_0 + 1;
a1->m_initializing = (unsigned __int8)&dword_0 + 1;
v6 = GameManager::sharedState();
a1->m_playTestSmoothFix = GameManager::getGameVariable(v6, "0102");
v7 = GameManager::sharedState();
a1->m_previewParticles = GameManager::getGameVariable(v7, "0117");
v8 = GameManager::sharedState();
a1->m_previewAnimations = GameManager::getGameVariable(v8, "0118");
m_alwaysHideParticleIcons = a1->m_alwaysHideParticleIcons;
if ( !m_alwaysHideParticleIcons )
{
v180 = GameManager::sharedState();
m_alwaysHideParticleIcons = GameManager::getGameVariable(v180, "0137");
}
a1->m_hideParticleIcons = m_alwaysHideParticleIcons;
LevelEditorLayer::updateOptions(a1);
a1->m_objectCount.value = 0;
v10 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
a1->m_objectCount.seed = v10;
a1->m_objectCount.random = v10;
v11 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v11, 1);
v12 = v208;
a1->m_level = (GJGameLevel *)v208;
cocos2d::CCObject::retain(v12);
GameManager::sharedState()->m_editorEnabled = 1;
v13 = GameManager::sharedState();
v13->m_levelEditorLayer = a1;
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v13);
a1->m_durationObjects = v14;
cocos2d::CCObject::retain(v14);
v15 = cocos2d::CCDictionary::create();
a1->m_triggerGroupsDict = v15;
cocos2d::CCObject::retain(v15);
v16 = cocos2d::CCDictionary::create();
a1->m_unk3778 = v16;
cocos2d::CCObject::retain(v16);
v17 = cocos2d::CCDictionary::create();
a1->m_unk3780 = v17;
cocos2d::CCObject::retain(v17);
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v18);
a1->m_pulseTriggers = v19;
cocos2d::CCObject::retain(v19);
v21 = (cocos2d::CCArray *)cocos2d::CCArray::create(v20);
a1->m_colorTriggers = v21;
cocos2d::CCObject::retain(v21);
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v22);
a1->m_alphaTriggers = v23;
cocos2d::CCObject::retain(v23);
v25 = (cocos2d::CCArray *)cocos2d::CCArray::create(v24);
a1->m_spawnTriggers = v25;
cocos2d::CCObject::retain(v25);
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v26);
a1->m_playtestTriggers = v27;
cocos2d::CCObject::retain(v27);
v28 = cocos2d::CCDictionary::create();
a1->m_spawnOrderTriggers = (cocos2d::CCArray *)v28;
cocos2d::CCObject::retain(v28);
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create(v29);
a1->m_spawnOrderObjects = v30;
cocos2d::CCObject::retain(v30);
v31 = cocos2d::CCDictionary::create();
a1->m_unk3740 = v31;
cocos2d::CCObject::retain(v31);
v33 = (cocos2d::CCArray *)cocos2d::CCArray::create(v32);
a1->m_unk3748 = v33;
cocos2d::CCObject::retain(v33);
a1->m_unk3751 = 1;
v35 = (cocos2d::CCArray *)cocos2d::CCArray::create(v34);
a1->m_moveTriggers = v35;
cocos2d::CCObject::retain(v35);
v37 = (cocos2d::CCArray *)cocos2d::CCArray::create(v36);
a1->m_undoObjects = v37;
cocos2d::CCObject::retain(v37);
v39 = (cocos2d::CCArray *)cocos2d::CCArray::create(v38);
a1->m_redoObjects = v39;
cocos2d::CCObject::retain(v39);
v41 = (cocos2d::CCArray *)cocos2d::CCArray::create(v40);
a1->m_cameraGuideTriggers = v41;
cocos2d::CCObject::retain(v41);
v43 = (cocos2d::CCArray *)cocos2d::CCArray::create(v42);
a1->m_particleObjects = v43;
cocos2d::CCObject::retain(v43);
v45 = (cocos2d::CCArray *)cocos2d::CCArray::create(v44);
a1->m_keyframeObjects = v45;
cocos2d::CCObject::retain(v45);
m_start = a1->m_objectVector.m_start;
v47 = a1->m_objectVector.m_finish - m_start;
if ( v47 <= 0x270F )
{
std::vector::_M_default_append((__int64)&a1->m_objectVector, 10000 - v47);
}
else if ( v47 != 10000 )
{
a1->m_objectVector.m_finish = m_start + 10000;
}
m_bitptr = a1->m_toggledGroups.m_end.m_bitptr;
m_offset = a1->m_toggledGroups.m_end.m_offset;
v50 = a1->m_toggledGroups.m_start.m_bitptr;
v51 = a1->m_toggledGroups.m_start.m_offset;
v52 = m_offset + 8 * ((char *)m_bitptr - (char *)v50) - v51;
if ( v52 <= 0x2710 )
{
LODWORD(v221) = a1->m_toggledGroups.m_end.m_offset;
v220[1] = (cocos2d::CCPoint)m_bitptr;
std::vector::_M_fill_insert((__int64)&a1->m_toggledGroups, (__int64)m_bitptr, m_offset, 10000 - v52, 0);
}
else
{
v53 = v51 + 10000;
a1->m_toggledGroups.m_end.m_offset = v53 & 0x3F;
a1->m_toggledGroups.m_end.m_bitptr = &v50[v53 >> 6];
}
v54 = a1->m_lockedLayers.m_end.m_bitptr;
v55 = a1->m_lockedLayers.m_end.m_offset;
v56 = a1->m_lockedLayers.m_start.m_bitptr;
v57 = a1->m_lockedLayers.m_start.m_offset;
v58 = v55 + 8 * ((char *)v54 - (char *)v56) - v57;
if ( v58 <= 0x2710 )
{
LODWORD(v223) = a1->m_lockedLayers.m_end.m_offset;
v222 = v54;
std::vector::_M_fill_insert((__int64)&a1->m_lockedLayers, (__int64)v54, v55, 10000 - v58, 0);
}
else
{
v59 = v57 + 10000;
a1->m_lockedLayers.m_end.m_offset = v59 & 0x3F;
a1->m_lockedLayers.m_end.m_bitptr = &v56[v59 >> 6];
}
v60 = a1->m_toggledGroupStates.m_start;
m_finish = a1->m_toggledGroupStates.m_finish;
v62 = m_finish - v60;
if ( (unsigned __int64)(m_finish - v60) <= 0x270F )
{
v151 = 10000 - v62;
if ( a1->m_toggledGroupStates.m_reserveEnd - m_finish >= 10000 - v62 )
{
memset(m_finish, 0, 10000 - v62);
a1->m_toggledGroupStates.m_finish += v151;
}
else
{
v152 = nullptr;
if ( v151 < v62 )
v153 = m_finish - v60;
else
v153 = 10000 - v62;
v154 = v153 + v62;
if ( v154 < v62 )
v154 = -1;
v155 = (unsigned __int8 *)operator new(v154);
v156 = v155;
v157 = a1->m_toggledGroupStates.m_start;
v158 = (unsigned __int8 *)(a1->m_toggledGroupStates.m_finish - v157);
if ( v158 )
{
v152 = (unsigned __int8 *)(a1->m_toggledGroupStates.m_finish - v157);
memmove(v155, v157, (size_t)v158);
}
v159 = v151;
v160 = &v152[(_QWORD)v156 + v151];
memset(&v152[(_QWORD)v156], 0, v159);
v161 = a1->m_toggledGroupStates.m_start;
if ( v161 )
operator delete(v161);
a1->m_toggledGroupStates.m_start = v156;
a1->m_toggledGroupStates.m_finish = v160;
a1->m_toggledGroupStates.m_reserveEnd = &v156[v154];
}
}
else if ( v62 != 10000 )
{
a1->m_toggledGroupStates.m_finish = v60 + 10000;
}
v63 = a1->m_blendingColors2.m_end.m_bitptr;
v64 = a1->m_blendingColors2.m_end.m_offset;
v65 = a1->m_blendingColors2.m_start.m_bitptr;
v66 = a1->m_blendingColors2.m_start.m_offset;
v67 = v64 + 8 * ((char *)v63 - (char *)v65) - v66;
if ( v67 <= 0x2710 )
{
LODWORD(v225) = a1->m_blendingColors2.m_end.m_offset;
v224 = v63;
std::vector::_M_fill_insert((__int64)&a1->m_blendingColors2, (__int64)v63, v64, 10000 - v67, 0);
}
else
{
v68 = v66 + 10000;
a1->m_blendingColors2.m_end.m_offset = v68 & 0x3F;
a1->m_blendingColors2.m_end.m_bitptr = &v65[v68 >> 6];
}
v69 = a1->m_blendingColors.m_end.m_bitptr;
v70 = a1->m_blendingColors.m_end.m_offset;
v71 = a1->m_blendingColors.m_start.m_bitptr;
v72 = a1->m_blendingColors.m_start.m_offset;
v73 = v70 + 8 * ((char *)v69 - (char *)v71) - v72;
if ( v73 <= 0x2710 )
{
LODWORD(v227) = a1->m_blendingColors.m_end.m_offset;
v226 = v69;
std::vector::_M_fill_insert((__int64)&a1->m_blendingColors, (__int64)v69, v70, 10000 - v73, 0);
}
else
{
v74 = v72 + 10000;
a1->m_blendingColors.m_end.m_offset = v74 & 0x3F;
a1->m_blendingColors.m_end.m_bitptr = &v71[v74 >> 6];
}
v75 = a1->m_triggerGroups.m_start;
v76 = a1->m_triggerGroups.m_finish - v75;
if ( v76 <= 0x270F )
{
std::vector::_M_default_append((__int64)&a1->m_triggerGroups, 10000 - v76);
}
else if ( v76 != 10000 )
{
a1->m_triggerGroups.m_finish = v75 + 10000;
}
v77 = a1->m_sortedGroups.m_end.m_bitptr;
v78 = a1->m_sortedGroups.m_end.m_offset;
v79 = a1->m_sortedGroups.m_start.m_bitptr;
v80 = a1->m_sortedGroups.m_start.m_offset;
v81 = v78 + 8 * ((char *)v77 - (char *)v79) - v80;
if ( v81 <= 0x2710 )
{
LODWORD(v229) = a1->m_sortedGroups.m_end.m_offset;
v228 = v77;
std::vector::_M_fill_insert((__int64)&a1->m_sortedGroups, (__int64)v77, v78, 10000 - v81, 0);
}
else
{
v82 = v80 + 10000;
a1->m_sortedGroups.m_end.m_offset = v82 & 0x3F;
a1->m_sortedGroups.m_end.m_bitptr = &v79[v82 >> 6];
}
v83 = a1->m_spawnGroupDelays.m_start;
v84 = a1->m_spawnGroupDelays.m_finish - v83;
if ( v84 <= 0x270F )
{
std::vector::_M_default_append((__int64)&a1->m_spawnGroupDelays, 10000 - v84);
}
else if ( v84 != 10000 )
{
a1->m_spawnGroupDelays.m_finish = v83 + 10000;
}
for ( i = 0; i != 10000; ++i )
{
a1->m_objectVector.m_start[i] = nullptr;
v86 = ~(1LL << (i & 0x3F));
v87 = a1->m_blendingColors2.m_start.m_bitptr;
v88 = a1->m_lockedLayers.m_start.m_bitptr;
v89 = a1->m_blendingColors.m_start.m_bitptr;
a1->m_toggledGroups.m_start.m_bitptr[i >> 6] &= v86;
v90 = a1->m_toggledGroupStates.m_start;
v91 = a1->m_sortedGroups.m_start.m_bitptr;
v87[i >> 6] &= v86;
v88[i >> 6] &= v86;
v89[i >> 6] &= v86;
v91[i >> 6] &= v86;
v90[i] = 0;
a1->m_triggerGroups.m_start[i] = nullptr;
a1->m_spawnGroupDelays.m_start[i] = 0.0;
}
LODWORD(v92) = sub_D18D28(&v213, &a1->m_level->m_lockedEditorLayers).n128_u32[0];
v94 = *(cocos2d::CCArray **)(v213 - 24);
if ( v94 )
{
v181 = (cocos2d::CCArray *)cocos2d::CCArray::create(v94);
v182 = sub_D168E0((unsigned int)v207 + 152, &byte_F804F8, 0, 1u);
v183 = v182;
v184 = 0;
v185 = *(_QWORD *)(v213 - 24);
v211 = &v218;
v207[13] = (cocos2d::CCObject *)&v219;
p_p = (cocos2d::CCPoint *)&byte_F804F8;
while ( 1 )
{
sub_D14F84(v220, &v213, v184, v183);
if ( v185 != v184 || *(_QWORD *)(*(_QWORD *)v220 - 24LL) )
{
sub_D153B8((int)&p, *(char **)v220);
v187 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&p, v186);
cocos2d::CCArray::addObject(v181, v187);
v188 = (char *)p - 24;
if ( (char *)p - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v192 = (unsigned int *)((char *)p - 8);
do
v193 = __ldaxr(v192);
while ( __stlxr(v193 - 1, v192) );
}
else
{
v193 = *((_DWORD *)p - 2);
*((_DWORD *)p - 2) = v193 - 1;
}
if ( v193 <= 0 )
operator delete(v188);
}
}
if ( v182 == -1 )
break;
v184 = v182 + 1;
v182 = sub_D168E0((int)&v213, p_p, (int)v182 + 1, 1u);
v189 = (void *)(*(_QWORD *)v220 - 24LL);
if ( (__int64 *)(*(_QWORD *)v220 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v190 = (unsigned int *)(*(_QWORD *)v220 - 8LL);
do
v191 = __ldaxr(v190);
while ( __stlxr(v191 - 1, v190) );
}
else
{
v191 = *(_DWORD *)(*(_QWORD *)v220 - 8LL);
*(_DWORD *)(*(_QWORD *)v220 - 8LL) = v191 - 1;
}
if ( v191 <= 0 )
operator delete(v189);
}
v183 = v182 - v184;
if ( *(_QWORD *)(v213 - 24) < v184 )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v184,
*(_QWORD *)(v213 - 24));
}
v194 = (void *)(*(_QWORD *)v220 - 24LL);
if ( (__int64 *)(*(_QWORD *)v220 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v205 = (unsigned int *)(*(_QWORD *)v220 - 8LL);
do
v206 = __ldaxr(v205);
while ( __stlxr(v206 - 1, v205) );
}
else
{
v206 = *(_DWORD *)(*(_QWORD *)v220 - 8LL);
*(_DWORD *)(*(_QWORD *)v220 - 8LL) = v206 - 1;
}
if ( v206 <= 0 )
operator delete(v194);
}
for ( j = 0; j < (unsigned int)cocos2d::CCArray::count(v181); ++j )
{
v196 = cocos2d::CCArray::stringAtIndex(v181, j);
v197 = cocos2d::CCString::intValue(v196);
if ( v197 <= 9999 )
a1->m_lockedLayers.m_start.m_bitptr[(unsigned __int64)v197 >> 6] |= 1LL << (v197 & 0x3F);
}
}
v95 = a1->m_savedPositions.m_start;
v96 = a1->m_savedPositions.m_finish;
v97 = v96 - v95;
if ( v97 <= 9 )
{
std::vector::_M_default_append((__int64)&a1->m_savedPositions, 10 - v97);
v96 = a1->m_savedPositions.m_finish;
v95 = a1->m_savedPositions.m_start;
}
else if ( v97 != 10 )
{
v96 = v95 + 10;
a1->m_savedPositions.m_finish = v95 + 10;
}
for ( ; v95 != v96; ++v95 )
cocos2d::CCPoint::operator=(v95, v92, v93);
sub_D18D28(&v214, &a1->m_level->m_savedCameraPositions);
if ( *(_QWORD *)(v214 - 24) )
{
p_p = (cocos2d::CCPoint *)&p;
p = nullptr;
v231 = nullptr;
v232 = 0;
sub_66B910(&v214, &byte_F804F8, (__int64)&p);
v162 = (cocos2d::CCPoint *)p;
v163 = v231;
if ( ((char *)v231 - (_BYTE *)p) >> 3 != 1 )
{
v164 = 0;
v165 = 1;
v166 = 2;
v167 = 0;
do
{
v168 = atoi(*(const char **)&v162[v164 / 4]);
v169 = atoi(*(const char **)&v162[v165]);
v170 = &a1->m_savedPositions.m_start[v164 / 8];
cocos2d::CCPoint::CCPoint(v220, (float)v168, (float)v169);
cocos2d::CCPoint::operator=(v170, v171, v172);
v162 = (cocos2d::CCPoint *)p;
++v167;
v163 = v231;
v165 += 2;
v164 += 8LL;
v173 = v166 >= (((char *)v231 - (_BYTE *)p) >> 3) - 1;
v166 += 2LL;
v174 = !v173;
}
while ( ((unsigned __int8)v174 & (v167 <= 9)) != 0 );
}
for ( ; v162 != v163; ++v162 )
{
v175 = *v162;
v176 = (__int64 *)(*(_QWORD *)v162 - 24LL);
if ( v176 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v177 = (unsigned int *)(*(_QWORD *)&v175 - 8LL);
do
v178 = __ldaxr(v177);
while ( __stlxr(v178 - 1, v177) );
}
else
{
v178 = *(_DWORD *)(*(_QWORD *)&v175 - 8LL);
*(_DWORD *)(*(_QWORD *)&v175 - 8LL) = v178 - 1;
}
if ( v178 <= 0 )
{
v211 = v163;
operator delete(v176);
v163 = v211;
}
}
}
if ( p )
operator delete(p);
}
else
{
p_p = (cocos2d::CCPoint *)&p;
}
v98 = p_p;
cocos2d::CCPoint::CCPoint(p_p, &a1->m_level->m_previewLock);
cocos2d::CCPoint::operator=(&a1->m_previewPosition, v99, v100);
cocos2d::CCPoint::CCPoint(v98, (const cocos2d::CCPoint *)&dword_12420B0);
v233.x = 1.0;
v233.y = 1.0;
v103 = OBB2D::create(v233, 0.0, v101, v102);
a1->m_currentOBB2D = v103;
cocos2d::CCObject::retain(v103);
v104 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v104);
GJBaseGameLayer::setupLayers(a1);
v105 = DrawGridLayer::create(a1->m_objectLayer, a1);
m_objectLayer = a1->m_objectLayer;
v107 = v105;
a1->m_drawGridLayer = v105;
addChild_0 = m_objectLayer->addChild_0;
v109 = GameManager::sharedState();
if ( GameManager::getGameVariable(v109, "0039") )
v110 = 1399;
else
v110 = 4294965697LL;
addChild_0(m_objectLayer, v107, v110);
v111 = cocos2d::CCDrawNode::create();
a1->m_debugDrawNode = v111;
v215.src = 770;
v215.dst = 771;
cocos2d::CCDrawNode::setBlendFunc(v111, &v215);
a1->m_debugDrawNode->setTag(a1->m_debugDrawNode, -9999);
a1->m_aboveShaderObjectLayer->addChild_0(a1->m_aboveShaderObjectLayer, a1->m_debugDrawNode, 1401);
GJBaseGameLayer::createPlayer(a1);
v112 = cocos2d::CCSprite::createWithSpriteFrameName("d_cross_01_001.png");
m_gameLayerT1 = a1->m_gameLayerT1;
a1->m_playtestDeathSprite = v112;
m_gameLayerT1->addChild_0(m_gameLayerT1, v112, 10);
a1->m_playtestDeathSprite->setColor(a1->m_playtestDeathSprite, (const cocos2d::ccColor3B *)&unk_EC3BF8);
a1->m_playtestDeathSprite->setVisible(a1->m_playtestDeathSprite, 0);
a1->m_playtestDeathSprite->setScale(a1->m_playtestDeathSprite, 0.7);
GJBaseGameLayer::createPlayerCollisionBlock(a1);
a1->m_collisionBlocksAdded = 1;
LevelEditorLayer::removePlayerCollisionBlock(a1);
sub_D18D28(&v216, &a1->m_level->GJBaseGameLayer::m_levelString);
cocos2d::ZipUtils::decompressString((cocos2d::ZipUtils *)&v216, nullptr, 11, v114);
sub_D163D4(&a1->m_levelString, &v217);
v115 = (void *)(v217 - 24);
if ( (__int64 *)(v217 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v201 = (unsigned int *)(v217 - 8);
do
v202 = __ldaxr(v201);
while ( __stlxr(v202 - 1, v201) );
}
else
{
v202 = *(_DWORD *)(v217 - 8);
*(_DWORD *)(v217 - 8) = v202 - 1;
}
if ( v202 <= 0 )
operator delete(v115);
}
v116 = (void *)(v216 - 24);
if ( (__int64 *)(v216 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v199 = (unsigned int *)(v216 - 8);
do
v200 = __ldaxr(v199);
while ( __stlxr(v200 - 1, v199) );
}
else
{
v200 = *(_DWORD *)(v216 - 8);
*(_DWORD *)(v216 - 8) = v200 - 1;
}
if ( v200 <= 0 )
operator delete(v116);
}
LevelEditorLayer::createObjectsFromSetup(a1, (const void **)&a1->m_levelString.m_data.m_data);
GJBaseGameLayer::createTextLayers(a1);
GJBaseGameLayer::increaseBatchNodeCapacity(a1);
m_levelSettings = a1->m_levelSettings;
if ( !m_levelSettings )
{
v198 = LevelSettingsObject::create();
a1->m_levelSettings = v198;
v198->m_level = a1->m_level;
cocos2d::CCObject::retain(a1->m_levelSettings);
GJBaseGameLayer::loadLevelSettings(a1);
m_levelSettings = a1->m_levelSettings;
}
ColorAction = GJEffectManager::getColorAction(m_levelSettings->m_effectManager, 1005);
m_player1 = a1->m_player1;
ColorAction->m_duration = 0.0;
r = m_player1->m_playerColor1.r;
g = m_player1->m_playerColor1.g;
ColorAction->m_fromColor.b = m_player1->m_playerColor1.b;
ColorAction->m_fromColor.r = r;
ColorAction->m_fromColor.g = g;
ColorAction->m_blending = 1;
v122 = GJEffectManager::getColorAction(a1->m_levelSettings->GJBaseGameLayer::m_effectManager, 1006);
v123 = a1->m_player1;
v122->m_duration = 0.0;
v124 = v123->m_playerColor2.r;
v125 = v123->m_playerColor2.g;
v122->m_fromColor.b = v123->m_playerColor2.b;
v122->m_fromColor.r = v124;
v122->m_fromColor.g = v125;
v122->m_blending = (unsigned __int8)&dword_0 + 1;
if ( !v209 )
{
v126 = EditorUI::create(a1);
v127 = a1->GJBaseGameLayer::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_editorUI = v126;
v127->addChild_0(a1, v126, 100);
}
GJBaseGameLayer::createGroundLayer(a1, a1->m_levelSettings->m_groundIndex, a1->m_levelSettings->m_groundLineIndex);
v128 = a1->m_levelSettings;
a1->m_spawnOrderObjectsChanged = 1;
GJBaseGameLayer::createBackground(a1, v128->m_backgroundIndex);
GJBaseGameLayer::createMiddleground(a1, a1->m_levelSettings->m_middleGroundIndex);
cocos2d::CCPoint::CCPoint(&v218, &a1->m_level->m_lastCameraPos);
if ( v218.x != *(float *)&dword_12420B0
|| (cocos2d::CCPoint::CCPoint(&v219, &a1->m_level->m_lastCameraPos), v219.y != *(float *)&dword_12420B4) )
{
v129 = a1->m_objectLayer;
v130 = p_p;
setPosition = v129->setPosition;
cocos2d::CCPoint::CCPoint(p_p, (const cocos2d::CCPoint *)((char *)&v208[15].__vftable + 4));
setPosition(v129, v130);
m_editorUI = a1->m_editorUI;
if ( m_editorUI )
EditorUI::updateSlider(m_editorUI);
if ( a1->m_level->m_lastEditorZoom == 0.0 )
goto LABEL_50;
goto LABEL_101;
}
if ( a1->m_level->m_lastEditorZoom != 0.0 )
{
LABEL_101:
((void (__fastcall *)(cocos2d::CCLayer *))a1->m_objectLayer->setScale)(a1->m_objectLayer);
v179 = a1->m_editorUI;
if ( v179 )
EditorUI::updateSlider(v179);
}
LABEL_50:
m_objects = a1->m_objects;
if ( m_objects )
{
data = m_objects->data;
if ( data->num )
{
arr = (LabelGameObject **)data->arr;
for ( k = &arr[data->num - 1]; k >= arr; ++arr )
{
v137 = *arr;
if ( !*arr )
break;
if ( v137->m_objectID == 1615 )
GJBaseGameLayer::addObjectCounter(a1, v137);
}
}
}
GJBaseGameLayer::resetGroupCounters(a1, 0);
GJBaseGameLayer::sortStickyGroups(a1);
a1->levelSettingsUpdated(a1);
m_batchNodes = a1->m_batchNodes;
if ( m_batchNodes )
{
v139 = m_batchNodes->data;
num = v139->num;
if ( v139->num )
{
v141 = v139->arr;
v142 = &v141[num - 1];
if ( v141 <= v142 )
{
for ( m = *v141; *v141; m = *v141 )
{
++v141;
LOBYTE(m[6].m_nTag) = 1;
if ( v142 < v141 )
break;
}
}
}
}
cocos2d::CCNode::schedule(a1, LevelEditorLayer::updateEditor, 0);
a1->m_previewMode = 1;
LevelEditorLayer::updateGameObjects(a1);
LevelEditorLayer::updateEditorMode(a1);
GJBaseGameLayer::refreshKeyframeAnims(a1);
LevelEditorLayer::updateAnimateOnTriggerObjects(a1, 1);
a1->m_initializing = 0;
v144 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v144, "0037");
LevelEditorLayer::toggleGround(a1, GameVariable);
v146 = v214;
a1->m_loadingProgress = 1.0;
v147 = (void *)(v146 - 24);
if ( (__int64 *)(v146 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v203 = (unsigned int *)(v146 - 8);
do
v204 = __ldaxr(v203);
while ( __stlxr(v204 - 1, v203) );
}
else
{
v204 = *(_DWORD *)(v146 - 8);
*(_DWORD *)(v146 - 8) = v204 - 1;
}
if ( v204 <= 0 )
operator delete(v147);
}
v148 = (void *)(v213 - 24);
if ( (__int64 *)(v213 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v149 = (unsigned int *)(v213 - 8);
do
v150 = __ldaxr(v149);
while ( __stlxr(v150 - 1, v149) );
}
else
{
v150 = *(_DWORD *)(v213 - 8);
*(_DWORD *)(v213 - 8) = v150 - 1;
}
if ( v150 <= 0 )
operator delete(v148);
}
return v210;
}