Fix a crash relating to SetAlphaModulation

This commit is contained in:
Riley 2024-05-27 21:35:50 -05:00
parent 0f511b7f24
commit 52619df35e

View File

@ -3,8 +3,20 @@
MAKE_HOOK(StudioRender_SetAlphaModulation, U::Memory.GetVFunc(I::StudioRender, 28), void, __fastcall,
void* ecx, float flAlpha)
{
if (Vars::Visuals::World::Modulations.Value & (1 << 2) && G::DrawingProps && !(Vars::Visuals::UI::CleanScreenshots.Value && I::EngineClient->IsTakingScreenshot()))
return CALL_ORIGINAL(ecx, float(Vars::Colors::PropModulation.Value.a) / 255.f * flAlpha);
if(Vars::Visuals::World::Modulations.Value & (1 << 2) &&
G::DrawingProps &&
!(Vars::Visuals::UI::CleanScreenshots.Value && I::EngineClient->IsTakingScreenshot()))
{
auto flVal = Vars::Colors::PropModulation.Value.a / 255.f * flAlpha;
if(flVal == 0.f)
{
flVal = 1.f;
}
return CALL_ORIGINAL(ecx, flVal);
}
CALL_ORIGINAL(ecx, flAlpha);
}