shithub: choc

Download patch

ref: 2e6406e08349f3bfb6f5d38ac5042aca7a02073d
parent: 51948fd78f11d689af0c8a6201fcfd3b87392c77
author: Simon Howard <fraggle@gmail.com>
date: Mon Dec 28 15:57:20 EST 2009

When recording low resolution (non-longtics) Vanilla demos, carry
forward the error from angleturn caused by the reduced resolution, so
that consecutive errors can accumulate, possibly making turning slightly
smoother.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1770

--- a/src/g_game.c
+++ b/src/g_game.c
@@ -650,10 +650,20 @@
 
     if (lowres_turn)
     {
-        // round angleturn to the nearest 256 boundary
+        static signed short carry = 0;
+        signed short desired_angleturn;
+
+        desired_angleturn = cmd->angleturn + carry;
+
+        // round angleturn to the nearest 256 unit boundary
         // for recording demos with single byte values for turn
 
-        cmd->angleturn = (cmd->angleturn + 128) & 0xff00;
+        cmd->angleturn = (desired_angleturn + 128) & 0xff00;
+
+        // Carry forward the error from the reduced resolution to the
+        // next tic, so that successive small movements can accumulate.
+
+        carry = desired_angleturn - cmd->angleturn;
     }
 }