]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
changes to dpprotocol code (precise aiming mainly)
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 26 Oct 2000 11:54:41 +0000 (11:54 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 26 Oct 2000 11:54:41 +0000 (11:54 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@63 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
common.c
common.h
sv_user.c

index bc6cbb1af50258094566e50f5fd4b432dc651f48..f3432d2230a5022a153e6daf128d261a1c408ea6 100644 (file)
@@ -382,8 +382,16 @@ void CL_SendMove (usercmd_t *cmd)
 
        MSG_WriteFloat (&buf, cl.mtime[0]);     // so server can get ping times
 
-       for (i=0 ; i<3 ; i++)
-               MSG_WriteAngle (&buf, cl.viewangles[i]);
+       if (dpprotocol)
+       {
+               for (i=0 ; i<3 ; i++)
+                       MSG_WritePreciseAngle (&buf, cl.viewangles[i]);
+       }
+       else
+       {
+               for (i=0 ; i<3 ; i++)
+                       MSG_WriteAngle (&buf, cl.viewangles[i]);
+       }
        
     MSG_WriteShort (&buf, forwardmove);
     MSG_WriteShort (&buf, sidemove);
index 27fd8bf88828b88ff10c6ad59dcb771715df7293..2c9c8cc11c07c6d42eba517bb339d6b651abeaca 100644 (file)
--- a/common.c
+++ b/common.c
@@ -583,44 +583,10 @@ void MSG_WriteString (sizebuf_t *sb, char *s)
                SZ_Write (sb, s, strlen(s)+1);
 }
 
-/*
-void MSG_WriteCoord (sizebuf_t *sb, float f)
-{
-       if (dpprotocol)
-       {
-               byte    *buf;
-               int c = (int)f;
-               buf = SZ_GetSpace (sb, 3);
-               buf[0] =  c        & 0xff;
-               buf[1] = (c >>  8) & 0xff;
-               buf[2] = (c >> 16) & 0xff;
-       }
-       else
-               MSG_WriteShort (sb, (int)(f*8));
-}
-*/
-
 void MSG_WriteCoord (sizebuf_t *sb, float f)
 {
        if (dpprotocol)
                MSG_WriteFloat(sb, f);
-       /*
-       {
-               int     i = (int) (f * 16.0f), j = 0, k, l;
-               // 1 sign bit, 5bit exponent, 10bit mantissa with implicit 1
-               if (i < 0)
-               {
-                       i = -i;
-                       j = 0x8000;
-               }
-
-               // LordHavoc: lets hope the compiler is good, if not it will still perform tolerably
-               for (k = 31,l = 0x80000000;!(i & l);k--,l >>= 1);
-               j |= k << 10 | ((i >> (k - 10)) & 0x3FF);
-               
-               MSG_WriteShort(sb, j);
-       }
-       */
        else
                MSG_WriteShort (sb, (int)(f*8));
 }
@@ -764,93 +730,12 @@ char *MSG_ReadString (void)
        return string;
 }
 
