//
// EditorUI::getEditColorTargets from 0x37fa90 to 0x37fbd8 (328 bytes)
//
// 2 xrefs:
// > EditorUI::updateEditColorButton @ 0x37fc6a
// > EditorUI::editColor @ 0x380804
//
// 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
//
void EditorUI::getEditColorTargets(EditorUI *a1, ColorAction **a2, ColorAction **a3, EffectGameObject **a4)
{
GameObject *m_selectedObject; // r1
GJSpriteColor *MainColor; // r0
int ColorMode; // r5
GJSpriteColor *SecondaryColor; // r0
int v12; // r6
cocos2d::CCArray *m_selectedObjects; // r3
cocos2d::ccArray *data; // r3
unsigned int num; // r4
cocos2d::CCObject **arr; // r3
unsigned int v17; // r7
GameObject **v18; // r9
GameObject *v19; // r8
GameObject *v20; // t1
GameManager *v21; // r0
GameManager *v22; // r0
GJSpriteColor *v23; // r0
int v24; // r0
_BOOL4 v25; // r4
GJSpriteColor *v26; // r0
int v27; // r0
m_selectedObject = a1->m_selectedObject;
if ( m_selectedObject )
{
if ( EditorUI::isLiveColorSelectTrigger(a1, m_selectedObject) )
{
*a4 = (EffectGameObject *)a1->m_selectedObject;
goto LABEL_22;
}
if ( GameObject::canChangeMainColor(a1->m_selectedObject) )
{
MainColor = GameObject::getMainColor(a1->m_selectedObject);
ColorMode = GJSpriteColor::getColorMode(MainColor);
}
else
{
ColorMode = -1;
}
if ( !GameObject::canChangeSecondaryColor(a1->m_selectedObject) )
{
if ( ColorMode < 0 )
goto LABEL_22;
v12 = -1;
goto LABEL_19;
}
SecondaryColor = GameObject::getSecondaryColor(a1->m_selectedObject);
v12 = GJSpriteColor::getColorMode(SecondaryColor);
}
else
{
if ( !cocos2d::CCArray::count(a1->m_selectedObjects) )
goto LABEL_22;
m_selectedObjects = a1->m_selectedObjects;
if ( !m_selectedObjects )
goto LABEL_22;
data = m_selectedObjects->data;
num = data->num;
if ( !data->num )
goto LABEL_22;
arr = data->arr;
v12 = -2;
ColorMode = -2;
v17 = (unsigned int)(&arr[num] + 0x3FFFFFFF);
v18 = (GameObject **)arr;
while ( (unsigned int)v18 <= v17 )
{
v20 = *v18++;
v19 = v20;
if ( !v20 )
break;
if ( !GameObject::canChangeCustomColor(v19) )
goto LABEL_22;
if ( GameObject::canChangeMainColor(v19) )
{
v23 = GameObject::getMainColor(v19);
v24 = GJSpriteColor::getColorMode(v23);
if ( ColorMode == -2 )
{
ColorMode = v24;
v25 = 0;
}
else
{
v25 = ColorMode != v24;
}
}
else
{
v25 = 0;
}
if ( GameObject::canChangeSecondaryColor(v19) )
{
v26 = GameObject::getSecondaryColor(v19);
v27 = GJSpriteColor::getColorMode(v26);
if ( v12 == -2 )
{
v12 = v27;
}
else if ( v12 != v27 )
{
goto LABEL_22;
}
}
if ( v25 )
goto LABEL_22;
}
}
if ( ColorMode >= 0 )
{
LABEL_19:
v21 = GameManager::sharedState();
*a2 = GJEffectManager::getColorAction(v21->m_levelEditorLayer->m_levelSettings->m_effectManager, ColorMode);
}
if ( v12 >= 0 )
{
v22 = GameManager::sharedState();
*a3 = GJEffectManager::getColorAction(v22->m_levelEditorLayer->m_levelSettings->m_effectManager, v12);
}
LABEL_22:
if ( !*a2 )
{
if ( *a3 )
{
*a2 = *a3;
*a3 = nullptr;
}
}
}