//
// GJBaseGameLayer::updateDebugDraw from 0x1000fdc30 to 0x1000fe832 (3074 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::updateDebugDraw @ 0x1000d2d37
// > ??> @ 0x100abb010
// > ??> @ 0x100ac50d8
//
// This function is hookable on this platform (idp: pc, 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:21:20 +0000
//
__int64 __fastcall GJBaseGameLayer::updateDebugDraw(__int64 a1, __int64 a2, __m128 a3)
{
__int64 v3; // r12
__int64 v4; // rdi
__int64 v5; // rsi
__int64 v6; // rax
double v7; // xmm2_8
double v8; // xmm3_8
__int64 v9; // xmm1_8
__m128 v10; // xmm6
__m128 v11; // xmm5
double v12; // xmm1_8
__m128 v13; // xmm0
__m128 v14; // xmm0
__m128d v15; // xmm2
__int64 v16; // rcx
int v17; // ebx
int v18; // ecx
int v19; // eax
__int64 v20; // rdi
_QWORD *v21; // rcx
__int64 v22; // rdx
__int64 v23; // rsi
int v24; // ecx
_QWORD *v25; // r15
__int64 v26; // r14
__int64 v27; // rbx
__int64 v28; // r13
int v29; // eax
__int64 v30; // r14
__int64 v31; // r15
float ObjectRadius; // xmm0_4
__int64 v33; // r8
__int64 v34; // rax
char *v35; // r14
__m128 v36; // xmm0
char v37; // r12
__int64 v38; // rsi
__int64 v39; // r14
__int64 v40; // rax
__int64 v41; // rdi
__int64 v42; // rdi
__int64 result; // rax
__int64 *v44; // rdi
__int64 v45; // r14
__int64 v46; // rax
__int64 v47; // rax
__int64 v48; // rax
__int64 *v49; // rdi
__int64 v50; // r14
__int64 v51; // rax
__int64 v52; // rax
__int64 v53; // rax
__int64 v54; // rax
__int64 v55; // rdi
__int64 v56; // rax
__int64 v57; // rdi
__int128 v58; // [rsp+0h] [rbp-100h]
__int64 v59; // [rsp+18h] [rbp-E8h]
__int64 v60; // [rsp+20h] [rbp-E0h]
__int64 v61; // [rsp+28h] [rbp-D8h]
__int64 v62; // [rsp+30h] [rbp-D0h]
float v63; // [rsp+38h] [rbp-C8h] BYREF
float v64; // [rsp+3Ch] [rbp-C4h]
float v65[2]; // [rsp+40h] [rbp-C0h] BYREF
char v66[8]; // [rsp+48h] [rbp-B8h] BYREF
__m128 v67; // [rsp+50h] [rbp-B0h]
__m128 v68; // [rsp+60h] [rbp-A0h] BYREF
_QWORD *v69; // [rsp+70h] [rbp-90h]
char v70[8]; // [rsp+78h] [rbp-88h] BYREF
__int128 v71; // [rsp+80h] [rbp-80h] BYREF
__m128 v72; // [rsp+90h] [rbp-70h]
__int64 v73; // [rsp+A8h] [rbp-58h]
__int128 v74; // [rsp+B0h] [rbp-50h] BYREF
__int128 v75; // [rsp+C0h] [rbp-40h] BYREF
float v76; // [rsp+D4h] [rbp-2Ch]
v3 = a1;
v4 = *(_QWORD *)(a1 + 13816);
cocos2d::CCDrawNode::clear(v4);
v5 = cocos2d::CCDirector::sharedDirector(v4, a2);
cocos2d::CCDirector::getWinSize(&v63, v5);
*(double *)a3.i64 = (*(double (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 3920) + 136LL))(*(_QWORD *)(v3 + 3920));
v67 = a3;
v72 = _mm_and_ps((__m128)xmmword_100A038A0, a3);
v76 = 0.25;
v6 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 3920) + 192LL))(*(_QWORD *)(v3 + 3920));
sub_1002782D0(v65, v6);
*(_QWORD *)&v7 = LODWORD(v63);
*(_QWORD *)&v8 = LODWORD(v64);
v9 = LODWORD(v65[0]);
*(float *)&v9 = v65[0] - v63;
v10.i32[0] = 0;
v11 = _mm_cmplt_ss(v67, v10);
v11.i64[0] = _mm_andnot_ps(v11, _mm_xor_ps((__m128)LODWORD(v65[0]), (__m128)xmmword_100A035F0)).u64[0]
| v9 & v11.i64[0];
v11.f32[0] = v11.f32[0] / v72.f32[0];
*(_QWORD *)&v12 = LODWORD(v65[1]) ^ 0x8000000080000000LL;
*(float *)&v12 = *(float *)&v12 / v72.f32[0];
*(float *)&v7 = v63 / v72.f32[0];
*(float *)&v8 = v64 / v72.f32[0];
sub_100278270(&v68, *(double *)v11.i64, v12, v7, v8);
v13 = (__m128)*(unsigned int *)(v3 + 804);
if ( v13.f32[0] != 0.0 )
{
*(__float2 *)v13.f32 = __sincosf_stret(v13.f32[0] * 0.017453292);
v14 = _mm_and_ps(_mm_shuffle_ps(v13, v13, 225), (__m128)xmmword_100A038A0);
v15 = (__m128d)_mm_sub_ps(
_mm_add_ps(
_mm_mul_ps(_mm_shuffle_ps(v68, v68, 170), v14),
_mm_mul_ps((__m128)_mm_shuffle_epi32((__m128i)v14, 225), _mm_shuffle_ps(v68, v68, 255))),
(__m128)_mm_loaddup_pd((const double *)&v68.i64[1]));
v68 = _mm_blend_ps(
_mm_add_ps((__m128)_mm_movedup_pd(v15), v68),
_mm_sub_ps(v68, _mm_mul_ps((__m128)v15, (__m128)xmmword_100A04CE0)),
3);
}
v76 = v76 / v72.f32[0];
cocos2d::CCDrawNode::enableDrawArea(*(_QWORD *)(v3 + 13816), &v68);
v16 = *(_QWORD *)(v3 + 13368);
v17 = -1;
if ( *(_QWORD *)(v3 + 13376) != v16 )
v17 = (unsigned __int64)(*(_QWORD *)(v3 + 13376) - v16) >> 3;
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v3 + 1312LL))(v3) )
{
v18 = *(_DWORD *)(v3 + 12220);
v19 = *(_DWORD *)(v3 + 12224);
v73 = v3;
if ( v18 <= v19 && v18 < v17 )
{
v20 = v18;
v62 = v17;
v58 = (__int128)_mm_unpacklo_pd((__m128d)0x3F800000u, (__m128d)xmmword_100A03610);
while ( 1 )
{
v21 = *(_QWORD **)(*(_QWORD *)(v3 + 13368) + 8 * v20);
if ( v21 )
{
v22 = (v21[1] - *v21) >> 3;
LODWORD(v23) = *(_DWORD *)(v3 + 12228);
v24 = *(_DWORD *)(v3 + 12232);
if ( (int)v23 > v24 )
goto LABEL_58;
}
else
{
LODWORD(v22) = -1;
LODWORD(v23) = *(_DWORD *)(v3 + 12228);
v24 = *(_DWORD *)(v3 + 12232);
if ( (int)v23 > v24 )
goto LABEL_58;
}
if ( (int)v23 < (int)v22 )
{
v23 = (int)v23;
v22 = (int)v22;
v60 = v20;
v61 = (int)v22;
while ( 1 )
{
v25 = *(_QWORD **)(**(_QWORD **)(*(_QWORD *)(v3 + 13368) + 8 * v20) + 8 * v23);
if ( v25 )
{
v26 = *(int *)(**(_QWORD **)(*(_QWORD *)(v3 + 13536) + 8 * v20) + 4 * v23);
if ( v26 > 0 )
break;
}
LABEL_55:
if ( v23 < v24 && ++v23 < v22 )
continue;
v19 = *(_DWORD *)(v3 + 12224);
goto LABEL_58;
}
v59 = v23;
v27 = 0;
v69 = *(_QWORD **)(**(_QWORD **)(*(_QWORD *)(v3 + 13368) + 8 * v20) + 8 * v23);
v67.i64[0] = v26;
while ( 2 )
{
v28 = *(_QWORD *)(*v25 + 8 * v27);
if ( !*(_BYTE *)(v28 + 773) && *(_BYTE *)(v3 + 12236) != 1 )
goto LABEL_20;
v29 = *(_DWORD *)(v28 + 920);
if ( v29 == 7 || *(_DWORD *)(v3 + 1972) && *(_BYTE *)(v28 + 650) )
goto LABEL_20;
if ( *(float *)(v28 + 900) > 0.0 )
{
if ( v29 == 2 )
{
v30 = *(_QWORD *)(v3 + 13816);
v31 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)v28 + 192LL))(*(_QWORD *)(*v25 + 8 * v27));
v72.i32[0] = GameObject::getObjectRadius(v28);
v75 = 0;
v74 = v58;
ObjectRadius = GameObject::getObjectRadius(v28);
v33 = 8;
if ( ObjectRadius > 8.0 )
v33 = (unsigned int)(int)GameObject::getObjectRadius(v28);
cocos2d::CCDrawNode::drawCircle(v30, v31, &v75, &v74, v33, v72.f32[0], v76);
v25 = v69;
goto LABEL_19;
}
goto LABEL_20;
}
if ( (*(unsigned int (__fastcall **)(_QWORD))(*(_QWORD *)v28 + 1800LL))(*(_QWORD *)(*v25 + 8 * v27)) == 25 )
{
v34 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 1328LL))(v28);
sub_1002787F0(&v75, v34);
GameObject::determineSlopeDirection(v28);
v35 = (char *)operator new[](0x18u);
sub_1002782A0(v35);
v72.i64[0] = (__int64)(v35 + 8);
sub_1002782A0(v35 + 8);
sub_1002782A0(v35 + 16);
sub_100278250(&v74, *(float *)&v75, *((float *)&v75 + 1));
sub_100278300(v35, &v74);
sub_100278250(&v74, *(float *)&v75, *((float *)&v75 + 1) + *((float *)&v75 + 3));
sub_100278300(v72.i64[0], &v74);
sub_100278250(&v74, *(float *)&v75 + *((float *)&v75 + 2), *((float *)&v75 + 1));
sub_100278300(v35 + 16, &v74);
sub_100278250(v70, *(float *)&v75 + *((float *)&v75 + 2), *((float *)&v75 + 1) + *((float *)&v75 + 3));
switch ( *(_DWORD *)(v28 + 1084) )
{
case 0:
case 7:
goto LABEL_45;
case 1:
case 5:
v72.i64[0] = (__int64)v35;
goto LABEL_45;
case 3:
case 6:
v72.i64[0] = (__int64)(v35 + 16);
LABEL_45:
sub_100278300(v72.i64[0], v70);
break;
default:
break;
}
v74 = xmmword_100A04CF0;
v25 = v69;
if ( *(_BYTE *)(v28 + 1298) == 1 )
_mm_storel_ps((double *)&v74, (__m128)0x3F800000u);
v3 = v73;
v42 = *(_QWORD *)(v73 + 13816);
v71 = 0;
cocos2d::CCDrawNode::drawPolygon(v42, v35, 3, &v71, &v74, 0, v76);
operator delete[](v35);
LABEL_19:
v26 = v67.i64[0];
LABEL_20:
if ( v26 == ++v27 )
{
v24 = *(_DWORD *)(v3 + 12232);
v20 = v60;
v23 = v59;
v22 = v61;
goto LABEL_55;
}
continue;
}
break;
}
v75 = xmmword_100A04CF0;
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v28 + 1800LL))(v28) == 2
|| (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v28 + 1800LL))(v28) == 47 )
{
_mm_storel_ps((double *)&v75, (__m128)0x3F800000u);
v36 = (__m128)0x3F80000000000000uLL;
goto LABEL_36;
}
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v28 + 1800LL))(v28) )
{
if ( *(_BYTE *)(v28 + 1346) != 1 )
goto LABEL_20;
v36 = (__m128)0x3F80000000000000uLL;
_mm_storel_ps((double *)&v75, (__m128)0x3F80000000000000uLL);
LABEL_36:
_mm_storel_ps((double *)&v75 + 1, v36);
}
else if ( *(_BYTE *)(v28 + 1293) == 1 )
{
*(_QWORD *)&v75 = 0x3F80000000000000LL;
v36 = (__m128)xmmword_100A038B0;
goto LABEL_36;
}
if ( v28 != *(_QWORD *)(v3 + 13928) )
{
v72.i8[0] = *(_BYTE *)(v28 + 720);
v37 = *(_BYTE *)(v28 + 864);
v38 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 1328LL))(v28);
sub_1002787F0(&v74, v38);
if ( __ROR4__(
-1527099483 * (int)(*(float (__fastcall **)(__int64))(*(_QWORD *)v28 + 368LL))(v28) + 47721858,
1) >= 0x2D82D83u
&& (*(_BYTE *)(v73 + 12236) || *(_BYTE *)(v28 + 744) == 1) )
{
GameObject::calculateOrientedBox(v28);
v39 = *(_QWORD *)(v73 + 13816);
v40 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 1560LL))(v28);
v71 = 0;
cocos2d::CCDrawNode::drawPolygon(v39, v40 + 316, 4, &v71, &v75, 0, v76);
}
else
{
sub_1002782D0(v70, &v74);
sub_100278250(v66, *(float *)&v74 + *((float *)&v74 + 2), *((float *)&v74 + 1) + *((float *)&v74 + 3));
v41 = *(_QWORD *)(v73 + 13816);
v71 = 0;
v25 = v69;
cocos2d::CCDrawNode::drawRect(v41, v70, v66, &v71, &v75, 0, v76);
}
*(_BYTE *)(v28 + 864) = v37;
*(_BYTE *)(v28 + 720) = v72.i8[0];
v3 = v73;
goto LABEL_19;
}
goto LABEL_20;
}
LABEL_58:
if ( v20 < v19 && ++v20 < v62 )
continue;
break;
}
}
if ( !*(_BYTE *)(v3 + 12236) )
{
if ( *(_BYTE *)(v3 + 13841) )
{
if ( *(_BYTE *)(v3 + 13842) != 1 || *(_BYTE *)(v3 + 12650) != 1 )
goto LABEL_61;
}
else if ( (*(_BYTE *)(v3 + 12650) & 1) == 0 )
{
goto LABEL_76;
}
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v3 + 1320LL))(v3) )
goto LABEL_61;
LABEL_76:
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 3256) + 1568LL))(*(_QWORD *)(v3 + 3256));
v44 = *(__int64 **)(v3 + 3256);
v45 = *(_QWORD *)(v3 + 13816);
v46 = *v44;
if ( *((_BYTE *)v44 + 2419) == 1 )
{
v47 = (*(__int64 (**)(void))(v46 + 1328))();
v75 = 0;
v74 = xmmword_100A04D00;
cocos2d::CCDrawNode::drawRect_1(v45, v47, &v75, &v74, 0, v76);
if ( *(_BYTE *)(v3 + 1010) != 1 )
goto LABEL_83;
}
else
{
v48 = (*(__int64 (**)(void))(v46 + 1560))();
v75 = 0;
v74 = xmmword_100A04D00;
cocos2d::CCDrawNode::drawPolygon(v45, v48 + 316, 4, &v75, &v74, 0, v76);
if ( *(_BYTE *)(v3 + 1010) != 1 )
goto LABEL_83;
}
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 3264) + 1568LL))(*(_QWORD *)(v3 + 3264));
v49 = *(__int64 **)(v3 + 3264);
v50 = *(_QWORD *)(v3 + 13816);
v51 = *v49;
if ( *((_BYTE *)v49 + 2419) == 1 )
{
v52 = (*(__int64 (**)(void))(v51 + 1328))();
v75 = 0;
v74 = xmmword_100A04D00;
cocos2d::CCDrawNode::drawRect_1(v50, v52, &v75, &v74, 0, v76);
}
else
{
v53 = (*(__int64 (**)(void))(v51 + 1560))();
v75 = 0;
v74 = xmmword_100A04D00;
cocos2d::CCDrawNode::drawPolygon(v50, v53 + 316, 4, &v75, &v74, 0, v76);
}
LABEL_83:
if ( *(_BYTE *)(v3 + 13842) == 1 && *(_BYTE *)(v3 + 12650) == 1 )
{
v54 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 3256) + 1328LL))(*(_QWORD *)(v3 + 3256));
sub_1002787F0(&v75, v54);
sub_1002782D0(v70, &v75);
sub_100278250(v66, *(float *)&v75 + *((float *)&v75 + 2), *((float *)&v75 + 1) + *((float *)&v75 + 3));
v55 = *(_QWORD *)(v3 + 13816);
v74 = 0;
v71 = xmmword_100A04D10;
cocos2d::CCDrawNode::drawRect(v55, v70, v66, &v74, &v71, 0, v76);
if ( *(_BYTE *)(v3 + 1010) == 1 )
{
v56 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 3264) + 1328LL))(*(_QWORD *)(v3 + 3264));
sub_100278810(&v75, v56);
sub_100278300(v70, &v75);
sub_100278250(&v74, *(float *)&v75 + *((float *)&v75 + 2), *((float *)&v75 + 1) + *((float *)&v75 + 3));
sub_100278300(v66, &v74);
v57 = *(_QWORD *)(v73 + 13816);
v74 = 0;
v71 = xmmword_100A04D10;
v3 = v73;
cocos2d::CCDrawNode::drawRect(v57, v70, v66, &v74, &v71, 0, v76);
}
}
}
}
LABEL_61:
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 1320LL))(v3);
if ( (_BYTE)result )
{
if ( *(_BYTE *)(v3 + 13904)
|| !(unsigned __int8)sub_100278830(v3 + 13908, &v68)
|| *(_BYTE *)(v3 + 13924) != *(_BYTE *)(v3 + 13845)
|| (result = *(unsigned __int8 *)(v3 + 13925), (_BYTE)result != *(_BYTE *)(v3 + 12650)) )
{
cocos2d::CCDrawNode::clear(*(_QWORD *)(v3 + 13824));
cocos2d::CCDrawNode::enableDrawArea(*(_QWORD *)(v3 + 13824), &v68);
sub_1000FE870(v3, v3 + 13848, *(unsigned int *)(v3 + 13896), &v68, v76);
sub_1000FE870(v3, v3 + 13872, *(unsigned int *)(v3 + 13900), &v68, v76);
*(_WORD *)(v3 + 13904) = 256;
sub_100278810(v3 + 13908, &v68);
*(_BYTE *)(v3 + 13924) = *(_BYTE *)(v3 + 13845);
result = *(unsigned __int8 *)(v3 + 12650);
*(_BYTE *)(v3 + 13925) = result;
}
}
else if ( *(_BYTE *)(v3 + 13905) == 1 )
{
result = cocos2d::CCDrawNode::clear(*(_QWORD *)(v3 + 13824));
*(_WORD *)(v3 + 13904) = 1;
}
return result;
}