-/*
-float MSG_ReadAbsoluteCoord (void)
-{
-       if (dpprotocol)
-       {
-               int     c;
-               
-               if (msg_readcount+3 > net_message.cursize)
-               {
-                       msg_badread = true;
-                       return 0;
-               }
-                       
-               c  = net_message.data[msg_readcount  ];
-               c |= net_message.data[msg_readcount+1] << 8;
-               c |= net_message.data[msg_readcount+2] << 16;
-               if (c & 0x800000)
-                       c |= ~0xFFFFFF; // sign extend
-               
-               msg_readcount += 3;
-               
-               return (float) c * (1.0f / 16.0f);
-       }
-       else
-       {
-               int     c;
-               
-               if (msg_readcount+2 > net_message.cursize)
-               {
-                       msg_badread = true;
-                       return 0;
-               }
-                       
-               c  = (short) (net_message.data[msg_readcount  ] |= net_message.data[msg_readcount+1] << 8);
-               
-               msg_readcount += 2;
-               
-               return (float) c * (1.0f / 8.0f);
-//             return MSG_ReadShort() * (1.0f/8.0f);
-       }
-}
-*/
-
 float MSG_ReadCoord (void)
 {
        if (dpprotocol)
                return MSG_ReadFloat();
-       /*
-       {
-               int     c, i;
-               
-               if (msg_readcount+2 > net_message.cursize)
-               {
-                       msg_badread = true;
-                       return 0;
-               }
-                       
-               c  = net_message.data[msg_readcount  ] |= net_message.data[msg_readcount+1] << 8;
-               
-               msg_readcount += 2;
-
-               if (!c)
-                       return 0.0f;
-               // 1 sign bit, 5bit exponent, 10bit mantissa with implicit 1
-               i = ((c & 0x03FF) | (0x0400)) << (((c & 0x7C00) >> 10) - 10);
-               if (c & 0x8000)
-                       i = -i;
-               return i * (1.0f / 16.0f);
-       }
-       */
        else
-       {
-               int     c;
-               
-               if (msg_readcount+2 > net_message.cursize)
-               {
-                       msg_badread = true;
-                       return 0;
-               }
-                       
-               c  = (short) (net_message.data[msg_readcount  ] | (net_message.data[msg_readcount+1] << 8));
-               
-               msg_readcount += 2;
-               
-               return ((float) c * (1.0f / 8.0f));
-//             return MSG_ReadShort() * (1.0f/8.0f);
-       }
+               return MSG_ReadShort() * (1.0f/8.0f);
 }
 
 /*
@@ -863,12 +748,12 @@ float MSG_ReadAngle (void)
 {
        return MSG_ReadChar() * (360.0f/256.0f);
 }
-*/
 
 float MSG_ReadPreciseAngle (void)
 {
        return MSG_ReadShort() * (360.0f/65536);
 }
+*/
 
 
 //===========================================================================
index 8f1719316d59123617d8064e02e964da38ab1f0c..152112cbf6030bac6d9acffbd68e1165097f3102 100644 (file)
--- a/common.h
+++ b/common.h
@@ -113,6 +113,7 @@ void MSG_WriteFloat (sizebuf_t *sb, float f);
 void MSG_WriteString (sizebuf_t *sb, char *s);
 void MSG_WriteCoord (sizebuf_t *sb, float f);
 void MSG_WriteAngle (sizebuf_t *sb, float f);
+void MSG_WritePreciseAngle (sizebuf_t *sb, float f);
 
 extern int                     msg_readcount;
 extern qboolean        msg_badread;            // set if a read goes beyond end of message
@@ -133,7 +134,8 @@ char *MSG_ReadString (void);
 float MSG_ReadCoord (void);
 //float MSG_ReadAngle (void);
 
-#define MSG_ReadAngle() (dpprotocol ? MSG_ReadShort() * (360.0f / 65536.0f) : MSG_ReadByte() * (360.0f / 256.0f))
+#define MSG_ReadAngle() (MSG_ReadByte() * (360.0f / 256.0f))
+#define MSG_ReadPreciseAngle() (MSG_ReadShort() * (360.0f / 65536.0f))
 
 extern qboolean dpprotocol;
 
index 7b286dd2dae350bd89e9e10d9d7e9fd26004ffff..12ef6157b964a51d775e7a9beab341299d52f2f8 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -459,13 +459,22 @@ void SV_ReadClientMove (usercmd_t *move)
        for (i=0, total = 0;i < NUM_PING_TIMES;i++)
                total += host_client->ping_times[i];
        host_client->ping = total / NUM_PING_TIMES; // can be used for prediction
-       host_client->latency = host_client->ping + sv_frametime; // push ahead by ticrate
+       if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) ) // if paused for any reason, don't predict
+               host_client->latency = host_client->ping + sv_frametime; // push ahead by ticrate
        if ((val = GETEDICTFIELDVALUE(host_client->edict, eval_ping)))
                val->_float = host_client->ping * 1000.0;
 
-// read current angles 
-       for (i=0 ; i<3 ; i++)
-               angle[i] = MSG_ReadAngle ();
+// read current angles
+       if (dpprotocol)
+       {
+               for (i=0 ; i<3 ; i++)
+                       angle[i] = MSG_ReadPreciseAngle ();
+       }
+       else
+       {
+               for (i=0 ; i<3 ; i++)
+                       angle[i] = MSG_ReadAngle ();
+       }
 
        VectorCopy (angle, host_client->edict->v.v_angle);