diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/d_loop.c | 1 | ||||
-rw-r--r-- | src/net_defs.h | 4 | ||||
-rw-r--r-- | src/net_structrw.c | 57 |
3 files changed, 47 insertions, 15 deletions
diff --git a/src/d_loop.c b/src/d_loop.c index 6b7cf6cd..617302a5 100644 --- a/src/d_loop.c +++ b/src/d_loop.c @@ -176,6 +176,7 @@ static boolean BuildNewTic(void) } //printf ("mk:%i ",maketic); + memset(&cmd, 0, sizeof(ticcmd_t)); loop_interface->BuildTiccmd(&cmd, maketic); #ifdef FEATURE_MULTIPLAYER diff --git a/src/net_defs.h b/src/net_defs.h index 7f79c139..808fd2ff 100644 --- a/src/net_defs.h +++ b/src/net_defs.h @@ -189,8 +189,8 @@ typedef struct #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 { diff --git a/src/net_structrw.c b/src/net_structrw.c index a15e812a..1d722df0 100644 --- a/src/net_structrw.c +++ b/src/net_structrw.c @@ -215,10 +215,16 @@ void NET_WriteTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff, 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 @@ boolean NET_ReadTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff, 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 @@ void NET_TiccmdDiff(ticcmd_t *tic1, ticcmd_t *tic2, net_ticdiff_t *diff) if (tic2->chatchar != 0) diff->diff |= NET_TICDIFF_CHATCHAR; - // Hexen-specific: + // Heretic/Hexen-specific + + if (tic1->lookfly != tic2->lookfly || tic2->arti != 0) + diff->diff |= NET_TICDIFF_RAVEN; - if (tic1->lookfly != tic2->lookfly) - diff->diff |= NET_TICDIFF_LOOKFLY; - if (tic2->arti != 0) - diff->diff |= NET_TICDIFF_ARTIFACT; + // 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 @@ void NET_TiccmdPatch(ticcmd_t *src, net_ticdiff_t *diff, ticcmd_t *dest) // 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; + } } // |