shithub: choc

Download patch

ref: 65c3fa788f31c6a9524f38fbbac9f0f81fc0bbae
parent: f8640f01d83dd649136fd648cfc3e272c4e729f5
author: Simon Howard <[email protected]>
date: Thu May 7 19:29:29 EDT 2009

Diff tics containing Heretic/Hexen fields.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1512

--- a/src/net_defs.h
+++ b/src/net_defs.h
@@ -152,6 +152,8 @@
 #define NET_TICDIFF_BUTTONS      (1 << 3)
 #define NET_TICDIFF_CONSISTANCY  (1 << 4)
 #define NET_TICDIFF_CHATCHAR     (1 << 5)
+#define NET_TICDIFF_LOOKFLY      (1 << 6)
+#define NET_TICDIFF_ARTIFACT     (1 << 7)
 
 typedef struct
 {
--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -132,6 +132,10 @@
         NET_WriteInt8(packet, diff->cmd.consistancy);
     if (diff->diff & NET_TICDIFF_CHATCHAR)
         NET_WriteInt8(packet, diff->cmd.chatchar);
+    if (diff->diff & NET_TICDIFF_LOOKFLY)
+        NET_WriteInt8(packet, diff->cmd.lookfly);
+    if (diff->diff & NET_TICDIFF_ARTIFACT)
+        NET_WriteInt8(packet, diff->cmd.arti);
 }
 
 boolean NET_ReadTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff,
@@ -198,6 +202,20 @@
         diff->cmd.chatchar = val;
     }
 
+    if (diff->diff & NET_TICDIFF_LOOKFLY)
+    {
+        if (!NET_ReadInt8(packet, &val))
+            return false;
+        diff->cmd.lookfly = val;
+    }
+
+    if (diff->diff & NET_TICDIFF_ARTIFACT)
+    {
+        if (!NET_ReadInt8(packet, &val))
+            return false;
+        diff->cmd.arti = val;
+    }
+
     return true;
 }
 
@@ -218,6 +236,13 @@
         diff->diff |= NET_TICDIFF_CONSISTANCY;
     if (tic2->chatchar != 0)
         diff->diff |= NET_TICDIFF_CHATCHAR;
+
+    // Hexen-specific:
+
+    if (tic1->lookfly != tic2->lookfly)
+        diff->diff |= NET_TICDIFF_LOOKFLY;
+    if (tic2->arti != 0)
+        diff->diff |= NET_TICDIFF_ARTIFACT;
 }
 
 void NET_TiccmdPatch(ticcmd_t *src, net_ticdiff_t *diff, ticcmd_t *dest)
@@ -241,6 +266,17 @@
         dest->chatchar = diff->cmd.chatchar;
     else
         dest->chatchar = 0;
+
+    // Heretic/Hexen specific:
+
+    if (diff->diff & NET_TICDIFF_LOOKFLY)
+        dest->lookfly = diff->cmd.lookfly;
+
+    if (diff->diff & NET_TICDIFF_ARTIFACT)
+        dest->arti = diff->cmd.arti;
+    else
+        dest->arti = 0;
+
 }
 
 //