From 5f9a101ac06b1a98114256be175670e028e8613f Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 11 Dec 2017 02:55:06 +0000 Subject: [PATCH] fixes for some #define feature enables. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5183 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_ents.c | 4 +-- engine/client/cl_master.h | 28 +++++++++++++------- engine/client/net_master.c | 53 +++++++++++++++++++++++++++++++++++--- engine/common/cmd.c | 4 --- engine/server/pr_cmds.c | 2 ++ 5 files changed, 72 insertions(+), 19 deletions(-) diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index b1888d620..0dbece937 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -5348,7 +5348,7 @@ void CL_LinkViewModel(void) if (plnum == -1) plnum = r_refdef.playerview->playernum; playereffects = 0; - if (r_refdef.playerview->nolocalplayer && plnum >= 0 && plnum < cl.maxlerpents) + if (r_refdef.playerview->nolocalplayer && plnum < cl.maxlerpents) { if (plnum+1 < cl.maxlerpents) { @@ -5357,7 +5357,7 @@ void CL_LinkViewModel(void) playereffects = le->entstate->effects; } } - else if (plnum >= 0 && plnum < cl.allocated_client_slots) + else if (plnum < cl.allocated_client_slots) playereffects = cl.inframes[parsecountmod].playerstate[plnum].effects; if (playereffects & DPEF_NOGUNBOB) diff --git a/engine/client/cl_master.h b/engine/client/cl_master.h index 52e787085..8709dfa4e 100644 --- a/engine/client/cl_master.h +++ b/engine/client/cl_master.h @@ -1,4 +1,20 @@ +enum masterprotocol_e +{ + MP_UNSPECIFIED, + MP_QUAKEWORLD, +#if defined(Q2CLIENT) || defined(Q2SERVER) + MP_QUAKE2, +#endif +#if defined(Q3CLIENT) || defined(Q3SERVER) + MP_QUAKE3, +#endif +#ifdef NQPROT + MP_NETQUAKE, +#endif + MP_DPMASTER +}; +#if defined(CL_MASTER) && !defined(SERVERONLY) #define SS_PROTOCOLMASK 0xf #define SS_UNKNOWN 0 #define SS_QUAKEWORLD 1 @@ -26,15 +42,6 @@ enum mastertype_e MT_BCAST, MT_SINGLE, }; -enum masterprotocol_e -{ - MP_UNSPECIFIED, - MP_QUAKEWORLD, - MP_QUAKE2, - MP_QUAKE3, - MP_NETQUAKE, - MP_DPMASTER -}; typedef enum @@ -231,3 +238,6 @@ serverinfo_t *Master_SortedServer(int idx); void Master_SetMaskString(qboolean or, hostcachekey_t field, const char *param, slist_test_t testop); void Master_SetMaskInteger(qboolean or, hostcachekey_t field, int param, slist_test_t testop); serverinfo_t *Master_FindRoute(netadr_t target); +#else +#define MasterInfo_WriteServers() +#endif diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 292150bf0..93f605227 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -76,11 +76,9 @@ typedef struct { cvar_t cv; char *comment; -#ifndef CLIENTONLY qboolean needsresolve; //set any time the cvar is modified qboolean resolving; //set any time the cvar is modified netadr_t adr[MAX_MASTER_ADDRESSES]; -#endif } net_masterlist_t; net_masterlist_t net_masterlist[] = { #ifndef QUAKETC @@ -152,11 +150,18 @@ net_masterlist_t net_masterlist[] = { // {MP_QUAKE2, CVARFC("net_q2masterextra1", "master.planetgloom.com:27900", CVAR_NOSAVE, Net_Masterlist_Callback)}, //? // {MP_QUAKE2, CVARFC("net_q2masterextra1", "master.q2servers.com:27900", CVAR_NOSAVE, Net_Masterlist_Callback)}, //? {MP_QUAKE2, CVARFC("net_q2masterextra1", "netdome.biz:27900", CVAR_NOSAVE, Net_Masterlist_Callback)}, //? + {MP_QUAKE2, CVARFC("net_q2masterextra2", "master.quakeservers.net:27900", CVAR_NOSAVE, Net_Masterlist_Callback)}, //? #endif #ifdef Q3CLIENT // {MP_QUAKE3, CVARFC("net_q3masterextra1", "masterserver.exhale.de:27950", CVAR_NOSAVE, Net_Masterlist_Callback), "Official Quake3 master server"}, {MP_QUAKE3, CVARFC("net_q3masterextra1", "master.quake3arena.com:27950", CVAR_NOSAVE, Net_Masterlist_Callback), "Official Quake3 master server"}, + {MP_QUAKE3, CVARFC("net_q3masterextra2", "master0.excessiveplus.net:27950", CVAR_NOSAVE, Net_Masterlist_Callback), "DE: Excessive Plus"}, + {MP_QUAKE3, CVARFC("net_q3masterextra3", "master.ioquake3.org:27950", CVAR_NOSAVE, Net_Masterlist_Callback), "DE: ioquake3"}, + {MP_QUAKE3, CVARFC("net_q3masterextra4", "master.huxxer.de:27950", CVAR_NOSAVE, Net_Masterlist_Callback), "DE: BMA Team"}, + {MP_QUAKE3, CVARFC("net_q3masterextra5", "master.maverickservers.com:27950", CVAR_NOSAVE, Net_Masterlist_Callback), "US: Maverickservers.com"}, + {MP_QUAKE3, CVARFC("net_q3masterextra6", "dpmaster.deathmask.net:27950", CVAR_NOSAVE, Net_Masterlist_Callback), "US: DeathMask.net"}, + {MP_QUAKE3, CVARFC("net_q3masterextra8", "master3.idsoftware.com:27950", CVAR_NOSAVE, Net_Masterlist_Callback), "US: id Software Quake III Master"}, #endif {MP_UNSPECIFIED, CVAR(NULL, NULL)} @@ -245,6 +250,7 @@ void SV_Master_SingleHeartbeat(net_masterlist_t *master) NET_SendPacket (NS_SERVER, strlen(string), string, na); } break; +#ifdef Q2SERVER case MP_QUAKE2: if (svs.gametype == GT_QUAKE2 && sv_listen_qw.value) //set listen to 1 to allow qw connections, 2 to allow nq connections too. { @@ -258,6 +264,7 @@ void SV_Master_SingleHeartbeat(net_masterlist_t *master) } } break; +#endif case MP_DPMASTER: if (sv_listen_dp.value || sv_listen_nq.value) //set listen to 1 to allow qw connections, 2 to allow nq connections too. { @@ -317,8 +324,12 @@ void SV_Master_Worker_Resolved(void *ctx, void *data, size_t a, size_t b) case MP_UNSPECIFIED: case MP_NETQUAKE: case MP_DPMASTER: na->port = BigShort (27950); break; +#ifdef Q2SERVER case MP_QUAKE2: na->port = BigShort (27000); break; //FIXME: verify +#endif +#ifdef Q3SERVER case MP_QUAKE3: na->port = BigShort (27950); break; +#endif case MP_QUAKEWORLD: na->port = BigShort (27000); break; } } @@ -333,9 +344,11 @@ void SV_Master_Worker_Resolved(void *ctx, void *data, size_t a, size_t b) //q2+qw masters are given a ping to verify that they're still up switch (master->protocol) { +#ifdef Q2SERVER case MP_QUAKE2: NET_SendPacket (NS_SERVER, 8, "\xff\xff\xff\xffping", na); break; +#endif case MP_QUAKEWORLD: //qw does this for some reason, keep the behaviour even though its unreliable thus pointless NET_SendPacket (NS_SERVER, 2, "k\0", na); @@ -407,8 +420,12 @@ void SV_Master_Heartbeat (void) switch (net_masterlist[i].protocol) { case MP_DPMASTER: enabled = sb_enabledarkplaces; break; +#ifdef Q2SERVER case MP_QUAKE2: enabled = sb_enablequake2; break; +#endif +#ifdef Q3SERVER case MP_QUAKE3: enabled = sb_enablequake3; break; +#endif case MP_QUAKEWORLD: enabled = sb_enablequakeworld; break; default: enabled = false; break; } @@ -1409,9 +1426,13 @@ void CLMaster_AddMaster_Worker_Resolved(void *ctx, void *data, size_t a, size_t switch (mast->protocoltype) { case MP_DPMASTER: mast->adr.port = BigShort (27950); break; - case MP_QUAKE2: mast->adr.port = BigShort (27000); break; //FIXME: verify +#ifdef Q2CLIENT + case MP_QUAKE2: mast->adr.port = BigShort (27900); break; //FIXME: verify +#endif +#ifdef Q3CLIENT case MP_QUAKE3: mast->adr.port = BigShort (27950); break; - case MP_QUAKEWORLD: mast->adr.port = BigShort (27000); break; +#endif + case MP_QUAKEWORLD: mast->adr.port = BigShort (PORT_QWMASTER); break; } } @@ -1656,18 +1677,27 @@ qboolean Master_LoadMasterList (char *filename, qboolean withcomment, int defaul else if (!strcmp(sep, "bcast")) servertype = MT_BCAST; +#ifndef QUAKETC else if (!strcmp(com_token, "qw")) protocoltype = MP_QUAKEWORLD; +#endif +#ifdef Q2CLIENT else if (!strcmp(com_token, "q2")) protocoltype = MP_QUAKE2; +#endif +#ifdef Q3CLIENT else if (!strcmp(com_token, "q3")) protocoltype = MP_QUAKE3; +#endif +#ifdef NQPROT else if (!strcmp(com_token, "nq")) protocoltype = MP_NETQUAKE; +#endif else if (!strcmp(com_token, "dp")) protocoltype = MP_DPMASTER; //legacy compat +#ifdef NQPROT else if (!strcmp(com_token, "httpjson")) { servertype = MT_MASTERHTTPJSON; @@ -1678,11 +1708,14 @@ qboolean Master_LoadMasterList (char *filename, qboolean withcomment, int defaul servertype = MT_MASTERHTTP; protocoltype = MP_NETQUAKE; } +#endif +#ifndef QUAKETC else if (!strcmp(com_token, "httpqw")) { servertype = MT_MASTERHTTP; protocoltype = MP_QUAKEWORLD; } +#endif else if (!strcmp(com_token, "favourite") || !strcmp(com_token, "favorite")) favourite = true; @@ -2649,22 +2682,28 @@ qboolean CL_QueryServers(void) if (!sb_enabledarkplaces) continue; break; +#ifdef NQPROT case MP_NETQUAKE: if (!sb_enablenetquake) continue; break; +#endif case MP_QUAKEWORLD: if (!sb_enablequakeworld) continue; break; +#ifdef Q2CLIENT case MP_QUAKE2: if (!sb_enablequake2) continue; break; +#endif +#ifdef Q3CLIENT case MP_QUAKE3: if (!sb_enablequake3) continue; break; +#endif } if (mast->sends > 0) @@ -3003,12 +3042,18 @@ int CL_ReadServerInfo(char *msg, enum masterprotocol_e prototype, qboolean favor break; } } +#ifdef Q2CLIENT else if (prototype == MP_QUAKE2) info->special |= SS_QUAKE2; +#endif +#ifdef Q3CLIENT else if (prototype == MP_QUAKE3) info->special |= SS_QUAKE3; +#endif +#ifdef NQPROT else if (prototype == MP_NETQUAKE) info->special |= SS_NETQUAKE; +#endif else info->special |= SS_QUAKEWORLD; if (favorite) //was specifically named, not retrieved from a master. diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 2fc492030..77333b25e 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -21,9 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "fs.h" -#ifndef SERVERONLY #include "cl_master.h" -#endif cvar_t ruleset_allow_in = CVAR("ruleset_allow_in", "1"); cvar_t rcon_level = CVAR("rcon_level", "20"); @@ -3801,9 +3799,7 @@ void Cmd_WriteConfig_f(void) snprintf(fname, sizeof(fname), "fte.cfg"); #endif -#ifndef SERVERONLY MasterInfo_WriteServers(); -#endif f = FS_OpenWithFriends(fname, sysname, sizeof(sysname), 3, "quake.rc", "hexen.rc", "*.cfg", "configs/*.cfg"); diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 7a4f5b52a..8fbdd4ea7 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -12092,6 +12092,7 @@ void PR_DumpPlatform_f(void) {"TEREDIT_ENT_COUNT", "const float", CS, NULL, ter_ent_count}, #endif +#ifdef CL_MASTER {"SLIST_HOSTCACHEVIEWCOUNT", "const float", CS|MENU, NULL, SLIST_HOSTCACHEVIEWCOUNT}, {"SLIST_HOSTCACHETOTALCOUNT", "const float", CS|MENU, NULL, SLIST_HOSTCACHETOTALCOUNT}, {"SLIST_MASTERQUERYCOUNT", "const float", CS|MENU, NULL, SLIST_MASTERQUERYCOUNT}, @@ -12110,6 +12111,7 @@ void PR_DumpPlatform_f(void) {"SLIST_TEST_NOTEQUAL", "const float", CS|MENU, NULL, SLIST_TEST_NOTEQUAL}, {"SLIST_TEST_STARTSWITH", "const float", CS|MENU, NULL, SLIST_TEST_STARTSWITH}, {"SLIST_TEST_NOTSTARTSWITH", "const float", CS|MENU, NULL, SLIST_TEST_NOTSTARTSWITH}, +#endif {NULL} };