//
// LevelEditorLayer::resetUnusedColorChannels from 0x100360448 to 0x1003605bc (372 bytes)
//
// 1 xrefs:
// > EditorPauseLayer::FLAlert_Clicked @ 0x10039e89c
//
// 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 __fastcall LevelEditorLayer::resetUnusedColorChannels(LevelEditorLayer *a1)
{
cocos2d::CCArray *m_objects; // x8
cocos2d::ccArray *data; // x9
__int64 num; // x8
GameObject **arr; // x21
unsigned __int64 v6; // x22
GameObject *v7; // x20
int SecondaryColorMode; // w0
cocos2d::CCArray *m_colorTriggers; // x8
cocos2d::ccArray *v10; // x9
__int64 v11; // x8
GameObject **v12; // x20
unsigned __int64 v13; // x21
cocos2d::CCDictionary *m_unkObject148; // x8
cocos2d::CCDictElement *m_pElements; // x20
cocos2d::CCObject *m_pObject; // x8
int v17; // [xsp+8h] [xbp-58h] BYREF
int MainColorMode; // [xsp+Ch] [xbp-54h] BYREF
_QWORD v19[4]; // [xsp+10h] [xbp-50h] BYREF
int v20; // [xsp+30h] [xbp-30h]
memset(v19, 0, sizeof(v19));
v20 = 1065353216;
m_objects = a1->m_objects;
if ( m_objects )
{
data = m_objects->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (GameObject **)data->arr;
v6 = (unsigned __int64)&arr[num - 1];
do
{
v7 = *arr;
if ( !*arr )
break;
MainColorMode = GameObject::getMainColorMode(*arr);
SecondaryColorMode = GameObject::getSecondaryColorMode(v7);
v17 = SecondaryColorMode;
if ( MainColorMode <= 999 )
{
sub_10001C1B0((unsigned __int64)v19, &MainColorMode, &MainColorMode);
SecondaryColorMode = v17;
}
if ( SecondaryColorMode <= 999 )
sub_10001C1B0((unsigned __int64)v19, &v17, &v17);
++arr;
}
while ( (unsigned __int64)arr <= v6 );
}
}
m_colorTriggers = a1->m_colorTriggers;
if ( m_colorTriggers )
{
v10 = m_colorTriggers->data;
v11 = v10->num;
if ( (_DWORD)v11 )
{
v12 = (GameObject **)v10->arr;
v13 = (unsigned __int64)&v12[v11 - 1];
do
{
if ( !*v12 )
break;
MainColorMode = GameObject::getColorIndex(*v12);
if ( MainColorMode <= 999 )
sub_10001C1B0((unsigned __int64)v19, &MainColorMode, &MainColorMode);
++v12;
}
while ( (unsigned __int64)v12 <= v13 );
}
}
m_unkObject148 = a1->m_levelSettings->GJBaseGameLayer::m_effectManager->m_unkObject148;
if ( m_unkObject148 )
{
m_pElements = m_unkObject148->m_pElements;
while ( m_pElements )
{
m_pObject = m_pElements->m_pObject;
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
MainColorMode = m_pObject[1].m_uUnknown;
if ( (unsigned int)(MainColorMode - 1) <= 0x3E6 && !sub_100018814(v19, &MainColorMode) )
GJEffectManager::removeColorAction(a1->m_levelSettings->GJBaseGameLayer::m_effectManager, MainColorMode);
}
}
sub_100017A98((__int64)v19);
}