//
// DrawGridLayer::draw from 0x665c6c to 0x667218 (5548 bytes)
//
// 2 xrefs:
// > ??> @ 0x81c48
// > ??> @ 0x1155898
//
// 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 DrawGridLayer::draw(DrawGridLayer *a1)
{
LevelEditorLayer *m_editorLayer; // x0
PlaybackMode m_playbackMode; // w22
int v4; // w20
GameManager *v5; // x0
_BOOL4 GameVariable; // w27
cocos2d::CCArray *m_effectGameObjects; // x0
float v8; // s0
cocos2d::CCNode *v9; // x19
float v10; // s1
float v11; // s1
float v12; // s0
float v13; // s0
float m_playbackY; // s1
LevelEditorLayer *v15; // x1
PlaybackMode v16; // w0
LevelEditorLayer *v17; // x0
cocos2d::CCArray *m_durationObjects; // x0
cocos2d::ccArray *v19; // x1
cocos2d::CCObject **v20; // x26
cocos2d::CCObject **v21; // x28
cocos2d::CCObject *v22; // x25
signed int v23; // w19
int v24; // w0
float v25; // s10
int *p_m_uOrderOfArrival; // x20
float v27; // s0
__int64 v28; // x20
char *v29; // x25
float v30; // s1
float v31; // s0
float v32; // s1
float v33; // s0
cocos2d::CCPoint *v34; // x20
float v35; // s1
float v36; // s0
float v37; // s1
GameManager *v38; // x0
float v39; // s11
unsigned int m_showGround; // w24
const cocos2d::CCPoint *v41; // x0
cocos2d::CCDirector *v42; // x0
cocos2d::CCNode *m_objectLayer; // x19
float x; // s10
float v45; // s14
float v46; // s0
cocos2d::CCNode *v47; // x19
float v48; // s14
float v49; // s8
float y; // s9
float v51; // s0
float m_gridSize; // s2
float v53; // s8
int v54; // w25
float v55; // s10
signed int v56; // w19
float v57; // s10
__int64 v58; // x26
char *v59; // x28
float v60; // s1
float v61; // s0
float v62; // s1
float v63; // s1
cocos2d::CCPoint *v64; // x26
float v65; // s0
float v66; // s1
int v67; // w25
float v68; // s0
float v69; // s15
float v70; // s0
__int64 v71; // x26
char *v72; // x28
float v73; // s0
float v74; // s1
cocos2d::CCPoint *v75; // x26
float v76; // s0
float v77; // s0
float v78; // s1
float v79; // s0
cocos2d::CCArray *m_timeMarkers; // x0
unsigned int v81; // w19
signed int v82; // w25
signed int v83; // w20
signed int v84; // w24
cocos2d::CCString *v85; // x0
float v86; // s15
cocos2d::CCString *v87; // x0
float v88; // s0
__int64 v89; // x26
char *v90; // x28
float v91; // s1
float v92; // s0
float v93; // s1
float v94; // s1
cocos2d::CCPoint *v95; // x26
float v96; // s0
float v97; // s1
std::__detail::_Hash_node_base *M_nxt; // x25
signed int v99; // w26
signed int v100; // w24
std::__detail::_Hash_node_base *v101; // x20
int M_nxt_high; // w0
float m_normalSpeed; // s12
int v104; // w1
float v105; // s10
float *v106; // x0
float v107; // s15
float v108; // s12
int v109; // w19
float v110; // s1
float v111; // s1
float v112; // s0
float v113; // s1
int v114; // w0
__int64 v115; // x28
float v116; // s0
float v117; // s1
float m_playbackX; // s0
_BOOL4 v119; // w0
float v120; // s1
float v121; // s1
float v122; // s10
float v123; // s1
float v124; // s1
LevelEditorLayer *v125; // x0
float MinPortalY; // s10
float MaxPortalY; // s12
float v128; // s0
float v129; // s0
float v130; // s0
float v131; // s0
__int64 v132; // x28
float v133; // s0
float v134; // s1
float v135; // s1
float v136; // s1
cocos2d::CCArray *v137; // x0
cocos2d::ccArray *data; // x1
cocos2d::CCObject **arr; // x24
__int64 v140; // x0
char *v141; // x20
cocos2d::CCObject *v142; // x25
signed int v143; // w19
float v144; // s12
float v145; // s10
unsigned int v146; // w19
GameObject *v147; // x0
float v148; // s13
float v149; // s0
float v150; // s0
float v151; // s0
float v152; // s0
__int64 v153; // x26
char *v154; // x28
float v155; // s1
float v156; // s0
float v157; // s1
float v158; // s1
cocos2d::CCPoint *v159; // x26
float v160; // s0
float v161; // s1
float v162; // s0
float v163; // s0
__int64 v164; // x26
char *v165; // x28
float v166; // s1
float v167; // s0
float v168; // s1
float v169; // s1
cocos2d::CCPoint *v170; // x26
float v171; // s0
float v172; // s1
float v173; // s0
PlayerObject *m_player1; // x1
__int64 v175; // x25
char *v176; // x26
float v177; // s1
float v178; // s0
float v179; // s1
float v180; // s1
cocos2d::CCPoint *v181; // x25
float v182; // s0
float v183; // s1
_BOOL4 LastGameplayRotated; // w25
float v185; // s0
float v186; // s1
int v187; // [xsp+0h] [xbp-10h]
float v188; // [xsp+B0h] [xbp+A0h]
float v189; // [xsp+B0h] [xbp+A0h]
unsigned int v190; // [xsp+C8h] [xbp+B8h]
float v191; // [xsp+CCh] [xbp+BCh]
cocos2d::CCPoint v192; // [xsp+D0h] [xbp+C0h] BYREF
float v193; // [xsp+D8h] [xbp+C8h]
float v194; // [xsp+DCh] [xbp+CCh]
cocos2d::CCPoint v195; // [xsp+E0h] [xbp+D0h] BYREF
cocos2d::CCPoint v196; // [xsp+E8h] [xbp+D8h] BYREF
cocos2d::CCPoint v197; // [xsp+F0h] [xbp+E0h] BYREF
cocos2d::CCPoint v198; // 0:kr20_8.8
cocos2d::CCPoint v199; // 0:kr38_8.8
cocos2d::CCPoint v200; // 0:s0.4,4:s1.4
m_editorLayer = a1->m_editorLayer;
if ( !m_editorLayer->m_editorUI )
return;
m_playbackMode = m_editorLayer->m_playbackMode;
v4 = 0;
if ( m_editorLayer->m_showGrid )
{
v4 = 1;
if ( m_playbackMode == Playing )
v4 = !m_editorLayer->m_hideGridOnPlay;
}
if ( m_playbackMode == Playing || !m_editorLayer->m_drawEffectLines )
{
v38 = GameManager::sharedState();
v190 = 0;
GameVariable = GameManager::getGameVariable(v38, "0121");
}
else
{
v5 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v5, "0121");
if ( a1->m_sortEffects
&& (m_effectGameObjects = a1->m_effectGameObjects, a1->m_sortEffects = 0, m_effectGameObjects)
&& (unsigned int)cocos2d::CCArray::count(m_effectGameObjects) )
{
v190 = 1;
qsort(
a1->m_effectGameObjects->data->arr,
a1->m_effectGameObjects->data->num,
8u,
(int (*)(const void *, const void *))xCompReal);
}
else
{
v190 = 1;
}
}
cocos2d::ccGLBlendFunc((unsigned int)&dword_0 + 1, 0x303u);
if ( a1->m_editorLayer->m_levelSettings->m_dynamicLevelHeight )
v39 = 30090.0;
else
v39 = 2490.0;
cocos2d::ccDrawColor4B(0, 0, 0, 0x96u);
glLineWidth();
m_showGround = a1->m_editorLayer->m_showGround;
v41 = a1->m_objectLayer->getPosition(a1->m_objectLayer);
cocos2d::CCPoint::CCPoint(&v192, v41);
v42 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v42);
m_objectLayer = a1->m_objectLayer;
cocos2d::CCPoint::CCPoint(&v196, 0.0, 0.0);
cocos2d::CCNode::convertToNodeSpace(m_objectLayer, &v196);
x = v197.x;
v45 = v193;
v191 = v197.x;
v46 = a1->m_objectLayer->getScale(a1->m_objectLayer);
v47 = a1->m_objectLayer;
v48 = (float)(v45 / v46) + x;
cocos2d::CCPoint::CCPoint(&v196, 0.0, 0.0);
v198 = cocos2d::CCNode::convertToNodeSpace(v47, &v196);
v49 = v194;
y = v197.y;
v51 = ((float (__fastcall *)(cocos2d::CCNode *, float, float))a1->m_objectLayer->getScale)(
a1->m_objectLayer,
v198.x,
v198.y);
m_gridSize = a1->m_gridSize;
v53 = (float)(v49 / v51) + y;
v54 = vcvtms_s32_f32(x / m_gridSize);
v55 = (float)v54;
if ( v48 <= (float)(m_gridSize * (float)v54) )
{
v67 = vcvtms_s32_f32(y / m_gridSize);
v68 = (float)v67;
if ( (float)((float)v67 * m_gridSize) < v53 )
{
v56 = 0;
goto LABEL_83;
}
}
else
{
v56 = 0;
while ( 1 )
{
v57 = v55 * m_gridSize;
if ( v57 >= -3000.0 && v57 <= 240000.0 )
{
if ( v57 == 240000.0 || v57 == 0.0 )
{
cocos2d::ccDrawColor4B(0xFFu, 0xFFu, 0xFFu, 0x96u);
v135 = y;
if ( y <= -3000.0 )
v135 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, v57, v135);
v136 = v53;
if ( v53 >= v39 )
v136 = v39;
cocos2d::CCPoint::CCPoint(&v197, v57, v136);
cocos2d::ccDrawLine(&v196, &v197);
m_gridSize = a1->m_gridSize;
}
else if ( v56 <= 397 && v4 )
{
v58 = v56;
v59 = (char *)a1->m_pointArray1 + v58 * 8;
v60 = y;
if ( y <= -3000.0 )
v60 = -3000.0;
cocos2d::CCPoint::CCPoint(&v197, v57, v60);
cocos2d::CCPoint::operator=(v59, v61, v62);
v63 = v53;
v64 = &a1->m_pointArray1->__elems_[v58 + 1];
if ( v53 >= v39 )
v63 = v39;
v56 += 2;
cocos2d::CCPoint::CCPoint(&v197, v57, v63);
cocos2d::CCPoint::operator=(v64, v65, v66);
m_gridSize = a1->m_gridSize;
}
}
++v54;
if ( v48 <= v57 )
break;
v55 = (float)v54;
}
v67 = vcvtms_s32_f32(y / m_gridSize);
v68 = (float)v67;
if ( v53 > (float)((float)v67 * m_gridSize) )
{
while ( 1 )
{
LABEL_83:
v69 = v68 * m_gridSize;
if ( (float)(v68 * m_gridSize) < -3000.0 || v69 > v39 )
goto LABEL_94;
if ( v69 != v39 && v69 != 90.0 )
{
if ( v56 <= 397 && v4 )
{
v70 = v191;
v71 = v56;
v72 = (char *)a1->m_pointArray1 + v71 * 8;
if ( v191 <= -3000.0 )
v70 = -3000.0;
cocos2d::CCPoint::CCPoint(&v197, v70, v69);
cocos2d::CCPoint::operator=(v72, v73, v74);
v75 = &a1->m_pointArray1->__elems_[v71 + 1];
v76 = v48;
if ( v48 >= 240000.0 )
v76 = 240000.0;
v56 += 2;
cocos2d::CCPoint::CCPoint(&v197, v76, v69);
cocos2d::CCPoint::operator=(v75, v77, v78);
}
LABEL_94:
++v67;
if ( v53 <= v69 )
break;
goto LABEL_95;
}
if ( (v69 != 90.0) < m_showGround )
goto LABEL_94;
cocos2d::ccDrawColor4B(0xFFu, 0xFFu, 0xFFu, 0x96u);
glLineWidth();
if ( v191 <= -3000.0 )
{
cocos2d::CCPoint::CCPoint(&v196, -3000.0, v69);
v79 = v48;
if ( v48 < 240000.0 )
{
LABEL_99:
cocos2d::CCPoint::CCPoint(&v197, v79, v69);
cocos2d::ccDrawLine(&v196, &v197);
goto LABEL_100;
}
}
else
{
cocos2d::CCPoint::CCPoint(&v196, v191, v69);
v79 = v48;
if ( v48 < 240000.0 )
goto LABEL_99;
}
cocos2d::CCPoint::CCPoint(&v197, 240000.0, v69);
cocos2d::ccDrawLine(&v196, &v197);
LABEL_100:
++v67;
if ( v53 <= v69 )
break;
LABEL_95:
m_gridSize = a1->m_gridSize;
v68 = (float)v67;
}
}
if ( v56 > 0 && v4 )
{
cocos2d::ccDrawColor4B(0, 0, 0, 0x96u);
glLineWidth();
cocos2d::ccDrawLines(a1->m_pointArray1->__elems_, v56);
}
}
if ( !GameManager::sharedState()->m_showSongMarkers )
goto LABEL_126;
m_timeMarkers = a1->m_timeMarkers;
if ( !m_timeMarkers )
goto LABEL_126;
v81 = 0;
v82 = 0;
v83 = 0;
v84 = 0;
while ( v81 < (unsigned int)cocos2d::CCArray::count(m_timeMarkers) )
{
v85 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(a1->m_timeMarkers, v81);
v86 = cocos2d::CCString::floatValue(v85);
if ( v86 < -3000.0 )
goto LABEL_108;
if ( v191 > v86 || v48 < v86 )
goto LABEL_107;
v87 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(a1->m_timeMarkers, v81 + 1);
v88 = cocos2d::CCString::floatValue(v87);
if ( v88 != 0.9 )
{
if ( v88 == 1.0 )
{
if ( v82 <= 397 )
{
v153 = v82;
v154 = (char *)a1->m_pointArray3 + v153 * 8;
v155 = y;
if ( y <= -3000.0 )
v155 = -3000.0;
cocos2d::CCPoint::CCPoint(&v197, v86, v155);
cocos2d::CCPoint::operator=(v154, v156, v157);
v158 = v53;
v159 = &a1->m_pointArray3->__elems_[v153 + 1];
if ( v53 >= v39 )
v158 = v39;
v82 += 2;
cocos2d::CCPoint::CCPoint(&v197, v86, v158);
cocos2d::CCPoint::operator=(v159, v160, v161);
}
}
else if ( v84 <= 397 )
{
v164 = v84;
v165 = (char *)a1->m_pointArray1 + v164 * 8;
v166 = y;
if ( y <= -3000.0 )
v166 = -3000.0;
cocos2d::CCPoint::CCPoint(&v197, v86, v166);
cocos2d::CCPoint::operator=(v165, v167, v168);
v169 = v53;
v170 = &a1->m_pointArray1->__elems_[v164 + 1];
if ( v53 >= v39 )
v169 = v39;
v84 += 2;
cocos2d::CCPoint::CCPoint(&v197, v86, v169);
cocos2d::CCPoint::operator=(v170, v171, v172);
}
LABEL_107:
if ( v48 < v86 )
break;
goto LABEL_108;
}
if ( v83 > 397 )
goto LABEL_107;
v89 = v83;
v90 = (char *)a1->m_pointArray2 + v89 * 8;
v91 = y;
if ( y <= -3000.0 )
v91 = -3000.0;
cocos2d::CCPoint::CCPoint(&v197, v86, v91);
cocos2d::CCPoint::operator=(v90, v92, v93);
v94 = v53;
v95 = &a1->m_pointArray2->__elems_[v89 + 1];
if ( v53 >= v39 )
v94 = v39;
v83 += 2;
cocos2d::CCPoint::CCPoint(&v197, v86, v94);
cocos2d::CCPoint::operator=(v95, v96, v97);
if ( v48 < v86 )
break;
LABEL_108:
m_timeMarkers = a1->m_timeMarkers;
v81 += 2;
}
if ( v84 )
{
cocos2d::ccDrawColor4B(0xFFu, 0x7Fu, 0, 0xFFu);
glLineWidth();
cocos2d::ccDrawLines(a1->m_pointArray1->__elems_, v84);
}
if ( v83 )
{
cocos2d::ccDrawColor4B(0xFFu, 0xFFu, 0, 0xFFu);
glLineWidth();
cocos2d::ccDrawLines(a1->m_pointArray2->__elems_, v83);
}
if ( v82 )
{
cocos2d::ccDrawColor4B((unsigned __int8)&dword_7C + 3, 0xFFu, 0, 0xFFu);
glLineWidth();
cocos2d::ccDrawLines(a1->m_pointArray3->__elems_, v82);
}
LABEL_126:
M_nxt = a1->m_audioLineObjects._M_h._M_before_begin._M_nxt;
if ( M_nxt )
{
v99 = 0;
v100 = 0;
do
{
v101 = M_nxt[2]._M_nxt;
if ( !LOBYTE(v101[229]._M_nxt) )
{
M_nxt_high = HIDWORD(v101[227]._M_nxt);
if ( M_nxt_high > 0 && (!GameVariable || !BYTE6(v101[159]._M_nxt) || BYTE5(v101[139]._M_nxt)) )
{
m_normalSpeed = a1->m_normalSpeed;
switch ( HIDWORD(v101[228]._M_nxt) )
{
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;
default:
break;
}
v104 = (int)v101[228]._M_nxt;
if ( v104 > 0 )
M_nxt_high *= v104;
v105 = (float)(60.0 / (float)M_nxt_high) * m_normalSpeed;
v106 = (float *)((__int64 (__fastcall *)(std::__detail::_Hash_node_base *))v101->_M_nxt[24]._M_nxt)(M_nxt[2]._M_nxt);
v107 = *v106;
v108 = *v106 + (float)(*((float *)&v101[179]._M_nxt + 1) * m_normalSpeed);
if ( v48 <= v108 )
v108 = v48;
v109 = 0;
if ( v191 > v107 )
{
v109 = vcvtps_s32_f32((float)(v191 - v107) / v105);
v107 = v107 + (float)((float)v109 * v105);
}
while ( v108 > v107 )
{
v110 = y;
if ( y <= -3000.0 )
v110 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, v107, v110);
v111 = v53;
if ( v53 >= v39 )
v111 = v39;
cocos2d::CCPoint::CCPoint(&v197, v107, v111);
v114 = (int)v101[228]._M_nxt;
if ( v114 > 0 && v109 % v114 )
{
if ( v99 <= 397 )
{
v132 = v99;
v99 += 2;
cocos2d::CCPoint::operator=((char *)a1->m_pointArray2 + v132 * 8, v112, v113);
cocos2d::CCPoint::operator=(&a1->m_pointArray2->__elems_[v132 + 1], v133, v134);
}
}
else if ( v100 <= 397 )
{
v115 = v100;
v100 += 2;
cocos2d::CCPoint::operator=((char *)a1->m_pointArray1 + v115 * 8, v112, v113);
cocos2d::CCPoint::operator=(&a1->m_pointArray1->__elems_[v115 + 1], v116, v117);
}
v107 = v107 + v105;
++v109;
}
}
}
M_nxt = M_nxt->_M_nxt;
}
while ( M_nxt );
if ( v100 )
{
cocos2d::ccDrawColor4B(0xFFu, 0xFFu, 0, 0xFFu);
glLineWidth();
cocos2d::ccDrawLines(a1->m_pointArray1->__elems_, v100);
}
if ( v99 )
{
cocos2d::ccDrawColor4B(0xFFu, 0x7Fu, 0, 0xFFu);
glLineWidth();
cocos2d::ccDrawLines(a1->m_pointArray2->__elems_, v99);
}
}
glLineWidth();
if ( (m_playbackMode == Playing) < v190
&& (cocos2d::ccDrawColor4B(0, 0xFFu, 0xFFu, 0x96u), (v137 = a1->m_effectGameObjects) != nullptr)
&& (data = v137->data, data->num) )
{
arr = data->arr;
v140 = 8LL * data->num - 8;
v141 = (char *)arr + v140;
if ( arr <= (cocos2d::CCObject **)((char *)arr + v140) )
{
v142 = *arr;
if ( *arr )
{
v143 = 0;
v144 = -1.0;
do
{
v145 = *(float *)((__int64 (__fastcall *)(cocos2d::CCObject *))v142->__vftable[2].acceptVisitor)(v142);
if ( v48 >= v145 && v191 <= v145 )
{
if ( (!GameObject::getGroupDisabled((GameObject *)v142) && (!GameVariable || !BYTE2(v142[22].m_nZOrder))
|| BYTE1(v142[19].m_unknown5))
&& !LOBYTE(v142[26].__vftable)
&& __PAIR64__(BYTE1(v142[26].__vftable), LODWORD(v144)) < LODWORD(v145) )
{
v144 = v145;
if ( v143 <= 397 )
{
v175 = v143;
v176 = (char *)a1->m_pointArray1 + v175 * 8;
v177 = y;
if ( y <= -3000.0 )
v177 = -3000.0;
cocos2d::CCPoint::CCPoint(&v197, v145, v177);
cocos2d::CCPoint::operator=(v176, v178, v179);
v180 = v53;
v181 = &a1->m_pointArray1->__elems_[v175 + 1];
if ( v53 >= v39 )
v180 = v39;
v144 = v145;
v143 += 2;
cocos2d::CCPoint::CCPoint(&v197, v145, v180);
cocos2d::CCPoint::operator=(v181, v182, v183);
}
}
}
else if ( v48 < v145 )
{
break;
}
if ( v141 < (char *)++arr )
break;
v142 = *arr;
}
while ( *arr );
if ( v143 )
{
cocos2d::ccDrawColor4B(0, 0xFFu, 0xFFu, 0x96u);
cocos2d::ccDrawLines(a1->m_pointArray1->__elems_, v143);
}
}
}
LABEL_208:
v146 = 0;
glLineWidth();
cocos2d::ccDrawColor4B(0, 0xFFu, 0xFFu, 0xFFu);
while ( v146 < (unsigned int)cocos2d::CCArray::count(a1->m_guideObjects) )
{
v147 = (GameObject *)cocos2d::CCArray::objectAtIndex(a1->m_guideObjects, v146);
if ( !GameVariable || !v147->m_isHide || v147->m_isSelected )
{
DrawGridLayer::getPortalMinMax(a1, v147);
v148 = v195.y;
if ( v195.x <= v39 && v195.x >= -3000.0 )
{
v149 = v191;
if ( v191 <= -3000.0 )
v149 = -3000.0;
v188 = v195.x;
cocos2d::CCPoint::CCPoint(&v196, v149, v195.x);
v150 = v48;
if ( v48 >= 240000.0 )
v150 = 240000.0;
cocos2d::CCPoint::CCPoint(&v197, v150, v188);
cocos2d::ccDrawLine(&v196, &v197);
}
if ( v148 <= v39 && v148 >= -3000.0 )
{
v151 = v191;
if ( v191 <= -3000.0 )
v151 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, v151, v148);
v152 = v48;
if ( v48 >= 240000.0 )
v152 = 240000.0;
cocos2d::CCPoint::CCPoint(&v197, v152, v148);
cocos2d::ccDrawLine(&v196, &v197);
}
}
++v146;
}
}
else if ( m_playbackMode != Playing )
{
goto LABEL_208;
}
v15 = a1->m_editorLayer;
v16 = v15->m_playbackMode;
if ( v16 )
{
v8 = 0.0;
a1->m_playbackX = 0.0;
a1->m_playbackY = 0.0;
if ( v16 == Playing )
goto LABEL_183;
LABEL_10:
if ( v15->m_previewMode )
{
v9 = v15->m_objectLayer;
cocos2d::CCPoint::CCPoint(
&v197,
v193 * 0.5,
(float)(v15->m_editorUI->m_toolbarHeight * 0.5) + (float)(v194 * 0.5));
cocos2d::CCNode::convertToNodeSpace(v9, &v197);
cocos2d::ccDrawColor4B(0, 0, 0, 0x32u);
glLineWidth();
v10 = y;
if ( y <= -3000.0 )
v10 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, v195.x, v10);
v11 = v53;
if ( v53 >= v39 )
v11 = v39;
cocos2d::CCPoint::CCPoint(&v197, v195.x, v11);
cocos2d::ccDrawLine(&v196, &v197);
v12 = v191;
if ( v191 <= -3000.0 )
v12 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, v12, v195.y);
v13 = v48;
if ( v48 >= 240000.0 )
v13 = 240000.0;
cocos2d::CCPoint::CCPoint(&v197, v13, v195.y);
cocos2d::ccDrawLine(&v196, &v197);
v15 = a1->m_editorLayer;
v16 = v15->m_playbackMode;
}
if ( v16 )
goto LABEL_183;
goto LABEL_21;
}
if ( !v15->m_editorUI->m_playbackActive )
{
cocos2d::ccDrawColor4B((unsigned __int8)&dword_30 + 2, 0xFFu, (unsigned __int8)&dword_30 + 2, 0x64u);
glLineWidth();
m_playbackX = a1->m_playbackX;
a1->m_musicTime = -1.0;
if ( v48 < m_playbackX || m_playbackX <= 0.0 || v191 > m_playbackX )
goto LABEL_236;
goto LABEL_168;
}
cocos2d::ccDrawColor4B((unsigned __int8)&dword_30 + 2, 0xFFu, (unsigned __int8)&dword_30 + 2, 0xFFu);
glLineWidth();
LevelTools::posForTimeInternal(
a1->m_playbackTime,
a1->m_speedObjects,
a1->m_editorLayer->m_levelSettings->m_startSpeed,
a1->m_editorLayer->m_levelSettings->m_platformerMode,
1,
1,
&a1->m_editorLayer->m_gameState.m_rotateChannel,
0);
m_playbackX = v197.x;
if ( v197.x > 0.0 )
{
a1->m_playbackX = v197.x;
a1->m_playbackY = 0.0;
v119 = v191 <= m_playbackX && v48 >= m_playbackX;
goto LABEL_167;
}
v173 = v197.y;
if ( v197.y > 0.0 )
{
a1->m_playbackX = 0.0;
a1->m_playbackY = v173;
goto LABEL_236;
}
m_playbackX = a1->m_playbackX;
v119 = v48 >= m_playbackX && v191 <= m_playbackX && m_playbackX > 0.0;
LABEL_167:
if ( v119 )
{
LABEL_168:
v120 = y;
if ( y <= -3000.0 )
v120 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, m_playbackX, v120);
v121 = v53;
if ( v53 >= v39 )
v121 = v39;
cocos2d::CCPoint::CCPoint(&v197, a1->m_playbackX, v121);
cocos2d::ccDrawLine(&v196, &v197);
}
else
{
LABEL_236:
m_playbackY = a1->m_playbackY;
if ( m_playbackY > 0.0 && y <= m_playbackY && v53 >= m_playbackY )
{
v162 = v191;
if ( v191 <= -3000.0 )
v162 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, v162, m_playbackY);
v163 = v48;
if ( v48 >= 240000.0 )
v163 = 240000.0;
cocos2d::CCPoint::CCPoint(&v197, v163, a1->m_playbackY);
cocos2d::ccDrawLine(&v196, &v197);
}
}
v15 = a1->m_editorLayer;
v122 = v15->m_previewPosition.x;
if ( v122 != 0.0 || (v8 = v15->m_previewPosition.y, v8 != 0.0) )
{
v8 = v191;
if ( v122 > 0.0 && v191 <= v122 && v48 >= v122 )
{
cocos2d::ccDrawColor4B(0xFFu, 0x96u, 0, 0xFFu);
glLineWidth();
v123 = y;
if ( y <= -3000.0 )
v123 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, v122, v123);
v124 = v53;
if ( v53 >= v39 )
v124 = v39;
cocos2d::CCPoint::CCPoint(&v197, v122, v124);
cocos2d::ccDrawLine(&v196, &v197);
v15 = a1->m_editorLayer;
}
}
v16 = v15->m_playbackMode;
if ( v16 != Playing )
goto LABEL_10;
LABEL_183:
v125 = v15;
if ( v15->m_gameState.m_isDualMode )
goto LABEL_184;
if ( PlayerObject::isFlying(v15->m_player1) )
{
v125 = a1->m_editorLayer;
goto LABEL_184;
}
v125 = a1->m_editorLayer;
m_player1 = v125->m_player1;
if ( m_player1->m_isBall || m_player1->m_isSpider )
{
LABEL_184:
MinPortalY = GJBaseGameLayer::getMinPortalY(v125);
MaxPortalY = GJBaseGameLayer::getMaxPortalY(a1->m_editorLayer);
glLineWidth();
cocos2d::ccDrawColor4B(0xFFu, 0xAFu, 0x32u, 0xFFu);
if ( MinPortalY == 90.0 )
{
v130 = v191;
if ( v191 > -3000.0 )
goto LABEL_190;
}
else
{
v128 = v191;
if ( v191 <= -3000.0 )
v128 = -3000.0;
cocos2d::CCPoint::CCPoint(&v196, v128, MinPortalY);
v129 = v48;
if ( v48 >= 240000.0 )
v129 = 240000.0;
cocos2d::CCPoint::CCPoint(&v197, v129, MinPortalY);
cocos2d::ccDrawLine(&v196, &v197);
v130 = v191;
if ( v191 > -3000.0 )
{
LABEL_190:
cocos2d::CCPoint::CCPoint(&v196, v130, MaxPortalY);
v131 = v48;
if ( v48 < 240000.0 )
{
LABEL_191:
cocos2d::CCPoint::CCPoint(&v197, v131, MaxPortalY);
cocos2d::ccDrawLine(&v196, &v197);
goto LABEL_21;
}
LABEL_249:
cocos2d::CCPoint::CCPoint(&v197, 240000.0, MaxPortalY);
cocos2d::ccDrawLine(&v196, &v197);
goto LABEL_21;
}
}
cocos2d::CCPoint::CCPoint(&v196, -3000.0, MaxPortalY);
v131 = v48;
if ( v48 < 240000.0 )
goto LABEL_191;
goto LABEL_249;
}
LABEL_21:
if ( m_playbackMode == Playing )
goto LABEL_58;
v17 = a1->m_editorLayer;
if ( !v17->m_showDurationLines )
goto LABEL_58;
m_durationObjects = v17->m_durationObjects;
if ( !m_durationObjects )
goto LABEL_58;
v19 = m_durationObjects->data;
if ( !v19->num )
goto LABEL_58;
v20 = v19->arr;
v21 = &v20[v19->num - 1];
if ( v20 > v21 )
goto LABEL_58;
v22 = *v20;
v23 = 0;
if ( !*v20 )
goto LABEL_58;
while ( 2 )
{
if ( GameVariable && BYTE2(v22[22].m_nZOrder) && !BYTE1(v22[19].m_unknown5) )
goto LABEL_54;
if ( a1->m_updateTimeMarkers )
{
cocos2d::CCPoint::operator=(&v22[31].m_uOrderOfArrival, v8, m_playbackY);
v24 = HIDWORD(v22[18].__vftable);
v25 = *(float *)&v22[25].m_uUnknown;
if ( v24 != 1006 )
goto LABEL_32;
goto LABEL_259;
}
v24 = HIDWORD(v22[18].__vftable);
v25 = *(float *)&v22[25].m_uUnknown;
if ( v24 == 1006 )
{
LABEL_259:
m_playbackY = *(float *)&v22[28].m_nLuaID;
v8 = *(float *)&v22[28].m_uID + m_playbackY;
v25 = v8 + *(float *)&v22[28].m_nTag;
goto LABEL_34;
}
LABEL_32:
if ( v24 == 3602 )
v25 = *(float *)&v22[34].m_uUnknown;
LABEL_34:
if ( v25 > 0.0 )
{
((void (__fastcall *)(cocos2d::CCPoint *__return_ptr, cocos2d::CCObject *))v22->__vftable[16].getTag)(&v195, v22);
v8 = v195.x;
if ( v48 >= v195.x )
{
v8 = v195.y;
if ( v195.y <= v39 && (!BYTE2(v22[11].m_uIndexInArray) || BYTE1(v22[19].m_unknown5)) )
{
p_m_uOrderOfArrival = &v22[31].m_uOrderOfArrival;
cocos2d::CCPoint::CCPoint(&v196, (const cocos2d::CCPoint *)&v22[31].m_uOrderOfArrival);
if ( BYTE1(v22[26].__vftable) )
{
v8 = v195.x + (float)(v25 * 311.58);
v196.y = v195.y;
v196.x = v8;
}
else
{
v8 = v196.x;
if ( v196.x == 0.0 && v196.y == 0.0 )
{
cocos2d::CCPoint::CCPoint(&v197, &v195);
LOBYTE(v187) = 0;
v189 = LevelTools::timeForPos(
v200,
(cocos2d::CCArray *)&v197,
(int)a1->m_speedObjects,
a1->m_editorLayer->m_levelSettings->m_startSpeed,
v22[31].m_uReference,
v22[31].m_uAutoReleaseCount,
0,
a1->m_editorLayer->m_levelSettings->m_platformerMode,
1,
v187);
LastGameplayRotated = LevelTools::getLastGameplayRotated();
v199 = LevelTools::posForTimeInternal(
v25 + v189,
a1->m_speedObjects,
a1->m_editorLayer->m_levelSettings->m_startSpeed,
a1->m_editorLayer->m_levelSettings->m_platformerMode,
0,
1,
&a1->m_editorLayer->m_gameState.m_rotateChannel,
0);
cocos2d::CCPoint::operator=(&v196, v199.x, v199.y);
if ( LastGameplayRotated == LevelTools::getLastGameplayRotated() )
{
if ( LastGameplayRotated )
v196.x = v195.x;
else
v196.y = v195.y;
}
cocos2d::CCPoint::operator=(p_m_uOrderOfArrival, v185, v186);
v8 = v196.x;
}
}
m_playbackY = v191;
if ( v191 <= v8 )
{
v8 = v196.y;
if ( y <= v196.y && v23 <= 397 )
{
v27 = v195.x;
v28 = v23;
v29 = (char *)a1->m_pointArray1 + v28 * 8;
if ( v191 >= v195.x )
v27 = v191;
v30 = v195.y;
if ( y >= v195.y )
v30 = y;
cocos2d::CCPoint::CCPoint(&v197, v27, v30);
cocos2d::CCPoint::operator=(v29, v31, v32);
v33 = v196.x;
v34 = &a1->m_pointArray1->__elems_[v28 + 1];
if ( v48 <= v196.x )
v33 = v48;
v35 = v196.y;
if ( v53 <= v196.y )
v35 = v53;
v23 += 2;
cocos2d::CCPoint::CCPoint(&v197, v33, v35);
cocos2d::CCPoint::operator=(v34, v36, v37);
}
}
}
}
}
LABEL_54:
if ( v21 >= ++v20 )
{
v22 = *v20;
if ( *v20 )
continue;
}
break;
}
if ( v23 )
{
glLineWidth();
cocos2d::ccDrawColor4B(
(unsigned __int8)&qword_60 + 4,
(unsigned __int8)&qword_60 + 4,
(unsigned __int8)&qword_60 + 4,
0x4Bu);
cocos2d::ccDrawLines(a1->m_pointArray1->__elems_, v23);
}
LABEL_58:
glLineWidth();
a1->m_updateTimeMarkers = 0;
}