//
// CustomizeObjectLayer::getActiveMode from 0x1001f8360 to 0x1001f844b (235 bytes)
//
// 7 xrefs:
// > CustomizeObjectLayer::onSelectMode @ 0x1001f7642
// > CustomizeObjectLayer::onSelectColor @ 0x1001f7a64
// > CustomizeObjectLayer::onEditColor @ 0x1001f7caf
// > CustomizeObjectLayer::onLiveEdit @ 0x1001f7d0f
// > CustomizeObjectLayer::onPaste @ 0x1001f82b0
// > CustomizeObjectLayer::updateCurrentSelection @ 0x1001f8463
// > CustomizeObjectLayer::updateColorSprite @ 0x1001f8531
//
// 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
//
int __fastcall CustomizeObjectLayer::getActiveMode(CustomizeObjectLayer *a1, bool a2)
{
GameObject *m_targetObject; // rdi
GJSpriteColor *RelativeSpriteColor; // rax
GJSpriteColor *v5; // rcx
int result; // eax
int m_defaultColorID; // ecx
bool v8; // bl
unsigned int v9; // r15d
int v10; // r12d
GameObject *v11; // rax
GJSpriteColor *v12; // rax
int m_colorID; // ecx
int v14; // eax
bool v15; // dl
m_targetObject = a1->m_targetObject;
if ( m_targetObject )
{
RelativeSpriteColor = GameObject::getRelativeSpriteColor(m_targetObject, a1->m_selectedMode);
if ( RelativeSpriteColor )
{
v5 = RelativeSpriteColor;
result = RelativeSpriteColor->m_colorID;
m_defaultColorID = v5->m_defaultColorID;
if ( !result )
result = m_defaultColorID;
if ( !a2 && m_defaultColorID == result )
return 0;
}
else
{
return 0;
}
}
else
{
v8 = !a2;
if ( (unsigned int)sub_100720070(a1->m_targetObjects) )
{
v9 = 0;
v10 = -1;
while ( 1 )
{
v11 = (GameObject *)sub_1007200C0(a1->m_targetObjects, v9);
v12 = GameObject::getRelativeSpriteColor(v11, a1->m_selectedMode);
if ( v12 )
{
m_colorID = v12->m_colorID;
v14 = v12->m_defaultColorID;
if ( !m_colorID )
m_colorID = v14;
v15 = v8;
v8 = m_colorID == v14;
if ( !v15 )
v8 = v15;
if ( v10 == -1 )
{
v10 = m_colorID;
}
else if ( v10 != m_colorID )
{
break;
}
}
if ( ++v9 >= (unsigned int)sub_100720070(a1->m_targetObjects) )
goto LABEL_21;
}
}
v10 = -1;
LABEL_21:
result = 0;
if ( !v8 )
return v10;
}
return result;
}