//
// LevelEditorLayer::validGroup from 0x3663c8 to 0x366474 (172 bytes)
//
// 10 xrefs:
// > LevelEditorLayer::addObjectsAtPosition @ 0x3664bc
// > LevelEditorLayer::addObjectsInRect @ 0x366570
// > LevelEditorLayer::typeExistsAtPosition @ 0x366762
// > LevelEditorLayer::objectAtPosition @ 0x366a2a
// > LevelEditorLayer::objectsAtPosition @ 0x366c38
// > LevelEditorLayer::objectsInRect @ 0x366faa
// > LevelEditorLayer::updateVisibility @ 0x36970e
// > LevelEditorLayer::updateDebugDraw @ 0x37a44e
// > EditorUI::selectAll @ 0x3a5a94
// > EditorUI::selectAllWithDirection @ 0x3a5b5c
//
// 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
//
bool LevelEditorLayer::validGroup(LevelEditorLayer *a1, GameObject *a2, bool a3)
{
int m_editorLayer; // r7
int m_editorLayer2; // r3
int m_currentLayer; // r0
_BOOL4 v7; // r0
unsigned int v8; // r4
int v9; // r2
std::uintptr_t *m_bitptr; // r7
_DWORD v12[2]; // [sp+4h] [bp-18h] BYREF
_DWORD v13[2]; // [sp+Ch] [bp-10h] BYREF
m_editorLayer = a2->m_editorLayer;
m_editorLayer2 = a2->m_editorLayer2;
m_currentLayer = a1->m_currentLayer;
if ( !a2->m_editorLayer2 )
m_editorLayer2 = -1;
v7 = m_currentLayer == -1 || m_currentLayer == m_editorLayer || m_currentLayer == m_editorLayer2;
if ( a3 )
{
if ( m_editorLayer2 < 0 )
{
v8 = -1;
}
else
{
v8 = 9999;
if ( m_editorLayer2 <= 9999 )
v8 = m_editorLayer2;
}
if ( v7 )
{
v9 = a2->m_editorLayer;
if ( m_editorLayer >= 9999 )
v9 = 9999;
m_bitptr = a1->m_lockedLayers.m_start.m_bitptr;
sub_365110(v12, (int)m_bitptr, v9 & ~(v9 >> 31));
if ( std::_Bit_reference::operator bool((int)v12) )
{
LOBYTE(v7) = 0;
}
else if ( v8 == -1 )
{
LOBYTE(v7) = 1;
}
else
{
sub_365110(v13, (int)m_bitptr, v8);
LOBYTE(v7) = !std::_Bit_reference::operator bool((int)v13);
}
}
}
return v7;
}