]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
add view_ofs before chase_active code, this should fix a bug in prophecy
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 5 Jun 2008 07:41:03 +0000 (07:41 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 5 Jun 2008 07:41:03 +0000 (07:41 +0000)
where the camera trace starts at the player's feet and glitches on
stairs

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8328 d7cf8633-e32d-0410-b094-e92efae38249

view.c

diff --git a/view.c b/view.c
index 5af9ff1358be471bb0606c4c83130195a705eccf..431a78ae334e148bf848c74a22962b0a3f172216 100644 (file)
--- a/view.c
+++ b/view.c
@@ -390,6 +390,9 @@ void V_CalcRefdef (void)
                        // TODO: add a cvar to disable this
                        viewangles[PITCH] += cl.qw_weaponkick;
 
+                       // apply the viewofs (even if chasecam is used)
+                       vieworg[2] += cl.stats[STAT_VIEWHEIGHT];
+
                        if (chase_active.value)
                        {
                                // observing entity from third person. Added "campitch" by Alexander "motorsep" Zubov
@@ -399,9 +402,6 @@ void V_CalcRefdef (void)
                                camup = chase_up.value;
                                campitch = chase_pitchangle.value;
 
-                               // this + 22 is to match view_ofs for compatibility with older versions
-                               camup += 22;
-
                                AngleVectors(viewangles, forward, NULL, NULL);
 
                                if (chase_overhead.integer)
@@ -423,6 +423,7 @@ void V_CalcRefdef (void)
                                        VectorCopy(trace.endpos, vieworg);
                                        vieworg[2] -= 8;
 #else
+                                       // trace from first person view location to our chosen third person view location
                                        trace = CL_Move(vieworg, camboxmins, camboxmaxs, chase_dest, MOVE_NOMONSTERS, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_SKY, true, false, NULL, false);
                                        VectorCopy(trace.endpos, bestvieworg);
                                        offset[2] = 0;
@@ -478,7 +479,6 @@ void V_CalcRefdef (void)
                                }
                                // origin
                                VectorAdd(vieworg, cl.punchvector, vieworg);
-                               vieworg[2] += cl.stats[STAT_VIEWHEIGHT];
                                if (cl.stats[STAT_HEALTH] > 0)
                                {
                                        double xyspeed, bob;