//
// sub_1800EA910 from 0x1800ea910 to 0x1800eabc1 (689 bytes)
//
// 2 xrefs:
// > sub_1800E8BE0 @ 0x1800e8be3
// > ??> @ 0x1802000e0
//
// 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
//
__int64 __fastcall sub_1800EA910(__int64 a1, unsigned int a2, __int64 a3, __int64 a4, int a5, int a6)
{
__int64 result; // rax
__int64 v11; // r14
int v12; // ecx
unsigned int v13; // edi
__int64 v14; // rcx
int *v15; // rcx
int v16; // eax
int v17; // esi
int v18; // ecx
int v19; // ecx
int v20; // eax
__int64 v21; // rdx
__int64 v22; // rcx
int v23; // ebp
signed int v24; // edi
__int64 v25; // rdx
__int64 v26; // rcx
bool v27; // zf
int v28; // ecx
int v29; // edi
int v30; // eax
char *v31; // rdx
char v32; // r9
if ( a6 == 1 )
{
if ( a5 )
return 11;
v11 = *(_QWORD *)(a1 + 544);
if ( a2 || (result = sub_1800E9660(a1, 1, 0, a4), !(_DWORD)result) )
{
v12 = *(_DWORD *)(a1 + 640);
if ( v12 )
{
if ( v12 == 1 )
{
v13 = 3;
}
else
{
v13 = *(_DWORD *)(a1 + 644);
if ( !v13 )
v13 = *(_DWORD *)(*(_QWORD *)(a1 + 168) + 70452LL);
}
}
else
{
v13 = 2;
}
v14 = *(_QWORD *)(a1 + 168);
a6 = 0;
sub_180101100(v14, v13, &a6);
if ( a4 )
{
v15 = *(int **)(a4 + 8);
v16 = a6;
*(_DWORD *)(a4 + 32) = v13;
*v15 = v16;
}
if ( !a2 )
return 0;
v17 = *(_DWORD *)(a3 + 32);
if ( *(float *)(a1 + 704) != 0.0 )
return 0;
v18 = *(_DWORD *)(a1 + 640);
if ( v18 )
{
v19 = v18 - 1;
if ( v19 )
{
if ( v19 != 1 )
return 0;
v20 = sub_1800F8AF0(*(unsigned int *)(a1 + 716), *(unsigned int *)(a1 + 644));
v21 = *(unsigned int *)(a1 + 644);
v22 = *(_QWORD *)(a1 + 168);
v23 = v20;
v24 = 0;
a6 = 0;
sub_180101100(v22, v21, &a6);
if ( a6 > 0 )
{
while ( _bittest(&v23, v24) )
{
v25 = *(unsigned int *)(a1 + 644);
v26 = *(_QWORD *)(a1 + 168);
++v24;
a6 = 0;
sub_180101100(v26, v25, &a6);
if ( v24 >= a6 )
goto LABEL_22;
}
return 0;
}
LABEL_22:
if ( v17 && v17 != *(_DWORD *)(*(_QWORD *)(a1 + 168) + 70452LL)
|| *(float *)(a1 + 656) != 360.0
|| *(float *)(a1 + 660) != 0.0 )
{
return 0;
}
v27 = *(float *)(a1 + 664) == 0.0;
}
else
{
if ( v17 != 3 )
return 0;
v27 = *(float *)(a1 + 648) == 0.0;
}
if ( !v27 )
return 0;
}
else if ( v17 != 2 )
{
return 0;
}
if ( !*(_QWORD *)(v11 + 64) && *(float *)(v11 + 128) == 1.0 && *(float *)(v11 + 104) == 1.0 )
return 6;
return 0;
}
}
else
{
v28 = **(_DWORD **)(a3 + 8);
v29 = **(_DWORD **)(a4 + 8);
v30 = *(_DWORD *)(a3 + 32);
if ( !v30 )
v30 = *(_DWORD *)(*(_QWORD *)(a1 + 168) + 70452LL);
*(_DWORD *)(a1 + 600) = v30;
v31 = **(char ***)(a4 + 24);
v32 = *(_DWORD *)(a4 + 32) == 1 || *(_DWORD *)(a3 + 32) == 1;
result = sub_180058150(*(_QWORD *)(a1 + 544), v31, **(_QWORD **)(a3 + 24), v32, v29, v28, a2, 1);
if ( !(_DWORD)result )
{
if ( v29 != **(_DWORD **)(a4 + 8) )
return 28;
return 0;
}
}
return result;
}