//
// GJBaseGameLayer::volumeForProximityEffect from 0x14034c740 to 0x14034cb0e (974 bytes)
//
// 7 xrefs:
// > GJBaseGameLayer::activateSFXTrigger @ 0x14034be62
// > GJBaseGameLayer::updateProximityVolumeEffects @ 0x14034c4b2
// > GJBaseGameLayer::addProximityVolumeEffect @ 0x14034c6cb
// > ??> @ 0x1408b8350
// > ??> @ 0x1408b8360
// > ??> @ 0x1409200a8
// > ??> @ 0x1409200b4
//
// 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 11:30:45 +0000
//
float __fastcall GJBaseGameLayer::volumeForProximityEffect(__int64 a1, unsigned int *a2)
{
__int64 v4; // rax
float v5; // xmm0_4
__int64 v6; // rax
__int64 v7; // rbx
struct cocos2d::CCObject *Group; // rbp
char v9; // si
bool v10; // r15
__int64 v11; // rax
__int64 v12; // rcx
__int64 v13; // rax
struct cocos2d::CCObject *MainObject; // rax
__int64 v15; // rax
int v16; // esi
float v17; // xmm6_4
float v18; // xmm11_4
float v19; // xmm7_4
float v20; // xmm10_4
float v21; // xmm8_4
int v22; // eax
int v23; // ecx
int v24; // r9d
double MinDistance; // xmm0_8
float v26; // xmm9_4
const struct cocos2d::CCPoint *v27; // rax
int v28; // eax
int v29; // ecx
int v30; // r9d
double v31; // xmm0_8
const struct cocos2d::CCPoint *v32; // rax
int v33; // eax
int v34; // ecx
int v35; // r9d
double v36; // xmm0_8
float v37; // xmm0_4
_BYTE v39[16]; // [rsp+30h] [rbp-A8h] BYREF
char v40; // [rsp+E0h] [rbp+8h] BYREF
float v41; // [rsp+E8h] [rbp+10h] BYREF
float v42; // [rsp+ECh] [rbp+14h]
char v43; // [rsp+F0h] [rbp+18h] BYREF
char v44; // [rsp+F8h] [rbp+20h] BYREF
v4 = cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v4, &v41);
v5 = *(float *)(a1 + 424);
v41 = v41 / v5;
v42 = v42 / v5;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v44, v41 * 0.5, v42 * 0.5);
cocos2d::CCPoint::operator+(a1 + 1040, &v43, v6);
v7 = *((_QWORD *)a2 + 2);
Group = GJBaseGameLayer::getGroup(a1, *a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40);
v9 = 0;
v10 = 0;
if ( *(_BYTE *)(v7 + 1968) )
{
v9 = 1;
cocos2d::CCPoint::operator=(&v40, &v43);
}
else if ( *(_BYTE *)(v7 + 1700) )
{
v9 = 1;
v11 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3512) + 200LL))(*(_QWORD *)(a1 + 3512));
cocos2d::CCPoint::operator=(&v40, v11);
if ( *(_BYTE *)(v7 + 1701) )
v10 = *(_BYTE *)(a1 + 1058) != 0;
}
else if ( *(_BYTE *)(v7 + 1701) )
{
v9 = 1;
if ( *(_BYTE *)(a1 + 1058) )
v12 = *(_QWORD *)(a1 + 3520);
else
v12 = *(_QWORD *)(a1 + 3512);
v13 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 200LL))(v12);
cocos2d::CCPoint::operator=(&v40, v13);
}
else
{
MainObject = GJBaseGameLayer::tryGetMainObject(a1, a2[1]);
if ( MainObject )
{
v15 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *, char *))(*(_QWORD *)MainObject + 1208LL))(
MainObject,
&v44);
cocos2d::CCPoint::operator=(&v40, v15);
v9 = 1;
}
}
if ( !Group || !cocos2d::CCArray::count(Group) || !v9 )
return 1.0;
v16 = *(_DWORD *)(v7 + 1964);
v17 = *(float *)(v7 + 1948);
v18 = *(float *)(v7 + 1940);
v19 = (float)(3 * *(_DWORD *)(v7 + 1952));
v20 = (float)(3 * *(_DWORD *)(v7 + 1956)) + v19;
v21 = (float)(3 * *(_DWORD *)(v7 + 1960)) + v20;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v44, (const struct cocos2d::CCPoint *)&v40);
MinDistance = GJBaseGameLayer::getMinDistance(v23, v22, (_DWORD)Group, v24, v16);
v26 = *(float *)&MinDistance;
if ( v10 && *(float *)&MinDistance > v19 )
{
v27 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3520) + 200LL))(*(_QWORD *)(a1 + 3520));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v44, v27);
v31 = GJBaseGameLayer::getMinDistance(v29, v28, (_DWORD)Group, v30, v16);
if ( *(float *)&v31 <= v26 )
{
v32 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3520) + 200LL))(*(_QWORD *)(a1 + 3520));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, v32);
v36 = GJBaseGameLayer::getMinDistance(v34, v33, (_DWORD)Group, v35, v16);
v26 = *(float *)&v36;
}
}
if ( v19 < v26 )
{
if ( v26 < v21 )
{
v37 = 0.0;
if ( v20 > 0.0 )
{
if ( v26 < v20 )
{
v18 = *(float *)(v7 + 1940);
v21 = v20;
v17 = *(float *)(v7 + 1944);
}
else
{
v18 = *(float *)(v7 + 1944);
v19 = v20;
v17 = *(float *)(v7 + 1948);
}
}
if ( v19 != v21 )
v37 = (float)(v26 - v19) / (float)(v21 - v19);
}
else
{
v37 = 1.0;
}
}
else
{
v37 = 0.0;
}
return (float)((float)(v17 - v18) * v37) + v18;
}