//
// GameToolbox::colorToSepia from 0x581148 to 0x581270 (296 bytes)
//
// 1 xrefs:
// > ??> @ 0x4a7c0
//
// 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!
cocos2d::ccColor3B GameToolbox::colorToSepia(cocos2d::ccColor3B a1, float a2)
{
double g; // d4
GLubyte v3; // w2
double r; // d3
double b; // d1
double v6; // d2
float v7; // s2
GLubyte v8; // w1
double v9; // d2
float v10; // s2
GLubyte v11; // w0
double v12; // d1
float v13; // s1
int v15; // [xsp+18h] [xbp+18h]
cocos2d::ccColor3B v16; // [xsp+20h] [xbp+20h]
cocos2d::ccColor3B v17; // [xsp+28h] [xbp+28h]
g = (double)a1.g;
v3 = -1;
r = (double)a1.r;
v15 = *(_DWORD *)&a1.r;
b = (double)a1.b;
v6 = g * 0.769 + r * 0.393 + b * 0.189;
if ( v6 < 255.0 )
{
v7 = v6;
v3 = (unsigned int)v7;
}
v8 = -1;
v9 = g * 0.686 + r * 0.349 + b * 0.168;
if ( v9 < 255.0 )
{
v10 = v9;
v8 = (unsigned int)v10;
}
v11 = -1;
v12 = g * 0.534 + r * 0.272 + b * 0.131;
if ( v12 < 255.0 )
{
v13 = v12;
v11 = (unsigned int)v13;
}
if ( a2 < 1.0 )
{
v16.r = v3;
v16.b = v11;
v16.g = v8;
v17 = GameToolbox::multipliedColorValue((cocos2d::ccColor3B)v15, v16, a2);
}
else
{
v17.r = v3;
v17.g = v8;
v17.b = v11;
}
return (cocos2d::ccColor3B)(v17.r | (unsigned __int16)(v17.g << 8) | (v17.b << 16));
}