//
// EditorUI::editButtonUsable from 0x1003f4a44 to 0x1003f4ea0 (1116 bytes)
//
// 2 xrefs:
// > EditorUI::editObject @ 0x1003e48bc
// > EditorUI::toggleEditObjectButton @ 0x1003e62ac
//
// 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 EditorUI::editButtonUsable(EditorUI *a1)
{
bool isSpawnableTrigger; // w20
bool v3; // zf
__int64 v4; // x8
__int64 v5; // x9
bool v6; // zf
GameObject *m_selectedObject; // x0
GameObject *v9; // x0
unsigned int v10; // w20
GameObject *v11; // x0
unsigned int v12; // w21
int v13; // w8
unsigned int v14; // w8
bool v15; // cc
int v16; // w8
unsigned int v18; // w21
unsigned int v19; // w21
GameObject *v20; // x0
int v21; // [xsp+4h] [xbp-3Ch] BYREF
int v22; // [xsp+8h] [xbp-38h] BYREF
int v23; // [xsp+Ch] [xbp-34h] BYREF
v23 = -1;
EditorUI::getGroupInfo(a1, a1->m_selectedObject, a1->m_selectedObjects, &v23, &v22, &v21);
isSpawnableTrigger = 1;
if ( v23 > 2898 )
{
v3 = (unsigned int)(v23 - 3600) > 0x3E || ((1LL << ((unsigned __int8)v23 - 16)) & 0x70802F00001EF3FDLL) == 0;
if ( !v3 || (unsigned int)(v23 - 2899) <= 0x1A && ((1 << (v23 - 83)) & 0x7F7FD77) != 0 )
return isSpawnableTrigger;
if ( (unsigned int)(v23 - 2999) <= 0x22 )
{
v4 = 1LL << ((unsigned __int8)v23 + 73);
v5 = 0x7C283FF81LL;
goto LABEL_41;
}
}
else if ( v23 > 1519 )
{
if ( v23 <= 1911 )
{
v6 = (unsigned int)(v23 - 1811) > 8 || v23 == 1813;
if ( !v6 || (unsigned int)(v23 - 1585) <= 0x1F && ((1 << (v23 - 49)) & 0x9C000401) != 0 || v23 == 1520 )
return isSpawnableTrigger;
goto LABEL_47;
}
if ( (unsigned int)(v23 - 1912) <= 0x17 && ((1 << (v23 - 120)) & 0xF80037) != 0 )
return isSpawnableTrigger;
if ( (unsigned int)(v23 - 2015) <= 0x36 )
{
v4 = 1LL << ((unsigned __int8)v23 + 33);
v5 = 0x79800000000003LL;
goto LABEL_41;
}
}
else
{
if ( v23 > 659 )
{
if ( v23 > 1005 )
{
if ( (unsigned int)(v23 - 1331) <= 0x10 && ((1 << (v23 - 51)) & 0x18009) != 0
|| (unsigned int)(v23 - 1006) <= 0x2B && ((1LL << ((unsigned __int8)v23 + 18)) & 0x80000000003LL) != 0
|| v23 == 1268 )
{
return isSpawnableTrigger;
}
}
else if ( (unsigned int)(v23 - 717) <= 0x1C && ((1 << (v23 + 51)) & 0x1C000003) != 0
|| (unsigned int)(v23 - 899) <= 0x10 && ((1 << (v23 + 125)) & 0x10007) != 0
|| v23 == 660 )
{
return isSpawnableTrigger;
}
goto LABEL_47;
}
if ( v23 > 104 )
{
if ( (unsigned int)(v23 - 200) <= 0x15 && ((1 << (v23 + 56)) & 0x20000F) != 0
|| (unsigned int)(v23 - 105) <= 0x25 && ((1LL << ((unsigned __int8)v23 - 105)) & 0x2000000041LL) != 0
|| (unsigned int)(v23 - 286) < 2 )
{
return isSpawnableTrigger;
}
goto LABEL_47;
}
if ( (unsigned int)v23 <= 0x2F )
{
v4 = 1LL << v23;
v5 = 0x8003E0003000LL;
LABEL_41:
if ( (v4 & v5) != 0 )
return isSpawnableTrigger;
}
}
LABEL_47:
m_selectedObject = a1->m_selectedObject;
if ( !m_selectedObject
|| !GameObject::isBasicTrigger(m_selectedObject)
&& ((v9 = a1->m_selectedObject) == nullptr || !GameObject::canChangeCustomColor(v9)) )
{
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects)
&& (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
v10 = 0;
do
{
v11 = (GameObject *)sub_10024A388((__int64)a1->m_selectedObjects, v10);
if ( GameObject::canChangeCustomColor(v11) )
return 1;
}
while ( ++v10 < (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) );
}
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
v12 = 0;
while ( 1 )
{
v13 = *(_DWORD *)(sub_10024A388((__int64)a1->m_selectedObjects, v12) + 1028);
if ( v13 > 898 )
{
v14 = v13 - 899;
v15 = v14 > 0x10;
v16 = (1 << v14) & 0x10003;
if ( v15 || v16 == 0 )
goto LABEL_76;
}
else if ( (unsigned int)(v13 - 29) >= 2 && v13 != 105 && v13 != 744 )
{
goto LABEL_76;
}
++v12;
isSpawnableTrigger = 1;
if ( v12 >= (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
return isSpawnableTrigger;
}
}
return 1;
}
LABEL_76:
if ( (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
if ( !(unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
return 1;
v18 = 0;
while ( (unsigned int)(*(_DWORD *)(sub_10024A388((__int64)a1->m_selectedObjects, v18) + 1028) - 3006) < 5 )
{
++v18;
isSpawnableTrigger = 1;
if ( v18 >= (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
return isSpawnableTrigger;
}
}
if ( !(unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
return 0;
if ( !(unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
return 1;
v19 = 0;
do
{
v20 = (GameObject *)sub_10024A388((__int64)a1->m_selectedObjects, v19);
isSpawnableTrigger = GameObject::isSpawnableTrigger(v20);
if ( !isSpawnableTrigger )
break;
++v19;
}
while ( v19 < (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) );
}
return isSpawnableTrigger;
}