From 2dfd91c8e6cf94cac2e8ffb9ae4f59ef67c133a5 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 24 May 2005 23:58:04 +0000 Subject: [PATCH] reordered the protocolversion_t values to have preferred protocols first changed client connect message to list all supported protocols shortened PROTOCOL_DARKPLACES* names to "DP1" and such to make connect message shorter git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5330 d7cf8633-e32d-0410-b094-e92efae38249 --- common.h | 16 ++++++++-------- netconn.c | 10 ++++++---- protocol.c | 16 ++++++++-------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/common.h b/common.h index 419ae22c..4cc520e3 100644 --- a/common.h +++ b/common.h @@ -117,16 +117,16 @@ unsigned short BuffLittleShort (const qbyte *buffer); typedef enum protocolversion_e { PROTOCOL_UNKNOWN, - PROTOCOL_QUAKE, // quake (aka netquake/normalquake/nq) protocol + PROTOCOL_DARKPLACES7, // added QuakeWorld-style movement protocol to allow more consistent prediction + PROTOCOL_DARKPLACES6, // various changes + PROTOCOL_DARKPLACES5, // uses EntityFrame5 entity snapshot encoder/decoder which is based on a Tribes networking article at http://www.garagegames.com/articles/networking1/ + PROTOCOL_DARKPLACES4, // various changes + PROTOCOL_DARKPLACES3, // uses EntityFrame4 entity snapshot encoder/decoder which is broken, this attempted to do partial snapshot updates on a QuakeWorld-like protocol, but it is broken and impossible to fix + PROTOCOL_DARKPLACES2, // various changes + PROTOCOL_DARKPLACES1, // uses EntityFrame entity snapshot encoder/decoder which is a QuakeWorld-like entity snapshot delta compression method PROTOCOL_QUAKEDP, // darkplaces extended quake protocol (used by TomazQuake and others), backwards compatible as long as no extended features are used PROTOCOL_NEHAHRAMOVIE, // Nehahra movie protocol, a big nasty hack dating back to early days of the Quake Standards Group (but only ever used by neh_gl.exe), this is potentially backwards compatible with quake protocol as long as no extended features are used (but in actuality the neh_gl.exe which wrote this protocol ALWAYS wrote the extended information) - PROTOCOL_DARKPLACES1, // uses EntityFrame_ entity snapshot encoder/decoder which is a QuakeWorld-like entity snapshot delta compression method - PROTOCOL_DARKPLACES2, // various changes - PROTOCOL_DARKPLACES3, // uses EntityFrame4 entity snapshot encoder/decoder which is broken, this attempted to do partial snapshot updates on a QuakeWorld-like protocol, but it is broken and impossible to fix - PROTOCOL_DARKPLACES4, // various changes - PROTOCOL_DARKPLACES5, // uses EntityFrame5 entity snapshot encoder/decoder which is based on a Tribes networking article at http://www.garagegames.com/articles/networking1/ - PROTOCOL_DARKPLACES6, // various changes - PROTOCOL_DARKPLACES7, // added QuakeWorld-style movement protocol to allow more consistent prediction + PROTOCOL_QUAKE, // quake (aka netquake/normalquake/nq) protocol } protocolversion_t; diff --git a/netconn.c b/netconn.c index 2061a865..e5fe3d88 100755 --- a/netconn.c +++ b/netconn.c @@ -927,10 +927,12 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, if (length > 10 && !memcmp(string, "challenge ", 10) && cls.connect_trying) { + char protocolnames[1400]; + Protocol_Names(protocolnames, sizeof(protocolnames)); LHNETADDRESS_ToString(peeraddress, addressstring2, sizeof(addressstring2), true); Con_Printf("\"%s\" received, sending connect request back to %s\n", string, addressstring2); M_Update_Return_Reason("Got challenge response"); - NetConn_WriteString(mysocket, va("\377\377\377\377connect\\protocol\\darkplaces 3\\challenge\\%s", string + 10), peeraddress); + NetConn_WriteString(mysocket, va("\377\377\377\377connect\\protocol\\darkplaces 3\\protocols\\%s\\challenge\\%s", protocolnames, string + 10), peeraddress); return true; } if (length == 6 && !memcmp(string, "accept", 6) && cls.connect_trying) @@ -964,12 +966,12 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, if( !strcmp( cname, serverlist_cache[n].info.cname ) ) break; if( n == serverlist_cachecount ) { - // LAN search doesnt require an answer from the master server so we wont + // LAN search doesnt require an answer from the master server so we wont // know the ping nor will it be initialized already... // find a slot if( serverlist_cachecount == SERVERLIST_TOTALSIZE ) - return true; + return true; serverquerycount++; memset(&serverlist_cache[serverlist_cachecount], 0, sizeof(serverlist_cache[serverlist_cachecount])); @@ -983,7 +985,7 @@ int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, } ++serverlist_cachecount; - + } info = &serverlist_cache[n].info; if ((s = SearchInfostring(string, "gamename" )) != NULL) strlcpy(info->game, s, sizeof (info->game));else info->game[0] = 0; diff --git a/protocol.c b/protocol.c index cb7fda68..0c047113 100644 --- a/protocol.c +++ b/protocol.c @@ -45,16 +45,16 @@ struct protocolversioninfo[] = { {0, "UNKNOWN"}, - {15, "QUAKE"}, + {3504, "DP7"}, + {3503, "DP6"}, + {3502, "DP5"}, + {3501, "DP4"}, + {3500, "DP3"}, + {97, "DP2"}, + {96, "DP1"}, {15, "QUAKEDP"}, {250, "NEHAHRAMOVIE"}, - {96, "DARKPLACES1"}, - {97, "DARKPLACES2"}, - {3500, "DARKPLACES3"}, - {3501, "DARKPLACES4"}, - {3502, "DARKPLACES5"}, - {3503, "DARKPLACES6"}, - {3504, "DARKPLACES7"}, + {15, "QUAKE"}, {0, NULL} }; -- 2.39.2