//
// GJBaseGameLayer::updateDebugDraw from 0x58d3b4 to 0x58dd52 (2462 bytes)
//
// 1 xrefs:
// > LevelEditorLayer::updateDebugDraw @ 0x47f8ea
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:53:03 +0000
//
int __fastcall GJBaseGameLayer::updateDebugDraw(GJBaseGameLayer *this)
{
cocos2d::CCDirector *v2; // r0
float v3; // s18
float v4; // s16
float v5; // s17
const cocos2d::CCPoint *v6; // r0
float v7; // s15
float v8; // s15
float v9; // s16
float v10; // s12
float v11; // s13
float v12; // s16
_DWORD *v13; // r9
int v14; // r2
int v15; // r3
bool v16; // zf
int v17; // r8
_DWORD *v18; // r2
int v19; // r3
int v20; // r7
int j; // r3
int v22; // r5
int v23; // r3
int v24; // r11
cocos2d::CCPoint *v25; // r10
int ObjectRadius; // r0
int v27; // r6
int v28; // r0
const cocos2d::CCRect *v29; // r0
char *v30; // r0
cocos2d::CCPoint *v31; // r11
char *v32; // r6
cocos2d::CCPoint *v33; // r10
char *v34; // r0
int v35; // r0
char v36; // r10
char v37; // r11
int *v38; // r6
const cocos2d::CCRect *v39; // r0
int v40; // r6
int v41; // r0
int *v42; // r0
int v43; // r8
int v44; // r2
int v45; // r8
int v46; // r0
int result; // r0
_BYTE *v48; // r7
char v49; // r2
int v50; // r3
int v51; // r0
int v52; // r9
int v53; // r0
int *v54; // r0
int v55; // r8
int v56; // r3
int v57; // r8
int v58; // r0
int v59; // r9
int v60; // r0
const cocos2d::CCRect *v61; // r0
int v62; // r0
int v63; // r0
int v64; // r0
int i; // [sp+14h] [bp-98h]
int k; // [sp+18h] [bp-94h]
int v67; // [sp+1Ch] [bp-90h]
int v68; // [sp+24h] [bp-88h]
int v69; // [sp+28h] [bp-84h]
_DWORD *v70; // [sp+2Ch] [bp-80h]
int v71; // [sp+30h] [bp-7Ch]
float v72[2]; // [sp+44h] [bp-68h] BYREF
float v73[2]; // [sp+4Ch] [bp-60h] BYREF
_BYTE v74[8]; // [sp+54h] [bp-58h] BYREF
_BYTE v75[8]; // [sp+5Ch] [bp-50h] BYREF
float v76; // [sp+64h] [bp-48h] BYREF
float v77; // [sp+68h] [bp-44h]
float v78; // [sp+6Ch] [bp-40h]
float v79; // [sp+70h] [bp-3Ch]
float v80; // [sp+74h] [bp-38h] BYREF
float v81; // [sp+78h] [bp-34h]
float v82; // [sp+7Ch] [bp-30h]
float v83; // [sp+80h] [bp-2Ch]
float v84; // [sp+84h] [bp-28h] BYREF
float v85; // [sp+88h] [bp-24h]
float v86; // [sp+8Ch] [bp-20h]
float v87; // [sp+90h] [bp-1Ch]
float v88; // [sp+94h] [bp-18h] BYREF
float v89; // [sp+98h] [bp-14h]
float v90; // [sp+9Ch] [bp-10h]
float v91; // [sp+A0h] [bp-Ch]
v2 = (cocos2d::CCDirector *)cocos2d::CCDrawNode::clear(*((cocos2d::CCDrawNode **)this + 2894));
cocos2d::CCDirector::sharedDirector(v2);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v72);
v3 = COERCE_FLOAT((*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 609) + 68))(*((_DWORD *)this + 609)));
v4 = fabsf(v3);
v5 = 0.25 / v4;
v6 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 609) + 96))(*((_DWORD *)this + 609));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v6);
if ( v3 < 0.0 )
v7 = v73[0] - v72[0];
else
v7 = -v73[0];
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v76, v7 / v4, (float)-v73[1] / v4, v72[0] / v4, v72[1] / v4);
v8 = *((float *)this + 177);
if ( v8 != 0.0 )
{
v9 = fabsf(cosf(v8 * 0.017453));
v10 = fabsf(sinf(v8 * 0.017453));
v11 = (float)((float)(v79 * v10) + (float)(v78 * v9)) - v78;
v12 = (float)((float)(v79 * v9) + (float)(v78 * v10)) - v79;
v76 = v76 - (float)(v11 * 0.5);
v77 = v77 - (float)(v12 * 0.5);
v78 = v78 + v11;
v79 = v79 + v12;
}
v13 = (_DWORD *)((char *)this + 11292);
cocos2d::CCDrawNode::enableDrawArea(*((cocos2d::CCDrawNode **)this + 2894), (cocos2d::CCRect *)&v76);
v14 = *((_DWORD *)this + 2823);
v15 = *((_DWORD *)this + 2824);
v16 = v14 == v15;
if ( v14 == v15 )
v15 = -1;
else
v14 = v15 - v14;
if ( !v16 )
v15 = v14 >> 2;
v68 = v15;
if ( (*(int (__fastcall **)(GJBaseGameLayer *))(*(_DWORD *)this + 656))(this) )
{
v17 = 4 * *((_DWORD *)this + 2649);
for ( i = *((_DWORD *)this + 2649); i <= *((_DWORD *)this + 2650) && i < v68; ++i )
{
v18 = *(_DWORD **)(*v13 + v17);
if ( v18 )
v19 = (*(_DWORD *)(*(_DWORD *)(*v13 + v17) + 4) - *v18) >> 2;
else
v19 = -1;
v69 = v19;
v20 = *((_DWORD *)this + 2651);
for ( j = 4 * v20; ; j = v67 + 4 )
{
v67 = j;
if ( v20 > *((_DWORD *)this + 2652) || v20 >= v69 )
break;
v70 = *(_DWORD **)(**(_DWORD **)(*v13 + v17) + j);
if ( v70 )
{
v71 = *(_DWORD *)(**(_DWORD **)(*((_DWORD *)this + 2844) + v17) + j);
for ( k = 0; ; ++k )
{
if ( k >= v71 )
goto LABEL_58;
v22 = *(_DWORD *)(*v70 + 4 * k);
if ( *(_BYTE *)(v22 + 657) || *((_BYTE *)this + 10612) )
{
v23 = *(_DWORD *)(v22 + 784);
if ( v23 != 7 && (!*((_DWORD *)this + 357) || !*(_BYTE *)(v22 + 550)) )
break;
}
LABEL_57:
;
}
if ( *(float *)(v22 + 764) > 0.0 )
{
if ( v23 == 2 )
{
v24 = *((_DWORD *)this + 2894);
v25 = (cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(*(_DWORD *)v22 + 96))(*(_DWORD *)(*v70 + 4 * k));
ObjectRadius = GameObject::getObjectRadius((GameObject *)v22);
v84 = 0.0;
v88 = 1.0;
v91 = 1.0;
v85 = 0.0;
v86 = 0.0;
v87 = 0.0;
v89 = 0.0;
v90 = 0.0;
v27 = ObjectRadius;
if ( COERCE_FLOAT(GameObject::getObjectRadius((GameObject *)v22)) <= 8.0 )
v28 = 8;
else
v28 = (unsigned int)COERCE_FLOAT(GameObject::getObjectRadius((GameObject *)v22));
cocos2d::CCDrawNode::drawCircle(v24, v25, v27, (int)&v84, v5, (int)&v88, v28);
}
goto LABEL_57;
}
if ( (*(int (__fastcall **)(_DWORD))(*(_DWORD *)v22 + 900))(*(_DWORD *)(*v70 + 4 * k)) == 25 )
{
v29 = (const cocos2d::CCRect *)(*(int (__fastcall **)(int))(*(_DWORD *)v22 + 664))(v22);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v80, v29);
GameObject::determineSlopeDirection((GameObject *)v22);
v30 = (char *)operator new[](0x18u);
v31 = (cocos2d::CCPoint *)(v30 + 24);
v32 = v30;
v33 = (cocos2d::CCPoint *)v30;
do
{
cocos2d::CCPoint::CCPoint(v33);
v33 = (cocos2d::CCPoint *)((char *)v33 + 8);
}
while ( v33 != v31 );
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v88, v80, v81);
cocos2d::CCPoint::operator=(v32, &v88);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v88, v80, v81 + v83);
cocos2d::CCPoint::operator=(v32 + 8, &v88);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v88, v80 + v82, v81);
cocos2d::CCPoint::operator=(v32 + 16, &v88);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v75, v80 + v82, v81 + v83);
switch ( *(_DWORD *)(v22 + 948) )
{
case 0:
case 7:
v34 = v32 + 8;
goto LABEL_42;
case 1:
case 5:
v34 = v32;
goto LABEL_42;
case 3:
case 6:
v34 = v32 + 16;
LABEL_42:
cocos2d::CCPoint::operator=(v34, v75);
break;
default:
break;
}
v84 = 0.0;
v85 = 0.25;
v86 = 1.0;
v87 = 1.0;
if ( *(_BYTE *)(v22 + 1118) )
{
v85 = 0.0;
v84 = 1.0;
}
v88 = 0.0;
v35 = *((_DWORD *)this + 2894);
v89 = 0.0;
v90 = 0.0;
v91 = 0.0;
cocos2d::CCDrawNode::drawPolygon(v35, (int)v32, 3, (int)&v88, v5, (int)&v84, 0);
operator delete[](v32);
goto LABEL_57;
}
v80 = 0.0;
v81 = 0.25;
v82 = 1.0;
v83 = 1.0;
if ( (*(int (__fastcall **)(int))(*(_DWORD *)v22 + 900))(v22) == 2
|| (*(int (__fastcall **)(int))(*(_DWORD *)v22 + 900))(v22) == 47 )
{
v81 = 0.0;
v80 = 1.0;
v83 = 1.0;
v82 = 0.0;
}
else if ( (*(int (__fastcall **)(int))(*(_DWORD *)v22 + 900))(v22) )
{
if ( !*(_BYTE *)(v22 + 1166) )
goto LABEL_57;
v80 = 0.0;
v81 = 1.0;
v82 = 0.0;
LABEL_51:
v83 = 1.0;
}
else if ( *(_BYTE *)(v22 + 1113) )
{
v80 = 0.0;
v81 = 1.0;
v82 = 1.0;
goto LABEL_51;
}
if ( v22 != *((_DWORD *)this + 2913) )
{
v36 = *(_BYTE *)(v22 + 732);
v37 = *(_BYTE *)(v22 + 620);
v38 = (int *)((char *)this + 11576);
v39 = (const cocos2d::CCRect *)(*(int (__fastcall **)(int))(*(_DWORD *)v22 + 664))(v22);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v84, v39);
if ( (int)(*(float (__fastcall **)(int))(*(_DWORD *)v22 + 184))(v22) % 90
&& (*((_BYTE *)this + 10612) || *(_BYTE *)(v22 + 636)) )
{
GameObject::calculateOrientedBox((GameObject *)v22);
v40 = *v38;
v41 = (*(int (__fastcall **)(int))(*(_DWORD *)v22 + 780))(v22);
v88 = 0.0;
v89 = 0.0;
v90 = 0.0;
v91 = 0.0;
cocos2d::CCDrawNode::drawPolygon(v40, v41 + 264, 4, (int)&v88, v5, (int)&v80, 0);
}
else
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v74, (const cocos2d::CCPoint *)&v84);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v75, v84 + v86, v85 + v87);
v51 = *v38;
v88 = 0.0;
v89 = 0.0;
v90 = 0.0;
v91 = 0.0;
cocos2d::CCDrawNode::drawRect(v51, (int)v74, (int)v75, (int)&v88, v5, (int)&v80, 0);
}
*(_BYTE *)(v22 + 732) = v36;
*(_BYTE *)(v22 + 620) = v37;
}
goto LABEL_57;
}
LABEL_58:
++v20;
}
v17 += 4;
}
if ( !*((_BYTE *)this + 10612)
&& (!*((_BYTE *)this + 11589) || *((_BYTE *)this + 11590) && *((_BYTE *)this + 10866))
&& (!*((_BYTE *)this + 10866) || !(*(int (__fastcall **)(GJBaseGameLayer *))(*(_DWORD *)this + 660))(this)) )
{
(*(void (__fastcall **)(_DWORD))(**((_DWORD **)this + 519) + 784))(*((_DWORD *)this + 519));
v42 = *((int **)this + 519);
v43 = *((unsigned __int8 *)v42 + 1955);
v44 = *v42;
if ( *((_BYTE *)v42 + 1955) )
{
v45 = *((_DWORD *)this + 2894);
v46 = (*(int (**)(void))(v44 + 664))();
v84 = 0.0;
v88 = 1.0;
v89 = 1.0;
v85 = 0.0;
v91 = 1.0;
v86 = 0.0;
v87 = 0.0;
v90 = 0.0;
cocos2d::CCDrawNode::drawRect(v45, v46, &v84, LODWORD(v5), &v88, 0);
}
else
{
v52 = *((_DWORD *)this + 2894);
v53 = (*(int (**)(void))(v44 + 780))();
v84 = 0.0;
v88 = 1.0;
v89 = 1.0;
v85 = 0.0;
v91 = 1.0;
v86 = 0.0;
v87 = 0.0;
v90 = 0.0;
cocos2d::CCDrawNode::drawPolygon(v52, v53 + 264, 4, (int)&v84, v5, (int)&v88, v43);
}
if ( *((_BYTE *)this + 866) )
{
(*(void (__fastcall **)(_DWORD))(**((_DWORD **)this + 520) + 784))(*((_DWORD *)this + 520));
v54 = *((int **)this + 520);
v55 = *((unsigned __int8 *)v54 + 1955);
v56 = *v54;
if ( *((_BYTE *)v54 + 1955) )
{
v57 = *((_DWORD *)this + 2894);
v58 = (*(int (**)(void))(v56 + 664))();
v84 = 0.0;
v88 = 1.0;
v89 = 1.0;
v85 = 0.0;
v91 = 1.0;
v86 = 0.0;
v87 = 0.0;
v90 = 0.0;
cocos2d::CCDrawNode::drawRect(v57, v58, &v84, LODWORD(v5), &v88, 0);
}
else
{
v59 = *((_DWORD *)this + 2894);
v60 = (*(int (**)(void))(v56 + 780))();
v84 = 0.0;
v88 = 1.0;
v89 = 1.0;
v85 = 0.0;
v91 = 1.0;
v86 = 0.0;
v87 = 0.0;
v90 = 0.0;
cocos2d::CCDrawNode::drawPolygon(v59, v60 + 264, 4, (int)&v84, v5, (int)&v88, v55);
}
}
if ( *((_BYTE *)this + 11590) )
{
if ( *((_BYTE *)this + 10866) )
{
v61 = (const cocos2d::CCRect *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 519) + 664))(*((_DWORD *)this + 519));
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v80, v61);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v74, (const cocos2d::CCPoint *)&v80);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v75, v80 + v82, v81 + v83);
v84 = 0.0;
v85 = 0.0;
v62 = *((_DWORD *)this + 2894);
v86 = 0.0;
v87 = 0.0;
v90 = 0.0;
v88 = 1.0;
v89 = 1.0;
v91 = 0.5;
cocos2d::CCDrawNode::drawRect(v62, (int)v74, (int)v75, (int)&v84, v5, (int)&v88, 0);
if ( *((_BYTE *)this + 866) )
{
v63 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 520) + 664))(*((_DWORD *)this + 520));
cocos2d::CCRect::operator=(&v80, v63);
cocos2d::CCPoint::operator=(v74, &v80);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v88, v80 + v82, v81 + v83);
cocos2d::CCPoint::operator=(v75, &v88);
v64 = *((_DWORD *)this + 2894);
v84 = 0.0;
v85 = 0.0;
v86 = 0.0;
v87 = 0.0;
v88 = 1.0;
v89 = 1.0;
v90 = 0.0;
v91 = 0.5;
cocos2d::CCDrawNode::drawRect(v64, (int)v74, (int)v75, (int)&v84, v5, (int)&v88, 0);
}
}
}
}
}
result = (*(int (__fastcall **)(GJBaseGameLayer *))(*(_DWORD *)this + 660))(this);
if ( !result )
{
if ( !*((_BYTE *)this + 11629) )
return result;
result = cocos2d::CCDrawNode::clear(*((cocos2d::CCDrawNode **)this + 2895));
*((_BYTE *)this + 11629) = 0;
v49 = 1;
v50 = 11628;
goto LABEL_91;
}
v48 = (char *)this + 11648;
if ( *((_BYTE *)this + 11628)
|| (result = cocos2d::CCRect::equals((GJBaseGameLayer *)((char *)this + 11632), (const cocos2d::CCRect *)&v76)) == 0
|| *v48 != *((_BYTE *)this + 11593)
|| *((unsigned __int8 *)this + 11649) != *((unsigned __int8 *)this + 10866) )
{
cocos2d::CCDrawNode::clear(*((cocos2d::CCDrawNode **)this + 2895));
cocos2d::CCDrawNode::enableDrawArea(*((cocos2d::CCDrawNode **)this + 2895), (cocos2d::CCRect *)&v76);
GJBaseGameLayer::drawHitboxTrail(
*(float *)&this,
(_DWORD *)this + 2899,
*((_DWORD *)this + 2905),
(const cocos2d::CCRect *)&v76,
v5);
GJBaseGameLayer::drawHitboxTrail(
*(float *)&this,
(_DWORD *)this + 2902,
*((_DWORD *)this + 2906),
(const cocos2d::CCRect *)&v76,
v5);
*((_BYTE *)this + 11628) = 0;
*((_BYTE *)this + 11629) = 1;
result = cocos2d::CCRect::operator=((char *)this + 11632, &v76);
*v48 = *((_BYTE *)this + 11593);
v49 = *((_BYTE *)this + 10866);
v50 = 11649;
LABEL_91:
*((_BYTE *)this + v50) = v49;
}
return result;
}