//
// EditorUI::getEditColorTargets from 0x68c9b4 to 0x68cc68 (692 bytes)
//
// 3 xrefs:
// > EditorUI::updateEditColorButton @ 0x68cd90
// > EditorUI::editColor @ 0x68e1e0
// > ??> @ 0xb2878
//
// 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; // x1
GJSpriteColor *v8; // x0
int v9; // w19
int v10; // w0
GameManager *v11; // x0
GJSpriteColor *v12; // x0
int v13; // w23
int v14; // w0
GameManager *v15; // x0
cocos2d::CCArray *m_selectedObjects; // x0
cocos2d::ccArray *data; // x1
GameObject **arr; // x24
GameObject **v19; // x25
GameObject *v20; // x22
GJSpriteColor *v21; // x0
int v22; // w0
GJSpriteColor *MainColor; // x0
int m_colorID; // w1
int m_defaultColorID; // w0
int v26; // w26
GJSpriteColor *SecondaryColor; // x0
int v28; // w1
int v29; // w0
m_selectedObject = a1->m_selectedObject;
if ( !m_selectedObject )
{
if ( !(unsigned int)cocos2d::CCArray::count(a1->m_selectedObjects) )
goto LABEL_4;
m_selectedObjects = a1->m_selectedObjects;
if ( !m_selectedObjects )
goto LABEL_4;
data = m_selectedObjects->data;
if ( !data->num )
goto LABEL_4;
arr = (GameObject **)data->arr;
v19 = &arr[data->num - 1];
if ( arr > v19 )
goto LABEL_4;
v20 = *arr;
if ( !*arr )
goto LABEL_4;
v9 = -2;
v13 = -2;
while ( 1 )
{
if ( !GameObject::canChangeCustomColor(v20) )
goto LABEL_4;
if ( GameObject::canChangeMainColor(v20) )
{
MainColor = GameObject::getMainColor(v20);
m_colorID = MainColor->m_colorID;
m_defaultColorID = MainColor->m_defaultColorID;
if ( m_colorID == m_defaultColorID || !m_colorID )
m_colorID = m_defaultColorID;
if ( v13 == -2 )
{
v13 = m_colorID;
}
else if ( v13 != m_colorID )
{
if ( !GameObject::canChangeSecondaryColor(v20) )
goto LABEL_4;
v26 = 1;
goto LABEL_45;
}
}
if ( !GameObject::canChangeSecondaryColor(v20) )
goto LABEL_28;
v26 = 0;
LABEL_45:
SecondaryColor = GameObject::getSecondaryColor(v20);
v28 = SecondaryColor->m_colorID;
v29 = SecondaryColor->m_defaultColorID;
if ( v28 == v29 || !v28 )
v28 = v29;
if ( v9 != -2 && v9 != v28 || v26 )
goto LABEL_4;
v9 = v28;
LABEL_28:
if ( v19 >= ++arr )
{
v20 = *arr;
if ( *arr )
continue;
}
goto LABEL_30;
}
}
if ( EditorUI::isLiveColorSelectTrigger(a1, m_selectedObject) )
{
*a4 = (EffectGameObject *)a1->m_selectedObject;
goto LABEL_4;
}
if ( GameObject::canChangeMainColor(a1->m_selectedObject) )
{
v12 = GameObject::getMainColor(a1->m_selectedObject);
v13 = v12->m_colorID;
v14 = v12->m_defaultColorID;
if ( v13 == v14 || !v13 )
v13 = v14;
if ( !GameObject::canChangeSecondaryColor(a1->m_selectedObject) )
{
v9 = -1;
if ( v13 < 0 )
goto LABEL_4;
goto LABEL_18;
}
v21 = GameObject::getSecondaryColor(a1->m_selectedObject);
v9 = v21->m_colorID;
v22 = v21->m_defaultColorID;
if ( v9 != v22 && v9 )
{
LABEL_30:
if ( v13 < 0 )
goto LABEL_10;
LABEL_18:
v15 = GameManager::sharedState();
*a2 = GJEffectManager::getColorAction(v15->m_levelEditorLayer->m_levelSettings->m_effectManager, v13);
goto LABEL_10;
}
v9 = v22;
}
else
{
if ( !GameObject::canChangeSecondaryColor(a1->m_selectedObject) )
goto LABEL_4;
v8 = GameObject::getSecondaryColor(a1->m_selectedObject);
v9 = v8->m_colorID;
v10 = v8->m_defaultColorID;
if ( v9 != v10 && v9 )
goto LABEL_10;
v13 = -1;
v9 = v10;
}
if ( (v13 & 0x80000000) == 0 )
goto LABEL_18;
LABEL_10:
if ( (v9 & 0x80000000) == 0 )
{
v11 = GameManager::sharedState();
*a3 = GJEffectManager::getColorAction(v11->m_levelEditorLayer->m_levelSettings->m_effectManager, v9);
if ( *a2 )
return;
goto LABEL_12;
}
LABEL_4:
if ( *a2 )
return;
LABEL_12:
if ( *a3 )
{
*a2 = *a3;
*a3 = nullptr;
}
}