//
// EditorUI::canSelectObject from 0x140110310 to 0x140110528 (536 bytes)
//
// 6 xrefs:
// > EditorUI::onDelete @ 0x1400e5f45
// > EditorUI::selectObject @ 0x140110545
// > EditorUI::ccTouchEnded @ 0x140124e32
// > EditorUI::ccTouchEnded @ 0x14012508e
// > ??> @ 0x1406c8ea4
// > ??> @ 0x1406c8eb0
//
// 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
//
// Hidden C++ exception states: #wind=5
bool EditorUI::canSelectObject(EditorUI *a1, GameObject *a2)
{
GameManager *v3; // rcx
GameManager *v4; // rcx
GameManager *v5; // rcx
GameManager *v6; // rcx
int IntGameVariable; // r8d
__int64 v8; // rcx
std::array *i; // rdx
GameManager *v11; // rcx
int v12; // edx
GJSpriteColor *m_baseColor; // rcx
int m_defaultColorID; // eax
int m_colorID; // ecx
GJSpriteColor *m_detailColor; // rax
int v17; // ecx
int v18; // eax
void *v19; // [rsp+30h] [rbp+8h]
void *v20; // [rsp+30h] [rbp+8h]
void *v21; // [rsp+30h] [rbp+8h]
void *v22; // [rsp+30h] [rbp+8h]
void *v23; // [rsp+30h] [rbp+8h]
v3 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v19 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v3, "0064") )
{
v4 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v20 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getIntGameVariable(v4, "0005") == 3 )
{
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v21 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
if ( a2->m_objectID != GameManager::getIntGameVariable(v5, "0006") )
return 0;
}
}
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v22 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
IntGameVariable = GameManager::getIntGameVariable(v6, "0133");
if ( IntGameVariable )
{
if ( a2->m_groupCount <= 0 )
return 0;
v8 = 0;
for ( i = a2->m_groups; i->_Elems[0] != IntGameVariable; i = (std::array *)((char *)i + 2) )
{
if ( ++v8 >= a2->m_groupCount )
return 0;
}
}
v11 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v23 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = (GameManager *)qword_1406C2ED8;
}
v12 = GameManager::getIntGameVariable(v11, "0139");
if ( !v12 )
return 1;
m_baseColor = a2->m_baseColor;
if ( m_baseColor )
{
m_defaultColorID = m_baseColor->m_defaultColorID;
m_colorID = m_baseColor->m_colorID;
if ( m_defaultColorID == m_colorID || !m_colorID )
m_colorID = m_defaultColorID;
if ( m_colorID == v12 )
return 1;
}
m_detailColor = a2->m_detailColor;
if ( !m_detailColor )
return 0;
v17 = m_detailColor->m_defaultColorID;
v18 = m_detailColor->m_colorID;
if ( v17 == v18 || !v18 )
v18 = v17;
return v18 == v12;
}