//
// DrawGridLayer::draw from 0x1402e91f0 to 0x1402eab17 (6439 bytes)
//
// 2 xrefs:
// > ??> @ 0x140585830
// > ??> @ 0x1406d3830
//
// 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=2
void DrawGridLayer::draw(DrawGridLayer *a1)
{
LevelEditorLayer *m_editorLayer; // rax
PlaybackMode m_playbackMode; // ecx
bool v4; // r12
bool v5; // bl
GameManager *v6; // rcx
cocos2d::CCArray *m_effectGameObjects; // rcx
int v8; // eax
float v9; // xmm13_4
bool m_showGround; // r13
double v11; // xmm0_8
__int64 v12; // rcx
cocos2d::CCDirector *v13; // rax
float v14; // xmm14_4
float v15; // xmm0_4
float v16; // xmm12_4
float x; // xmm11_4
float v18; // xmm9_4
int v19; // edi
float m_gridSize; // xmm6_4
double v21; // xmm0_8
int v22; // r15d
int v23; // esi
float v24; // xmm7_4
double v25; // xmm0_8
const struct cocos2d::CCPoint *v26; // rax
const struct cocos2d::CCPoint *v27; // rbx
cocos2d *v28; // rax
const struct cocos2d::CCPoint *v29; // r8
__int64 v30; // rax
double v31; // xmm0_8
__int64 v32; // rax
float v33; // xmm6_4
int v34; // esi
int v35; // r15d
float v36; // xmm7_4
double v37; // xmm0_8
const struct cocos2d::CCPoint *v38; // rax
const struct cocos2d::CCPoint *v39; // rbx
cocos2d *v40; // rax
const struct cocos2d::CCPoint *v41; // r8
__int64 v42; // rax
double v43; // xmm0_8
__int64 v44; // rax
unsigned int v45; // r8d
int v46; // r12d
int v47; // r13d
__int64 v48; // rax
cocos2d::CCArray *m_timeMarkers; // rcx
unsigned int v50; // ebx
int v51; // edi
int v52; // esi
int v53; // r15d
cocos2d::CCString *v54; // rax
cocos2d *v55; // rcx
float v56; // xmm0_4
float v57; // xmm6_4
cocos2d::CCString *v58; // rax
float v59; // xmm0_4
__int64 v60; // rax
double v61; // xmm0_8
__int64 v62; // rax
__int64 v63; // rax
double v64; // xmm0_8
__int64 v65; // rax
__int64 v66; // rax
double v67; // xmm0_8
__int64 v68; // rax
unsigned int v69; // r8d
unsigned int v70; // r8d
unsigned int v71; // r8d
std::_List_val>>::_Nodeptr Myhead; // rdi
_QWORD *v73; // rbx
__int64 v74; // r13
int v75; // edx
float m_normalSpeed; // xmm7_4
int v77; // eax
double v78; // xmm0_8
float v79; // xmm9_4
float v80; // xmm6_4
float v81; // xmm10_4
int v82; // r12d
int v83; // edi
int v84; // esi
int v85; // ebx
int v86; // r15d
double v87; // xmm0_8
int v88; // ecx
unsigned int v89; // r8d
unsigned int v90; // ebx
unsigned int v91; // r8d
double v92; // xmm0_8
int v93; // r15d
PlaybackMode v94; // edi
float v95; // xmm7_4
cocos2d::CCArray *v96; // rdi
cocos2d::ccArray *data; // rdi
__int64 num; // rax
cocos2d::CCObject **arr; // rdi
cocos2d::CCObject **v100; // r12
int v101; // esi
cocos2d::CCObject *v102; // rbx
float *v103; // rax
float v104; // xmm6_4
__int64 v105; // rax
double v106; // xmm0_8
__int64 v107; // rax
unsigned int v108; // r8d
unsigned int v109; // edi
bool i; // si
struct cocos2d::CCObject *v111; // rax
struct cocos2d::CCObject *v112; // rbx
float v113; // xmm6_4
__int64 v114; // rax
float v115; // xmm0_4
double v116; // xmm0_8
float y; // xmm6_4
double v118; // xmm0_8
const struct cocos2d::CCPoint *v119; // rax
const struct cocos2d::CCPoint *v120; // rbx
cocos2d *v121; // rax
const struct cocos2d::CCPoint *v122; // r8
double v123; // xmm0_8
const struct cocos2d::CCPoint *v124; // rax
const struct cocos2d::CCPoint *v125; // rbx
cocos2d *v126; // rax
const struct cocos2d::CCPoint *v127; // r8
LevelEditorLayer **p_m_editorLayer; // r13
LevelEditorLayer *v129; // rax
cocos2d::CCArray *v130; // rdx
float v131; // xmm0_4
float m_playbackX; // xmm1_4
const struct cocos2d::CCPoint *v133; // rax
double v134; // xmm0_8
float v135; // xmm9_4
float v136; // xmm1_4
float m_playbackY; // xmm2_4
const struct cocos2d::CCPoint *v138; // rbx
cocos2d *v139; // rax
const struct cocos2d::CCPoint *v140; // r8
LevelEditorLayer *v141; // rcx
float v142; // xmm6_4
double v143; // xmm0_8
const struct cocos2d::CCPoint *v144; // rax
const struct cocos2d::CCPoint *v145; // rbx
cocos2d *v146; // rax
const struct cocos2d::CCPoint *v147; // r8
LevelEditorLayer *v148; // rax
cocos2d::CCNode *m_objectLayer; // rbx
double v150; // xmm0_8
const struct cocos2d::CCPoint *v151; // rax
const struct cocos2d::CCPoint *v152; // rbx
double v153; // xmm0_8
cocos2d *v154; // rax
const struct cocos2d::CCPoint *v155; // r8
double v156; // xmm0_8
const struct cocos2d::CCPoint *v157; // rax
const struct cocos2d::CCPoint *v158; // rbx
cocos2d *v159; // rax
const struct cocos2d::CCPoint *v160; // r8
GJBaseGameLayer *v161; // rcx
PlayerObject *m_player1; // rax
float MinPortalY; // xmm7_4
LevelEditorLayer *v164; // rbx
double v165; // xmm0_8
double v166; // xmm0_8
const struct cocos2d::CCPoint *v167; // rax
const struct cocos2d::CCPoint *v168; // rbx
cocos2d *v169; // rax
const struct cocos2d::CCPoint *v170; // r8
double v171; // xmm0_8
const struct cocos2d::CCPoint *v172; // rax
const struct cocos2d::CCPoint *v173; // rbx
cocos2d *v174; // rax
const struct cocos2d::CCPoint *v175; // r8
cocos2d::CCArray *m_durationObjects; // rcx
float v177; // ebx
cocos2d::ccArray *v178; // r12
__int64 v179; // rax
std::_List_simple_types>::_Node *v180; // r12
std::_List_simple_types>::_Node *v181; // rdi
__int64 v182; // r15
float v183; // xmm6_4
int v184; // eax
float v185; // xmm1_4
LevelSettingsObject *m_levelSettings; // rbx
int m_startSpeed; // esi
int v188; // edi
cocos2d::CCPoint v189; // rax
float v190; // xmm0_4
char v191; // bl
cocos2d::CCArray *v192; // rdx
cocos2d::CCPoint v193; // rax
__int64 v194; // rsi
__int64 v195; // rax
double v196; // xmm0_8
__int64 v197; // rax
unsigned int v198; // r8d
int *v199; // [rsp+30h] [rbp-D0h]
int *v200; // [rsp+30h] [rbp-D0h]
int v201; // [rsp+50h] [rbp-B0h]
int v202; // [rsp+50h] [rbp-B0h]
PlaybackMode v203; // [rsp+58h] [rbp-A8h]
char v204[8]; // [rsp+60h] [rbp-A0h] BYREF
_QWORD *v205; // [rsp+68h] [rbp-98h]
std::_List_simple_types>::_Node *v206; // [rsp+70h] [rbp-90h]
int v207; // [rsp+78h] [rbp-88h]
cocos2d::CCPoint v208; // [rsp+80h] [rbp-80h] BYREF
int v209; // [rsp+88h] [rbp-78h]
float v210; // [rsp+90h] [rbp-70h]
float v211; // [rsp+94h] [rbp-6Ch]
char v212[8]; // [rsp+98h] [rbp-68h] BYREF
cocos2d::CCPoint v213; // [rsp+A8h] [rbp-58h] BYREF
void *v214; // [rsp+1A0h] [rbp+A0h]
bool GameVariable; // [rsp+1A0h] [rbp+A0h]
struct cocos2d::CCPoint v216; // [rsp+1A8h] [rbp+A8h] BYREF
cocos2d::CCPoint v217; // [rsp+1B0h] [rbp+B0h] BYREF
struct cocos2d::CCPoint v218; // [rsp+1B8h] [rbp+B8h] BYREF
m_editorLayer = a1->m_editorLayer;
if ( !m_editorLayer->m_editorUI )
return;
m_playbackMode = m_editorLayer->m_playbackMode;
v203 = m_playbackMode;
v4 = m_editorLayer->m_showGrid && (m_playbackMode != Playing || !m_editorLayer->m_hideGridOnPlay);
v5 = m_editorLayer->m_drawEffectLines && m_playbackMode != Playing;
LOBYTE(v216.x) = v5;
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v214 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v214);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
GameVariable = GameManager::getGameVariable(v6, "0121");
if ( v5 && a1->m_sortEffects )
{
a1->m_sortEffects = 0;
m_effectGameObjects = a1->m_effectGameObjects;
if ( m_effectGameObjects )
{
if ( cocos2d::CCArray::count(m_effectGameObjects) )
qsort(
a1->m_effectGameObjects->data->arr,
a1->m_effectGameObjects->data->num,
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_1402052D0);
}
}
v207 = 1;
cocos2d::ccGLBlendFunc((cocos2d *)1, 0x303u);
v8 = 80;
if ( a1->m_editorLayer->m_levelSettings->m_dynamicLevelHeight )
v8 = 1000;
v9 = (float)((float)v8 * 30.0) + 90.0;
cocos2d::ccDrawColor4B(nullptr, 0, 0, 0x96u);
glLineWidth(1.0);
m_showGround = a1->m_editorLayer->m_showGround;
a1->m_objectLayer->getPosition_0(a1->m_objectLayer);
v11 = cocos2d::CCPoint::CCPoint(&v213);
v13 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v12);
cocos2d::CCDirector::getWinSize(v13);
cocos2d::CCPoint::CCPoint(*(float *)&v11, 0.0);
v14 = **(float **)&cocos2d::CCNode::convertToNodeSpace(a1->m_objectLayer, &v218);
v15 = a1->m_objectLayer->getScale(a1->m_objectLayer);
v16 = (float)(v210 / v15) + v14;
cocos2d::CCPoint::CCPoint(v15, 0.0);
v218.x = *(float *)(*(_QWORD *)&cocos2d::CCNode::convertToNodeSpace(a1->m_objectLayer, &v218) + 4LL);
x = v218.x;
v18 = (float)(v211 / a1->m_objectLayer->getScale(a1->m_objectLayer)) + x;
v217.x = v18;
v19 = 0;
m_gridSize = a1->m_gridSize;
*(float *)&v21 = floorf(v14 / m_gridSize);
v22 = (int)*(float *)&v21;
if ( v16 > (float)((float)(int)*(float *)&v21 * m_gridSize) )
{
v23 = 1;
do
{
v24 = (float)v22 * a1->m_gridSize;
if ( v24 >= -3000.0 && v24 <= 240000.0 )
{
if ( v24 == 0.0 || v24 == 240000.0 )
{
cocos2d::ccDrawColor4B((cocos2d *)0xFF, 0xFFu, 0xFFu, 0x96u);
v25 = cocos2d::CCPoint::CCPoint(*(float *)&v21, v24);
v27 = v26;
v21 = cocos2d::CCPoint::CCPoint(*(float *)&v25, v24);
cocos2d::ccDrawLine(v28, v27, v29);
}
else if ( v4 && v23 + 1 < 400 )
{
cocos2d::CCPoint::CCPoint(*(float *)&v21, v24);
v31 = cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v19], v30);
cocos2d::CCPoint::CCPoint(*(float *)&v31, v24);
v21 = cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v23], v32);
v19 += 2;
v23 += 2;
}
}
++v22;
}
while ( v16 > v24 );
}
v33 = a1->m_gridSize;
v34 = (int)floorf(x / v33);
if ( v18 > (float)((float)v34 * v33) )
{
v35 = v19 + 1;
do
{
v36 = (float)v34 * a1->m_gridSize;
if ( v36 >= -3000.0 && v9 >= v36 )
{
if ( v36 == 90.0 || v36 == v9 )
{
if ( !m_showGround || v36 != 90.0 )
{
cocos2d::ccDrawColor4B((cocos2d *)0xFF, 0xFFu, 0xFFu, 0x96u);
glLineWidth(2.0);
v37 = cocos2d::CCPoint::CCPoint(2.0, fminf(240000.0, v16));
v39 = v38;
cocos2d::CCPoint::CCPoint(*(float *)&v37, fmaxf(-3000.0, v14));
cocos2d::ccDrawLine(v40, v39, v41);
}
}
else if ( v4 && v35 + 1 < 400 )
{
cocos2d::CCPoint::CCPoint(90.0, fmaxf(-3000.0, v14));
v43 = cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v19], v42);
cocos2d::CCPoint::CCPoint(*(float *)&v43, fminf(240000.0, v16));
cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v35], v44);
v19 += 2;
v35 += 2;
}
}
++v34;
}
while ( v18 > v36 );
}
if ( v4 && v19 > 0 )
{
cocos2d::ccDrawColor4B(nullptr, 0, 0, 0x96u);
glLineWidth(1.0);
cocos2d::ccDrawLines((cocos2d *)a1->m_pointArray1, (const struct cocos2d::CCPoint *)(unsigned int)v19, v45);
}
v46 = 0;
v47 = 0;
v201 = 0;
v48 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v208 = (cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v208);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v48 = qword_1406C2ED8;
}
if ( *(_BYTE *)(v48 + 913) )
{
m_timeMarkers = a1->m_timeMarkers;
if ( m_timeMarkers )
{
v50 = 0;
if ( cocos2d::CCArray::count(m_timeMarkers) )
{
v51 = 1;
v52 = 1;
v53 = 1;
do
{
v54 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(a1->m_timeMarkers, v50);
v56 = cocos2d::CCString::floatValue(v54);
v57 = v56;
if ( v56 >= -3000.0 )
{
if ( v56 >= v14 && v16 >= v56 )
{
v58 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(a1->m_timeMarkers, v50 + 1);
v59 = cocos2d::CCString::floatValue(v58);
if ( v59 == 0.89999998 )
{
if ( v53 + 1 < 400 )
{
cocos2d::CCPoint::CCPoint(v59, v57);
v61 = cocos2d::CCPoint::operator=(&a1->m_pointArray2->_Elems[v47], v60);
cocos2d::CCPoint::CCPoint(*(float *)&v61, v57);
cocos2d::CCPoint::operator=(&a1->m_pointArray2->_Elems[v53], v62);
v47 += 2;
v53 += 2;
}
}
else if ( v59 == 1.0 )
{
if ( v52 + 1 < 400 )
{
cocos2d::CCPoint::CCPoint(v59, v57);
v64 = cocos2d::CCPoint::operator=(&a1->m_pointArray3->_Elems[v201], v63);
cocos2d::CCPoint::CCPoint(*(float *)&v64, v57);
cocos2d::CCPoint::operator=(&a1->m_pointArray3->_Elems[v52], v65);
v201 += 2;
v52 += 2;
}
}
else if ( v51 + 1 < 400 )
{
cocos2d::CCPoint::CCPoint(v59, v57);
v67 = cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v46], v66);
cocos2d::CCPoint::CCPoint(*(float *)&v67, v57);
cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v51], v68);
v46 += 2;
v51 += 2;
}
}
if ( v57 > v16 )
break;
}
v50 += 2;
}
while ( v50 < cocos2d::CCArray::count(a1->m_timeMarkers) );
if ( v46 > 0 )
{
cocos2d::ccDrawColor4B((cocos2d *)0xFF, 0x7Fu, 0, 0xFFu);
glLineWidth(1.0);
cocos2d::ccDrawLines((cocos2d *)a1->m_pointArray1, (const struct cocos2d::CCPoint *)(unsigned int)v46, v69);
}
if ( v47 > 0 )
{
cocos2d::ccDrawColor4B((cocos2d *)0xFF, 0xFFu, 0, 0xFFu);
glLineWidth(1.0);
cocos2d::ccDrawLines((cocos2d *)a1->m_pointArray2, (const struct cocos2d::CCPoint *)(unsigned int)v47, v70);
}
if ( v201 > 0 )
{
LOBYTE(v55) = 127;
cocos2d::ccDrawColor4B(v55, 0xFFu, 0, 0xFFu);
glLineWidth(1.0);
cocos2d::ccDrawLines((cocos2d *)a1->m_pointArray3, (const struct cocos2d::CCPoint *)(unsigned int)v201, v71);
}
}
}
}
v202 = 0;
v209 = 0;
Myhead = a1->m_audioLineObjects._List._Mypair._Myval2._Myhead;
v206 = Myhead;
v73 = *(_QWORD **)Myhead;
v205 = v73;
if ( v73 != (_QWORD *)Myhead )
{
do
{
v74 = v73[3];
if ( !*(_BYTE *)(v74 + 1868) )
{
v75 = *(_DWORD *)(v74 + 1856);
if ( v75 > 0 && (!GameVariable || !*(_BYTE *)(v74 + 1302) || *(_BYTE *)(v74 + 1141)) )
{
m_normalSpeed = a1->m_normalSpeed;
switch ( *(_DWORD *)(v74 + 1864) )
{
case 1:
m_normalSpeed = a1->m_slowSpeed;
break;
case 2:
m_normalSpeed = a1->m_fastSpeed;
break;
case 3:
m_normalSpeed = a1->m_fasterSpeed;
break;
case 4:
m_normalSpeed = a1->m_fastestSpeed;
break;
}
v77 = *(_DWORD *)(v74 + 1860);
if ( v77 > 0 )
v75 *= v77;
*(float *)&v78 = (float)v75;
v79 = (float)(60.0 / (float)v75) * m_normalSpeed;
v80 = *(float *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)v74 + 200LL))(v73[3]);
v81 = fminf(v16, (float)(m_normalSpeed * *(float *)(v74 + 1468)) + v80);
v82 = 0;
if ( v14 > v80 )
{
*(float *)&v78 = ceilf((float)(v14 - v80) / v79);
v82 = (int)*(float *)&v78;
v80 = v80 + (float)((float)(int)*(float *)&v78 * v79);
}
if ( v81 > v80 )
{
v83 = v202;
v84 = v202 + 1;
v85 = v209;
v86 = v209 + 1;
do
{
v87 = cocos2d::CCPoint::CCPoint(*(float *)&v78, v80);
v78 = cocos2d::CCPoint::CCPoint(*(float *)&v87, v80);
v88 = *(_DWORD *)(v74 + 1860);
if ( v88 > 0 && v82 % v88 )
{
if ( v86 + 1 < 400 )
{
cocos2d::CCPoint::operator=(&a1->m_pointArray2->_Elems[v85], v212);
v78 = cocos2d::CCPoint::operator=(&a1->m_pointArray2->_Elems[v86], v204);
v85 += 2;
v86 += 2;
}
}
else if ( v84 + 1 < 400 )
{
cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v83], v212);
v78 = cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v84], v204);
v83 += 2;
v84 += 2;
}
v80 = v80 + v79;
++v82;
}
while ( v81 > v80 );
v209 = v85;
v202 = v83;
v73 = v205;
Myhead = v206;
}
}
}
v73 = (_QWORD *)*v73;
v205 = v73;
}
while ( v73 != (_QWORD *)Myhead );
if ( v202 > 0 )
{
cocos2d::ccDrawColor4B((cocos2d *)0xFF, 0xFFu, 0, 0xFFu);
glLineWidth(1.0);
cocos2d::ccDrawLines((cocos2d *)a1->m_pointArray1, (const struct cocos2d::CCPoint *)(unsigned int)v202, v89);
}
v90 = v209;
if ( v209 > 0 )
{
cocos2d::ccDrawColor4B((cocos2d *)0xFF, 0x7Fu, 0, 0xFFu);
glLineWidth(1.0);
cocos2d::ccDrawLines((cocos2d *)a1->m_pointArray2, (const struct cocos2d::CCPoint *)v90, v91);
}
}
LODWORD(v92) = 1065353216;
glLineWidth(1.0);
v93 = 0;
v94 = v203;
if ( v203 == Playing )
{
i = GameVariable;
}
else
{
if ( LOBYTE(v216.x) )
{
cocos2d::ccDrawColor4B(nullptr, 0xFFu, 0xFFu, 0x96u);
v95 = -1.0;
v96 = a1->m_effectGameObjects;
if ( v96 )
{
data = v96->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
v100 = &arr[num - 1];
if ( arr <= v100 )
{
v101 = 1;
do
{
v102 = *arr;
if ( !*arr )
break;
v103 = (float *)((__int64 (__fastcall *)(cocos2d::CCObject *))v102->__vftable[2].getTag)(*arr);
v104 = *v103;
if ( *v103 < v14 || v16 < v104 )
{
if ( v104 > v16 )
break;
}
else if ( (!BYTE2(v102[11].m_uUnknown) && (!GameVariable || !BYTE2(v102[23].m_nLuaID))
|| BYTE1(v102[20].m_uReference))
&& !LOBYTE(v102[26].m_uIndexInArray)
&& !BYTE1(v102[26].m_uIndexInArray)
&& v104 > v95 )
{
v95 = *v103;
if ( v101 + 1 < 400 )
{
cocos2d::CCPoint::CCPoint(*(float *)&v92, v104);
v106 = cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v93], v105);
cocos2d::CCPoint::CCPoint(*(float *)&v106, v104);
v92 = cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v101], v107);
v93 += 2;
v101 += 2;
}
}
++arr;
}
while ( arr <= v100 );
if ( v93 > 0 )
{
cocos2d::ccDrawColor4B(nullptr, 0xFFu, 0xFFu, 0x96u);
cocos2d::ccDrawLines(
(cocos2d *)a1->m_pointArray1,
(const struct cocos2d::CCPoint *)(unsigned int)v93,
v108);
}
}
}
}
}
glLineWidth(2.0);
cocos2d::ccDrawColor4B(nullptr, 0xFFu, 0xFFu, 0xFFu);
v109 = 0;
for ( i = GameVariable; v109 < cocos2d::CCArray::count(a1->m_guideObjects); ++v109 )
{
v111 = cocos2d::CCArray::objectAtIndex(a1->m_guideObjects, v109);
v112 = v111;
if ( !GameVariable || !BYTE2(v111[23].m_nLuaID) || BYTE1(v111[20].m_uReference) )
{
if ( ((unsigned int (__fastcall *)(struct cocos2d::CCObject *))v111->__vftable[22].canEncode)(v111) == 16 )
{
v113 = 240.0;
}
else if ( ((unsigned int (__fastcall *)(struct cocos2d::CCObject *))v112->__vftable[22].canEncode)(v112) == 33 )
{
v113 = 270.0;
}
else
{
v113 = 300.0;
}
v114 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v112->__vftable[2].getTag)(v112);
v115 = floorf((float)((float)(*(float *)(v114 + 4) - (float)(v113 * 0.5)) + 0.0) / 30.0) * 30.0;
v116 = cocos2d::CCPoint::CCPoint(v115, fmaxf(90.0, v115));
y = v216.y;
if ( v216.x >= -3000.0 && v9 >= v216.x )
{
v118 = cocos2d::CCPoint::CCPoint(*(float *)&v116, fminf(240000.0, v16));
v120 = v119;
v116 = cocos2d::CCPoint::CCPoint(*(float *)&v118, fmaxf(-3000.0, v14));
cocos2d::ccDrawLine(v121, v120, v122);
}
if ( y >= -3000.0 && v9 >= y )
{
v123 = cocos2d::CCPoint::CCPoint(*(float *)&v116, fminf(240000.0, v16));
v125 = v124;
cocos2d::CCPoint::CCPoint(*(float *)&v123, fmaxf(-3000.0, v14));
cocos2d::ccDrawLine(v126, v125, v127);
}
}
}
v94 = v203;
}
p_m_editorLayer = &a1->m_editorLayer;
v129 = a1->m_editorLayer;
if ( v129->m_playbackMode == Not )
{
if ( v129->m_editorUI->m_playbackActive )
{
cocos2d::ccDrawColor4B((cocos2d *)0x32, 0xFFu, 0x32u, 0xFFu);
glLineWidth(5.0);
LOBYTE(v199) = 1;
LevelTools::posForTimeInternal(
5.0,
v130,
(int)a1->m_speedObjects,
(*p_m_editorLayer)->m_levelSettings->m_startSpeed,
(*p_m_editorLayer)->m_levelSettings->m_platformerMode,
1,
v199,
*(_DWORD *)p_m_editorLayer + 832);
v131 = v216.x;
if ( v216.x <= 0.0 )
{
v131 = v216.y;
if ( v216.y > 0.0 )
{
a1->m_playbackX = 0.0;
a1->m_playbackY = v131;
}
}
else
{
a1->m_playbackX = v216.x;
a1->m_playbackY = 0.0;
}
}
else
{
cocos2d::ccDrawColor4B((cocos2d *)0x32, 0xFFu, 0x32u, 0x64u);
v131 = 3.0;
glLineWidth(3.0);
a1->m_musicTime = -1.0;
}
m_playbackX = a1->m_playbackX;
if ( m_playbackX <= 0.0 || m_playbackX < v14 || v16 < m_playbackX )
{
m_playbackY = a1->m_playbackY;
v135 = v218.x;
if ( m_playbackY <= 0.0 || m_playbackY < v218.x || v217.x < m_playbackY )
goto LABEL_161;
v134 = cocos2d::CCPoint::CCPoint(v131, fminf(240000.0, v16));
v136 = fmaxf(-3000.0, v14);
}
else
{
v134 = cocos2d::CCPoint::CCPoint(v131, m_playbackX);
v135 = v218.x;
v136 = a1->m_playbackX;
}
v138 = v133;
cocos2d::CCPoint::CCPoint(*(float *)&v134, v136);
cocos2d::ccDrawLine(v139, v138, v140);
LABEL_161:
v141 = a1->m_editorLayer;
v142 = v141->m_previewPosition.x;
if ( v142 != 0.0 || (p_m_editorLayer = &a1->m_editorLayer, v141->m_previewPosition.y != 0.0) )
{
p_m_editorLayer = &a1->m_editorLayer;
if ( v142 > 0.0 )
{
p_m_editorLayer = &a1->m_editorLayer;
if ( v142 >= v14 )
{
p_m_editorLayer = &a1->m_editorLayer;
if ( v16 >= v142 )
{
cocos2d::ccDrawColor4B((cocos2d *)0xFF, 0x96u, 0, 0xFFu);
glLineWidth(2.0);
v143 = cocos2d::CCPoint::CCPoint(2.0, v142);
v145 = v144;
cocos2d::CCPoint::CCPoint(*(float *)&v143, v142);
cocos2d::ccDrawLine(v146, v145, v147);
p_m_editorLayer = &a1->m_editorLayer;
}
}
}
}
goto LABEL_168;
}
*(_QWORD *)&a1->m_playbackX = 0;
v135 = v218.x;
LABEL_168:
v148 = *p_m_editorLayer;
if ( (*p_m_editorLayer)->m_playbackMode != Playing && v148->m_previewMode )
{
m_objectLayer = v148->m_objectLayer;
cocos2d::CCPoint::CCPoint(v211 * 0.5, v210 * 0.5);
cocos2d::CCNode::convertToNodeSpace(m_objectLayer, &v216);
cocos2d::ccDrawColor4B(nullptr, 0, 0, 0x32u);
glLineWidth(2.0);
v150 = cocos2d::CCPoint::CCPoint(2.0, v216.x);
v152 = v151;
v153 = cocos2d::CCPoint::CCPoint(*(float *)&v150, v216.x);
cocos2d::ccDrawLine(v154, v152, v155);
v156 = cocos2d::CCPoint::CCPoint(*(float *)&v153, fminf(240000.0, v16));
v158 = v157;
cocos2d::CCPoint::CCPoint(*(float *)&v156, fmaxf(-3000.0, v14));
cocos2d::ccDrawLine(v159, v158, v160);
}
v161 = *p_m_editorLayer;
if ( (*p_m_editorLayer)->m_playbackMode )
{
if ( v161->m_gameState.m_isDualMode
|| (m_player1 = v161->m_player1, m_player1->m_isShip)
|| m_player1->m_isBird
|| m_player1->m_isDart
|| m_player1->m_isSwing
|| (p_m_editorLayer = &a1->m_editorLayer, m_player1->m_isBall)
|| m_player1->m_isSpider )
{
MinPortalY = GJBaseGameLayer::getMinPortalY(v161);
v164 = a1->m_editorLayer;
if ( v164->m_gameState.m_unkPoint17.y == 0.0 || v164->m_gameState.m_unkBool1 )
GJBaseGameLayer::getMinPortalY(a1->m_editorLayer);
else
v164->m_groundLayer2->getPosition_0(v164->m_groundLayer2);
LODWORD(v165) = 0x40000000;
glLineWidth(2.0);
cocos2d::ccDrawColor4B((cocos2d *)0xFF, 0xAFu, 0x32u, 0xFFu);
if ( MinPortalY != 90.0 )
{
v166 = cocos2d::CCPoint::CCPoint(2.0, fminf(240000.0, v16));
v168 = v167;
v165 = cocos2d::CCPoint::CCPoint(*(float *)&v166, fmaxf(-3000.0, v14));
cocos2d::ccDrawLine(v169, v168, v170);
}
v171 = cocos2d::CCPoint::CCPoint(*(float *)&v165, fminf(240000.0, v16));
v173 = v172;
cocos2d::CCPoint::CCPoint(*(float *)&v171, fmaxf(-3000.0, v14));
cocos2d::ccDrawLine(v174, v173, v175);
p_m_editorLayer = &a1->m_editorLayer;
}
}
if ( v94 != Playing && (*p_m_editorLayer)->m_showDurationLines )
{
m_durationObjects = (*p_m_editorLayer)->m_durationObjects;
v177 = 0.0;
v216.x = 0.0;
if ( m_durationObjects )
{
v178 = m_durationObjects->data;
v179 = v178->num;
if ( (_DWORD)v179 )
{
v180 = (std::_List_simple_types>::_Node *)v178->arr;
v181 = (std::_List_simple_types>::_Node *)((char *)v180
+ 8 * v179
- 8);
v206 = v181;
if ( v180 <= v181 )
{
do
{
v182 = *(_QWORD *)v180;
if ( !*(_QWORD *)v180 )
break;
if ( !i || !*(_BYTE *)(v182 + 1302) || *(_BYTE *)(v182 + 1141) )
{
if ( a1->m_updateTimeMarkers )
cocos2d::CCPoint::operator=(v182 + 1816, &dword_1406C2128);
v183 = *(float *)(v182 + 1468);
v184 = *(_DWORD *)(v182 + 1036);
if ( v184 == 1006 )
{
v183 = (float)(*(float *)(v182 + 1612) + *(float *)(v182 + 1608)) + *(float *)(v182 + 1616);
}
else if ( v184 == 3602 )
{
v183 = *(float *)(v182 + 1996);
}
if ( v183 > 0.0 )
{
(*(void (__fastcall **)(__int64, struct cocos2d::CCPoint *))(*(_QWORD *)v182 + 1192LL))(v182, &v218);
if ( v16 >= v218.x && v9 >= v218.y && (!*(_BYTE *)(v182 + 654) || *(_BYTE *)(v182 + 1141)) )
{
cocos2d::CCPoint::CCPoint(&v217);
if ( *(_BYTE *)(v182 + 1489) )
{
v217.y = v218.y;
v185 = (float)(v183 * 311.58011) + v218.x;
v217.x = v185;
}
else
{
v185 = v217.x;
if ( v217.x == 0.0 && v217.y == 0.0 )
{
m_levelSettings = (*p_m_editorLayer)->m_levelSettings;
m_startSpeed = m_levelSettings->m_startSpeed;
v188 = *(_DWORD *)(v182 + 1792);
cocos2d::CCPoint::CCPoint(&v208);
v190 = LevelTools::timeForPos(
v189,
a1->m_speedObjects,
m_startSpeed,
*(_DWORD *)(v182 + 1788),
v188,
0,
m_levelSettings->m_platformerMode,
1,
0,
0);
v191 = byte_1406C2C76;
LOBYTE(v200) = 1;
v193 = LevelTools::posForTimeInternal(
v190 + v183,
v192,
(int)a1->m_speedObjects,
(*p_m_editorLayer)->m_levelSettings->m_startSpeed,
(*p_m_editorLayer)->m_levelSettings->m_platformerMode,
0,
v200,
*(_DWORD *)p_m_editorLayer + 832);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v217, v193);
if ( v191 == byte_1406C2C76 )
{
if ( v191 )
v217.x = v218.x;
else
v217.y = v218.y;
}
cocos2d::CCPoint::operator=(v182 + 1816, &v217);
v185 = v217.x;
v177 = v216.x;
v181 = v206;
}
}
if ( v185 >= v14 && v217.y >= v135 )
{
v194 = v207;
if ( v207 + 1 < 400 )
{
cocos2d::CCPoint::CCPoint(v217.y, fmaxf(v14, v218.x));
v196 = cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[SLODWORD(v177)], v195);
cocos2d::CCPoint::CCPoint(*(float *)&v196, fminf(v16, v217.x));
cocos2d::CCPoint::operator=(&a1->m_pointArray1->_Elems[v194], v197);
LODWORD(v177) += 2;
v216.x = v177;
v207 = v194 + 2;
}
}
}
}
}
v180 = (std::_List_simple_types>::_Node *)((char *)v180 + 8);
i = GameVariable;
}
while ( v180 <= v181 );
if ( SLODWORD(v177) > 0 )
{
glLineWidth(2.0);
cocos2d::ccDrawColor4B((cocos2d *)0x64, 0x64u, 0x64u, 0x4Bu);
cocos2d::ccDrawLines((cocos2d *)a1->m_pointArray1, (const struct cocos2d::CCPoint *)LODWORD(v177), v198);
}
}
}
}
}
glLineWidth(1.0);
a1->m_updateTimeMarkers = 0;
}