]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
support Q3A's gametype filtering (notteam, notq3a, notsingle, gametype) as in ioq3...
authorRudolf Polzer <divVerent@xonotic.org>
Fri, 18 Feb 2011 14:43:33 +0000 (15:43 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Fri, 18 Feb 2011 14:46:42 +0000 (15:46 +0100)
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_items.qc
qcsrc/server/t_quake3.qc

index 936cb9c6b651f85f181fc82a86bc65bd7c3aadd3..32ff5ab9879b081ac040d18da992e4442a3feeb1 100644 (file)
@@ -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
index 268743b41542393e8389fef479be07b8109eb18f..84402f0139441e3eda2e1e2945443006a013c67a 100644 (file)
@@ -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;
                }
        }
index c04c477cdf778cc0b32be50b5e628999342ad3f4..364c925991a893ccb2a75749cb57d9bd8a573104 100644 (file)
@@ -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");
 
index a40e8144d6656904d11f7843bcc4d81e7b68431d..68a86e9c479e7f68a9908fc12230831f2bb50803 100644 (file)
@@ -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';
index 143b3be4879d79cc2993a685f275e0a1cc2e0bee..5cd714b652a64f832e7c03633e40567596f6111f 100644 (file)
@@ -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
index 11bf880e60bf102b1d992c25698e8ff471973fbd..b96599475871932968acaaeba50101afdf395d48 100644 (file)
@@ -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;
+}