//
// sub_6DA978 from 0x6da978 to 0x6dabac (564 bytes)
//
// 3 xrefs:
// > sub_6DC010 @ 0x6dc0c8
// > sub_6DC010 @ 0x6dc0cc
// > ??> @ 0x6dc278
//
// 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
//
int __fastcall sub_6DA978(int result, __int16 *a2, int a3)
{
double v3; // d6
int v6; // [sp+14h] [bp-20h]
int *i; // [sp+18h] [bp-1Ch]
int v9; // [sp+20h] [bp-14h]
int v10; // [sp+24h] [bp-10h]
v6 = result;
for ( i = *(int **)(result + 12); a3-- > 0; ++i )
{
if ( *a2 > 0 )
{
if ( *a2 <= 7409 )
{
if ( *(_DWORD *)(v6 + 4) )
{
v3 = (double)*a2 - 3314.0;
v9 = (int)(v3 * 0.25 + (double)sub_6D7100() * 4.65661288e-10 - 0.5);
}
else
{
v9 = (*a2 - 3314) >> 2;
}
}
else
{
v9 = 1023;
}
}
else
{
v9 = 0;
}
result = uv_encode(((double)a2[1] + 0.5) / 32768.0, ((double)a2[2] + 0.5) / 32768.0, *(_DWORD *)(v6 + 4));
v10 = result;
if ( result < 0 )
{
result = uv_encode(0.210526316, 0.473684211, 0);
v10 = result;
}
*i = (v9 << 14) | v10;
a2 += 3;
}
return result;
}