//
// GJBaseGameLayer::updateDebugDraw from 0x99b788 to 0x99c3e8 (3168 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::updateDebugDraw @ 0x7be4dc
// > ??> @ 0x476b0
// > ??> @ 0x1428958
// > ??> @ 0x1475788
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:58:05 +0000
//
__int64 __fastcall GJBaseGameLayer::updateDebugDraw(GJBaseGameLayer *this)
{
cocos2d::CCDirector *v2; // x0
cocos2d::CCDirector *v3; // x0
long double v4; // q0
float v5; // s8
float v6; // s11
const cocos2d::CCPoint *v7; // x0
float v8; // s0
float v9; // s0
float v10; // s9
float v11; // s8
float v12; // s0
float v13; // s4
float v14; // s0
float v15; // s8
__int64 v16; // x1
__int64 v17; // x0
char *v18; // x19
int v19; // w0
int v20; // w28
_QWORD *v21; // x25
int v22; // w0
int v23; // w19
_QWORD *v24; // x23
int v25; // w25
__int64 v26; // x20
__int64 v27; // x22
__int64 v28; // x19
int v29; // w25
char v30; // w28
char v31; // w25
const cocos2d::CCRect *v32; // x0
__int64 v33; // x25
cocos2d::CCPoint *v34; // x28
const cocos2d::CCRect *v35; // x0
cocos2d::CCPoint *v36; // x26
cocos2d::CCPoint *v37; // x25
__int64 v38; // x0
int v39; // w0
_BYTE *v40; // x0
__int64 v41; // x22
__int64 v42; // x0
char v43; // w0
const cocos2d::CCRect *v45; // x0
__int64 v46; // x0
long double v47; // q0
__int64 v48; // x0
__int64 v49; // x0
long double v50; // q0
_BYTE *v51; // x0
__int64 v52; // x22
__int64 v53; // x0
int v54; // [xsp+94h] [xbp+94h]
unsigned __int64 v55; // [xsp+A0h] [xbp+A0h]
__int64 v56; // [xsp+B0h] [xbp+B0h]
__int64 v57; // [xsp+D8h] [xbp+D8h]
__int64 v58; // [xsp+E0h] [xbp+E0h]
__int64 v59; // [xsp+E8h] [xbp+E8h]
float v60; // [xsp+F0h] [xbp+F0h]
int v61; // [xsp+F0h] [xbp+F0h]
__int64 v62; // [xsp+108h] [xbp+108h] BYREF
float v63[2]; // [xsp+110h] [xbp+110h] BYREF
_BYTE v64[8]; // [xsp+118h] [xbp+118h] BYREF
_BYTE v65[8]; // [xsp+120h] [xbp+120h] BYREF
float v66; // [xsp+128h] [xbp+128h] BYREF
float v67; // [xsp+12Ch] [xbp+12Ch]
float v68; // [xsp+130h] [xbp+130h]
float v69; // [xsp+134h] [xbp+134h]
float v70; // [xsp+138h] [xbp+138h] BYREF
float v71; // [xsp+13Ch] [xbp+13Ch]
float v72; // [xsp+140h] [xbp+140h]
float v73; // [xsp+144h] [xbp+144h]
float v74; // [xsp+148h] [xbp+148h] BYREF
float v75; // [xsp+14Ch] [xbp+14Ch]
float v76; // [xsp+150h] [xbp+150h]
float v77; // [xsp+154h] [xbp+154h]
float v78; // [xsp+158h] [xbp+158h] BYREF
float v79; // [xsp+15Ch] [xbp+15Ch]
int v80; // [xsp+160h] [xbp+160h]
float v81; // [xsp+164h] [xbp+164h]
v2 = (cocos2d::CCDirector *)cocos2d::CCDrawNode::clear(*((cocos2d::CCDrawNode **)this + 1727));
v3 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v2);
cocos2d::CCDirector::getWinSize(&v62, v3);
v4 = ((long double (__fastcall *)(_QWORD))*(_QWORD *)(**((_QWORD **)this + 490) + 136LL))(*((_QWORD *)this + 490));
v5 = fabsf(*(float *)&v4);
v6 = 0.25 / v5;
v60 = *(float *)&v4;
v7 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 490) + 192LL))(*((_QWORD *)this + 490));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, v7);
if ( v60 < 0.0 )
v8 = (float)(v63[0] - *(float *)&v62) / v5;
else
v8 = (float)-v63[0] / v5;
cocos2d::CCRect::CCRect(
(cocos2d::CCRect *)&v66,
v8,
(float)-v63[1] / v5,
*(float *)&v62 / v5,
*((float *)&v62 + 1) / v5);
v9 = *((float *)this + 201);
if ( v9 != 0.0 )
{
v10 = v9 * 0.017453;
v11 = fabsf(cosf(v9 * 0.017453));
v12 = fabsf(sinf(v10));
v13 = v69 * v12;
v14 = (float)((float)(v11 * v69) + (float)(v12 * v68)) - v69;
v15 = (float)(v13 + (float)(v68 * v11)) - v68;
v68 = v68 + v15;
v69 = v69 + v14;
v67 = v67 - (float)(v14 * 0.5);
v66 = v66 - (float)(v15 * 0.5);
}
cocos2d::CCDrawNode::enableDrawArea(*((cocos2d::CCDrawNode **)this + 1727), (cocos2d::CCRect *)&v66);
v16 = *((_QWORD *)this + 1671);
v17 = *((_QWORD *)this + 1672);
if ( v16 == v17 )
LODWORD(v55) = -1;
else
v55 = (unsigned __int64)(v17 - v16) >> 3;
v18 = (char *)this + 12288;
if ( !(*(unsigned __int8 (__fastcall **)(GJBaseGameLayer *))(*(_QWORD *)this + 1312LL))(this) )
goto LABEL_71;
v19 = *((_DWORD *)this + 3055);
v54 = v19;
if ( (int)v55 > v19 )
{
v20 = *((_DWORD *)this + 3056);
v57 = 8LL * v19;
if ( v19 <= v20 )
{
while ( 1 )
{
v21 = *(_QWORD **)(*((_QWORD *)this + 1671) + v57);
if ( v21 )
v56 = (v21[1] - *v21) >> 3;
else
LODWORD(v56) = -1;
v22 = *((_DWORD *)this + 3057);
v61 = v22;
if ( (int)v56 > v22 )
{
v23 = *((_DWORD *)this + 3058);
if ( v22 <= v23 )
break;
}
LABEL_59:
v39 = v54 + 1;
v54 = v39;
v57 += 8;
if ( v20 < v39 || (int)v55 <= v39 )
goto LABEL_61;
}
v59 = 8LL * v22;
v58 = 4LL * v22;
while ( 1 )
{
v24 = *(_QWORD **)(*v21 + v59);
if ( v24 )
{
v25 = *(_DWORD *)(**(_QWORD **)(*((_QWORD *)this + 1692) + v57) + v58);
if ( v25 > 0 )
break;
}
LABEL_39:
++v61;
v59 += 8;
v58 += 4;
if ( v23 < v61 || (int)v56 <= v61 )
{
v20 = *((_DWORD *)this + 3056);
goto LABEL_59;
}
v21 = *(_QWORD **)(*((_QWORD *)this + 1671) + v57);
}
v26 = 0;
v27 = 8 * ((unsigned int)(v25 - 1) + 1LL);
while ( 1 )
{
v28 = *(_QWORD *)(*v24 + v26);
if ( !*(_BYTE *)(v28 + 773) && !*((_BYTE *)this + 12236) )
goto LABEL_19;
v29 = *(_DWORD *)(v28 + 920);
if ( v29 == 7 || *((_DWORD *)this + 493) && *(_BYTE *)(v28 + 650) )
goto LABEL_19;
if ( *(float *)(v28 + 900) > 0.0 )
{
if ( v29 == 2 )
{
v33 = *((_QWORD *)this + 1727);
v34 = (cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)v28 + 192LL))(*(_QWORD *)(*v24 + v26));
GameObject::getObjectRadius((GameObject *)v28);
v74 = 0.0;
v75 = 0.0;
v76 = 0.0;
v77 = 0.0;
v78 = 1.0;
v79 = 0.0;
v80 = 0;
v81 = 1.0;
if ( GameObject::getObjectRadius((GameObject *)v28) > 8.0 )
GameObject::getObjectRadius((GameObject *)v28);
cocos2d::CCDrawNode::drawCircle(v33, v34);
}
goto LABEL_19;
}
if ( (*(unsigned int (__fastcall **)(_QWORD))(*(_QWORD *)v28 + 1800LL))(*(_QWORD *)(*v24 + v26)) == 25 )
{
v35 = (const cocos2d::CCRect *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 1328LL))(v28);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v70, v35);
GameObject::determineSlopeDirection((GameObject *)v28);
v36 = (cocos2d::CCPoint *)operator new[](0x18u);
v37 = v36;
do
{
cocos2d::CCPoint::CCPoint(v37);
v37 = (cocos2d::CCPoint *)((char *)v37 + 8);
}
while ( v37 != (cocos2d::CCPoint *)((char *)v36 + 24) );
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v78, v70, v71);
cocos2d::CCPoint::operator=(v36, &v78);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v78, v70, v71 + v73);
cocos2d::CCPoint::operator=((char *)v36 + 8, &v78);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v78, v70 + v72, v71);
cocos2d::CCPoint::operator=((char *)v36 + 16, &v78);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v70 + v72, v71 + v73);
switch ( *(_DWORD *)(v28 + 1084) )
{
case 0:
case 7:
cocos2d::CCPoint::operator=((char *)v36 + 8, v65);
break;
case 1:
case 5:
cocos2d::CCPoint::operator=(v36, v65);
break;
case 3:
case 6:
cocos2d::CCPoint::operator=((char *)v36 + 16, v65);
break;
default:
break;
}
v75 = 0.25;
v76 = 1.0;
v77 = 1.0;
v74 = 0.0;
if ( *(_BYTE *)(v28 + 1298) )
{
v74 = 1.0;
v75 = 0.0;
}
v78 = 0.0;
v79 = 0.0;
v80 = 0;
v81 = 0.0;
cocos2d::CCDrawNode::drawPolygon(v6);
operator delete[](v36);
goto LABEL_19;
}
v70 = 0.0;
v71 = 0.25;
v72 = 1.0;
v73 = 1.0;
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v28 + 1800LL))(v28) == 2
|| (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v28 + 1800LL))(v28) == 47 )
{
v70 = 1.0;
v73 = 1.0;
v71 = 0.0;
v72 = 0.0;
}
else if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v28 + 1800LL))(v28) )
{
if ( !*(_BYTE *)(v28 + 1346) )
goto LABEL_19;
v70 = 0.0;
v71 = 1.0;
v72 = 0.0;
v73 = 1.0;
}
else if ( *(_BYTE *)(v28 + 1293) )
{
v70 = 0.0;
v71 = 1.0;
v72 = 1.0;
v73 = 1.0;
}
if ( *((_QWORD *)this + 1741) == v28 )
{
LABEL_19:
v26 += 8;
if ( v26 == v27 )
goto LABEL_38;
}
else
{
v30 = *(_BYTE *)(v28 + 864);
v31 = *(_BYTE *)(v28 + 720);
v32 = (const cocos2d::CCRect *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 1328LL))(v28);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v74, v32);
if ( (int)(*(float (__fastcall **)(__int64))(*(_QWORD *)v28 + 368LL))(v28) % 90
&& (*((_BYTE *)this + 12236) || *(_BYTE *)(v28 + 744)) )
{
GameObject::calculateOrientedBox((GameObject *)v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v28 + 1560LL))(v28);
v78 = 0.0;
v79 = 0.0;
v80 = 0;
v81 = 0.0;
cocos2d::CCDrawNode::drawPolygon(v6);
}
else
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, (const cocos2d::CCPoint *)&v74);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v74 + v76, v75 + v77);
v38 = *((_QWORD *)this + 1727);
v78 = 0.0;
v79 = 0.0;
v80 = 0;
v81 = 0.0;
cocos2d::CCDrawNode::drawRect(v38, v64, v65, &v78, &v70, 0, v6);
}
v26 += 8;
*(_BYTE *)(v28 + 864) = v30;
*(_BYTE *)(v28 + 720) = v31;
if ( v26 == v27 )
{
LABEL_38:
v23 = *((_DWORD *)this + 3058);
goto LABEL_39;
}
}
}
}
}
LABEL_61:
v18 = (char *)this + 12288;
if ( *((_BYTE *)this + 12236) )
{
LABEL_71:
if ( !(*(unsigned __int8 (__fastcall **)(GJBaseGameLayer *))(*(_QWORD *)this + 1320LL))(this) )
goto LABEL_79;
LABEL_72:
if ( v18[1616]
|| !(unsigned __int8)cocos2d::CCRect::equals((cocos2d::CCRect *)(v18 + 1620), (const cocos2d::CCRect *)&v66)
|| v18[1636] != v18[1557]
|| v18[1637] != v18[362] )
{
cocos2d::CCDrawNode::clear(*((cocos2d::CCDrawNode **)this + 1728));
cocos2d::CCDrawNode::enableDrawArea(*((cocos2d::CCDrawNode **)this + 1728), (cocos2d::CCRect *)&v66);
GJBaseGameLayer::drawHitboxTrail(
this,
(_QWORD *)v18 + 195,
*((_DWORD *)this + 3474),
(const cocos2d::CCRect *)&v66,
v6);
GJBaseGameLayer::drawHitboxTrail(
this,
(_QWORD *)v18 + 198,
*((_DWORD *)this + 3475),
(const cocos2d::CCRect *)&v66,
v6);
v18[1616] = 0;
v18[1617] = 1;
cocos2d::CCRect::operator=(v18 + 1620, &v66);
v43 = v18[362];
v18[1636] = v18[1557];
v18[1637] = v43;
}
return _stack_chk_guard;
}
if ( *((_BYTE *)this + 13841) )
{
if ( !*((_BYTE *)this + 13842) || !*((_BYTE *)this + 12650) )
goto LABEL_71;
}
else if ( !*((_BYTE *)this + 12650) )
{
goto LABEL_66;
}
if ( (*(unsigned __int8 (__fastcall **)(GJBaseGameLayer *))(*(_QWORD *)this + 1320LL))(this) )
goto LABEL_71;
LABEL_66:
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 407) + 1568LL))(*((_QWORD *)this + 407));
v40 = *((_BYTE **)this + 407);
if ( v40[2419] )
{
v41 = *((_QWORD *)this + 1727);
v42 = (*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v40 + 1328LL))(v40);
v74 = 0.0;
v75 = 0.0;
v76 = 0.0;
v77 = 0.0;
v78 = 1.0;
v79 = 1.0;
v80 = 0;
v81 = 1.0;
cocos2d::CCDrawNode::drawRect(v41, v42, &v74, &v78, 0, v6);
}
else
{
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v40 + 1560LL))(v40);
v74 = 0.0;
v75 = 0.0;
v76 = 0.0;
v77 = 0.0;
v78 = 1.0;
v79 = 1.0;
v80 = 0;
v81 = 1.0;
cocos2d::CCDrawNode::drawPolygon(v6);
}
if ( *((_BYTE *)this + 1010) )
{
(*(void (__fastcall **)(_QWORD))(**((_QWORD **)this + 408) + 1568LL))(*((_QWORD *)this + 408));
v51 = *((_BYTE **)this + 408);
if ( v51[2419] )
{
v52 = *((_QWORD *)this + 1727);
v53 = (*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v51 + 1328LL))(v51);
v74 = 0.0;
v75 = 0.0;
v76 = 0.0;
v77 = 0.0;
v78 = 1.0;
v79 = 1.0;
v80 = 0;
v81 = 1.0;
cocos2d::CCDrawNode::drawRect(v52, v53, &v74, &v78, 0, v6);
}
else
{
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)v51 + 1560LL))(v51);
v74 = 0.0;
v75 = 0.0;
v76 = 0.0;
v77 = 0.0;
v78 = 1.0;
v79 = 1.0;
v80 = 0;
v81 = 1.0;
cocos2d::CCDrawNode::drawPolygon(v6);
}
}
if ( !*((_BYTE *)this + 13842) )
goto LABEL_71;
if ( !*((_BYTE *)this + 12650) )
goto LABEL_71;
v45 = (const cocos2d::CCRect *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 407) + 1328LL))(*((_QWORD *)this + 407));
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v70, v45);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, (const cocos2d::CCPoint *)&v70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v70 + v72, v71 + v73);
v46 = *((_QWORD *)this + 1727);
v74 = 0.0;
v75 = 0.0;
v76 = 0.0;
v77 = 0.0;
v78 = 1.0;
v79 = 1.0;
v80 = 0;
v81 = 0.5;
*(__n128 *)&v47 = cocos2d::CCDrawNode::drawRect(v46, v64, v65, &v74, &v78, 0, v6);
if ( !*((_BYTE *)this + 1010) )
goto LABEL_71;
v48 = (*(__int64 (__fastcall **)(_QWORD, long double))(**((_QWORD **)this + 408) + 1328LL))(
*((_QWORD *)this + 408),
v47);
cocos2d::CCRect::operator=(&v70, v48);
cocos2d::CCPoint::operator=(v64, &v70);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v78, v70 + v72, v71 + v73);
cocos2d::CCPoint::operator=(v65, &v78);
v49 = *((_QWORD *)this + 1727);
v74 = 0.0;
v75 = 0.0;
v76 = 0.0;
v77 = 0.0;
v78 = 1.0;
v79 = 1.0;
v80 = 0;
v81 = 0.5;
*(__n128 *)&v50 = cocos2d::CCDrawNode::drawRect(v49, v64, v65, &v74, &v78, 0, v6);
if ( (*(unsigned __int8 (__fastcall **)(GJBaseGameLayer *, long double))(*(_QWORD *)this + 1320LL))(this, v50) )
goto LABEL_72;
LABEL_79:
if ( !v18[1617] )
return _stack_chk_guard;
cocos2d::CCDrawNode::clear(*((cocos2d::CCDrawNode **)this + 1728));
v18[1617] = 0;
v18[1616] = 1;
return _stack_chk_guard;
}