//
// GJBaseGameLayer::getMinDistance from 0x100205728 to 0x100205af4 (972 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::volumeForProximityEffect @ 0x100205548
// > GJBaseGameLayer::volumeForProximityEffect @ 0x100205590
// > GJBaseGameLayer::volumeForProximityEffect @ 0x1002055c8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
float __fastcall GJBaseGameLayer::getMinDistance(
GJBaseGameLayer *a1,
cocos2d::CCPoint a2,
cocos2d::CCArray *a3,
float a4,
int a5)
{
int v5; // w3
int v6; // w21
float x; // s8
__int64 v8; // x20
float v10; // s9
unsigned int *v11; // x9
__int64 v12; // x8
_BYTE **v13; // x20
unsigned __int64 v14; // x21
_BYTE *v15; // x0
float v16; // s0
unsigned int *v17; // x9
__int64 v18; // x8
_BYTE **v19; // x20
unsigned __int64 v20; // x21
_BYTE *v21; // x0
unsigned int *v22; // x9
__int64 v23; // x8
_BYTE **v24; // x20
unsigned __int64 v25; // x21
_BYTE *v26; // x0
unsigned int *v27; // x9
__int64 v28; // x8
_BYTE **v29; // x20
unsigned __int64 v30; // x21
_BYTE *v31; // x0
unsigned int *v32; // x9
__int64 v33; // x8
_BYTE **v34; // x20
unsigned __int64 v35; // x21
_BYTE *v36; // x0
unsigned int *v37; // x9
__int64 v38; // x8
_BYTE **v39; // x20
unsigned __int64 v40; // x21
_BYTE *v41; // x0
float v42; // s1
unsigned int *v43; // x9
__int64 v44; // x8
_BYTE **v45; // x20
unsigned __int64 v46; // x21
_BYTE *v47; // x0
float v48; // s0
__int64 v50; // [xsp+0h] [xbp-40h] BYREF
cocos2d::CCPoint v51; // [xsp+8h] [xbp-38h] BYREF
v6 = v5;
x = a2.x;
v8 = *(_QWORD *)&a5;
sub_1000229B0(&v51);
v10 = 2147500000.0;
if ( v6 <= 2 )
{
if ( v6 )
{
if ( v6 == 1 )
{
if ( v8 )
{
v43 = *(unsigned int **)(v8 + 56);
v44 = *v43;
if ( (_DWORD)v44 )
{
v45 = *((_BYTE ***)v43 + 2);
v46 = (unsigned __int64)&v45[v44 - 1];
do
{
v47 = *v45;
if ( !*v45 )
break;
if ( (v47[650] & 1) == 0 )
{
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v47 + 1344LL))(&v50);
sub_1000229D0(&v51, (double *)&v50);
v48 = vabds_f32(v51.x, *(float *)&a3->__vftable);
if ( v10 > v48 )
v10 = v48;
if ( v10 <= x )
break;
}
++v45;
}
while ( (unsigned __int64)v45 <= v46 );
}
}
}
else if ( v6 == 2 )
{
if ( v8 )
{
v17 = *(unsigned int **)(v8 + 56);
v18 = *v17;
if ( (_DWORD)v18 )
{
v19 = *((_BYTE ***)v17 + 2);
v20 = (unsigned __int64)&v19[v18 - 1];
do
{
v21 = *v19;
if ( !*v19 )
break;
if ( (v21[650] & 1) == 0 )
{
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v21 + 1344LL))(&v50);
sub_1000229D0(&v51, (double *)&v50);
if ( v10 > (float)(v51.x - *(float *)&a3->__vftable) )
v10 = v51.x - *(float *)&a3->__vftable;
if ( v10 <= x )
break;
}
++v19;
}
while ( (unsigned __int64)v19 <= v20 );
}
}
}
}
else if ( v8 )
{
v27 = *(unsigned int **)(v8 + 56);
v28 = *v27;
if ( (_DWORD)v28 )
{
v29 = *((_BYTE ***)v27 + 2);
v30 = (unsigned __int64)&v29[v28 - 1];
do
{
v31 = *v29;
if ( !*v29 )
break;
if ( (v31[650] & 1) == 0 )
{
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v31 + 1344LL))(&v50);
sub_1000229D0(&v51, (double *)&v50);
if ( v10 > cocos2d::ccpDistance(&v51, (const cocos2d::CCPoint *)a3) )
v10 = cocos2d::ccpDistance(&v51, (const cocos2d::CCPoint *)a3);
if ( v10 <= x )
break;
}
++v29;
}
while ( (unsigned __int64)v29 <= v30 );
}
}
}
else if ( v6 > 4 )
{
if ( v6 == 5 )
{
if ( v8 )
{
v37 = *(unsigned int **)(v8 + 56);
v38 = *v37;
if ( (_DWORD)v38 )
{
v39 = *((_BYTE ***)v37 + 2);
v40 = (unsigned __int64)&v39[v38 - 1];
do
{
v41 = *v39;
if ( !*v39 )
break;
if ( (v41[650] & 1) == 0 )
{
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v41 + 1344LL))(&v50);
sub_1000229D0(&v51, (double *)&v50);
v42 = *((float *)&a3->__vftable + 1);
if ( v10 > (float)(v51.y - v42) )
v10 = v51.y - v42;
if ( v10 <= x )
break;
}
++v39;
}
while ( (unsigned __int64)v39 <= v40 );
}
}
}
else if ( v6 == 6 )
{
if ( v8 )
{
v22 = *(unsigned int **)(v8 + 56);
v23 = *v22;
if ( (_DWORD)v23 )
{
v24 = *((_BYTE ***)v22 + 2);
v25 = (unsigned __int64)&v24[v23 - 1];
do
{
v26 = *v24;
if ( !*v24 )
break;
if ( (v26[650] & 1) == 0 )
{
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v26 + 1344LL))(&v50);
sub_1000229D0(&v51, (double *)&v50);
if ( v10 > (float)(*((float *)&a3->__vftable + 1) - v51.y) )
v10 = *((float *)&a3->__vftable + 1) - v51.y;
if ( v10 <= x )
break;
}
++v24;
}
while ( (unsigned __int64)v24 <= v25 );
}
}
}
}
else if ( v6 == 3 )
{
if ( v8 )
{
v32 = *(unsigned int **)(v8 + 56);
v33 = *v32;
if ( (_DWORD)v33 )
{
v34 = *((_BYTE ***)v32 + 2);
v35 = (unsigned __int64)&v34[v33 - 1];
do
{
v36 = *v34;
if ( !*v34 )
break;
if ( (v36[650] & 1) == 0 )
{
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v36 + 1344LL))(&v50);
sub_1000229D0(&v51, (double *)&v50);
if ( v10 > (float)(*(float *)&a3->__vftable - v51.x) )
v10 = *(float *)&a3->__vftable - v51.x;
if ( v10 <= x )
break;
}
++v34;
}
while ( (unsigned __int64)v34 <= v35 );
}
}
}
else if ( v8 )
{
v11 = *(unsigned int **)(v8 + 56);
v12 = *v11;
if ( (_DWORD)v12 )
{
v13 = *((_BYTE ***)v11 + 2);
v14 = (unsigned __int64)&v13[v12 - 1];
do
{
v15 = *v13;
if ( !*v13 )
break;
if ( (v15[650] & 1) == 0 )
{
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v15 + 1344LL))(&v50);
sub_1000229D0(&v51, (double *)&v50);
v16 = vabds_f32(v51.y, *((float *)&a3->__vftable + 1));
if ( v10 > v16 )
v10 = v16;
if ( v10 <= x )
break;
}
++v13;
}
while ( (unsigned __int64)v13 <= v14 );
}
}
return v10;
}