1
0
Fork 0
forked from fte/fteqw

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
This commit is contained in:
Spoike 2005-05-27 05:41:07 +00:00
parent 95948b35ec
commit 1534fee1ae
8 changed files with 56 additions and 30 deletions

View file

@ -1109,8 +1109,8 @@ void CL_SendCmd (float frametime)
// if we are spectator, try autocam // if we are spectator, try autocam
if (cl.spectator) if (cl.spectator)
Cam_Track(plnum, cmd); Cam_Track(plnum, &independantphysics[plnum]);
Cam_FinishMove(plnum, cmd); Cam_FinishMove(plnum, &independantphysics[plnum]);
independantphysics[plnum].msec = msecstouse; independantphysics[plnum].msec = msecstouse;
} }

View file

@ -1428,7 +1428,6 @@ void CLQ2_ParseServerData (void)
#ifdef NQPROT #ifdef NQPROT
//FIXME: move to header //FIXME: move to header
#define NQ_PROTOCOL_VERSION 15
void CL_KeepaliveMessage(void){} void CL_KeepaliveMessage(void){}
void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution. 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; sizeofcoord = 4;
sizeofangle = 2; sizeofangle = 2;
} }
else if (protover == 3503) else if (protover == DP6_PROTOCOL_VERSION)
{ {
//darkplaces6 (it's a small difference from dp5) //darkplaces6 (it's a small difference from dp5)
nq_dp_protocol = 6; 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; cls.z_ext = Z_EXT_VIEWHEIGHT;
} }
else if (protover == 3504) else if (protover == DP7_PROTOCOL_VERSION)
{ {
//darkplaces7 (it's a small difference from dp5) //darkplaces7 (it's a small difference from dp5)
nq_dp_protocol = 7; nq_dp_protocol = 7;

View file

@ -4222,12 +4222,11 @@ typedef struct {
gamemode_info_t gamemode_info[] = { 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. //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. //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-Hipnotic", "hipnotic", "-hipnotic", "hipnotic/pak0.pak","id1", "qw", "hipnotic", "fte"},
{"Darkplaces-Rogue", "rogue", "-rogue", "rogue/pak0.pak", "id1", "qw", "rogue", "fte"}, {"Darkplaces-Rogue", "rogue", "-rogue", "rogue/pak0.pak", "id1", "qw", "rogue", "fte"},
{"Nexuiz", "nexuiz", "-nexuiz", "data/data.pk3", "id1", "qw", "data", "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) //supported commercial mods (some are currently only partially supported)
{"FTE-Hexen2", "hexen", "-hexen2", "data1/pak0.pak", "data1", "fte"}, {"FTE-Hexen2", "hexen", "-hexen2", "data1/pak0.pak", "data1", "fte"},
{"FTE-Quake2", "q2", "-q2", "baseq2/pak0.pak", "baseq2", "fte"}, {"FTE-Quake2", "q2", "-q2", "baseq2/pak0.pak", "baseq2", "fte"},

View file

@ -192,6 +192,12 @@ int Huff_GetByte(qbyte *buffer, int *count);
#define CCREP_SERVER_INFO 0x83 #define CCREP_SERVER_INFO 0x83
#define CCREP_PLAYER_INFO 0x84 #define CCREP_PLAYER_INFO 0x84
#define CCREP_RULE_INFO 0x85 #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 #endif
int UDP_OpenSocket (int port, qboolean bcast); int UDP_OpenSocket (int port, qboolean bcast);

View file

@ -474,7 +474,7 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
{ {
int oldsize = send.cursize; int oldsize = send.cursize;
Huff_CompressPacket(&send, (chan->sock == NS_CLIENT)?10:8); 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); // Huff_DecompressPacket(&send, (chan->sock == NS_CLIENT)?10:8);
} }
#endif #endif

View file

@ -491,9 +491,11 @@ typedef struct client_s
enum { enum {
SCP_BAD, SCP_BAD,
SCP_QUAKEWORLD, SCP_QUAKEWORLD,
SCP_QUAKE2,
SCP_NETQUAKE, SCP_NETQUAKE,
SCP_DARKPLACES, SCP_DARKPLACES6,
SCP_QUAKE2 SCP_DARKPLACES7 //extra prediction stuff
//note, nq is nq+
} protocol; } protocol;
//speed cheat testing //speed cheat testing
@ -528,7 +530,7 @@ typedef struct client_s
#define ISQWCLIENT(cl) ((cl)->protocol == SCP_QUAKEWORLD) #define ISQWCLIENT(cl) ((cl)->protocol == SCP_QUAKEWORLD)
#define ISQ2CLIENT(cl) ((cl)->protocol == SCP_QUAKE2) #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: // a client can leave the server in one of four ways:
// dropping properly by quiting or disconnecting // dropping properly by quiting or disconnecting

View file

@ -329,7 +329,8 @@ void SV_DropClient (client_t *drop)
break; break;
case SCP_QUAKEWORLD: case SCP_QUAKEWORLD:
case SCP_NETQUAKE: case SCP_NETQUAKE:
case SCP_DARKPLACES: case SCP_DARKPLACES6:
case SCP_DARKPLACES7:
MSG_WriteByte (&drop->netchan.message, svc_disconnect); MSG_WriteByte (&drop->netchan.message, svc_disconnect);
break; break;
} }
@ -491,7 +492,8 @@ int SV_CalcPing (client_t *cl)
switch (cl->protocol) switch (cl->protocol)
{ {
case SCP_NETQUAKE: case SCP_NETQUAKE:
case SCP_DARKPLACES: case SCP_DARKPLACES6:
case SCP_DARKPLACES7:
case SCP_QUAKEWORLD: case SCP_QUAKEWORLD:
ping = 0; ping = 0;
count = 0; count = 0;
@ -994,8 +996,8 @@ void SVC_GetChallenge (void)
Netchan_OutOfBand(NS_SERVER, net_from, over-buf, buf); Netchan_OutOfBand(NS_SERVER, net_from, over-buf, buf);
buf = va("challenge %i", svs.challenges[i].challenge); // buf = va("challenge %i", svs.challenges[i].challenge);
Netchan_OutOfBand(NS_SERVER, net_from, strlen(buf)+1, buf); // Netchan_OutOfBand(NS_SERVER, net_from, strlen(buf)+1, buf);
} }
// Netchan_OutOfBandPrint (net_from, "%c%i", S2C_CHALLENGE, // 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); *(int*)string = BigLong(NETFLAG_CTL|len);
NET_SendPacket(NS_SERVER, len, string, net_from); NET_SendPacket(NS_SERVER, len, string, net_from);
return; return;
case SCP_DARKPLACES: case SCP_DARKPLACES6:
case SCP_DARKPLACES7:
strcpy(string, "reject "); strcpy(string, "reject ");
_vsnprintf (string+7,sizeof(string)-1-7, format,argptr); _vsnprintf (string+7,sizeof(string)-1-7, format,argptr);
len = strlen(string); len = strlen(string);
@ -1139,7 +1142,8 @@ void SV_AcceptMessage(int protocol)
*(int*)sb.data = BigLong(NETFLAG_CTL|sb.cursize); *(int*)sb.data = BigLong(NETFLAG_CTL|sb.cursize);
NET_SendPacket(NS_SERVER, sb.cursize, sb.data, net_from); NET_SendPacket(NS_SERVER, sb.cursize, sb.data, net_from);
return; return;
case SCP_DARKPLACES: case SCP_DARKPLACES6:
case SCP_DARKPLACES7:
strcpy(string, "accept"); strcpy(string, "accept");
len = strlen(string); len = strlen(string);
break; break;
@ -1211,10 +1215,14 @@ client_t *SVC_DirectConnect(void)
Con_Printf ("* rejected connect from incompatable client\n"); Con_Printf ("* rejected connect from incompatable client\n");
return NULL; return NULL;
} }
//it's a darkplaces client. //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")); challenge = atoi(Info_ValueForKey(userinfo[0], "challenge"));
qport = 0; qport = 0;
@ -1223,10 +1231,7 @@ client_t *SVC_DirectConnect(void)
{ {
if (atoi(Cmd_Argv(0)+7)) if (atoi(Cmd_Argv(0)+7))
{ {
#ifdef NQPROT numssclients = atoi(Cmd_Argv(0)+7);
if (!socket)
#endif
numssclients = atoi(Cmd_Argv(0)+7);
if (numssclients<1 || numssclients > 4) if (numssclients<1 || numssclients > 4)
{ {
SV_RejectMessage (SCP_BAD, "Server is version %4.2f.\n", VERSION); SV_RejectMessage (SCP_BAD, "Server is version %4.2f.\n", VERSION);
@ -1385,9 +1390,6 @@ client_t *SVC_DirectConnect(void)
nextuserid--; nextuserid--;
return NULL; return NULL;
} }
#ifdef NQPROT
if (!socket)
#endif
{ {
Con_Printf ("%s:reconnect\n", NET_AdrToString (adr)); Con_Printf ("%s:reconnect\n", NET_AdrToString (adr));
// SV_DropClient (cl); // SV_DropClient (cl);

View file

@ -255,7 +255,6 @@ void SV_New_f (void)
else else
MSG_WriteByte (&host_client->netchan.message, 0); MSG_WriteByte (&host_client->netchan.message, 0);
} }
#define NQ_PROTOCOL_VERSION 15
#define GAME_DEATHMATCH 0 #define GAME_DEATHMATCH 0
#define GAME_COOP 1 #define GAME_COOP 1
void SVNQ_New_f (void) void SVNQ_New_f (void)
@ -273,8 +272,24 @@ void SVNQ_New_f (void)
MSG_WriteString (&host_client->netchan.message,message); MSG_WriteString (&host_client->netchan.message,message);
MSG_WriteByte (&host_client->netchan.message, svc_serverdata); MSG_WriteByte (&host_client->netchan.message, svc_serverdata);
MSG_WriteLong (&host_client->netchan.message, NQ_PROTOCOL_VERSION); switch(host_client->protocol)
MSG_WriteByte (&host_client->netchan.message, 16); {
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) if (!coop.value && deathmatch.value)
MSG_WriteByte (&host_client->netchan.message, GAME_DEATHMATCH); MSG_WriteByte (&host_client->netchan.message, GAME_DEATHMATCH);
@ -4560,6 +4575,9 @@ void SVNQ_ReadClientMove (usercmd_t *move)
client_frame_t *frame; client_frame_t *frame;
frame = &host_client->frames[host_client->netchan.incoming_acknowledged & UPDATE_MASK]; 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 (); frame->ping_time = sv.time - MSG_ReadFloat ();