From 1534fee1ae5812e0d9761e382d88a9e6735f4907 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 27 May 2005 05:41:07 +0000 Subject: [PATCH] Small fixes. Compiles in mingw and allows fte clients to connect without confusing them. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1055 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_input.c | 4 ++-- engine/client/cl_parse.c | 5 ++--- engine/common/common.c | 3 +-- engine/common/net.h | 6 ++++++ engine/common/net_chan.c | 2 +- engine/server/server.h | 8 +++++--- engine/server/sv_main.c | 34 ++++++++++++++++++---------------- engine/server/sv_user.c | 24 +++++++++++++++++++++--- 8 files changed, 56 insertions(+), 30 deletions(-) diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index f43c92eb2..f7ce49363 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -1109,8 +1109,8 @@ void CL_SendCmd (float frametime) // if we are spectator, try autocam if (cl.spectator) - Cam_Track(plnum, cmd); - Cam_FinishMove(plnum, cmd); + Cam_Track(plnum, &independantphysics[plnum]); + Cam_FinishMove(plnum, &independantphysics[plnum]); independantphysics[plnum].msec = msecstouse; } diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index e0a4247e3..f418c7644 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1428,7 +1428,6 @@ void CLQ2_ParseServerData (void) #ifdef NQPROT //FIXME: move to header -#define NQ_PROTOCOL_VERSION 15 void CL_KeepaliveMessage(void){} void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution. { @@ -1457,7 +1456,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution. sizeofcoord = 4; sizeofangle = 2; } - else if (protover == 3503) + else if (protover == DP6_PROTOCOL_VERSION) { //darkplaces6 (it's a small difference from dp5) nq_dp_protocol = 6; @@ -1466,7 +1465,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution. cls.z_ext = Z_EXT_VIEWHEIGHT; } - else if (protover == 3504) + else if (protover == DP7_PROTOCOL_VERSION) { //darkplaces7 (it's a small difference from dp5) nq_dp_protocol = 7; diff --git a/engine/common/common.c b/engine/common/common.c index e24d1cd29..d5d44ff0a 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -4222,12 +4222,11 @@ typedef struct { gamemode_info_t gamemode_info[] = { //note that there is no basic 'fte' gamemode, this is because we aim for network compatability. Darkplaces-Quake is the closest we get. //this is to avoid having too many gamemodes anyway. + {"Darkplaces-Quake", "darkplaces", "-quake", "id1/pak0.pak", "id1", "qw", "fte"}, {"Darkplaces-Hipnotic", "hipnotic", "-hipnotic", "hipnotic/pak0.pak","id1", "qw", "hipnotic", "fte"}, {"Darkplaces-Rogue", "rogue", "-rogue", "rogue/pak0.pak", "id1", "qw", "rogue", "fte"}, {"Nexuiz", "nexuiz", "-nexuiz", "data/data.pk3", "id1", "qw", "data", "fte"}, - {"Darkplaces-Quake", "darkplaces", "-quake", "id1/pak0.pak", "id1", "qw", "fte"}, - //supported commercial mods (some are currently only partially supported) {"FTE-Hexen2", "hexen", "-hexen2", "data1/pak0.pak", "data1", "fte"}, {"FTE-Quake2", "q2", "-q2", "baseq2/pak0.pak", "baseq2", "fte"}, diff --git a/engine/common/net.h b/engine/common/net.h index 8f7bff3b8..aa9711c51 100644 --- a/engine/common/net.h +++ b/engine/common/net.h @@ -192,6 +192,12 @@ int Huff_GetByte(qbyte *buffer, int *count); #define CCREP_SERVER_INFO 0x83 #define CCREP_PLAYER_INFO 0x84 #define CCREP_RULE_INFO 0x85 + +//server->client protocol info +#define NQ_PROTOCOL_VERSION 15 +#define DP5_PROTOCOL_VERSION 3502 +#define DP6_PROTOCOL_VERSION 3503 +#define DP7_PROTOCOL_VERSION 3504 #endif int UDP_OpenSocket (int port, qboolean bcast); diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index f185094b5..c84cb589d 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -474,7 +474,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate) { int oldsize = send.cursize; Huff_CompressPacket(&send, (chan->sock == NS_CLIENT)?10:8); - Con_Printf("%i becomes %i\n", oldsize, send.cursize); +// Con_Printf("%i becomes %i\n", oldsize, send.cursize); // Huff_DecompressPacket(&send, (chan->sock == NS_CLIENT)?10:8); } #endif diff --git a/engine/server/server.h b/engine/server/server.h index 2ffa66bbf..f0b494e5e 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -491,9 +491,11 @@ typedef struct client_s enum { SCP_BAD, SCP_QUAKEWORLD, + SCP_QUAKE2, SCP_NETQUAKE, - SCP_DARKPLACES, - SCP_QUAKE2 + SCP_DARKPLACES6, + SCP_DARKPLACES7 //extra prediction stuff + //note, nq is nq+ } protocol; //speed cheat testing @@ -528,7 +530,7 @@ typedef struct client_s #define ISQWCLIENT(cl) ((cl)->protocol == SCP_QUAKEWORLD) #define ISQ2CLIENT(cl) ((cl)->protocol == SCP_QUAKE2) -#define ISNQCLIENT(cl) ((cl)->protocol == SCP_NETQUAKE || (cl)->protocol == SCP_DARKPLACES) +#define ISNQCLIENT(cl) ((cl)->protocol >= SCP_NETQUAKE) // a client can leave the server in one of four ways: // dropping properly by quiting or disconnecting diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 5727bba77..d2b89d7b9 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -329,7 +329,8 @@ void SV_DropClient (client_t *drop) break; case SCP_QUAKEWORLD: case SCP_NETQUAKE: - case SCP_DARKPLACES: + case SCP_DARKPLACES6: + case SCP_DARKPLACES7: MSG_WriteByte (&drop->netchan.message, svc_disconnect); break; } @@ -491,7 +492,8 @@ int SV_CalcPing (client_t *cl) switch (cl->protocol) { case SCP_NETQUAKE: - case SCP_DARKPLACES: + case SCP_DARKPLACES6: + case SCP_DARKPLACES7: case SCP_QUAKEWORLD: ping = 0; count = 0; @@ -994,8 +996,8 @@ void SVC_GetChallenge (void) Netchan_OutOfBand(NS_SERVER, net_from, over-buf, buf); - buf = va("challenge %i", svs.challenges[i].challenge); - Netchan_OutOfBand(NS_SERVER, net_from, strlen(buf)+1, buf); +// buf = va("challenge %i", svs.challenges[i].challenge); +// Netchan_OutOfBand(NS_SERVER, net_from, strlen(buf)+1, buf); } // Netchan_OutOfBandPrint (net_from, "%c%i", S2C_CHALLENGE, @@ -1092,7 +1094,8 @@ void SV_RejectMessage(int protocol, char *format, ...) *(int*)string = BigLong(NETFLAG_CTL|len); NET_SendPacket(NS_SERVER, len, string, net_from); return; - case SCP_DARKPLACES: + case SCP_DARKPLACES6: + case SCP_DARKPLACES7: strcpy(string, "reject "); _vsnprintf (string+7,sizeof(string)-1-7, format,argptr); len = strlen(string); @@ -1139,7 +1142,8 @@ void SV_AcceptMessage(int protocol) *(int*)sb.data = BigLong(NETFLAG_CTL|sb.cursize); NET_SendPacket(NS_SERVER, sb.cursize, sb.data, net_from); return; - case SCP_DARKPLACES: + case SCP_DARKPLACES6: + case SCP_DARKPLACES7: strcpy(string, "accept"); len = strlen(string); break; @@ -1211,10 +1215,14 @@ client_t *SVC_DirectConnect(void) Con_Printf ("* rejected connect from incompatable client\n"); return NULL; } - - //it's a darkplaces client. - protocol = SCP_DARKPLACES; + + s = Info_ValueForKey(userinfo[0], "protocols"); + if (strstr(s, "DP7")) + protocol = SCP_DARKPLACES7; + else + protocol = SCP_DARKPLACES6; + challenge = atoi(Info_ValueForKey(userinfo[0], "challenge")); qport = 0; @@ -1223,10 +1231,7 @@ client_t *SVC_DirectConnect(void) { if (atoi(Cmd_Argv(0)+7)) { - #ifdef NQPROT - if (!socket) - #endif - numssclients = atoi(Cmd_Argv(0)+7); + numssclients = atoi(Cmd_Argv(0)+7); if (numssclients<1 || numssclients > 4) { SV_RejectMessage (SCP_BAD, "Server is version %4.2f.\n", VERSION); @@ -1385,9 +1390,6 @@ client_t *SVC_DirectConnect(void) nextuserid--; return NULL; } -#ifdef NQPROT - if (!socket) -#endif { Con_Printf ("%s:reconnect\n", NET_AdrToString (adr)); // SV_DropClient (cl); diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index d2386e7ab..841eb6bb0 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -255,7 +255,6 @@ void SV_New_f (void) else MSG_WriteByte (&host_client->netchan.message, 0); } -#define NQ_PROTOCOL_VERSION 15 #define GAME_DEATHMATCH 0 #define GAME_COOP 1 void SVNQ_New_f (void) @@ -273,8 +272,24 @@ void SVNQ_New_f (void) MSG_WriteString (&host_client->netchan.message,message); MSG_WriteByte (&host_client->netchan.message, svc_serverdata); - MSG_WriteLong (&host_client->netchan.message, NQ_PROTOCOL_VERSION); - MSG_WriteByte (&host_client->netchan.message, 16); + switch(host_client->protocol) + { + case SCP_NETQUAKE: + MSG_WriteLong (&host_client->netchan.message, NQ_PROTOCOL_VERSION); + MSG_WriteByte (&host_client->netchan.message, 16); + break; + case SCP_DARKPLACES6: + MSG_WriteLong (&host_client->netchan.message, DP6_PROTOCOL_VERSION); + MSG_WriteByte (&host_client->netchan.message, sv.allocated_client_slots); + break; + case SCP_DARKPLACES7: + MSG_WriteLong (&host_client->netchan.message, DP7_PROTOCOL_VERSION); + MSG_WriteByte (&host_client->netchan.message, sv.allocated_client_slots); + break; + default: + host_client->drop = true; + break; + } if (!coop.value && deathmatch.value) MSG_WriteByte (&host_client->netchan.message, GAME_DEATHMATCH); @@ -4560,6 +4575,9 @@ void SVNQ_ReadClientMove (usercmd_t *move) client_frame_t *frame; frame = &host_client->frames[host_client->netchan.incoming_acknowledged & UPDATE_MASK]; + + if (host_client->protocol == SCP_DARKPLACES7) + MSG_ReadLong (); frame->ping_time = sv.time - MSG_ReadFloat ();