From 64961430223850e1851cff6e4b5ebc60f2c9ec29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Wed, 27 Nov 2019 23:58:22 +0300 Subject: [PATCH] Shadow/blood fade and scale fix --- src/peds/Ped.cpp | 6 +++--- src/render/Shadows.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index f18273e8..0f304c38 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -9244,7 +9244,7 @@ CPed::ProcessControl(void) float timeDependentDist; if (remainingBloodyFpTime >= 2000) { if (remainingBloodyFpTime <= 7000) - timeDependentDist = (remainingBloodyFpTime - 2000) / 5000 * 0.75f; + timeDependentDist = (remainingBloodyFpTime - 2000) / 5000.0f * 0.75f; else timeDependentDist = 0.75f; } else { @@ -9288,8 +9288,8 @@ CPed::ProcessControl(void) } else { CShadows::StoreStaticShadow( (uintptr)this + 17, SHADOWTYPE_DARK, gpBloodPoolTex, &bloodPos, - (remainingBloodyFpTime - 2000) / 5000 * 0.75f, 0.0f, - 0.0f, (remainingBloodyFpTime - 2000) / 5000 * -0.75f, + (remainingBloodyFpTime - 2000) / 5000.0f * 0.75f, 0.0f, + 0.0f, (remainingBloodyFpTime - 2000) / 5000.0f * -0.75f, 255, 255, 0, 0, 4.0f, 1.0f, 40.0f, false, 0.0f); } } diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index 5b6bb976..1d100d4d 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -1516,11 +1516,11 @@ CShadows::UpdatePermanentShadows(void) aPermanentShadows[i].m_nType = SHADOWTYPE_NONE; else { - if ( timePassed >= (aPermanentShadows[i].m_nLifeTime*(1-(1/4))) ) + if ( timePassed >= (aPermanentShadows[i].m_nLifeTime * 3 / 4) ) { // timePassed == 0 -> 4 // timePassed == aPermanentShadows[i].m_nLifeTime -> 0 - float fMult = 1.0f - (timePassed - (aPermanentShadows[i].m_nLifeTime*(1-(1/4)))) / (aPermanentShadows[i].m_nLifeTime / 4); + float fMult = 1.0f - float(timePassed - (aPermanentShadows[i].m_nLifeTime * 3 / 4)) / (aPermanentShadows[i].m_nLifeTime / 4); StoreStaticShadow((uint32)&aPermanentShadows[i], aPermanentShadows[i].m_nType,