Make StudioRender fix better.

This commit is contained in:
Riley 2024-05-28 00:05:48 -05:00
parent 5903015df9
commit 682654fcf8
2 changed files with 25 additions and 13 deletions

View File

@ -7,16 +7,15 @@ MAKE_HOOK(StudioRender_SetAlphaModulation, U::Memory.GetVFunc(I::StudioRender, 2
G::DrawingProps &&
!(Vars::Visuals::UI::CleanScreenshots.Value && I::EngineClient->IsTakingScreenshot()))
{
auto flVal = Vars::Colors::PropModulation.Value.a / 255.f * flAlpha;
// TODO: make these static?
auto PropVal = Vars::Colors::PropModulation.Value.a;
auto flHookAlpha = flAlpha;
if(flVal == 0.f)
if(PropVal || flHookAlpha)
{
flVal = 1.f;
auto flVal = PropVal / 255.f * flHookAlpha;
return CALL_ORIGINAL(ecx, flVal);
}
return CALL_ORIGINAL(ecx, flVal);
}
CALL_ORIGINAL(ecx, flAlpha);
}

View File

@ -5,13 +5,26 @@ MAKE_HOOK(StudioRender_SetColorModulation, U::Memory.GetVFunc(I::StudioRender, 2
{
if (Vars::Visuals::World::Modulations.Value & (1 << 2) && G::DrawingProps && !(Vars::Visuals::UI::CleanScreenshots.Value && I::EngineClient->IsTakingScreenshot()))
{
const float flCustomBlend[3] = {
float(Vars::Colors::PropModulation.Value.r) / 255.f,
float(Vars::Colors::PropModulation.Value.g) / 255.f,
float(Vars::Colors::PropModulation.Value.b) / 255.f
};
// TODO: make these static?
auto Red = Vars::Colors::PropModulation.Value.r;
auto Green = Vars::Colors::PropModulation.Value.g;
auto Blue = Vars::Colors::PropModulation.Value.b;
return CALL_ORIGINAL(ecx, flCustomBlend);
// Assert the values to make sure they aren't 0, we're dividing here.
if(Red || Green || Blue)
{
float flRed = Red / 255.f;
float flGreen = Green / 255.f;
float flBlue = Blue / 255.f;
const float flBlend[3] = {
flRed,
flGreen,
flBlue
};
return CALL_ORIGINAL(ecx, flBlend);
}
}
CALL_ORIGINAL(ecx, pColor);