//
// CustomizeObjectLayer::getActiveMode from 0x100050080 to 0x10005015c (220 bytes)
//
// 7 xrefs:
// > CustomizeObjectLayer::onSelectMode @ 0x10004f6d0
// > CustomizeObjectLayer::onSelectColor @ 0x10004fac4
// > CustomizeObjectLayer::onEditColor @ 0x10004fc0c
// > CustomizeObjectLayer::onLiveEdit @ 0x10004fc60
// > CustomizeObjectLayer::onPaste @ 0x10005001c
// > CustomizeObjectLayer::updateCurrentSelection @ 0x100050170
// > CustomizeObjectLayer::updateColorSprite @ 0x1000501ec
//
// 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; // x0
GJSpriteColor *RelativeSpriteColor; // x0
int m_defaultColorID; // w8
char v7; // w21
__int64 v8; // x20
int v9; // w22
GameObject *v10; // x0
GJSpriteColor *v11; // x0
int m_colorID; // w8
m_targetObject = a1->m_targetObject;
if ( m_targetObject )
{
RelativeSpriteColor = GameObject::getRelativeSpriteColor(m_targetObject, a1->m_selectedMode);
if ( RelativeSpriteColor )
{
m_defaultColorID = RelativeSpriteColor->m_defaultColorID;
if ( RelativeSpriteColor->m_colorID )
LODWORD(RelativeSpriteColor) = RelativeSpriteColor->m_colorID;
else
LODWORD(RelativeSpriteColor) = RelativeSpriteColor->m_defaultColorID;
if ( !a2 && m_defaultColorID == (_DWORD)RelativeSpriteColor )
LODWORD(RelativeSpriteColor) = 0;
}
}
else
{
v7 = !a2;
if ( (unsigned int)sub_10024A36C(a1->m_targetObjects) )
{
v8 = 0;
v9 = -1;
do
{
v10 = (GameObject *)sub_10024A388(a1->m_targetObjects, v8);
v11 = GameObject::getRelativeSpriteColor(v10, a1->m_selectedMode);
if ( v11 )
{
m_colorID = v11->m_colorID;
if ( !v11->m_colorID )
m_colorID = v11->m_defaultColorID;
v7 &= m_colorID == v11->m_defaultColorID;
if ( v9 == -1 )
{
v9 = m_colorID;
}
else if ( v9 != m_colorID )
{
goto LABEL_21;
}
}
v8 = (unsigned int)(v8 + 1);
}
while ( (unsigned int)v8 < (unsigned int)sub_10024A36C(a1->m_targetObjects) );
}
else
{
LABEL_21:
v9 = -1;
}
if ( (v7 & 1) != 0 )
LODWORD(RelativeSpriteColor) = 0;
else
LODWORD(RelativeSpriteColor) = v9;
}
return (int)RelativeSpriteColor;
}