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.
This commit is contained in:
Christoph Oelckers 2018-06-19 08:32:25 +02:00
parent 01bda6348e
commit d73d89762d
3 changed files with 10 additions and 10 deletions

View file

@ -177,9 +177,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));
}
@ -292,7 +292,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))
{
@ -339,12 +339,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

View file

@ -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 ();

View file

@ -872,7 +872,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;