//
// GJBaseGameLayer::updateDebugDraw from 0x1001e4758 to 0x1001e5000 (2216 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::updateDebugDraw @ 0x100367d30
// > ??> @ 0x10078fd90
// > ??> @ 0x1007c0ba8
//
// 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 __fastcall GJBaseGameLayer::updateDebugDraw(GJBaseGameLayer *a1)
{
bool *p_m_isEditor; // x24
cocos2d::CCDirector *v3; // x0
float v4; // s8
__int64 *v5; // x0
float32x2_t *v6; // x0
int v7; // w9
_BOOL4 v8; // w10
int m_leftSectionIndex; // w11
int m_rightSectionIndex; // w8
float v11; // s8
__int64 v12; // x12
__int64 v13; // x13
std::vector *, std::allocator *>> *v19; // x9
signed __int64 v20; // x10
int m_bottomSectionIndex; // w11
int m_topSectionIndex; // w9
__int64 v24; // x26
std::vector *v25; // x27
__int64 v26; // x28
__int64 v27; // x25
GameObject *v28; // x20
GameObjectType m_objectType; // w8
cocos2d::CCDrawNode *v30; // x21
const cocos2d::CCPoint *v31; // x22
float ObjectRadius; // s9
unsigned int v33; // w4
__int64 v34; // x0
float32x2_t *v35; // x21
__int64 i; // x22
__n128 v37; // q0
__n128 v38; // q1
__n128 v39; // q0
__n128 v40; // q1
__n128 v41; // q0
__n128 v42; // q1
__n128 v43; // q0
__n128 v44; // q1
int m_slopeDirection; // w8
float32x2_t *v46; // x0
__int64 v47; // d0
bool m_isObjectRectDirty; // w22
bool m_boxOffsetCalculated; // w23
__int64 v50; // x0
double v51; // d0
unsigned __int64 v52; // t2
cocos2d::CCDrawNode *v53; // x21
__int64 v54; // x0
__n128 v55; // q0
__n128 v56; // q1
cocos2d::CCDrawNode *v57; // x0
cocos2d::CCDrawNode *m_debugDrawNode; // x0
PlayerObject *m_player1; // x0
cocos2d::CCDrawNode *v60; // x20
PlayerObject_vtbl *v61; // x8
__int64 v62; // x0
__int64 v63; // x0
PlayerObject *m_player2; // x0
cocos2d::CCDrawNode *v65; // x20
PlayerObject_vtbl *v66; // x8
__int64 v67; // x0
__int64 v68; // x0
__int64 v69; // x0
__n128 v70; // q0
__n128 v71; // q1
cocos2d::CCDrawNode *v72; // x0
__int64 v73; // x0
__n128 v74; // q0
__n128 v75; // q1
cocos2d::CCDrawNode *v76; // x0
__int64 v77; // [xsp+8h] [xbp-138h]
signed __int64 v78; // [xsp+10h] [xbp-130h]
__int64 v79; // [xsp+18h] [xbp-128h]
__int64 v80; // [xsp+48h] [xbp-F8h] BYREF
__int128 v81; // [xsp+50h] [xbp-F0h] BYREF
__int64 v82; // [xsp+68h] [xbp-D8h] BYREF
unsigned __int128 v83; // [xsp+70h] [xbp-D0h] BYREF
cocos2d::ccColor4F v84; // [xsp+80h] [xbp-C0h] BYREF
cocos2d::CCRect v85; // [xsp+98h] [xbp-A8h] BYREF
float32x2_t v86; // [xsp+A8h] [xbp-98h] BYREF
float v87; // [xsp+B0h] [xbp-90h]
float v88; // [xsp+B4h] [xbp-8Ch]
cocos2d::CCSize WinSize; // 0:kr00_8.8
p_m_isEditor = &a1->m_isEditor;
cocos2d::CCDrawNode::clear(a1->m_debugDrawNode);
v3 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v3);
v4 = ((float (__fastcall *)(cocos2d::CCLayer *, float, float))a1->m_objectLayer->getScale)(
a1->m_objectLayer,
WinSize.width,
WinSize.height);
v5 = (__int64 *)((__int64 (__fastcall *)(cocos2d::CCLayer *))a1->m_objectLayer->getPosition)(a1->m_objectLayer);
sub_1000229B8((__int64 *)&v86, v5);
sub_100022A14(v6, (float32x2_t *)&v85, 1.0 / v4);
sub_1000229D0(&v86, (double *)&v85.origin);
sub_100022A04(&v86, (float32x2_t *)&v85);
sub_1000229D0(&v86, (double *)&v85.origin);
sub_100022990((float *)&v85.origin, v86.f32[0], v86.f32[1], v87 / v4, v88 / v4);
cocos2d::CCDrawNode::enableDrawArea(a1->m_debugDrawNode, &v85);
if ( a1->m_sections.__end_ == a1->m_sections.__begin_ )
v7 = -1;
else
v7 = (unsigned __int64)((char *)a1->m_sections.__end_ - (char *)a1->m_sections.__begin_) >> 3;
v8 = *p_m_isEditor;
if ( v8 && !p_m_isEditor[1572] )
return;
m_leftSectionIndex = a1->m_leftSectionIndex;
m_rightSectionIndex = a1->m_rightSectionIndex;
v11 = 0.25 / v4;
if ( m_leftSectionIndex > m_rightSectionIndex || m_leftSectionIndex >= v7 )
{
if ( v8 )
return;
goto LABEL_75;
}
v12 = m_leftSectionIndex;
v13 = v7;
__asm { FMOV V12.2S, #1.0 }
v77 = v7;
do
{
v19 = a1->m_sections.__begin_[v12];
if ( v19 )
v20 = (unsigned __int64)((char *)v19->__end_ - (char *)v19->__begin_) >> 3;
else
LODWORD(v20) = -1;
m_bottomSectionIndex = a1->m_bottomSectionIndex;
m_topSectionIndex = a1->m_topSectionIndex;
if ( m_bottomSectionIndex <= m_topSectionIndex && m_bottomSectionIndex < (int)v20 )
{
v24 = m_bottomSectionIndex;
v20 = (int)v20;
v78 = (int)v20;
v79 = v12;
while ( 1 )
{
v25 = a1->m_sections.__begin_[v12]->__begin_[v24];
if ( v25 )
{
v26 = (unsigned int)a1->m_sectionSizes.__begin_[v12]->__begin_[v24];
if ( (int)v26 >= 1 )
break;
}
LABEL_67:
if ( v24 < m_topSectionIndex && ++v24 < v20 )
continue;
m_rightSectionIndex = a1->m_rightSectionIndex;
v13 = v77;
goto LABEL_70;
}
v27 = 0;
while ( 1 )
{
v28 = v25->__begin_[v27];
if ( v28->m_isActivated || *p_m_isEditor )
{
m_objectType = v28->m_objectType;
if ( m_objectType != Decoration && (a1->m_playbackMode == Not || !v28->m_isGroupDisabled) )
{
if ( v28->m_objectRadius <= 0.0 )
{
if ( ((unsigned int (__fastcall *)(GameObject *))v28->getType)(v25->__begin_[v27]) == 25 )
{
v34 = ((__int64 (__fastcall *)(GameObject *))v28->getObjectRect)(v28);
sub_100022B98(&v84, v34);
GameObject::determineSlopeDirection(v28);
v35 = (float32x2_t *)operator new[](0x18u);
for ( i = 0; i != 3; ++i )
sub_1000229B0(&v35[i]);
v38.n128_u32[0] = LODWORD(v84.g);
v37.n128_u32[0] = LODWORD(v84.r);
sub_100022980(v37, v38, &v83);
v39.n128_f64[0] = sub_1000229D0(v35, (double *)&v83);
v39.n128_u32[0] = LODWORD(v84.r);
v40.n128_f32[0] = v84.g + v84.a;
sub_100022980(v39, v40, &v83);
v41.n128_f64[0] = sub_1000229D0(&v35[1], (double *)&v83);
v42.n128_u32[0] = LODWORD(v84.g);
v41.n128_f32[0] = v84.r + v84.b;
sub_100022980(v41, v42, &v83);
v43.n128_f64[0] = sub_1000229D0(&v35[2], (double *)&v83);
v43.n128_f32[0] = v84.r + v84.b;
v44.n128_f32[0] = v84.g + v84.a;
sub_100022980(v43, v44, &v82);
m_slopeDirection = v28->m_slopeDirection;
if ( m_slopeDirection > 4 )
{
if ( m_slopeDirection == 5 )
{
v46 = v35;
}
else
{
v46 = v35 + 2;
if ( m_slopeDirection != 6 )
{
v46 = v35 + 1;
if ( m_slopeDirection != 7 )
goto LABEL_60;
}
}
}
else
{
v46 = v35 + 1;
if ( m_slopeDirection )
{
v46 = v35;
if ( m_slopeDirection != 1 )
{
v46 = v35 + 2;
if ( m_slopeDirection != 3 )
goto LABEL_60;
}
}
}
sub_1000229D0(v46, (double *)&v82);
LABEL_60:
v83 = xmmword_10063A4F0;
if ( v28->m_isGripSlope )
{
*(_QWORD *)&v83 = 1065353216;
HIDWORD(v83) = 1065353216;
}
m_debugDrawNode = a1->m_debugDrawNode;
v81 = 0u;
cocos2d::CCDrawNode::drawPolygon(
m_debugDrawNode,
v35,
3u,
(float32x2_t *)&v81,
(float32x2_t *)&v83,
0,
v11);
operator delete[](v35);
goto LABEL_63;
}
v84 = (cocos2d::ccColor4F)xmmword_10063A4F0;
if ( ((unsigned int (__fastcall *)(GameObject *))v28->getType)(v28) == 2
|| ((unsigned int (__fastcall *)(GameObject *))v28->getType)(v28) == 47 )
{
v84.r = 1.0;
v47 = 0;
goto LABEL_41;
}
if ( !((unsigned int (__fastcall *)(GameObject *))v28->getType)(v28) )
{
if ( v28->m_isPassable )
{
v84.r = 0.0;
v47 = _D12;
LABEL_41:
*(_QWORD *)&v84.g = v47;
v84.a = 1.0;
}
if ( v28 != a1->m_anticheatSpike )
{
m_isObjectRectDirty = v28->m_isObjectRectDirty;
m_boxOffsetCalculated = v28->m_boxOffsetCalculated;
v50 = ((__int64 (__fastcall *)(GameObject *))v28->getObjectRect)(v28);
v51 = sub_100022B98(&v83, v50);
HIDWORD(v52) = -1527099483
* (int)((float (__fastcall *)(GameObject *, double))v28->getRotation)(v28, v51)
+ 47721858;
LODWORD(v52) = HIDWORD(v52);
if ( (unsigned int)(v52 >> 1) >= 0x2D82D83 && (*p_m_isEditor || v28->m_shouldUseOuterOb) )
{
GameObject::calculateOrientedBox(v28);
v53 = a1->m_debugDrawNode;
v54 = ((__int64 (__fastcall *)(GameObject *))v28->getOrientedBox)(v28);
v81 = 0u;
cocos2d::CCDrawNode::drawPolygon(
v53,
(float32x2_t *)(v54 + 316),
4u,
(float32x2_t *)&v81,
(float32x2_t *)&v84,
0,
v11);
}
else
{
sub_1000229B8(&v82, (__int64 *)&v83);
v55.n128_f32[0] = *(float *)&v83 + *((float *)&v83 + 2);
v56.n128_f32[0] = *((float *)&v83 + 1) + *((float *)&v83 + 3);
sub_100022980(v55, v56, &v80);
v57 = a1->m_debugDrawNode;
v81 = 0u;
cocos2d::CCDrawNode::drawRect(
v57,
(unsigned __int32 *)&v82,
(unsigned __int32 *)&v80,
(float32x2_t *)&v81,
(float32x2_t *)&v84,
0,
v11);
}
v28->m_isObjectRectDirty = m_isObjectRectDirty;
v28->m_boxOffsetCalculated = m_boxOffsetCalculated;
}
goto LABEL_63;
}
if ( v28->m_greenDebugDraw )
{
v84.r = 0.0;
v47 = 1065353216;
goto LABEL_41;
}
}
else if ( m_objectType == Hazard )
{
v30 = a1->m_debugDrawNode;
v31 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(GameObject *))v28->getPosition)(v25->__begin_[v27]);
ObjectRadius = GameObject::getObjectRadius(v28);
v84 = (cocos2d::ccColor4F)0LL;
v83 = xmmword_1006356D0;
if ( GameObject::getObjectRadius(v28) <= 8.0 )
v33 = 8;
else
v33 = (unsigned int)GameObject::getObjectRadius(v28);
cocos2d::CCDrawNode::drawCircle(v30, v31, ObjectRadius, &v84, v11, (const cocos2d::ccColor4F *)&v83, v33);
}
}
}
LABEL_63:
if ( ++v27 == v26 )
{
m_topSectionIndex = a1->m_topSectionIndex;
v20 = v78;
v12 = v79;
goto LABEL_67;
}
}
}
LABEL_70:
if ( v12 >= m_rightSectionIndex )
break;
++v12;
}
while ( v12 < v13 );
if ( *p_m_isEditor )
return;
LABEL_75:
if ( !p_m_isEditor[1573] || p_m_isEditor[1574] && p_m_isEditor[382] )
{
((void (__fastcall *)(PlayerObject *))a1->m_player1->updateOrientedBox)(a1->m_player1);
m_player1 = a1->m_player1;
v60 = a1->m_debugDrawNode;
v61 = m_player1->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( m_player1->m_isBall )
{
v62 = ((__int64 (*)(void))v61->getObjectRect)();
v84 = (cocos2d::ccColor4F)0LL;
v83 = xmmword_100635DF0;
cocos2d::CCDrawNode::drawRect_1((__int64)v60, v62, (__int64)&v84, (__int64)&v83, 0, v11);
}
else
{
v63 = ((__int64 (*)(void))v61->getOrientedBox)();
v84 = (cocos2d::ccColor4F)0LL;
v83 = xmmword_100635DF0;
cocos2d::CCDrawNode::drawPolygon(
v60,
(float32x2_t *)(v63 + 316),
4u,
(float32x2_t *)&v84,
(float32x2_t *)&v83,
0,
v11);
}
if ( a1->m_gameState.m_isDualMode )
{
((void (__fastcall *)(PlayerObject *))a1->m_player2->updateOrientedBox)(a1->m_player2);
m_player2 = a1->m_player2;
v65 = a1->m_debugDrawNode;
v66 = m_player2->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( m_player2->m_isBall )
{
v67 = ((__int64 (*)(void))v66->getObjectRect)();
v84 = (cocos2d::ccColor4F)0LL;
v83 = xmmword_100635DF0;
cocos2d::CCDrawNode::drawRect_1((__int64)v65, v67, (__int64)&v84, (__int64)&v83, 0, v11);
}
else
{
v68 = ((__int64 (*)(void))v66->getOrientedBox)();
v84 = (cocos2d::ccColor4F)0LL;
v83 = xmmword_100635DF0;
cocos2d::CCDrawNode::drawPolygon(
v65,
(float32x2_t *)(v68 + 316),
4u,
(float32x2_t *)&v84,
(float32x2_t *)&v83,
0,
v11);
}
}
if ( p_m_isEditor[1574] && p_m_isEditor[382] )
{
v69 = ((__int64 (__fastcall *)(PlayerObject *))a1->m_player1->getObjectRect)(a1->m_player1);
sub_100022B98(&v84, v69);
sub_1000229B8(&v82, (__int64 *)&v84);
v70.n128_f32[0] = v84.r + v84.b;
v71.n128_f32[0] = v84.g + v84.a;
sub_100022980(v70, v71, &v80);
v72 = a1->m_debugDrawNode;
v83 = 0u;
v81 = xmmword_10063A500;
cocos2d::CCDrawNode::drawRect(
v72,
(unsigned __int32 *)&v82,
(unsigned __int32 *)&v80,
(float32x2_t *)&v83,
(float32x2_t *)&v81,
0,
v11);
if ( a1->m_gameState.m_isDualMode )
{
v73 = ((__int64 (__fastcall *)(PlayerObject *))a1->m_player2->getObjectRect)(a1->m_player2);
sub_100022BB0(&v84, v73);
v74.n128_f64[0] = sub_1000229D0(&v82, (double *)&v84.r);
v74.n128_f32[0] = v84.r + v84.b;
v75.n128_f32[0] = v84.g + v84.a;
sub_100022980(v74, v75, &v83);
sub_1000229D0(&v80, (double *)&v83);
v76 = a1->m_debugDrawNode;
v83 = 0u;
v81 = xmmword_10063A500;
cocos2d::CCDrawNode::drawRect(
v76,
(unsigned __int32 *)&v82,
(unsigned __int32 *)&v80,
(float32x2_t *)&v83,
(float32x2_t *)&v81,
0,
v11);
}
}
}
}