//
// LevelEditorLayer::transferDefaultColors from 0x100360670 to 0x10036083c (460 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::updateGameObjects @ 0x100358984
// > LevelEditorLayer::onPlaytest @ 0x100362b84
//
// 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::transferDefaultColors(LevelEditorLayer *a1, GJEffectManager *a2, GJEffectManager *a3)
{
cocos2d::CCArray *AllColorActions; // x0
cocos2d::ccArray *data; // x9
__int64 num; // x8
cocos2d::CCObject **arr; // x21
unsigned __int64 v9; // x22
cocos2d::CCObject *v10; // x23
ColorAction *ColorAction; // x0
int m_uIndexInArray; // w8
bool v13; // zf
cocos2d::ccColor3B *p_m_nTag; // x8
__int16 v15; // w9
PlayerObject *m_player1; // x8
__int16 v17; // w21
GLubyte b; // w22
ColorAction *v19; // x0
PlayerObject *v20; // x8
__int16 v21; // w21
GLubyte v22; // w22
ColorAction *v23; // x0
PlayerObject *v24; // x8
__int16 v25; // w21
GLubyte v26; // w22
ColorActionSprite *ColorSprite; // x0
PlayerObject *v28; // x8
__int16 v29; // w21
GLubyte v30; // w22
ColorActionSprite *v31; // x0
PlayerObject *v32; // x8
__int16 v33; // w21
GLubyte v34; // w22
ColorActionSprite *v35; // x0
PlayerObject *v36; // x8
__int16 v37; // w21
GLubyte v38; // w22
ColorActionSprite *v39; // x0
GJEffectManager *m_effectManager; // x19
cocos2d::ccColor3B v41; // 0:w0.3
AllColorActions = GJEffectManager::getAllColorActions(a2);
if ( AllColorActions )
{
data = AllColorActions->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
v9 = (unsigned __int64)&arr[num - 1];
do
{
v10 = *arr;
if ( !*arr )
break;
ColorAction = GJEffectManager::getColorAction(a3, v10[1].m_uUnknown);
m_uIndexInArray = v10[1].m_uIndexInArray;
if ( m_uIndexInArray <= 0 )
{
p_m_nTag = (cocos2d::ccColor3B *)&v10[1].m_nTag;
}
else
{
v13 = m_uIndexInArray == 1;
p_m_nTag = &a1->m_player1->m_playerColor2;
if ( v13 )
p_m_nTag = &a1->m_player1->m_playerColor1;
}
v15 = *(_WORD *)&p_m_nTag->r;
ColorAction->m_toColor.b = p_m_nTag->b;
*(_WORD *)&ColorAction->m_toColor.r = v15;
LODWORD(ColorAction->m_toOpacity) = v10[1].m_unknown2;
ColorAction->m_blending = v10[1].m_eObjType;
ColorAction->m_copyID = v10[2].m_uID;
ColorAction->m_copyHSV = *(cocos2d::ccHSVValue *)&v10[1].m_uOrderOfArrival;
ColorAction->m_copyOpacity = BYTE1(v10[2].m_nLuaID);
GJEffectManager::colorActionChanged(a3, ColorAction);
++arr;
}
while ( (unsigned __int64)arr <= v9 );
}
}
m_player1 = a1->m_player1;
v17 = *(_WORD *)&m_player1->m_playerColor1.r;
b = m_player1->m_playerColor1.b;
v19 = GJEffectManager::getColorAction(a3, 1005);
v19->m_toColor.b = b;
*(_WORD *)&v19->m_toColor.r = v17;
v20 = a1->m_player1;
v21 = *(_WORD *)&v20->m_playerColor2.r;
v22 = v20->m_playerColor2.b;
v23 = GJEffectManager::getColorAction(a3, 1006);
v23->m_toColor.b = v22;
*(_WORD *)&v23->m_toColor.r = v21;
v24 = a1->m_player1;
v25 = *(_WORD *)&v24->m_playerColor1.r;
v26 = v24->m_playerColor1.b;
ColorSprite = GJEffectManager::getColorSprite(a3, 1005);
ColorSprite->m_color.b = v26;
*(_WORD *)&ColorSprite->m_color.r = v25;
v28 = a1->m_player1;
v29 = *(_WORD *)&v28->m_playerColor1.r;
v30 = v28->m_playerColor1.b;
v31 = GJEffectManager::getColorSprite(a3, 1005);
v31->m_copyColor.b = v30;
*(_WORD *)&v31->m_copyColor.r = v29;
v32 = a1->m_player1;
v33 = *(_WORD *)&v32->m_playerColor2.r;
v34 = v32->m_playerColor2.b;
v35 = GJEffectManager::getColorSprite(a3, 1006);
v35->m_color.b = v34;
*(_WORD *)&v35->m_color.r = v33;
v36 = a1->m_player1;
v37 = *(_WORD *)&v36->m_playerColor2.r;
v38 = v36->m_playerColor2.b;
v39 = GJEffectManager::getColorSprite(a3, 1006);
v39->m_copyColor.b = v38;
*(_WORD *)&v39->m_copyColor.r = v37;
m_effectManager = a1->m_effectManager;
v41 = GJEffectManager::activeColorForIndex(m_effectManager, 1005);
GJEffectManager::calculateLightBGColor(m_effectManager, (cocos2d::ccColor3B)(*(_DWORD *)&v41.r & 0xFFFFFF));
}