]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
mapinfo: remove some IS_GAMETYPE macros
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 14 Oct 2015 21:11:05 +0000 (08:11 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 14 Oct 2015 21:11:05 +0000 (08:11 +1100)
12 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/mapinfo.qh
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_deathmatch.qc
qcsrc/server/mutators/gamemode_domination.qc
qcsrc/server/mutators/gamemode_invasion.qc
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/weapons/throwing.qc

index 4d63b9a5f2c57b9f0dbfc5b6fe01a4c74d37a55b..93f60fe67ac1a7ee576fbe578e162c5348810cd3 100644 (file)
@@ -1011,10 +1011,12 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
 
 MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
 {SELFPARAM();
-       if(self.weapon == WEP_NEXBALL.m_id)
-               return true;
+       return self.weapon == WEP_NEXBALL.m_id;
+}
 
-       return false;
+MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
+{SELFPARAM();
+       return self.weapon == WEP_MORTAR.m_id; // TODO: what is this for?
 }
 
 MUTATOR_HOOKFUNCTION(nb, FilterItem)
index 6faef6e05716be116e414e9db8615186f2b618e4..1238bfe4bdc7bc74f3098e0949e54b825e98b64b 100644 (file)
@@ -55,10 +55,8 @@ int MAPINFO_TYPE_ALL;
     (MapInfo_LoadedGametype == MAPINFO_TYPE_##NAME)
 
 REGISTER_GAMETYPE(_("Deathmatch"),dm,g_dm,DEATHMATCH,false,"timelimit=20 pointlimit=30 leadlimit=0",_("Score as many frags as you can."));
-#define g_dm IS_GAMETYPE(DEATHMATCH)
 
 REGISTER_GAMETYPE(_("Last Man Standing"),lms,g_lms,LMS,false,"timelimit=20 lives=9 leadlimit=0",_("Survive and kill until the enemies have no lives left."));
-#define g_lms IS_GAMETYPE(LMS)
 
 REGISTER_GAMETYPE(_("Race"),rc,g_race,RACE,false,"timelimit=20 qualifying_timelimit=5 laplimit=7 teamlaplimit=15 leadlimit=0",_("Race against other players to the finish line."));
 #define g_race IS_GAMETYPE(RACE)
@@ -76,16 +74,13 @@ REGISTER_GAMETYPE(_("Clan Arena"),ca,g_ca,CA,true,"timelimit=20 pointlimit=10 te
 #define g_ca IS_GAMETYPE(CA)
 
 REGISTER_GAMETYPE(_("Domination"),dom,g_domination,DOMINATION,true,"timelimit=20 pointlimit=200 teams=2 leadlimit=0",_("Capture and defend all the control points to win."));
-#define g_domination IS_GAMETYPE(DOMINATION)
 
 REGISTER_GAMETYPE(_("Key Hunt"),kh,g_keyhunt,KEYHUNT,true,"timelimit=20 pointlimit=1000 teams=3 leadlimit=0",_("Gather all the keys to win the round."));
-#define g_keyhunt IS_GAMETYPE(KEYHUNT)
 
 REGISTER_GAMETYPE(_("Assault"),as,g_assault,ASSAULT,true,"timelimit=20",_("Destroy obstacles to find and destroy the enemy power core before time runs out."));
 #define g_assault IS_GAMETYPE(ASSAULT)
 
 REGISTER_GAMETYPE(_("Onslaught"),ons,g_onslaught,ONSLAUGHT,true,"pointlimit=1 timelimit=20",_("Capture control points to reach and destroy the enemy generator."));
-#define g_onslaught IS_GAMETYPE(ONSLAUGHT)
 
 REGISTER_GAMETYPE(_("Nexball"),nb,g_nexball,NEXBALL,true,"timelimit=20 pointlimit=5 leadlimit=0",_("Shoot and kick the ball into the enemies goal, keep your goal clean."));
 #define g_nexball IS_GAMETYPE(NEXBALL)
@@ -94,10 +89,8 @@ REGISTER_GAMETYPE(_("Freeze Tag"),ft,g_freezetag,FREEZETAG,true,"timelimit=20 po
 #define g_freezetag IS_GAMETYPE(FREEZETAG)
 
 REGISTER_GAMETYPE(_("Keepaway"),ka,g_keepaway,KEEPAWAY,true,"timelimit=20 pointlimit=30",_("Hold the ball to get points for kills."));
-#define g_keepaway IS_GAMETYPE(KEEPAWAY)
 
 REGISTER_GAMETYPE(_("Invasion"),inv,g_invasion,INVASION,false,"pointlimit=50 teams=0",_("Survive against waves of monsters."));
-#define g_invasion IS_GAMETYPE(INVASION)
 
 const int MAPINFO_FEATURE_WEAPONS       = 1; // not defined for instagib-only maps
 const int MAPINFO_FEATURE_VEHICLES      = 2;
index 4f9116e73c9d689cb6adbf7f0e4d6f7b21dcff67..f0b768c5741986aca921eb5a77be1ee83e73947c 100644 (file)
@@ -978,7 +978,7 @@ void WaypointSprite_Reset()
 {SELFPARAM();
     // if a WP wants to time out, let it time out immediately; other WPs ought to be reset/killed by their owners
 
-    if (self.fade_time) // was there before: || g_keyhunt, do we really need this?
+    if (self.fade_time)
         WaypointSprite_Kill(self);
 }
 
index 4caacea7cfb0c4cdf3fd28dd0e087513fa16763e..52a1aa351165d20d73ba0be9d96f1c21227b8689 100644 (file)
@@ -147,9 +147,12 @@ string format_replacement;
 string format_message;
 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
 
-/** returns 1 if throwing the current weapon shall not be allowed */
+/** returns true if throwing the current weapon shall not be allowed */
 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_NO_ARGS);
 
+/** returns true if dropping the current weapon shall not be allowed at any time including death */
+MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_NO_ARGS);
+
 /** allows changing attack rate */
 #define EV_WeaponRateFactor(i, o) \
     /**/ i(float, weapon_rate) \
index 773c08d21a06c66af7e90edc46d48d466f3810cb..d5f9cbdc6e90b4f046fc22c9be11c662a525de73 100644 (file)
@@ -6,7 +6,7 @@ MUTATOR_HOOKFUNCTION(dm, Scores_CountFragsRemaining)
        return true;
 }
 
-REGISTER_MUTATOR(dm, g_dm)
+REGISTER_MUTATOR(dm, IS_GAMETYPE(DEATHMATCH))
 {
        MUTATOR_ONADD
        {
index 2c124b5dec61c4b37b81d256af5a752d7210427f..504f31db0f80915d406fdd7674d7ca26d60792c9 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "../teamplay.qh"
 
+bool g_domination;
+
 int autocvar_g_domination_default_teams;
 bool autocvar_g_domination_disable_frags;
 int autocvar_g_domination_point_amt;
@@ -659,11 +661,12 @@ void dom_DelayedInit() // Do this check with a delay so we can wait for teams to
 
 void dom_Initialize()
 {
+       g_domination = true;
        InitializeEntity(world, dom_DelayedInit, INITPRIO_GAMETYPE);
 }
 
 
-REGISTER_MUTATOR(dom, g_domination)
+REGISTER_MUTATOR(dom, IS_GAMETYPE(DOMINATION))
 {
        int fraglimit_override = autocvar_g_domination_point_limit;
        if(autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit)
index f1b942919f60b09f70d8b8c2a4dbbe7a89e875cf..e752da96eba32a61aba4a058d90b60d5c572f827 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "../teamplay.qh"
 
+bool g_invasion;
+
 float autocvar_g_invasion_round_timelimit;
 int autocvar_g_invasion_teams;
 bool autocvar_g_invasion_team_spawns;
@@ -468,7 +470,7 @@ void invasion_Initialize()
        InitializeEntity(world, invasion_DelayedInit, INITPRIO_GAMETYPE);
 }
 
-REGISTER_MUTATOR(inv, g_invasion)
+REGISTER_MUTATOR(inv, IS_GAMETYPE(INVASION))
 {
        SetLimits(autocvar_g_invasion_point_limit, -1, -1, -1);
        if(autocvar_g_invasion_teams >= 2)
@@ -482,6 +484,7 @@ REGISTER_MUTATOR(inv, g_invasion)
        {
                if(time > 1) // game loads at time 1
                        error("This is a game type and it cannot be added at runtime.");
+               g_invasion = true;
                invasion_Initialize();
 
                cvar_settemp("g_monsters", "1");
index 61289b58f48099d3565c76c86c97b88c87d37282..f96aada3ee09ac8506edb8661d116229ca8be63f 100644 (file)
@@ -421,8 +421,6 @@ MUTATOR_HOOKFUNCTION(ka, DropSpecialItems)
 
 void ka_SpawnBall() // loads various values for the ball, runs only once at start of match
 {
-       if(!g_keepaway) { return; }
-
        entity e;
        e = spawn();
        e.model = "models/orbs/orbblue.md3";
@@ -456,15 +454,12 @@ void ka_ScoreRules()
 
 void ka_Initialize() // run at the start of a match, initiates game mode
 {
-       if(!g_keepaway)
-               return;
-
        ka_ScoreRules();
        ka_SpawnBall();
 }
 
 
-REGISTER_MUTATOR(ka, g_keepaway)
+REGISTER_MUTATOR(ka, IS_GAMETYPE(KEEPAWAY))
 {
        MUTATOR_ONADD
        {
index 9b33d5d7524ea464a894ed1e1414acbe0e2dd4b0..8f680ae648ee9c583b91c419029e0a83423e9e55 100644 (file)
@@ -1349,7 +1349,7 @@ MUTATOR_HOOKFUNCTION(kh, reset_map_global)
        return false;
 }
 
-REGISTER_MUTATOR(kh, g_keyhunt)
+REGISTER_MUTATOR(kh, IS_GAMETYPE(KEYHUNT))
 {
        ActivateTeamplay();
        SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, -1, -1);
index dc56fb17a1bcf8ed065d7635f58599da056abbbc..65c85f73a6e8eb372dda1cffbda290688522b29e 100644 (file)
@@ -272,7 +272,7 @@ void lms_Initialize()
        lms_ScoreRules();
 }
 
-REGISTER_MUTATOR(lms, g_lms)
+REGISTER_MUTATOR(lms, IS_GAMETYPE(LMS))
 {
        SetLimits(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override), 0, -1, -1);
 
index 53cf0c7980ac1caa3d387aa3d6ff7527e872e35a..3ebcb7eac0f0db0e2a12582e5352f1b8b7ca61d4 100644 (file)
@@ -2,6 +2,8 @@
 #include "../controlpoint.qh"
 #include "../generator.qh"
 
+bool g_onslaught;
+
 float autocvar_g_onslaught_debug;
 float autocvar_g_onslaught_teleport_wait;
 bool autocvar_g_onslaught_spawn_at_controlpoints;
@@ -2177,6 +2179,7 @@ void ons_DelayedInit() // Do this check with a delay so we can wait for teams to
 
 void ons_Initialize()
 {
+       g_onslaught = true;
        ons_captureshield_force = autocvar_g_onslaught_shield_force;
 
        addstat(STAT_ROUNDLOST, AS_INT, ons_roundlost);
@@ -2184,7 +2187,7 @@ void ons_Initialize()
        InitializeEntity(world, ons_DelayedInit, INITPRIO_GAMETYPE);
 }
 
-REGISTER_MUTATOR(ons, g_onslaught)
+REGISTER_MUTATOR(ons, IS_GAMETYPE(ONSLAUGHT))
 {
        ActivateTeamplay();
        SetLimits(autocvar_g_onslaught_point_limit, -1, -1, -1);
index 83025da9a859869669381fc26167a9fadef66f8b..ef243948ac446e71c40860bf3fe4f27dc57af4b6 100644 (file)
@@ -141,8 +141,6 @@ float W_IsWeaponThrowable(float w)
                return 0;
        if (g_cts)
                return 0;
-       if (g_nexball && w == WEP_MORTAR.m_id)
-               return 0;
     if(w == 0)
         return 0;
 
@@ -170,7 +168,7 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
        w = self.weapon;
        if (w == 0)
                return; // just in case
-       if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon))
+       if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon) || MUTATOR_CALLHOOK(ForbidDropCurrentWeapon))
                return;
        if(!autocvar_g_weapon_throwable)
                return;
@@ -193,6 +191,6 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
 void SpawnThrownWeapon(vector org, float w)
 {SELFPARAM();
        if(self.weapons & WepSet_FromWeapon(self.weapon))
-               if(W_IsWeaponThrowable(self.weapon))
+               if(!MUTATOR_CALLHOOK(ForbidDropCurrentWeapon) && W_IsWeaponThrowable(self.weapon))
                        W_ThrowNewWeapon(self, self.weapon, false, org, randomvec() * 125 + '0 0 200');
 }