//
// sub_1000BD710 from 0x1000bd710 to 0x1000bd9f5 (741 bytes)
//
// 1 xrefs:
// > LevelEditorLayer::updateEditor @ 0x1000aca17
//
// 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 12:20:32 +0000
//
__int64 __fastcall sub_1000BD710(__int64 a1, __int64 a2, __int64 a3, float a4)
{
const char *v5; // rsi
__int64 v6; // rax
__int64 v7; // rdi
__int64 v8; // rdx
__int64 v9; // rax
int v10; // eax
int v11; // ecx
float v12; // xmm1_4
double v13; // xmm0_8
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rdi
__int64 result; // rax
__int64 v18; // rdx
__int64 v19; // rax
int v20; // eax
unsigned int v21; // ecx
bool v22; // cc
__int64 v23; // rcx
float v24; // xmm2_4
int v25; // edx
double v26; // xmm0_8
__int64 v27; // rcx
__int64 v28; // rdi
__int64 v29; // rdi
__int64 v30; // rdi
GameManager::sharedState(a1, a2, a3);
v5 = "0184";
v7 = v6;
if ( (unsigned __int8)GameManager::getGameVariable(v6, "0184") )
{
GameManager::sharedState(v7, "0184", v8);
v5 = "0185";
v7 = v9;
GameManager::getIntGameVariable(v9, "0185");
v11 = 300;
if ( v10 > 0 )
v11 = v10;
v12 = a4 + *(float *)(a1 + 15056);
HIDWORD(v13) = 0;
*(float *)(a1 + 15056) = v12;
if ( v12 >= (float)v11 )
{
*(float *)&v13 = (float)v11;
if ( (*(_BYTE *)(LocalLevelManager::sharedState(v13) + 601) & 1) == 0
&& *(_DWORD *)(*(_QWORD *)(a1 + 1936) + 1140LL) == 2
&& !*(_DWORD *)(a1 + 1972)
&& !*(_BYTE *)(a1 + 14808) )
{
v14 = *(_QWORD *)(a1 + 14248);
if ( !v14 )
{
LABEL_22:
*(_DWORD *)(a1 + 15056) = 0;
v7 = a1;
sub_1000D5190(a1);
goto LABEL_23;
}
if ( *(_BYTE *)(v14 + 1513) || *(_BYTE *)(v14 + 1512) )
goto LABEL_23;
v7 = *(_QWORD *)(v14 + 760);
if ( v7 )
{
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v7 + 352LL))(v7) )
goto LABEL_23;
v14 = *(_QWORD *)(a1 + 14248);
}
v7 = *(_QWORD *)(v14 + 784);
if ( v7 )
{
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v7 + 352LL))(v7) )
goto LABEL_23;
v14 = *(_QWORD *)(a1 + 14248);
}
v7 = *(_QWORD *)(v14 + 792);
if ( v7 )
{
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v7 + 352LL))(v7) )
goto LABEL_23;
v14 = *(_QWORD *)(a1 + 14248);
}
if ( *(_DWORD *)(v14 + 704) == -1 )
goto LABEL_22;
}
}
}
LABEL_23:
GameManager::sharedState(v7, v5, v8);
v16 = v15;
result = GameManager::getGameVariable(v15, "0186");
if ( !(_BYTE)result )
return result;
GameManager::sharedState(v16, "0186", v18);
GameManager::getIntGameVariable(v19, "0187");
v21 = 600;
if ( v20 >= 601 )
v21 = v20;
v22 = v20 <= 0;
result = 3600;
if ( !v22 )
result = v21;
v23 = *(_QWORD *)(a1 + 1936);
v24 = (double)*(int *)(v23 + 652) + *(double *)(a1 + 14688);
v25 = *(_DWORD *)(v23 + 1464);
if ( v25 <= 0 || (float)v25 > v24 )
{
v25 = (int)v24;
*(_DWORD *)(v23 + 1464) = (int)v24;
}
HIDWORD(v26) = 0;
if ( (float)(v24 - (float)v25) < (float)(int)result )
return result;
*(float *)&v26 = (float)v25;
result = *(unsigned __int8 *)(LocalLevelManager::sharedState(v26) + 601);
if ( (result & 1) != 0 )
return result;
v27 = *(_QWORD *)(a1 + 1936);
if ( *(_DWORD *)(v27 + 1140) != 2 || *(_DWORD *)(a1 + 1972) || *(_BYTE *)(a1 + 14808) )
return result;
result = *(_QWORD *)(a1 + 14248);
if ( !result )
{
LABEL_51:
*(_DWORD *)(v27 + 1464) = (int)v24;
return sub_1000D5780(a1);
}
if ( !*(_BYTE *)(result + 1513) && !*(_BYTE *)(result + 1512) )
{
v28 = *(_QWORD *)(result + 760);
if ( v28 )
{
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 352LL))(v28);
if ( (_BYTE)result )
return result;
result = *(_QWORD *)(a1 + 14248);
}
v29 = *(_QWORD *)(result + 784);
if ( v29 )
{
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v29 + 352LL))(v29);
if ( (_BYTE)result )
return result;
result = *(_QWORD *)(a1 + 14248);
}
v30 = *(_QWORD *)(result + 792);
if ( v30 )
{
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v30 + 352LL))(v30);
if ( (_BYTE)result )
return result;
result = *(_QWORD *)(a1 + 14248);
}
if ( *(_DWORD *)(result + 704) == -1 )
{
v27 = *(_QWORD *)(a1 + 1936);
goto LABEL_51;
}
}
return result;
}