//
// LevelEditorLayer::validGroup from 0x1000e0a20 to 0x1000e0ae6 (198 bytes)
//
// 3 xrefs:
// > EditorUI::selectAll @ 0x10003cffa
// > EditorUI::selectAllWithDirection @ 0x10003d37e
// > EditorUI::selectAllWithDirection @ 0x10003d3da
//
// 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 __fastcall LevelEditorLayer::validGroup(LevelEditorLayer *a1, GameObject *a2, bool a3)
{
int v3; // eax
unsigned int m_editorLayer; // esi
int v5; // ecx
bool result; // al
unsigned __int64 v7; // r8
__int16 v8; // r9
unsigned __int16 v9; // dx
std::__vector_base::pointer begin; // rax
__int64 v11; // rsi
__int64 v12; // rax
v3 = *(_DWORD *)&a2->m_editorLayer2;
m_editorLayer = (unsigned __int16)a2->m_editorLayer;
v5 = (_WORD)v3 == 0 ? -1 : v3;
result = a1->m_currentLayer == -1
|| a1->m_currentLayer == (unsigned __int16)m_editorLayer
|| a1->m_currentLayer == (unsigned __int16)((_WORD)v3 == 0 ? -1 : v3);
if ( a3 )
{
v7 = 9999;
v8 = 9999;
if ( (__int16)v5 < 9999 )
v8 = v5;
v9 = -1;
if ( v8 >= 0 )
v9 = v8;
if ( result )
{
if ( (__int16)m_editorLayer < 9999 )
v7 = m_editorLayer;
if ( (__int16)v7 <= 0 )
v7 = 0;
begin = a1->m_lockedLayers.__begin_;
v11 = *(_QWORD *)&begin[((unsigned int)v7 >> 3) & 0x7F8];
if ( _bittest64(&v11, v7) )
{
return 0;
}
else if ( (v5 & 0x8000u) != 0 )
{
return 1;
}
else
{
v12 = *(_QWORD *)&begin[8 * ((unsigned __int64)v9 >> 6)];
return !_bittest64(&v12, v9);
}
}
else
{
return 0;
}
}
return result;
}