From be9b25e76057b092b6f9a633c81793cd612024dc Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 25 Apr 2016 13:27:27 -0500 Subject: [PATCH] Use ViewRoll instead of CamRoll, and removed CamRoll entirely. Begin work on interpolation. --- src/g_shared/a_quake.cpp | 2 +- src/p_mobj.cpp | 5 ++--- src/r_utility.cpp | 9 ++++----- src/r_utility.h | 1 + src/thingdef/thingdef_codeptr.cpp | 1 - 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index bcbe058145..7da5824b89 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -72,7 +72,7 @@ void DEarthquake::Serialize (FArchive &arc) << m_QuakeSFX << m_Flags << m_CountdownStart << m_WaveSpeed << m_Falloff << m_Highpoint << m_MiniCount - << m_RollIntensity; + << m_RollIntensity << m_RollWave; } //========================================================================== diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index ffb1c3a4f2..b7d8871951 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -238,7 +238,6 @@ void AActor::Serialize(FArchive &arc) << Angles.Yaw << Angles.Pitch << Angles.Roll - << Angles.CamRoll << frame << Scale << RenderStyle @@ -4593,7 +4592,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) } mobj->Angles.Yaw = SpawnAngle; - mobj->Angles.Pitch = mobj->Angles.Roll = mobj->Angles.CamRoll = 0.; + mobj->Angles.Pitch = mobj->Angles.Roll = 0.; mobj->health = p->health; // [RH] Set player sprite based on skin @@ -5075,7 +5074,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) if (mthing->pitch) mobj->Angles.Pitch = (double)mthing->pitch; if (mthing->roll) - mobj->Angles.Roll = mobj->Angles.CamRoll = (double)mthing->roll; + mobj->Angles.Roll = (double)mthing->roll; if (mthing->score) mobj->Score = mthing->score; if (mthing->fillcolor) diff --git a/src/r_utility.cpp b/src/r_utility.cpp index dc32a2c707..a61227a5c0 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -108,6 +108,7 @@ int viewwindowy; DVector3 ViewPos; DAngle ViewAngle; DAngle ViewPitch; +DAngle ViewRoll; DVector3 ViewPath[2]; extern "C" @@ -542,11 +543,13 @@ void R_InterpolateView (player_t *player, double Frac, InterpolationViewer *ivie ViewAngle = (nviewangle + AngleToFloat(LocalViewAngle & 0xFFFF0000)).Normalized180(); DAngle delta = player->centering ? DAngle(0.) : AngleToFloat(int(LocalViewPitch & 0xFFFF0000)); ViewPitch = clamp((iview->New.Angles.Pitch - delta).Normalized180(), player->MinPitch, player->MaxPitch); + ViewRoll = iview->New.Angles.Roll.Normalized180(); } else { ViewPitch = (iview->Old.Angles.Pitch + deltaangle(iview->Old.Angles.Pitch, iview->New.Angles.Pitch) * Frac).Normalized180(); ViewAngle = (oviewangle + deltaangle(oviewangle, nviewangle) * Frac).Normalized180(); + ViewRoll = iview->Old.Angles.Roll.Normalized180(); } // Due to interpolation this is not necessarily the same as the sector the camera is in. @@ -871,7 +874,7 @@ void R_SetupFrame (AActor *actor) if (jiggers.RollIntensity != 0 || jiggers.RollWave != 0) { - camera->Angles.CamRoll = camera->Angles.Roll + QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.Falloff, jiggers.WFalloff); + ViewRoll += QuakePower(quakefactor, jiggers.RollIntensity, jiggers.RollWave, jiggers.Falloff, jiggers.WFalloff); } if (jiggers.RelIntensity.X != 0 || jiggers.RelOffset.X != 0) { @@ -903,10 +906,6 @@ void R_SetupFrame (AActor *actor) ViewPos.Z += QuakePower(quakefactor, jiggers.Intensity.Z, jiggers.Offset.Z, jiggers.Falloff, jiggers.WFalloff); } } - else - { - camera->Angles.CamRoll = camera->Angles.Roll; - } } extralight = camera->player ? camera->player->extralight : 0; diff --git a/src/r_utility.h b/src/r_utility.h index a89e4e50cb..f15d42052f 100644 --- a/src/r_utility.h +++ b/src/r_utility.h @@ -15,6 +15,7 @@ extern DCanvas *RenderTarget; extern DVector3 ViewPos; extern DAngle ViewAngle; extern DAngle ViewPitch; +extern DAngle ViewRoll; extern DVector3 ViewPath[2]; extern "C" int centerx, centerxwide; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 689e9425a1..fe464b1371 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2388,7 +2388,6 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags) if (flags & SIXF_TRANSFERROLL) { mo->Angles.Roll = self->Angles.Roll; - mo->Angles.CamRoll = self->Angles.CamRoll; } if (flags & SIXF_ISTARGET)