//
// CustomizeObjectLayer::getActiveMode from 0x840dcc to 0x840ef0 (292 bytes)
//
// 8 xrefs:
// > CustomizeObjectLayer::onLiveEdit @ 0x840f04
// > CustomizeObjectLayer::onEditColor @ 0x840f48
// > CustomizeObjectLayer::updateColorSprite @ 0x840fb4
// > CustomizeObjectLayer::onSelectColor @ 0x841808
// > CustomizeObjectLayer::updateCurrentSelection @ 0x841944
// > CustomizeObjectLayer::onPaste @ 0x8419cc
// > CustomizeObjectLayer::onSelectMode @ 0x841cb8
// > ??> @ 0x46290
//
// 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 CustomizeObjectLayer::getActiveMode(CustomizeObjectLayer *a1, bool a2)
{
GameObject *m_targetObject; // x0
_BOOL4 v4; // w22
GJSpriteColor *v5; // x0
int v6; // w21
int v7; // w0
unsigned int v10; // w19
_BOOL4 v11; // w22
GameObject *v12; // x0
GJSpriteColor *RelativeSpriteColor; // x0
int m_colorID; // w1
int m_defaultColorID; // w0
m_targetObject = a1->m_targetObject;
v4 = a2;
if ( !m_targetObject )
{
v10 = 0;
v11 = !a2;
v6 = -1;
if ( !(unsigned int)cocos2d::CCArray::count(a1->m_targetObjects) )
{
LABEL_20:
if ( v11 )
return 0;
return v6;
}
while ( 1 )
{
v12 = (GameObject *)cocos2d::CCArray::objectAtIndex(a1->m_targetObjects, v10);
RelativeSpriteColor = GameObject::getRelativeSpriteColor(v12, a1->m_selectedMode);
if ( RelativeSpriteColor )
{
m_colorID = RelativeSpriteColor->m_colorID;
m_defaultColorID = RelativeSpriteColor->m_defaultColorID;
if ( m_colorID == m_defaultColorID || !m_colorID )
m_colorID = m_defaultColorID;
if ( v11 )
v11 = m_defaultColorID == m_colorID;
if ( v6 == -1 )
{
v6 = m_colorID;
++v10;
goto LABEL_19;
}
if ( m_colorID != v6 )
{
v6 = -1;
if ( v11 )
return 0;
return v6;
}
}
++v10;
LABEL_19:
if ( v10 >= (unsigned int)cocos2d::CCArray::count(a1->m_targetObjects) )
goto LABEL_20;
}
}
v5 = GameObject::getRelativeSpriteColor(m_targetObject, a1->m_selectedMode);
if ( !v5 )
return 0;
v6 = v5->m_colorID;
v7 = v5->m_defaultColorID;
if ( v6 != v7 && v6 )
return v6;
if ( v4 )
return v7;
else
return 0;
}