//
// GJEffectManager::calculateLightBGColor from 0x14036e270 to 0x14036e46a (506 bytes)
//
// 6 xrefs:
// > LevelEditorLayer::updateVisibility @ 0x1403f656d
// > LevelEditorLayer::transferDefaultColors @ 0x1403fa93b
// > LevelEditorLayer::updateGameObjects @ 0x1403fb16c
// > LevelEditorLayer::postUpdate @ 0x14040093b
// > PlayLayer::updateVisibility @ 0x14050df8d
// > ??> @ 0x140921a64
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:30:58 +0000
//
char *__fastcall GJEffectManager::calculateLightBGColor(__int64 a1, __int64 a2)
{
char *ColorSprite; // rax
unsigned __int16 v5; // bx
unsigned __int8 v6; // di
float v7; // xmm6_4
__int16 v8; // si
int v9; // ebp
float v10; // xmm5_4
unsigned __int16 v11; // cx
float v12; // xmm5_4
float v13; // xmm4_4
float v14; // xmm2_4
float v15; // xmm3_4
char *v16; // rax
char *result; // rax
__int16 v18; // [rsp+20h] [rbp-68h]
float v19[7]; // [rsp+30h] [rbp-58h] BYREF
float v20; // [rsp+4Ch] [rbp-3Ch]
unsigned __int16 v21; // [rsp+A0h] [rbp+18h] BYREF
unsigned __int8 v22; // [rsp+A2h] [rbp+1Ah]
__int16 v23; // [rsp+A8h] [rbp+20h] BYREF
unsigned __int8 v24; // [rsp+AAh] [rbp+22h]
ColorSprite = GJEffectManager::getColorSprite(a1, 1000);
if ( ColorSprite )
{
v5 = *(_WORD *)(ColorSprite + 327);
v6 = ColorSprite[329];
}
else
{
v5 = -1;
v6 = -1;
}
LOWORD(v20) = 257;
v19[3] = v20;
v22 = v6;
v7 = 0.0;
v21 = v5;
v19[0] = 0.0;
v19[1] = -0.2;
v19[2] = 0.2;
GameToolbox::transformColor((__int64)&v23, &v21, v19);
v8 = v23;
LOBYTE(v9) = v24;
v10 = (float)((unsigned __int8)v5 + HIBYTE(v21) + v6);
if ( v10 < 150.0 )
{
v11 = *(_WORD *)a2;
v12 = v10 / 150.0;
v21 = *(_WORD *)a2;
v13 = fminf((float)((float)v24 * v12) + (float)((float)*(unsigned __int8 *)(a2 + 2) * (float)(1.0 - v12)), 255.0);
if ( v13 < 0.0 )
v13 = 0.0;
v14 = fminf((float)((float)HIBYTE(v23) * v12) + (float)((float)HIBYTE(v11) * (float)(1.0 - v12)), 255.0);
if ( v14 < 0.0 )
v14 = 0.0;
v15 = fminf(
(float)((float)(unsigned __int8)v23 * v12) + (float)((float)(unsigned __int8)v11 * (float)(1.0 - v12)),
255.0);
if ( v15 >= 0.0 )
v7 = v15;
v9 = (int)v13;
LOBYTE(v18) = (int)v7;
HIBYTE(v18) = (int)v14;
v8 = v18;
}
v16 = GJEffectManager::getColorSprite(a1, 1007);
*((_WORD *)v16 + 162) = v8;
v16[326] = v9;
result = GJEffectManager::getColorSprite(a1, 1007);
*(_WORD *)(result + 327) = v8;
result[329] = v9;
return result;
}