From: Rudolf Polzer Date: Fri, 18 Feb 2011 14:43:33 +0000 (+0100) Subject: support Q3A's gametype filtering (notteam, notq3a, notsingle, gametype) as in ioq3... X-Git-Tag: xonotic-v0.5.0~311^2~7^2~1 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=cf98caa66bd643a804f71bc2aa152a7a98c592c2;p=xonotic%2Fxonotic-data.pk3dir.git support Q3A's gametype filtering (notteam, notq3a, notsingle, gametype) as in ioq3 source. Has a known bug it shares with ioq3 (namely, that "gametype" "teamtournament" also matches "tournament" (in Xonotic: arena) and "team" because of retarded substring matching). ONLY the game type names ffa (anything non-teamplay not having a more special name), tournament (Arena), single (maxplayers == 1), team (anything teamplay not having a more special name), ctf (ctf, duh) are supported, as we currently have nothing matching Q3A's oneflag, obelisk, harvester and teamtournament modes! --- diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 936cb9c6b..32ff5ab98 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -84,8 +84,6 @@ float maxclients; .vector pos1, pos2; .vector mangle; -.float cvar_cl_hitsound; - .float pain_finished; //Added by Supajoe .float pain_frame; //" .float statdraintime; // record the one-second intervals between draining health and armour when they're over 100 @@ -402,10 +400,6 @@ float assault_attacker_team; .float speedrunning; // Q3 support -.float notteam; -.float notsingle; -.float notfree; -.float notq3a; float q3acompat_machineshotgunswap; // database diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 268743b41..84402f013 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -2843,14 +2843,14 @@ void EndFrame() { if(self.enemy.typehitsound) self.typehit_time = time; - else if(self.enemy.hitsound && self.cvar_cl_hitsound) + else if(self.enemy.hitsound) self.hit_time = time; } else { if(self.typehitsound) self.typehit_time = time; - else if(self.hitsound && self.cvar_cl_hitsound) + else if(self.hitsound) self.hit_time = time; } } diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index c04c477cd..364c92599 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -603,7 +603,6 @@ void GetCvars(float f) GetCvars_handleFloat(s, f, cvar_cl_noantilag, "cl_noantilag"); GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional"); GetCvars_handleFloat(s, f, cvar_cl_voice_directional_taunt_attenuation, "cl_voice_directional_taunt_attenuation"); - GetCvars_handleFloat(s, f, cvar_cl_hitsound, "cl_hitsound"); GetCvars_handleFloat(s, f, cvar_cl_accuracy_data_share, "cl_accuracy_data_share"); GetCvars_handleFloat(s, f, cvar_cl_accuracy_data_receive, "cl_accuracy_data_receive"); diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index a40e8144d..68a86e9c4 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -232,6 +232,7 @@ void StartFrame (void) .float anglejitter; .string gametypefilter; .string cvarfilter; +float DoesQ3ARemoveThisEntity(); void SV_OnEntityPreSpawnFunction() { if(self.gametypefilter != "") @@ -350,6 +351,12 @@ void SV_OnEntityPreSpawnFunction() } } + if(DoesQ3ARemoveThisEntity()) + { + remove(self); + return; + } + // support special -1 and -2 angle from radiant if (self.angles == '0 -1 0') self.angles = '-90 0 0'; diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 143b3be48..5cd714b65 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -735,36 +735,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, waypoint_spawnforitem(self); } - if(teams_matter) - { - if(self.notteam) - { - print("removed non-teamplay ", self.classname, "\n"); - startitem_failed = TRUE; - remove (self); - return; - } - } - else - { - if(self.notfree) - { - print("removed non-FFA ", self.classname, "\n"); - startitem_failed = TRUE; - remove (self); - return; - } - } - - if(self.notq3a) - { - // We aren't TA or something like that, so we keep the Q3A entities - print("removed non-Q3A ", self.classname, "\n"); - startitem_failed = TRUE; - remove (self); - return; - } - /* * can't do it that way, as it would break maps * TODO make a target_give like entity another way, that perhaps has diff --git a/qcsrc/server/t_quake3.qc b/qcsrc/server/t_quake3.qc index 11bf880e6..b96599475 100644 --- a/qcsrc/server/t_quake3.qc +++ b/qcsrc/server/t_quake3.qc @@ -130,3 +130,48 @@ void spawnfunc_team_CTF_redspawn() { spawnfunc_info_player_team1(); } void spawnfunc_team_CTF_bluespawn() { spawnfunc_info_player_team2(); } void spawnfunc_item_flight() { spawnfunc_item_jetpack(); } + +.float notteam; +.float notsingle; +.float notfree; +.float notq3a; +.string gametype; +float DoesQ3ARemoveThisEntity() +{ + // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY) + + if(self.notq3a) + return 1; + + if(self.notsingle) + if(maxclients == 1) + return 1; + + if(self.notteam) + if(teams_matter) + return 1; + + if(self.notfree) + if(!teams_matter) + return 1; + + if(self.gametype) + { + string gametypename; + // static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"}; + gametypename = "ffa"; + if(teams_matter) + gametypename = "team"; + if(g_arena) + gametypename = "tournament"; + if(g_ctf) + gametypename = "ctf"; + if(maxclients == 1) + gametypename = "single"; + // we do not have the other types (oneflag, obelisk, harvester, teamtournament) + if(strstrofs(self.gametype, gametypename, 0) < 0) + return 1; + } + + return 0; +}