//
// GJBaseGameLayer::updateDebugDraw from 0x46b854 to 0x46c06e (2074 bytes)
//
// 1 xrefs:
// > LevelEditorLayer::updateDebugDraw @ 0x379e1a
//
// 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; // r0
float v3; // s16
float v4; // s17
const cocos2d::CCPoint *v5; // r0
int v6; // r2
bool v7; // r3
int v8; // r2
bool v9; // r3
int m_start; // r2
int v11; // r3
std::vector *, std::allocator *>> **m_finish; // r6
bool v13; // zf
int m_leftSectionIndex; // r8
std::vector *, std::allocator *>> *v15; // r2
int v16; // r3
int m_bottomSectionIndex; // r7
int j; // r3
GameObject *v19; // r5
GameObjectType m_objectType; // r3
cocos2d::CCDrawNode *m_debugDrawNode; // r11
const cocos2d::CCPoint *v22; // r10
float ObjectRadius; // r0
float v24; // r6
unsigned int v25; // r0
const cocos2d::CCRect *v26; // r0
cocos2d::CCPoint *v27; // r0
cocos2d::CCPoint *v28; // r11
int v29; // r6
cocos2d::CCPoint *v30; // r10
int v31; // r2
bool v32; // r3
int v33; // r2
bool v34; // r3
int v35; // r2
int m_slopeDirection; // r2
PlayerObject *v37; // r0
_BOOL4 m_isGripSlope; // r2
GameObject_vtbl *v39; // r3
bool m_isObjectRectDirty; // r10
bool m_boxOffsetCalculated; // r11
cocos2d::CCDrawNode **p_m_debugDrawNode; // r6
const cocos2d::CCRect *v43; // r0
int v44; // r6
int v45; // r0
PlayerObject *m_player1; // r0
int m_isBall; // r8
PlayerObject_vtbl *v48; // r3
cocos2d::CCDrawNode *v49; // r8
int v50; // r0
cocos2d::CCDrawNode *v51; // r9
int v52; // r0
PlayerObject *m_player2; // r0
int v54; // r8
PlayerObject_vtbl *v55; // r3
cocos2d::CCDrawNode *v56; // r8
int v57; // r0
cocos2d::CCDrawNode *v58; // r9
int v59; // r0
const cocos2d::CCRect *v60; // r0
cocos2d::CCDrawNode *v61; // r0
const cocos2d::CCRect *v62; // r0
int v63; // r2
bool v64; // r3
int v65; // r2
bool v66; // r3
cocos2d::CCDrawNode *v67; // r0
int v68; // r0
int i; // [sp+14h] [bp-98h]
int k; // [sp+18h] [bp-94h]
int v71; // [sp+1Ch] [bp-90h]
int v72; // [sp+24h] [bp-88h]
int v73; // [sp+28h] [bp-84h]
_DWORD *v74; // [sp+2Ch] [bp-80h]
int v75; // [sp+30h] [bp-7Ch]
cocos2d::CCSize v76; // [sp+44h] [bp-68h] BYREF
cocos2d::CCPoint v77; // [sp+4Ch] [bp-60h] BYREF
cocos2d::CCPoint v78; // [sp+54h] [bp-58h] BYREF
cocos2d::CCPoint v79; // [sp+5Ch] [bp-50h] BYREF
cocos2d::CCRect v80; // [sp+64h] [bp-48h] BYREF
cocos2d::CCRect v81; // [sp+74h] [bp-38h] BYREF
cocos2d::CCRect v82; // [sp+84h] [bp-28h] BYREF
cocos2d::ccColor4F v83; // [sp+94h] [bp-18h] BYREF
cocos2d::CCDrawNode::clear(a1->m_debugDrawNode);
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v76, v2);
v3 = COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLayer *))a1->m_objectLayer->getScale)(a1->m_objectLayer));
v4 = 0.25 / v3;
v5 = a1->m_objectLayer->getPosition(a1->m_objectLayer);
cocos2d::CCPoint::CCPoint(&v77, v5);
cocos2d::CCPoint::operator*(&v83, &v77, 1.0 / v3);
cocos2d::CCPoint::operator=((PlayerObject *)&v77, COERCE_FLOAT(&v83), v6, v7);
cocos2d::CCPoint::operator-(&v83, &v77);
cocos2d::CCPoint::operator=((PlayerObject *)&v77, COERCE_FLOAT(&v83), v8, v9);
cocos2d::CCRect::CCRect(&v80, v77.x, v77.y, v76.width / v3, v76.height / v3);
cocos2d::CCDrawNode::enableDrawArea(a1->m_debugDrawNode, &v80);
m_start = (int)a1->m_sections.m_start;
v11 = 11440;
m_finish = a1->m_sections.m_finish;
v13 = m_start == (_DWORD)m_finish;
if ( (std::vector *, std::allocator *>> **)m_start == m_finish )
v11 = -1;
else
m_start = (int)m_finish - m_start;
if ( !v13 )
v11 = m_start >> 2;
v72 = v11;
if ( !a1->m_isEditor || a1->m_isDebugDrawEnabled )
{
m_leftSectionIndex = a1->m_leftSectionIndex;
for ( i = a1->m_leftSectionIndex; i <= a1->m_rightSectionIndex && i < v72; ++i )
{
v15 = a1->m_sections.m_start[m_leftSectionIndex];
if ( v15 )
v16 = a1->m_sections.m_start[m_leftSectionIndex]->m_finish - v15->m_start;
else
v16 = -1;
v73 = v16;
m_bottomSectionIndex = a1->m_bottomSectionIndex;
for ( j = 4 * m_bottomSectionIndex; ; j = v71 + 4 )
{
v71 = j;
if ( m_bottomSectionIndex > a1->m_topSectionIndex || m_bottomSectionIndex >= v73 )
break;
v74 = *(std::vector **)((char *)a1->m_sections.m_start[m_leftSectionIndex]->m_start + j);
if ( v74 )
{
v75 = *(int *)((char *)a1->m_sectionSizes.m_start[m_leftSectionIndex]->m_start + j);
for ( k = 0; ; ++k )
{
if ( k >= v75 )
goto LABEL_54;
v19 = *(GameObject **)(*v74 + 4 * k);
if ( v19->m_isActivated || a1->m_isEditor )
{
m_objectType = v19->m_objectType;
if ( m_objectType != Decoration && (a1->m_playbackMode == Not || !v19->m_isGroupDisabled) )
break;
}
LABEL_53:
;
}
if ( v19->m_objectRadius > 0.0 )
{
if ( m_objectType == Hazard )
{
m_debugDrawNode = a1->m_debugDrawNode;
v22 = v19->getPosition(*(_DWORD *)(*v74 + 4 * k));
ObjectRadius = GameObject::getObjectRadius(v19);
memset(&v82, 0, sizeof(v82));
v83.r = 1.0;
v83.a = 1.0;
v83.g = 0.0;
v83.b = 0.0;
v24 = ObjectRadius;
if ( GameObject::getObjectRadius(v19) <= 8.0 )
v25 = 8;
else
v25 = (unsigned int)GameObject::getObjectRadius(v19);
cocos2d::CCDrawNode::drawCircle(
m_debugDrawNode,
v22,
v24,
(const cocos2d::ccColor4F *)&v82,
v4,
&v83,
v25);
}
goto LABEL_53;
}
if ( v19->getType(*(const GameObject **)(*v74 + 4 * k)) == Slope )
{
v26 = v19->getObjectRect(v19);
cocos2d::CCRect::CCRect(&v81, v26);
GameObject::determineSlopeDirection(v19);
v27 = (cocos2d::CCPoint *)operator new[](0x18u);
v28 = v27 + 3;
v29 = (int)v27;
v30 = v27;
do
cocos2d::CCPoint::CCPoint(v30++);
while ( v30 != v28 );
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v83, v81.origin.x, v81.origin.y);
cocos2d::CCPoint::operator=((PlayerObject *)v29, COERCE_FLOAT(&v83), v31, v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v83, v81.origin.x, v81.origin.y + v81.size.height);
cocos2d::CCPoint::operator=((PlayerObject *)(v29 + 8), COERCE_FLOAT(&v83), v33, v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v83, v81.origin.x + v81.size.width, v81.origin.y);
cocos2d::CCPoint::operator=((PlayerObject *)(v29 + 16), COERCE_FLOAT(&v83), v35, v29 + 16);
cocos2d::CCPoint::CCPoint(&v79, v81.origin.x + v81.size.width, v81.origin.y + v81.size.height);
m_slopeDirection = v19->m_slopeDirection;
switch ( m_slopeDirection )
{
case 0:
case 7:
v37 = (PlayerObject *)(v29 + 8);
goto LABEL_38;
case 1:
case 5:
v37 = (PlayerObject *)v29;
goto LABEL_38;
case 3:
case 6:
v37 = (PlayerObject *)(v29 + 16);
LABEL_38:
cocos2d::CCPoint::operator=(v37, COERCE_FLOAT(&v79), m_slopeDirection, v29 + 16);
break;
default:
break;
}
m_isGripSlope = v19->m_isGripSlope;
v82.origin.x = 0.0;
v82.origin.y = 0.25;
v82.size.width = 1.0;
v82.size.height = 1.0;
if ( m_isGripSlope )
{
v82.origin.y = 0.0;
v82.origin.x = 1.0;
}
memset(&v83, 0, sizeof(v83));
cocos2d::CCDrawNode::drawPolygon((int)a1->m_debugDrawNode, v29, 3, (int)&v83, v4, (int)&v82, 0);
operator delete[]((void *)v29);
goto LABEL_53;
}
v81.origin.y = 0.25;
v39 = v19->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v81.origin.x = 0.0;
v81.size.width = 1.0;
v81.size.height = 1.0;
if ( v39->getType(v19) == Hazard || v19->getType(v19) == AnimatedHazard )
{
v81.origin.y = 0.0;
v81.origin.x = 1.0;
v81.size.height = 1.0;
v81.size.width = 0.0;
}
else if ( v19->getType(v19) )
{
if ( !v19->m_greenDebugDraw )
goto LABEL_53;
v81.origin.x = 0.0;
v81.origin.y = 1.0;
v81.size.width = 0.0;
LABEL_47:
v81.size.height = 1.0;
}
else if ( v19->m_isPassable )
{
v81.origin.x = 0.0;
v81.origin.y = 1.0;
v81.size.width = 1.0;
goto LABEL_47;
}
if ( v19 != a1->m_anticheatSpike )
{
m_isObjectRectDirty = v19->m_isObjectRectDirty;
m_boxOffsetCalculated = v19->m_boxOffsetCalculated;
p_m_debugDrawNode = &a1->m_debugDrawNode;
v43 = v19->getObjectRect(v19);
cocos2d::CCRect::CCRect(&v82, v43);
if ( (int)v19->getRotation(v19) % 90 && (a1->m_isEditor || v19->m_shouldUseOuterOb) )
{
GameObject::calculateOrientedBox(v19);
v44 = (int)*p_m_debugDrawNode;
v45 = (int)v19->getOrientedBox(v19);
memset(&v83, 0, sizeof(v83));
cocos2d::CCDrawNode::drawPolygon(v44, v45 + 264, 4, (int)&v83, v4, (int)&v81, 0);
}
else
{
cocos2d::CCPoint::CCPoint(&v78, &v82.origin);
cocos2d::CCPoint::CCPoint(&v79, v82.origin.x + v82.size.width, v82.origin.y + v82.size.height);
v68 = (int)*p_m_debugDrawNode;
memset(&v83, 0, sizeof(v83));
cocos2d::CCDrawNode::drawRect(v68, (int)&v78, (int)&v79, (int)&v83, v4, (int)&v81, 0);
}
v19->m_isObjectRectDirty = m_isObjectRectDirty;
v19->m_boxOffsetCalculated = m_boxOffsetCalculated;
}
goto LABEL_53;
}
LABEL_54:
++m_bottomSectionIndex;
}
++m_leftSectionIndex;
}
if ( !a1->m_isEditor && (!a1->m_disablePlayerHitbox || a1->m_hitboxesOnDeath && a1->m_playerDied) )
{
a1->m_player1->updateOrientedBox(a1->m_player1);
m_player1 = a1->m_player1;
m_isBall = m_player1->m_isBall;
v48 = m_player1->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( m_player1->m_isBall )
{
v49 = a1->m_debugDrawNode;
v50 = ((int (*)(void))v48->getObjectRect)();
memset(&v82, 0, sizeof(v82));
v83.r = 1.0;
v83.g = 1.0;
v83.a = 1.0;
v83.b = 0.0;
cocos2d::CCDrawNode::drawRect(v49, v50, &v82, LODWORD(v4), &v83, 0);
}
else
{
v51 = a1->m_debugDrawNode;
v52 = ((int (*)(void))v48->getOrientedBox)();
memset(&v82, 0, sizeof(v82));
v83.r = 1.0;
v83.g = 1.0;
v83.a = 1.0;
v83.b = 0.0;
cocos2d::CCDrawNode::drawPolygon((int)v51, v52 + 264, 4, (int)&v82, v4, (int)&v83, m_isBall);
}
if ( a1->m_gameState.m_isDualMode )
{
a1->m_player2->updateOrientedBox(a1->m_player2);
m_player2 = a1->m_player2;
v54 = m_player2->m_isBall;
v55 = m_player2->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( m_player2->m_isBall )
{
v56 = a1->m_debugDrawNode;
v57 = ((int (*)(void))v55->getObjectRect)();
memset(&v82, 0, sizeof(v82));
v83.r = 1.0;
v83.g = 1.0;
v83.a = 1.0;
v83.b = 0.0;
cocos2d::CCDrawNode::drawRect(v56, v57, &v82, LODWORD(v4), &v83, 0);
}
else
{
v58 = a1->m_debugDrawNode;
v59 = ((int (*)(void))v55->getOrientedBox)();
memset(&v82, 0, sizeof(v82));
v83.r = 1.0;
v83.g = 1.0;
v83.a = 1.0;
v83.b = 0.0;
cocos2d::CCDrawNode::drawPolygon((int)v58, v59 + 264, 4, (int)&v82, v4, (int)&v83, v54);
}
}
if ( a1->m_hitboxesOnDeath && a1->m_playerDied )
{
v60 = a1->m_player1->getObjectRect(a1->m_player1);
cocos2d::CCRect::CCRect(&v81, v60);
cocos2d::CCPoint::CCPoint(&v78, &v81.origin);
cocos2d::CCPoint::CCPoint(&v79, v81.origin.x + v81.size.width, v81.origin.y + v81.size.height);
memset(&v82, 0, sizeof(v82));
v61 = a1->m_debugDrawNode;
v83.b = 0.0;
v83.r = 1.0;
v83.g = 1.0;
v83.a = 0.5;
cocos2d::CCDrawNode::drawRect((int)v61, (int)&v78, (int)&v79, (int)&v82, v4, (int)&v83, 0);
if ( a1->m_gameState.m_isDualMode )
{
v62 = a1->m_player2->getObjectRect(a1->m_player2);
cocos2d::CCRect::operator=(&v81, v62);
cocos2d::CCPoint::operator=((PlayerObject *)&v78, COERCE_FLOAT(&v81), v63, v64);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v83,
v81.origin.x + v81.size.width,
v81.origin.y + v81.size.height);
cocos2d::CCPoint::operator=((PlayerObject *)&v79, COERCE_FLOAT(&v83), v65, v66);
v67 = a1->m_debugDrawNode;
memset(&v82, 0, sizeof(v82));
v83.r = 1.0;
v83.g = 1.0;
v83.b = 0.0;
v83.a = 0.5;
cocos2d::CCDrawNode::drawRect((int)v67, (int)&v78, (int)&v79, (int)&v82, v4, (int)&v83, 0);
}
}
}
}
}