//
// GJEffectManager::calculateLightBGColor from 0x1002edba0 to 0x1002edd2d (397 bytes)
//
// 5 xrefs:
// > PlayLayer::updateVisibility @ 0x1000b706b
// > LevelEditorLayer::updateGameObjects @ 0x1000de06e
// > LevelEditorLayer::updateVisibility @ 0x1000ead8f
// > LevelEditorLayer::transferDefaultColors @ 0x1000eeb49
// > LevelEditorLayer::postUpdate @ 0x1000f346a
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall GJEffectManager::calculateLightBGColor(GJEffectManager *a1, cocos2d::ccColor3B a2)
{
__int64 v2; // rax
ColorActionSprite *ColorSprite; // rax
int v4; // eax
int v5; // eax
int v6; // ebx
int v7; // eax
float v8; // xmm0_4
int v9; // [rsp+0h] [rbp-1Ch] BYREF
v9 = HIDWORD(v2);
ColorSprite = GJEffectManager::getColorSprite(a1, 1000);
if ( ColorSprite )
v4 = *(unsigned __int16 *)&ColorSprite->m_copyColor.r | (ColorSprite->m_copyColor.b << 16);
else
v4 = 0xFFFFFF;
LOWORD(v9) = v4;
BYTE2(v9) = BYTE2(v4);
*(cocos2d::ccColor3B *)&v5 = GameToolbox::transformColor((const cocos2d::ccColor3B *)&v9, 0.0, -0.2, 0.2);
v6 = v5;
v7 = (unsigned __int8)v9 + BYTE1(v9) + BYTE2(v9);
if ( (unsigned int)v7 <= 0x95 )
{
v8 = (float)v7 / 150.0;
v6 = ((int)fmaxf(
fminf(
255.0,
(float)((float)((v6 & 0xFF0000u) >> 16) * v8)
+ (float)((float)((*(_DWORD *)&a2.r & 0xFF0000u) >> 16) * (float)(1.0 - v8))),
0.0) << 16)
| ((unsigned __int8)(int)fmaxf(
fminf(
255.0,
(float)((float)BYTE1(v6) * v8) + (float)((float)a2.g * (float)(1.0 - v8))),
0.0) << 8)
| (unsigned __int8)(int)fmaxf(
fminf(
255.0,
(float)((float)(unsigned __int8)v6 * v8) + (float)((float)a2.r * (float)(1.0 - v8))),
0.0);
}
GJEffectManager::getColorSprite(a1, 1007)->m_color = (cocos2d::ccColor3B)v6;
GJEffectManager::getColorSprite(a1, 1007)->m_copyColor = (cocos2d::ccColor3B)v6;
}