//
// GJBaseGameLayer::getMinDistance from 0x868558 to 0x868a54 (1276 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::volumeForProximityEffect @ 0x868ba4
// > GJBaseGameLayer::volumeForProximityEffect @ 0x868d28
// > GJBaseGameLayer::volumeForProximityEffect @ 0x868d68
// > ??> @ 0x48f48
//
// 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 GJBaseGameLayer::getMinDistance(GJBaseGameLayer *a1, cocos2d::CCPoint a2, cocos2d::CCArray *a3, float a4, int a5)
{
int v5; // w3
float x; // s9
float v8; // s8
unsigned int *v9; // x1
_BYTE **v10; // x21
_BYTE **v11; // x23
unsigned int *v13; // x1
_BYTE **v14; // x21
_BYTE **v15; // x23
_BYTE *v16; // x0
float v17; // s0
float v18; // s1
float v19; // s1
unsigned int *v20; // x1
_BYTE **v21; // x21
_BYTE **v22; // x23
_BYTE *v23; // x0
float v24; // s0
float v25; // s1
unsigned int *v26; // x1
_BYTE **v27; // x21
_BYTE **v28; // x23
_BYTE *v29; // x0
float v30; // s0
float v31; // s1
float v32; // s0
unsigned int *v33; // x1
_BYTE **v34; // x21
_BYTE **v35; // x23
_BYTE *v36; // x0
float v37; // s0
float v38; // s1
unsigned int *v39; // x1
_BYTE **v40; // x21
_BYTE **v41; // x23
_BYTE *v42; // x0
float v43; // s0
float v44; // s1
unsigned int *v45; // x1
_BYTE **v46; // x21
_BYTE **v47; // x23
_BYTE *v48; // x0
float v49; // s0
float v50; // s1
float v51; // s0
_BYTE *v52; // x0
float v53; // s0
float v54; // s1
int v55; // [xsp+50h] [xbp+50h]
__int64 v56; // [xsp+58h] [xbp+58h]
cocos2d::CCPoint v57; // [xsp+68h] [xbp+68h] BYREF
x = a2.x;
v55 = v5;
v56 = *(_QWORD *)&a5;
cocos2d::CCPoint::CCPoint(&v57);
v8 = 2147500000.0;
switch ( v55 )
{
case 0:
if ( !v56 )
goto LABEL_5;
v20 = *(unsigned int **)(v56 + 56);
if ( !*v20 )
goto LABEL_5;
v21 = *((_BYTE ***)v20 + 2);
v22 = &v21[*v20 - 1];
if ( v21 > v22 )
goto LABEL_5;
v23 = *v21;
v8 = 2147500000.0;
if ( *v21 )
{
if ( !v23[650] )
goto LABEL_27;
while ( v22 >= ++v21 )
{
v23 = *v21;
if ( !*v21 )
break;
if ( !v23[650] )
{
LABEL_27:
v24 = (*(float (__fastcall **)(_BYTE *))(*(_QWORD *)v23 + 1344LL))(v23);
cocos2d::CCPoint::operator=(&v57, v24, v25);
if ( v8 > cocos2d::ccpDistance(&v57, (const cocos2d::CCPoint *)a3) )
v8 = cocos2d::ccpDistance(&v57, (const cocos2d::CCPoint *)a3);
if ( v8 <= x )
return v8;
}
}
}
break;
case 1:
if ( !v56 )
goto LABEL_5;
v26 = *(unsigned int **)(v56 + 56);
if ( !*v26 )
goto LABEL_5;
v27 = *((_BYTE ***)v26 + 2);
v28 = &v27[*v26 - 1];
if ( v27 > v28 )
goto LABEL_5;
v29 = *v27;
v8 = 2147500000.0;
if ( *v27 )
{
if ( !v29[650] )
goto LABEL_39;
while ( v28 >= ++v27 )
{
v29 = *v27;
if ( !*v27 )
break;
if ( !v29[650] )
{
LABEL_39:
v30 = (*(float (__fastcall **)(_BYTE *))(*(_QWORD *)v29 + 1344LL))(v29);
cocos2d::CCPoint::operator=(&v57, v30, v31);
v32 = vabds_f32(v57.x, *(float *)&a3->__vftable);
if ( v8 > v32 )
v8 = v32;
if ( v8 <= x )
return v8;
}
}
}
break;
case 2:
if ( !v56 )
goto LABEL_5;
v33 = *(unsigned int **)(v56 + 56);
if ( !*v33 )
goto LABEL_5;
v34 = *((_BYTE ***)v33 + 2);
v35 = &v34[*v33 - 1];
if ( v34 > v35 )
goto LABEL_5;
v36 = *v34;
v8 = 2147500000.0;
if ( *v34 )
{
if ( !v36[650] )
goto LABEL_51;
while ( v35 >= ++v34 )
{
v36 = *v34;
if ( !*v34 )
break;
if ( !v36[650] )
{
LABEL_51:
v37 = (*(float (__fastcall **)(_BYTE *))(*(_QWORD *)v36 + 1344LL))(v36);
cocos2d::CCPoint::operator=(&v57, v37, v38);
if ( v8 > (float)(v57.x - *(float *)&a3->__vftable) )
v8 = v57.x - *(float *)&a3->__vftable;
if ( v8 <= x )
return v8;
}
}
}
break;
case 3:
if ( !v56 )
goto LABEL_5;
v39 = *(unsigned int **)(v56 + 56);
if ( !*v39 )
goto LABEL_5;
v40 = *((_BYTE ***)v39 + 2);
v41 = &v40[*v39 - 1];
if ( v40 > v41 )
goto LABEL_5;
v42 = *v40;
v8 = 2147500000.0;
if ( *v40 )
{
if ( !v42[650] )
goto LABEL_63;
while ( v41 >= ++v40 )
{
v42 = *v40;
if ( !*v40 )
break;
if ( !v42[650] )
{
LABEL_63:
v43 = (*(float (__fastcall **)(_BYTE *))(*(_QWORD *)v42 + 1344LL))(v42);
cocos2d::CCPoint::operator=(&v57, v43, v44);
if ( v8 > (float)(*(float *)&a3->__vftable - v57.x) )
v8 = *(float *)&a3->__vftable - v57.x;
if ( v8 <= x )
return v8;
}
}
}
break;
case 4:
if ( !v56 )
goto LABEL_5;
v45 = *(unsigned int **)(v56 + 56);
if ( !*v45 )
goto LABEL_5;
v46 = *((_BYTE ***)v45 + 2);
v47 = &v46[*v45 - 1];
if ( v46 > v47 )
goto LABEL_5;
v48 = *v46;
v8 = 2147500000.0;
if ( *v46 )
{
if ( !v48[650] )
goto LABEL_75;
while ( v47 >= ++v46 )
{
v48 = *v46;
if ( !*v46 )
break;
if ( !v48[650] )
{
LABEL_75:
v49 = (*(float (__fastcall **)(_BYTE *))(*(_QWORD *)v48 + 1344LL))(v48);
cocos2d::CCPoint::operator=(&v57, v49, v50);
v51 = vabds_f32(v57.y, *((float *)&a3->__vftable + 1));
if ( v8 > v51 )
v8 = v51;
if ( v8 <= x )
return v8;
}
}
}
break;
case 5:
if ( !v56 )
goto LABEL_5;
v13 = *(unsigned int **)(v56 + 56);
if ( !*v13 )
goto LABEL_5;
v14 = *((_BYTE ***)v13 + 2);
v15 = &v14[*v13 - 1];
if ( v14 > v15 )
goto LABEL_5;
v16 = *v14;
v8 = 2147500000.0;
if ( *v14 )
{
if ( !v16[650] )
goto LABEL_15;
while ( v15 >= ++v14 )
{
v16 = *v14;
if ( !*v14 )
break;
if ( !v16[650] )
{
LABEL_15:
v17 = (*(float (__fastcall **)(_BYTE *))(*(_QWORD *)v16 + 1344LL))(v16);
cocos2d::CCPoint::operator=(&v57, v17, v18);
v19 = *((float *)&a3->__vftable + 1);
if ( v8 > (float)(v57.y - v19) )
v8 = v57.y - v19;
if ( v8 <= x )
return v8;
}
}
}
break;
case 6:
if ( v56
&& (v9 = *(unsigned int **)(v56 + 56), *v9)
&& (v10 = *((_BYTE ***)v9 + 2), v11 = &v10[*v9 - 1], v10 <= v11) )
{
v52 = *v10;
v8 = 2147500000.0;
if ( *v10 )
{
if ( !v52[650] )
goto LABEL_84;
while ( v11 >= ++v10 )
{
v52 = *v10;
if ( !*v10 )
break;
if ( !v52[650] )
{
LABEL_84:
v53 = (*(float (__fastcall **)(_BYTE *))(*(_QWORD *)v52 + 1344LL))(v52);
cocos2d::CCPoint::operator=(&v57, v53, v54);
if ( v8 > (float)(*((float *)&a3->__vftable + 1) - v57.y) )
v8 = *((float *)&a3->__vftable + 1) - v57.y;
if ( v8 <= x )
return v8;
}
}
}
}
else
{
LABEL_5:
v8 = 2147500000.0;
}
break;
default:
return v8;
}
return v8;
}