From b347b818e7799a6e01fe0099847ae722d01f2e67 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Sun, 1 Jan 2017 23:07:34 +0100 Subject: [PATCH] -Fixed broken net commands, thus fixing (or at least greatly improving) chat/commands/joins/leaves and possibly other annoying bugs -Updated packet name list so the debug file no longer shows garbage packet names -Replaced byte values with actual net command names in the debug file. Only the first net command in a packet will be shown though -Added a MOBJCONSISTANCY define that makes the game takes all revelant mobjs to be counted in the synch seed -Added a PACKETDROP define that adds two console commands "drop" and "droprate" to simulate bad internet by dropping packets -Added/changed comments here in there in the netcode -Fixed a minor error that would ignore one of the urgent ack slots -Added a space between the map name and "zone" for the messages shown in a joiner's console --- src/Makefile | 10 +++++++++- src/d_clisrv.c | 10 ++++++---- src/d_clisrv.h | 2 -- src/d_net.c | 2 -- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Makefile b/src/Makefile index ce4b569e..01f7a84c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -366,6 +366,14 @@ endif OPTS:=-fno-exceptions $(OPTS) +ifdef MOBJCONSISTANCY + OPTS+=-DMOBJCONSISTANCY +endif + +ifdef PACKETDROP + OPTS+=-DPACKETDROP +endif + ifdef DEBUGMODE # build with debugging information @@ -375,7 +383,7 @@ ifdef GCC48 else CFLAGS+=-O0 endif - CFLAGS+= -Wall -DPARANOIA -DRANGECHECK + CFLAGS+= -Wall -DPARANOIA -DRANGECHECK -DPACKETDROP -DMOBJCONSISTANCY else diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7eb7f6c3..ca870903 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2781,7 +2781,6 @@ void D_ClientServerInit(void) COM_AddCommand("reloadbans", Command_ReloadBan); COM_AddCommand("connect", Command_connect); COM_AddCommand("nodes", Command_Nodes); -#define PACKETDROP #ifdef PACKETDROP COM_AddCommand("drop", Command_Drop); COM_AddCommand("droprate", Command_Droprate); @@ -3911,8 +3910,10 @@ static INT16 Consistancy(void) { INT32 i; UINT32 ret = 0; +#ifdef MOBJCONSISTANCY thinker_t *th; mobj_t *mo; +#endif DEBFILE(va("TIC %u ", gametic)); @@ -3934,8 +3935,8 @@ static INT16 Consistancy(void) if (!G_PlatformGametype()) ret += P_GetRandSeed(); - // !!! - /*if (!thinkercap.next) +#ifdef MOBJCONSISTANCY + if (!thinkercap.next) return ret; for (th = thinkercap.next; th != &thinkercap; th = th->next) { @@ -4002,7 +4003,8 @@ static INT16 Consistancy(void) ret -= mo->sprite; ret += mo->frame; } - }*/ + } +#endif return (INT16)(ret & 0xFFFF); } diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 5b215555..fe80be1b 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -76,8 +76,6 @@ typedef enum NUMPACKETTYPE } packettype_t; -#define PACKETDROP - #ifdef PACKETDROP void Command_Drop(void); void Command_Droprate(void); diff --git a/src/d_net.c b/src/d_net.c index 52041a8a..097efc88 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -878,8 +878,6 @@ static void DebugPrintpacket(const char *header) } #endif -#define PACKETDROP - #ifdef PACKETDROP static INT32 packetdropquantity[NUMPACKETTYPE] = {0}; static INT32 packetdroprate = 0;