//
// GJBaseGameLayer::updateDebugDraw from 0x140210800 to 0x14021125c (2652 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::updateDebugDraw @ 0x1402e6ced
// > ??> @ 0x140567018
// > ??> @ 0x1405c9c00
// > ??> @ 0x1406ccf18
//
// 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=1
void GJBaseGameLayer::updateDebugDraw(GJBaseGameLayer *a1)
{
__int64 v2; // rcx
cocos2d::CCDirector *v3; // rax
double v4; // xmm0_8
float v5; // xmm6_4
float v6; // xmm8_4
std::_Vector_val *, std::allocator *>> *>>::pointer Myfirst; // rcx
std::_Vector_val *, std::allocator *>> *>>::pointer Mylast; // rax
__int64 v9; // rax
__int64 m_leftSectionIndex; // rdx
__int64 v11; // r9
std::_Simple_types *, std::allocator *>> *>::value_type v12; // rcx
__int64 v13; // rax
__int64 m_bottomSectionIndex; // rcx
__int64 v15; // r8
std::_Simple_types *>::value_type v16; // rdx
__int64 v17; // r12
__int64 v18; // r13
GameObject *v19; // rdi
GameObjectType m_objectType; // eax
float m_objectRadius; // xmm6_4
float m_scaleX; // xmm2_4
float m_scaleY; // xmm4_4
float v24; // xmm0_4
float v25; // xmm3_4
const struct cocos2d::CCPoint *v26; // rax
bool v27; // zf
GameObject_vtbl *v28; // rax
const struct cocos2d::CCRect *v29; // rax
cocos2d::CCPoint *v30; // rbx
double v31; // xmm0_8
__int64 v32; // rax
double v33; // xmm0_8
__int64 v34; // rax
double v35; // xmm0_8
__int64 v36; // rax
double v37; // xmm0_8
cocos2d::CCPoint *v38; // rcx
__int128 v39; // xmm0
bool m_isObjectRectDirty; // bl
bool m_boxOffsetCalculated; // r14
const struct cocos2d::CCRect *v42; // rax
float v43; // xmm0_4
__int64 v44; // rax
double v45; // xmm0_8
PlayerObject *m_player1; // rcx
PlayerObject_vtbl *v47; // rax
__int64 v48; // rax
__int64 v49; // rax
PlayerObject *m_player2; // rcx
PlayerObject_vtbl *v51; // rax
__int64 v52; // rax
__int64 v53; // rax
const struct cocos2d::CCRect *v54; // rax
double v55; // xmm0_8
const cocos2d::CCRect *v56; // rax
double v57; // xmm0_8
__int64 v58; // rax
cocos2d::CCRect v59; // [rsp+40h] [rbp-C0h] BYREF
std::vector *v60; // [rsp+50h] [rbp-B0h] BYREF
char v61[8]; // [rsp+58h] [rbp-A8h] BYREF
cocos2d::CCPoint v62; // [rsp+60h] [rbp-A0h] BYREF
__int64 v63; // [rsp+68h] [rbp-98h] BYREF
int v64; // [rsp+70h] [rbp-90h]
int v65; // [rsp+74h] [rbp-8Ch]
float v66; // [rsp+78h] [rbp-88h]
float v67; // [rsp+7Ch] [rbp-84h]
__int64 v68; // [rsp+80h] [rbp-80h]
cocos2d::CCRect v69; // [rsp+88h] [rbp-78h] BYREF
char v70[8]; // [rsp+98h] [rbp-68h] BYREF
cocos2d::CCPoint v71; // [rsp+A0h] [rbp-60h] BYREF
__int64 v72; // [rsp+A8h] [rbp-58h]
__int64 v73; // [rsp+B0h] [rbp-50h]
cocos2d::CCPoint *v74; // [rsp+C0h] [rbp-40h]
cocos2d::CCRect v75; // [rsp+D8h] [rbp-28h] BYREF
__int128 v76; // [rsp+E8h] [rbp-18h] BYREF
__int128 v77; // [rsp+F8h] [rbp-8h] BYREF
__int128 v78; // [rsp+108h] [rbp+8h] BYREF
cocos2d::CCDrawNode::clear(a1->m_debugDrawNode);
v3 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v2);
cocos2d::CCDirector::getWinSize(v3);
v4 = ((double (__fastcall *)(cocos2d::CCLayer *))a1->m_objectLayer->getScale)(a1->m_objectLayer);
v5 = *(float *)&v4;
v6 = 0.25 / *(float *)&v4;
a1->m_objectLayer->getPosition_0(a1->m_objectLayer);
cocos2d::CCPoint::CCPoint(&v62);
cocos2d::CCPoint::operator*(&v62, &v63);
cocos2d::CCPoint::operator=(&v62, &v63);
cocos2d::CCPoint::operator-(&v62, &v63);
cocos2d::CCPoint::operator=(&v62, &v63);
cocos2d::CCRect::CCRect(&v75, v62.x, v62.y, v66 / v5, v67 / v5);
cocos2d::CCDrawNode::enableDrawArea(a1->m_debugDrawNode, &v75);
Myfirst = a1->m_sections._Mypair._Myval2._Myfirst;
Mylast = a1->m_sections._Mypair._Myval2._Mylast;
if ( Myfirst == Mylast )
LODWORD(v9) = -1;
else
v9 = Mylast - Myfirst;
if ( !a1->m_isEditor || a1->m_isDebugDrawEnabled )
{
m_leftSectionIndex = a1->m_leftSectionIndex;
v65 = m_leftSectionIndex;
if ( (int)m_leftSectionIndex <= a1->m_rightSectionIndex )
{
v11 = m_leftSectionIndex;
v63 = m_leftSectionIndex;
v9 = (int)v9;
v73 = (int)v9;
while ( v11 < v9 )
{
v12 = a1->m_sections._Mypair._Myval2._Myfirst[v11];
if ( v12 )
v13 = v12->_Mypair._Myval2._Mylast - v12->_Mypair._Myval2._Myfirst;
else
LODWORD(v13) = -1;
m_bottomSectionIndex = a1->m_bottomSectionIndex;
v64 = m_bottomSectionIndex;
if ( (int)m_bottomSectionIndex <= a1->m_topSectionIndex )
{
v15 = m_bottomSectionIndex;
v68 = m_bottomSectionIndex;
v13 = (int)v13;
v72 = (int)v13;
while ( v15 < v13 )
{
v16 = a1->m_sections._Mypair._Myval2._Myfirst[v11]->_Mypair._Myval2._Myfirst[v15];
v60 = v16;
if ( v16 )
{
v17 = 0;
v18 = a1->m_sectionSizes._Mypair._Myval2._Myfirst[v11]->_Mypair._Myval2._Myfirst[v15];
if ( v18 > 0 )
{
while ( 1 )
{
v19 = v16->_Mypair._Myval2._Myfirst[v17];
if ( !v19->m_isActivated && !a1->m_isEditor )
goto LABEL_64;
m_objectType = v19->m_objectType;
if ( m_objectType == Decoration || a1->m_playbackMode && v19->m_isGroupDisabled )
goto LABEL_64;
m_objectRadius = v19->m_objectRadius;
if ( m_objectRadius <= 0.0 )
break;
if ( m_objectType == Hazard )
{
m_scaleX = v19->m_scaleX;
if ( m_scaleX == 1.0 && (m_scaleY = v19->m_scaleY, m_scaleY == 1.0) )
{
v24 = v19->m_objectRadius;
}
else
{
m_scaleY = v19->m_scaleY;
v24 = fmaxf(m_scaleX, m_scaleY) * m_objectRadius;
}
if ( v24 >= 8.0 )
{
if ( m_scaleX == 1.0 && m_scaleY == 1.0 )
v25 = v19->m_objectRadius;
else
v25 = fmaxf(m_scaleX, m_scaleY) * m_objectRadius;
}
else
{
v25 = 8.0;
}
v78 = xmmword_1406240D0;
v76 = 0;
if ( m_scaleX != 1.0 || m_scaleY != 1.0 )
m_objectRadius = fmaxf(m_scaleX, m_scaleY) * m_objectRadius;
v26 = v19->getPosition_0(v19);
cocos2d::CCDrawNode::drawCircle(
a1->m_debugDrawNode,
v26,
m_objectRadius,
(const struct cocos2d::_ccColor4F *)&v76,
v6,
(const struct cocos2d::_ccColor4F *)&v78,
(int)v25);
goto LABEL_63;
}
LABEL_64:
if ( ++v17 >= v18 )
{
v15 = v68;
v11 = v63;
goto LABEL_66;
}
}
v27 = v19->getType(v16->_Mypair._Myval2._Myfirst[v17]) == Slope;
v28 = v19->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v27 )
{
v29 = v28->getObjectRect_0(v19);
cocos2d::CCRect::CCRect(&v59, v29);
GameObject::determineSlopeDirection(v19);
v30 = (cocos2d::CCPoint *)operator new(0x18u);
v74 = v30;
cocos2d::CCPoint::CCPoint(v30);
cocos2d::CCPoint::CCPoint(v30 + 1);
v31 = cocos2d::CCPoint::CCPoint(v30 + 2);
cocos2d::CCPoint::CCPoint(*(float *)&v31, v59.origin.x);
v33 = cocos2d::CCPoint::operator=(v30, v32);
cocos2d::CCPoint::CCPoint(*(float *)&v33, v59.origin.x);
v35 = cocos2d::CCPoint::operator=(&v30[1], v34);
cocos2d::CCPoint::CCPoint(*(float *)&v35, v59.size.width + v59.origin.x);
v37 = cocos2d::CCPoint::operator=(&v30[2], v36);
cocos2d::CCPoint::CCPoint(*(float *)&v37, v59.size.width + v59.origin.x);
switch ( v19->m_slopeDirection )
{
case 0:
case 7:
v38 = v30 + 1;
goto LABEL_43;
case 1:
case 5:
v38 = v30;
goto LABEL_43;
case 3:
case 6:
v38 = v30 + 2;
LABEL_43:
cocos2d::CCPoint::operator=(v38, v61);
break;
default:
break;
}
v77 = xmmword_1406242B0;
if ( v19->m_isGripSlope )
*(_QWORD *)&v77 = 1065353216;
v76 = 0;
cocos2d::CCDrawNode::drawPolygon(a1->m_debugDrawNode, v30, 3, &v76, LODWORD(v6), &v77, 0);
j_j_free(v30);
goto LABEL_63;
}
v78 = xmmword_1406242B0;
if ( v28->getType(v19) == Hazard || v19->getType(v19) == AnimatedHazard )
{
v39 = xmmword_1406240D0;
}
else
{
if ( v19->getType(v19) == Solid )
{
if ( v19->m_isPassable )
{
v39 = xmmword_140624310;
goto LABEL_55;
}
LABEL_56:
if ( v19 != a1->m_anticheatSpike )
{
m_isObjectRectDirty = v19->m_isObjectRectDirty;
m_boxOffsetCalculated = v19->m_boxOffsetCalculated;
v42 = v19->getObjectRect_0(v19);
cocos2d::CCRect::CCRect(&v69, v42);
v43 = v19->getRotation(v19);
if ( (int)v43 != 90 * ((int)v43 / 90) && (a1->m_isEditor || v19->m_shouldUseOuterOb) )
{
v19->m_shouldUseOuterOb = 1;
v19->updateOrientedBox(v19);
v19->getObjectRect_0(v19);
v76 = 0;
v44 = (__int64)v19->getOrientedBox(v19);
cocos2d::CCDrawNode::drawPolygon(a1->m_debugDrawNode, v44 + 320, 4, &v76, LODWORD(v6), &v78, 0);
}
else
{
v45 = cocos2d::CCPoint::CCPoint(&v71);
cocos2d::CCPoint::CCPoint(*(float *)&v45, v69.size.width + v69.origin.x);
v76 = 0;
cocos2d::CCDrawNode::drawRect(a1->m_debugDrawNode, &v71, v70, &v76, LODWORD(v6), &v78, 0);
}
v19->m_isObjectRectDirty = m_isObjectRectDirty;
v19->m_boxOffsetCalculated = m_boxOffsetCalculated;
}
goto LABEL_63;
}
if ( !v19->m_greenDebugDraw )
{
LABEL_63:
v16 = v60;
goto LABEL_64;
}
v39 = xmmword_140624150;
}
LABEL_55:
v78 = v39;
goto LABEL_56;
}
}
LABEL_66:
++v64;
v68 = ++v15;
v13 = v72;
if ( v64 > a1->m_topSectionIndex )
break;
}
LODWORD(m_leftSectionIndex) = v65;
}
LODWORD(m_leftSectionIndex) = m_leftSectionIndex + 1;
v65 = m_leftSectionIndex;
v63 = ++v11;
v9 = v73;
if ( (int)m_leftSectionIndex > a1->m_rightSectionIndex )
break;
}
}
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;
v76 = xmmword_140624160;
v77 = 0;
v47 = m_player1->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( m_player1->m_isBall )
{
v48 = ((__int64 (*)(void))v47->getObjectRect_0)();
cocos2d::CCDrawNode::drawRect(a1->m_debugDrawNode, v48, &v77);
}
else
{
v49 = ((__int64 (*)(void))v47->getOrientedBox)();
cocos2d::CCDrawNode::drawPolygon(a1->m_debugDrawNode, v49 + 320, 4, &v77, LODWORD(v6), &v76, 0);
}
if ( a1->m_gameState.m_isDualMode )
{
a1->m_player2->updateOrientedBox(a1->m_player2);
m_player2 = a1->m_player2;
v76 = xmmword_140624160;
v77 = 0;
v51 = m_player2->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( m_player2->m_isBall )
{
v52 = ((__int64 (*)(void))v51->getObjectRect_0)();
cocos2d::CCDrawNode::drawRect(a1->m_debugDrawNode, v52, &v77);
}
else
{
v53 = ((__int64 (*)(void))v51->getOrientedBox)();
cocos2d::CCDrawNode::drawPolygon(a1->m_debugDrawNode, v53 + 320, 4, &v77, LODWORD(v6), &v76, 0);
}
}
if ( a1->m_hitboxesOnDeath && a1->m_playerDied )
{
v54 = a1->m_player1->getObjectRect_0(a1->m_player1);
cocos2d::CCRect::CCRect(&v59, v54);
v55 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60);
cocos2d::CCPoint::CCPoint(*(float *)&v55, v59.size.width + v59.origin.x);
v76 = xmmword_140624080;
v77 = 0;
cocos2d::CCDrawNode::drawRect(a1->m_debugDrawNode, &v60, v61, &v77, LODWORD(v6), &v76, 0);
if ( a1->m_gameState.m_isDualMode )
{
v56 = a1->m_player2->getObjectRect_0(a1->m_player2);
cocos2d::CCRect::operator=(&v59, v56);
v57 = cocos2d::CCPoint::operator=(&v60, &v59);
cocos2d::CCPoint::CCPoint(*(float *)&v57, v59.size.width + v59.origin.x);
cocos2d::CCPoint::operator=(v61, v58);
v76 = xmmword_140624080;
v77 = 0;
cocos2d::CCDrawNode::drawRect(a1->m_debugDrawNode, &v60, v61, &v77, LODWORD(v6), &v76, 0);
}
}
}
}
}