ref: 1a659baf2ac897122671d4b4fd1a7d70f46f3a01
parent: 7a8b8e57e7bd6b6a61b8492031bf5e995272e6bf
author: Simon Howard <[email protected]>
date: Mon Oct 17 15:16:43 EDT 2011
Fix tic diffs to handle Strife fields correctly. Subversion-branch: /branches/v2-branch Subversion-revision: 2436
--- a/src/d_loop.c
+++ b/src/d_loop.c
@@ -176,6 +176,7 @@
}
//printf ("mk:%i ",maketic);
+ memset(&cmd, 0, sizeof(ticcmd_t));
loop_interface->BuildTiccmd(&cmd, maketic);
#ifdef FEATURE_MULTIPLAYER
--- a/src/net_defs.h
+++ b/src/net_defs.h
@@ -189,8 +189,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)
+#define NET_TICDIFF_RAVEN (1 << 6)
+#define NET_TICDIFF_STRIFE (1 << 7)
typedef struct
{
--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -215,10 +215,16 @@
NET_WriteInt8(packet, diff->cmd.consistancy);
if (diff->diff & NET_TICDIFF_CHATCHAR)
NET_WriteInt8(packet, diff->cmd.chatchar);
- if (diff->diff & NET_TICDIFF_LOOKFLY)
+ if (diff->diff & NET_TICDIFF_RAVEN)
+ {
NET_WriteInt8(packet, diff->cmd.lookfly);
- if (diff->diff & NET_TICDIFF_ARTIFACT)
NET_WriteInt8(packet, diff->cmd.arti);
+ }
+ if (diff->diff & NET_TICDIFF_STRIFE)
+ {
+ NET_WriteInt8(packet, diff->cmd.buttons2);
+ NET_WriteInt8(packet, diff->cmd.inventory);
+ }
}
boolean NET_ReadTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff,
@@ -285,18 +291,26 @@
diff->cmd.chatchar = val;
}
- if (diff->diff & NET_TICDIFF_LOOKFLY)
+ if (diff->diff & NET_TICDIFF_RAVEN)
{
if (!NET_ReadInt8(packet, &val))
return false;
diff->cmd.lookfly = val;
+
+ if (!NET_ReadInt8(packet, &val))
+ return false;
+ diff->cmd.arti = val;
}
- if (diff->diff & NET_TICDIFF_ARTIFACT)
+ if (diff->diff & NET_TICDIFF_STRIFE)
{
if (!NET_ReadInt8(packet, &val))
return false;
- diff->cmd.arti = val;
+ diff->cmd.buttons2 = val;
+
+ if (!NET_ReadInt8(packet, &val))
+ return false;
+ diff->cmd.inventory = val;
}
return true;
@@ -320,12 +334,15 @@
if (tic2->chatchar != 0)
diff->diff |= NET_TICDIFF_CHATCHAR;
- // Hexen-specific:
+ // Heretic/Hexen-specific
- if (tic1->lookfly != tic2->lookfly)
- diff->diff |= NET_TICDIFF_LOOKFLY;
- if (tic2->arti != 0)
- diff->diff |= NET_TICDIFF_ARTIFACT;
+ if (tic1->lookfly != tic2->lookfly || tic2->arti != 0)
+ diff->diff |= NET_TICDIFF_RAVEN;
+
+ // Strife-specific
+
+ if (tic2->buttons2 != 0 || tic2->inventory != 0)
+ diff->diff |= NET_TICDIFF_STRIFE;
}
void NET_TiccmdPatch(ticcmd_t *src, net_ticdiff_t *diff, ticcmd_t *dest)
@@ -352,14 +369,28 @@
// Heretic/Hexen specific:
- if (diff->diff & NET_TICDIFF_LOOKFLY)
+ if (diff->diff & NET_TICDIFF_RAVEN)
+ {
dest->lookfly = diff->cmd.lookfly;
-
- if (diff->diff & NET_TICDIFF_ARTIFACT)
dest->arti = diff->cmd.arti;
+ }
else
+ {
dest->arti = 0;
+ }
+ // Strife-specific:
+
+ if (diff->diff & NET_TICDIFF_STRIFE)
+ {
+ dest->buttons2 = diff->cmd.buttons2;
+ dest->inventory = diff->cmd.inventory;
+ }
+ else
+ {
+ dest->buttons2 = 0;
+ dest->inventory = 0;
+ }
}
//