//
// GJBaseGameLayer::updateDebugDraw from 0x854a2c to 0x85552c (2816 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::updateDebugDraw @ 0x683aa0
// > ??> @ 0x2fbe0
// > ??> @ 0x1148a28
// > ??> @ 0x1190718
//
// 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 GJBaseGameLayer::updateDebugDraw(GJBaseGameLayer *a1)
{
cocos2d::CCDirector *v2; // x0
float v3; // s8
float v4; // s11
const cocos2d::CCPoint *v5; // x0
float v6; // s0
float v7; // s1
float v8; // s0
float v9; // s1
std::vector *, std::allocator *>> **m_start; // x26
std::vector *, std::allocator *>> **m_finish; // x0
int m_leftSectionIndex; // w0
int m_rightSectionIndex; // w28
int v14; // w2
std::vector *, std::allocator *>> *v15; // x25
int m_bottomSectionIndex; // w0
int m_topSectionIndex; // w26
std::vector *v18; // x22
int v19; // w0
unsigned __int64 v20; // x20
__int64 v21; // x21
GameObject *v22; // x19
GameObjectType m_objectType; // w0
bool v24; // zf
GameObject_vtbl *v25; // x1
GameObjectType (__fastcall *getType)(const GameObject *__hidden); // x1
bool m_isObjectRectDirty; // w25
bool m_boxOffsetCalculated; // w26
const cocos2d::CCRect *v29; // x0
__int64 v30; // x0
cocos2d::CCDrawNode *m_debugDrawNode; // x25
const cocos2d::CCPoint *v32; // x26
float ObjectRadius; // s10
float v34; // s0
unsigned int v35; // w4
const cocos2d::CCRect *v36; // x0
cocos2d::CCPoint *v37; // x26
float v38; // s0
float v39; // s1
float v40; // s0
float v41; // s1
float v42; // s0
float v43; // s1
float v44; // s0
float v45; // s1
_BOOL4 m_isGripSlope; // w0
cocos2d::CCDrawNode *v47; // x0
cocos2d::CCDrawNode *v48; // x0
int v49; // w0
PlayerObject *m_player1; // x0
cocos2d::CCDrawNode *v51; // x20
__int64 v52; // x0
int v53; // w0
PlayerObject *m_player2; // x0
cocos2d::CCDrawNode *v55; // x20
__int64 v56; // x0
__int64 v57; // x0
__int64 v58; // x0
const cocos2d::CCRect *v59; // x0
cocos2d::CCDrawNode *v60; // x0
long double v61; // q0
__int64 v62; // x0
float v63; // s0
float v64; // s1
float v65; // s0
float v66; // s1
cocos2d::CCDrawNode *v67; // x0
unsigned __int64 v68; // [xsp+A0h] [xbp+A0h]
unsigned __int64 i; // [xsp+B0h] [xbp+B0h]
__int64 v70; // [xsp+D8h] [xbp+D8h]
__int64 v71; // [xsp+E0h] [xbp+E0h]
__int64 v72; // [xsp+E8h] [xbp+E8h]
int v73; // [xsp+F0h] [xbp+F0h]
int v74; // [xsp+F4h] [xbp+F4h]
cocos2d::CCDrawNode *pa; // [xsp+F8h] [xbp+F8h]
cocos2d::CCPoint *p; // [xsp+F8h] [xbp+F8h]
float v77; // [xsp+108h] [xbp+108h]
float v78; // [xsp+10Ch] [xbp+10Ch]
cocos2d::CCPoint v79; // [xsp+110h] [xbp+110h] BYREF
cocos2d::CCPoint v80; // [xsp+118h] [xbp+118h] BYREF
cocos2d::CCPoint v81; // [xsp+120h] [xbp+120h] BYREF
cocos2d::CCRect v82; // [xsp+128h] [xbp+128h] BYREF
cocos2d::CCRect v83; // [xsp+138h] [xbp+138h] BYREF
cocos2d::CCRect v84; // [xsp+148h] [xbp+148h] BYREF
cocos2d::ccColor4F v85; // [xsp+158h] [xbp+158h] BYREF
cocos2d::CCSize WinSize; // 0:kr00_8.8
cocos2d::CCDrawNode::clear(a1->m_debugDrawNode);
v2 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v2);
v3 = ((float (__fastcall *)(cocos2d::CCLayer *, float, float))a1->m_objectLayer->getScale)(
a1->m_objectLayer,
WinSize.width,
WinSize.height);
v4 = 0.25 / v3;
v5 = a1->m_objectLayer->getPosition(a1->m_objectLayer);
cocos2d::CCPoint::CCPoint(&v79, v5);
cocos2d::CCPoint::operator*(&v79, 1.0 / v3);
cocos2d::CCPoint::operator=(&v79, v6, v7);
cocos2d::CCPoint::operator-(&v85, &v79);
cocos2d::CCPoint::operator=(&v79, v8, v9);
cocos2d::CCRect::CCRect(&v82, v79.x, v79.y, v77 / v3, v78 / v3);
cocos2d::CCDrawNode::enableDrawArea(a1->m_debugDrawNode, &v82);
m_start = a1->m_sections.m_start;
m_finish = a1->m_sections.m_finish;
if ( m_finish == m_start )
LODWORD(v68) = -1;
else
v68 = (unsigned __int64)((char *)m_finish - (char *)m_start) >> 3;
if ( a1->m_isEditor )
{
if ( !a1->m_isDebugDrawEnabled )
return;
m_leftSectionIndex = a1->m_leftSectionIndex;
v73 = m_leftSectionIndex;
if ( (int)v68 <= m_leftSectionIndex )
return;
m_rightSectionIndex = a1->m_rightSectionIndex;
if ( m_leftSectionIndex > m_rightSectionIndex )
return;
}
else
{
v53 = a1->m_leftSectionIndex;
v73 = v53;
if ( (int)v68 <= v53 )
goto LABEL_62;
m_rightSectionIndex = a1->m_rightSectionIndex;
if ( v53 > m_rightSectionIndex )
goto LABEL_62;
}
v14 = m_rightSectionIndex;
v70 = v73;
v15 = m_start[v70];
if ( !v15 )
goto LABEL_59;
LABEL_8:
for ( i = (unsigned __int64)((char *)v15->m_finish - (char *)v15->m_start) >> 3; ; LODWORD(i) = -1 )
{
m_bottomSectionIndex = a1->m_bottomSectionIndex;
v74 = m_bottomSectionIndex;
if ( (int)i > m_bottomSectionIndex )
{
m_topSectionIndex = a1->m_topSectionIndex;
if ( m_bottomSectionIndex <= m_topSectionIndex )
{
v72 = m_bottomSectionIndex;
v71 = m_bottomSectionIndex;
while ( 1 )
{
v18 = v15->m_start[v72];
if ( v18 )
{
v19 = a1->m_sectionSizes.m_start[v70]->m_start[v71];
if ( v19 > 0 )
break;
}
LABEL_36:
++v74;
++v72;
++v71;
if ( m_topSectionIndex < v74 || (int)i <= v74 )
{
v14 = a1->m_rightSectionIndex;
goto LABEL_56;
}
v15 = a1->m_sections.m_start[v70];
}
v20 = 0;
v21 = 8 * ((unsigned int)(v19 - 1) + 1LL);
while ( 1 )
{
v22 = v18->m_start[v20 / 8];
if ( !v22->m_isActivated && !a1->m_isEditor )
goto LABEL_16;
m_objectType = v22->m_objectType;
if ( m_objectType == Decoration || a1->m_playbackMode && v22->m_isGroupDisabled )
goto LABEL_16;
if ( v22->m_objectRadius > 0.0 )
{
if ( m_objectType == Hazard )
{
m_debugDrawNode = a1->m_debugDrawNode;
v32 = v22->getPosition(v18->m_start[v20 / 8]);
ObjectRadius = GameObject::getObjectRadius(v22);
v84.origin.x = 0.0;
v84.origin.y = 0.0;
v84.size.width = 0.0;
v84.size.height = 0.0;
v85.r = 1.0;
v85.g = 0.0;
v85.b = 0.0;
v85.a = 1.0;
v34 = GameObject::getObjectRadius(v22);
v35 = 8;
if ( v34 > 8.0 )
v35 = (unsigned int)GameObject::getObjectRadius(v22);
cocos2d::CCDrawNode::drawCircle(
m_debugDrawNode,
v32,
ObjectRadius,
(const cocos2d::ccColor4F *)&v84,
v4,
&v85,
v35);
}
goto LABEL_16;
}
v24 = v22->getType(v18->m_start[v20 / 8]) == Slope;
v25 = v22->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v24 )
{
v36 = v25->getObjectRect(v22);
cocos2d::CCRect::CCRect(&v83, v36);
GameObject::determineSlopeDirection(v22);
p = (cocos2d::CCPoint *)operator new[](0x18u);
v37 = p;
do
cocos2d::CCPoint::CCPoint(v37++);
while ( v37 != &p[3] );
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v83.origin.x, v83.origin.y);
cocos2d::CCPoint::operator=(p, v38, v39);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v83.origin.x, v83.origin.y + v83.size.height);
cocos2d::CCPoint::operator=(&p[1], v40, v41);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v83.origin.x + v83.size.width, v83.origin.y);
cocos2d::CCPoint::operator=(&p[2], v42, v43);
cocos2d::CCPoint::CCPoint(&v81, v83.origin.x + v83.size.width, v83.origin.y + v83.size.height);
switch ( v22->m_slopeDirection )
{
case 0:
case 7:
cocos2d::CCPoint::operator=(&p[1], v44, v45);
break;
case 1:
case 5:
cocos2d::CCPoint::operator=(p, v44, v45);
break;
case 3:
case 6:
cocos2d::CCPoint::operator=(&p[2], v44, v45);
break;
default:
break;
}
m_isGripSlope = v22->m_isGripSlope;
v84.origin.y = 0.25;
v84.size.width = 1.0;
v84.size.height = 1.0;
v84.origin.x = 0.0;
if ( m_isGripSlope )
{
v84.origin.x = 1.0;
v84.origin.y = 0.0;
}
v47 = a1->m_debugDrawNode;
v85.r = 0.0;
v85.g = 0.0;
v85.b = 0.0;
v85.a = 0.0;
cocos2d::CCDrawNode::drawPolygon(v47, p, 3, &v85, &v84, 0, v4);
operator delete[](p);
goto LABEL_16;
}
getType = v25->getType;
v83.origin.x = 0.0;
v83.origin.y = 0.25;
v83.size.width = 1.0;
v83.size.height = 1.0;
if ( getType(v22) == Hazard || v22->getType(v22) == AnimatedHazard )
{
v83.origin.x = 1.0;
v83.size.height = 1.0;
v83.origin.y = 0.0;
v83.size.width = 0.0;
}
else if ( v22->getType(v22) )
{
if ( !v22->m_greenDebugDraw )
goto LABEL_16;
v83.origin.x = 0.0;
v83.origin.y = 1.0;
v83.size.width = 0.0;
v83.size.height = 1.0;
}
else if ( v22->m_isPassable )
{
v83.origin.x = 0.0;
v83.origin.y = 1.0;
v83.size.width = 1.0;
v83.size.height = 1.0;
}
if ( a1->m_anticheatSpike == v22 )
{
LABEL_16:
v20 += 8LL;
if ( v20 == v21 )
goto LABEL_35;
}
else
{
m_isObjectRectDirty = v22->m_isObjectRectDirty;
m_boxOffsetCalculated = v22->m_boxOffsetCalculated;
v29 = v22->getObjectRect(v22);
cocos2d::CCRect::CCRect(&v84, v29);
if ( (int)v22->getRotation(v22) % 90 && (a1->m_isEditor || v22->m_shouldUseOuterOb) )
{
GameObject::calculateOrientedBox(v22);
pa = a1->m_debugDrawNode;
v30 = (__int64)v22->getOrientedBox(v22);
v85.r = 0.0;
v85.g = 0.0;
v85.b = 0.0;
v85.a = 0.0;
cocos2d::CCDrawNode::drawPolygon(pa, v30 + 316, 4, &v85, &v83, 0, v4);
}
else
{
cocos2d::CCPoint::CCPoint(&v80, &v84.origin);
cocos2d::CCPoint::CCPoint(&v81, v84.origin.x + v84.size.width, v84.origin.y + v84.size.height);
v48 = a1->m_debugDrawNode;
v85.r = 0.0;
v85.g = 0.0;
v85.b = 0.0;
v85.a = 0.0;
cocos2d::CCDrawNode::drawRect(v48, &v80, &v81, &v85, &v83, 0, v4);
}
v20 += 8LL;
v22->m_isObjectRectDirty = m_isObjectRectDirty;
v22->m_boxOffsetCalculated = m_boxOffsetCalculated;
if ( v20 == v21 )
{
LABEL_35:
m_topSectionIndex = a1->m_topSectionIndex;
goto LABEL_36;
}
}
}
}
}
LABEL_56:
v49 = v73 + 1;
v73 = v49;
++v70;
if ( v14 < v49 || (int)v68 <= v49 )
break;
v15 = a1->m_sections.m_start[v70];
if ( v15 )
goto LABEL_8;
LABEL_59:
;
}
if ( !a1->m_isEditor )
{
LABEL_62:
if ( !a1->m_disablePlayerHitbox || a1->m_hitboxesOnDeath && a1->m_playerDied )
{
a1->m_player1->updateOrientedBox(a1->m_player1);
m_player1 = a1->m_player1;
v51 = a1->m_debugDrawNode;
if ( m_player1->m_isBall )
{
v52 = (__int64)m_player1->getObjectRect(m_player1);
v84.origin.x = 0.0;
v84.origin.y = 0.0;
v84.size.width = 0.0;
v84.size.height = 0.0;
v85.r = 1.0;
v85.g = 1.0;
v85.b = 0.0;
v85.a = 1.0;
cocos2d::CCDrawNode::drawRect(v51, v52, &v84, &v85, 0, v4);
}
else
{
v57 = (__int64)m_player1->getOrientedBox(m_player1);
v84.origin.x = 0.0;
v84.origin.y = 0.0;
v84.size.width = 0.0;
v84.size.height = 0.0;
v85.r = 1.0;
v85.g = 1.0;
v85.b = 0.0;
v85.a = 1.0;
cocos2d::CCDrawNode::drawPolygon(v51, v57 + 316, 4, &v84, &v85, 0, v4);
}
if ( a1->m_gameState.m_isDualMode )
{
a1->m_player2->updateOrientedBox(a1->m_player2);
m_player2 = a1->m_player2;
v55 = a1->m_debugDrawNode;
if ( m_player2->m_isBall )
{
v56 = (__int64)m_player2->getObjectRect(m_player2);
v84.origin.x = 0.0;
v84.origin.y = 0.0;
v84.size.width = 0.0;
v84.size.height = 0.0;
v85.r = 1.0;
v85.g = 1.0;
v85.b = 0.0;
v85.a = 1.0;
cocos2d::CCDrawNode::drawRect(v55, v56, &v84, &v85, 0, v4);
}
else
{
v58 = (__int64)m_player2->getOrientedBox(m_player2);
v84.origin.x = 0.0;
v84.origin.y = 0.0;
v84.size.width = 0.0;
v84.size.height = 0.0;
v85.r = 1.0;
v85.g = 1.0;
v85.b = 0.0;
v85.a = 1.0;
cocos2d::CCDrawNode::drawPolygon(v55, v58 + 316, 4, &v84, &v85, 0, v4);
}
}
if ( a1->m_hitboxesOnDeath && a1->m_playerDied )
{
v59 = a1->m_player1->getObjectRect(a1->m_player1);
cocos2d::CCRect::CCRect(&v83, v59);
cocos2d::CCPoint::CCPoint(&v80, &v83.origin);
cocos2d::CCPoint::CCPoint(&v81, v83.origin.x + v83.size.width, v83.origin.y + v83.size.height);
v60 = a1->m_debugDrawNode;
v84.origin.x = 0.0;
v84.origin.y = 0.0;
v84.size.width = 0.0;
v84.size.height = 0.0;
v85.r = 1.0;
v85.g = 1.0;
v85.b = 0.0;
v85.a = 0.5;
*(__n128 *)&v61 = cocos2d::CCDrawNode::drawRect(v60, &v80, &v81, &v84, &v85, 0, v4);
if ( a1->m_gameState.m_isDualMode )
{
v62 = ((__int64 (__fastcall *)(PlayerObject *, long double))a1->m_player2->getObjectRect)(a1->m_player2, v61);
cocos2d::CCRect::operator=(&v83, v62);
cocos2d::CCPoint::operator=(&v80, v63, v64);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v85,
v83.origin.x + v83.size.width,
v83.origin.y + v83.size.height);
cocos2d::CCPoint::operator=(&v81, v65, v66);
v67 = a1->m_debugDrawNode;
v84.origin.x = 0.0;
v84.origin.y = 0.0;
v84.size.width = 0.0;
v84.size.height = 0.0;
v85.r = 1.0;
v85.g = 1.0;
v85.b = 0.0;
v85.a = 0.5;
cocos2d::CCDrawNode::drawRect(v67, &v80, &v81, &v84, &v85, 0, v4);
}
}
}
}
}