//
// GJBaseGameLayer::volumeForProximityEffect from 0x5974f0 to 0x59778a (666 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::updateProximityVolumeEffects @ 0x59d0d0
// > GJBaseGameLayer::addProximityVolumeEffect @ 0x5a5122
// > GJBaseGameLayer::activateSFXTrigger @ 0x5b19fe
//
// 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:09 +0000
//
int __fastcall GJBaseGameLayer::volumeForProximityEffect(int a1, int *a2)
{
float v4; // s13
int v5; // r4
cocos2d::CCObject *Group; // r8
float *v7; // r1
int v8; // r7
int v9; // r0
int v10; // r0
int MainObject; // r0
int v12; // r6
float v13; // s18
int v15; // r10
float v16; // s18
int v17; // r6
float v18; // s19
float v19; // s16
float v20; // r0
float v21; // s17
const cocos2d::CCPoint *v22; // r0
const cocos2d::CCPoint *v23; // r0
float v24; // s14
float v25; // s15
float *v26; // r3
float v27; // s17
int v28; // [sp+8h] [bp-2Ch]
float v29; // [sp+14h] [bp-20h] BYREF
float v30; // [sp+18h] [bp-1Ch]
_BYTE v31[8]; // [sp+1Ch] [bp-18h] BYREF
_BYTE v32[8]; // [sp+24h] [bp-10h] BYREF
float v33[2]; // [sp+2Ch] [bp-8h] BYREF
float v34[2]; // [sp+34h] [bp+0h] BYREF
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)a1);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v29);
v4 = *(float *)(a1 + 328);
v29 = v29 / v4;
v30 = v30 / v4;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v34, v29 * 0.5, v30 * 0.5);
cocos2d::CCPoint::operator+(v31, a1 + 848, v34);
v5 = a2[3];
Group = GJBaseGameLayer::getGroup((GJBaseGameLayer *)a1, *a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v32);
if ( *(_BYTE *)(v5 + 1740) )
{
v7 = (float *)v31;
}
else
{
if ( *(_BYTE *)(v5 + 1504) )
{
v9 = (*(int (__fastcall **)(_DWORD))(**(_DWORD **)(a1 + 2076) + 96))(*(_DWORD *)(a1 + 2076));
cocos2d::CCPoint::operator=(v32, v9);
if ( *(_BYTE *)(v5 + 1505) )
v8 = *(unsigned __int8 *)(a1 + 866);
else
v8 = *(unsigned __int8 *)(v5 + 1505);
goto LABEL_15;
}
if ( *(_BYTE *)(v5 + 1505) )
{
if ( *(_BYTE *)(a1 + 866) )
v10 = *(_DWORD *)(a1 + 2080);
else
v10 = *(_DWORD *)(a1 + 2076);
v7 = (float *)(*(int (__fastcall **)(int))(*(_DWORD *)v10 + 96))(v10);
}
else
{
MainObject = GJBaseGameLayer::tryGetMainObject((cocos2d::CCDictionary **)a1, a2[1]);
if ( !MainObject )
{
v8 = 0;
v12 = 0;
goto LABEL_17;
}
(*(void (__fastcall **)(float *, int))(*(_DWORD *)MainObject + 680))(v34, MainObject);
v7 = v34;
}
}
cocos2d::CCPoint::operator=(v32, v7);
v8 = 0;
LABEL_15:
v12 = 1;
LABEL_17:
if ( Group && cocos2d::CCArray::count(Group) && v12 )
{
v15 = *(_DWORD *)(v5 + 1736);
v16 = *(float *)(v5 + 1712);
v17 = *(_DWORD *)(v5 + 1732);
v18 = *(float *)(v5 + 1720);
v19 = (float)(3 * *(_DWORD *)(v5 + 1724));
v28 = *(_DWORD *)(v5 + 1728);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v34, (const cocos2d::CCPoint *)v32);
v20 = COERCE_FLOAT(GJBaseGameLayer::getMinDistance(a1, v34, (int)Group, v19, v15));
v21 = v20;
if ( v8 )
{
if ( v20 > v19 )
{
v22 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(**(_DWORD **)(a1 + 2080) + 96))(*(_DWORD *)(a1 + 2080));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v33, v22);
if ( v21 > COERCE_FLOAT(GJBaseGameLayer::getMinDistance(a1, v33, (int)Group, v19, v15)) )
{
v23 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(**(_DWORD **)(a1 + 2080) + 96))(*(_DWORD *)(a1 + 2080));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v34, v23);
v21 = COERCE_FLOAT(GJBaseGameLayer::getMinDistance(a1, v34, (int)Group, v19, v15));
}
}
}
if ( v21 > v19 )
{
v24 = (float)(3 * v28) + v19;
v25 = (float)(3 * v17) + v24;
if ( v21 >= v25 )
{
v27 = 1.0;
goto LABEL_38;
}
if ( v24 > 0.0 )
{
v26 = (float *)(v5 + 1716);
if ( v21 >= v24 )
{
v16 = *v26;
v18 = *(float *)(v5 + 1720);
v19 = (float)(3 * v28) + v19;
}
else
{
v5 += 1712;
}
if ( v21 < v24 )
{
v16 = *(float *)v5;
v18 = *v26;
v25 = v24;
}
}
if ( v19 != v25 )
{
v27 = (float)(v21 - v19) / (float)(v25 - v19);
LABEL_38:
v13 = v16 + (float)((float)(v18 - v16) * v27);
return LODWORD(v13);
}
}
v27 = 0.0;
goto LABEL_38;
}
v13 = 1.0;
return LODWORD(v13);
}