From 54e6922f28e3ee8dde359ce1e10a8d55c3597d84 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Jun 2018 08:32:25 +0200 Subject: [PATCH] Don't let DEarthquake depend on r_viewpoint. The ticFrac value should be passed as a parameter, especially since this gets called from code that sets up r_viewpoint. --- src/g_shared/a_quake.cpp | 14 +++++++------- src/g_shared/a_sharedglobal.h | 4 ++-- src/r_utility.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index 10010c3f9..d21e63f53 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -181,9 +181,9 @@ void DEarthquake::Tick () // //========================================================================== -double DEarthquake::GetModWave(double waveMultiplier) const +double DEarthquake::GetModWave(double ticFrac, double waveMultiplier) const { - double time = m_Countdown - r_viewpoint.TicFrac; + double time = m_Countdown - ticFrac; return g_sin(waveMultiplier * time * (M_PI * 2 / TICRATE)); } @@ -296,7 +296,7 @@ double DEarthquake::GetFalloff(double dist) const // //========================================================================== -int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jiggers) +int DEarthquake::StaticGetQuakeIntensities(double ticFrac, AActor *victim, FQuakeJiggers &jiggers) { if (victim->player != NULL && (victim->player->cheats & CF_NOCLIP)) { @@ -343,12 +343,12 @@ int DEarthquake::StaticGetQuakeIntensities(AActor *victim, FQuakeJiggers &jigger } else { - jiggers.RollWave = r * quake->GetModWave(quake->m_RollWave) * falloff * strength; + jiggers.RollWave = r * quake->GetModWave(ticFrac, quake->m_RollWave) * falloff * strength; - intensity.X *= quake->GetModWave(quake->m_WaveSpeed.X); - intensity.Y *= quake->GetModWave(quake->m_WaveSpeed.Y); - intensity.Z *= quake->GetModWave(quake->m_WaveSpeed.Z); + intensity.X *= quake->GetModWave(ticFrac, quake->m_WaveSpeed.X); + intensity.Y *= quake->GetModWave(ticFrac, quake->m_WaveSpeed.Y); + intensity.Z *= quake->GetModWave(ticFrac, quake->m_WaveSpeed.Z); intensity *= strength * falloff; // [RH] This only gives effect to the last sine quake. I would diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index 9f1bff5d4..e2a033b07 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -145,10 +145,10 @@ public: double m_RollIntensity, m_RollWave; double GetModIntensity(double intensity, bool fake = false) const; - double GetModWave(double waveMultiplier) const; + double GetModWave(double ticFrac, double waveMultiplier) const; double GetFalloff(double dist) const; - static int StaticGetQuakeIntensities(AActor *viewer, FQuakeJiggers &jiggers); + static int StaticGetQuakeIntensities(double ticFrac, AActor *viewer, FQuakeJiggers &jiggers); private: DEarthquake (); diff --git a/src/r_utility.cpp b/src/r_utility.cpp index 45d19d9c6..650f7ed49 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -866,7 +866,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor FQuakeJiggers jiggers; memset(&jiggers, 0, sizeof(jiggers)); - if (DEarthquake::StaticGetQuakeIntensities(viewpoint.camera, jiggers) > 0) + if (DEarthquake::StaticGetQuakeIntensities(viewpoint.TicFrac, viewpoint.camera, jiggers) > 0) { double quakefactor = r_quakeintensity; DAngle an;