//
// LevelEditorLayer::updateEditorMode from 0x1000ad9b0 to 0x1000adcf3 (835 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::init @ 0x1000aaf84
// > MapSelectLayer::init @ 0x100252552
// > EditorPauseLayer::toggleEditorColorMode @ 0x10027efca
// > EditorUI::toggleViewOption @ 0x10063e8a2
//
// 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:18 +0000
//
__int64 __fastcall LevelEditorLayer::updateEditorMode(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD *v3; // rbx
char GameVariable; // al
__int64 v5; // rax
__int64 v6; // r14
__int64 v7; // rdi
bool v8; // al
__int64 v9; // r14
__int64 v10; // rdi
bool v11; // al
__int64 v12; // rdi
__int64 v13; // rax
__int64 v14; // rcx
unsigned __int64 v15; // rsi
_QWORD *v16; // rdx
__int64 v17; // rdi
__int64 v18; // r13
_QWORD *v19; // rbx
__int64 v20; // r12
__int64 i; // r15
__int64 v22; // r14
__int64 v23; // r14
unsigned int v24; // r15d
unsigned __int64 j; // rax
unsigned __int64 v26; // rsi
unsigned __int64 v28; // [rsp+10h] [rbp-40h]
_QWORD *v29; // [rsp+18h] [rbp-38h]
__int16 v30; // [rsp+24h] [rbp-2Ch] BYREF
char v31; // [rsp+26h] [rbp-2Ah]
v3 = (_QWORD *)a1;
GameVariable = 1;
if ( !*(_BYTE *)(a1 + 14298) )
{
GameManager::sharedState(a1, a2, a3);
GameVariable = GameManager::getGameVariable(v5, "0036");
}
*(_BYTE *)(a1 + 14297) = GameVariable;
*(_BYTE *)(a1 + 14296) = 1;
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 3944) + 960LL))(*(_QWORD *)(a1 + 3944), &unk_100A04A56);
v6 = *(_QWORD *)(a1 + 3960);
GJGroundLayer::updateGround01Color(v6, 10921638);
GJGroundLayer::updateGround02Color(v6, 10921638);
v7 = *(_QWORD *)(v6 + 432);
v31 = -31;
v30 = -7711;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v7 + 960LL))(v7, &v30);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v6 + 432) + 912LL))(*(_QWORD *)(v6 + 432), 255);
v8 = *((_BYTE *)v3 + 14297) == 1 && (*(_QWORD *)(v3[1824] + 120LL) & 0x40000000000LL) != 0;
GJGroundLayer::updateLineBlend(v6, v8);
v9 = v3[496];
GJGroundLayer::updateGround01Color(v9, 10921638);
GJGroundLayer::updateGround02Color(v9, 10921638);
v10 = *(_QWORD *)(v9 + 432);
v31 = -31;
v30 = -7711;
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v10 + 960LL))(v10, &v30);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v9 + 432) + 912LL))(*(_QWORD *)(v9 + 432), 255);
v11 = *((_BYTE *)v3 + 14297) == 1 && (*(_QWORD *)(v3[1824] + 120LL) & 0x40000000000LL) != 0;
GJGroundLayer::updateLineBlend(v9, v11);
v12 = v3[497];
if ( v12 )
{
GJMGLayer::updateGroundColor(v12, 6579300, 1);
GJMGLayer::updateGroundColor(v3[497], 9868950, 0);
}
v13 = v3[1671];
v14 = v3[1672];
if ( v14 != v13 )
{
v15 = 0;
v29 = v3;
do
{
v16 = *(_QWORD **)(v13 + 8 * v15);
if ( v16 )
{
v17 = (v16[1] - *v16) >> 3;
if ( (int)v17 > 0 )
{
v18 = 0;
v28 = v15;
do
{
v19 = *(_QWORD **)(**(_QWORD **)(v3[1671] + 8 * v15) + 8 * v18);
if ( v19 )
{
v20 = *(int *)(**(_QWORD **)(v29[1692] + 8 * v28) + 4 * v18);
if ( v20 > 0 )
{
for ( i = 0; i != v20; ++i )
{
v22 = *(_QWORD *)(*v19 + 8 * i);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v22 + 1376LL))(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v22 + 1288LL))(v22);
}
}
}
++v18;
v3 = v29;
v15 = v28;
}
while ( v18 != (v17 & 0x7FFFFFFF) );
v13 = v29[1671];
v14 = v29[1672];
}
}
++v15;
}
while ( (v14 - v13) >> 3 > v15 );
}
if ( !*((_BYTE *)v3 + 14297) )
{
v23 = v3[410];
if ( (unsigned int)sub_1007FEF90(v23) )
{
v24 = 0;
do
*(_BYTE *)(sub_1007FEFE0(v23, v24++) + 1149) = 1;
while ( v24 < (unsigned int)sub_1007FEF90(v23) );
}
}
for ( j = 0; j != 10000; j += 2LL )
{
*(_BYTE *)(v3[1830] + j) = 0;
v26 = j >> 6;
*(_QWORD *)(v3[1813] + 8 * v26) &= __ROL8__(-2, j & 0x3E);
*(_BYTE *)(v3[1830] + j + 1) = 0;
*(_QWORD *)(v3[1813] + 8 * v26) &= __ROL8__(-2, (unsigned __int8)j + 1);
}
return LevelEditorLayer::updatePreviewParticles(v3);
}