Merge branch 'byteManiak/misc' into 'master'
authorterencehill <piuntn@gmail.com>
Fri, 29 Mar 2019 23:12:56 +0000 (23:12 +0000)
committerterencehill <piuntn@gmail.com>
Fri, 29 Mar 2019 23:12:56 +0000 (23:12 +0000)
Merge FRAGS_LMS_LOSER and FRAGS_PLAYER_NONSOLID into a single constant called FRAGS_PLAYER_OUT_OF_GAME.

See merge request xonotic/xonotic-data.pk3dir!642

qcsrc/common/constants.qh
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc
qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
qcsrc/common/gamemodes/gamemode/race/sv_race.qc
qcsrc/server/defs.qh

index 675b75c..15c1366 100644 (file)
@@ -40,9 +40,7 @@ const int SPECIES_RESERVED = 15;
 
 const int FRAGS_PLAYER = 0;
 const int FRAGS_SPECTATOR = -666;
-const int FRAGS_LMS_LOSER = -616;
-const int FRAGS_PLAYER_NONSOLID = FRAGS_LMS_LOSER;
-// we can use this frags value for both
+const int FRAGS_PLAYER_OUT_OF_GAME = -616;
 
 // server flags
 const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
index 56cfabc..4105f7c 100644 (file)
@@ -147,7 +147,7 @@ bool CA_CheckTeams()
 
 bool ca_isEliminated(entity e)
 {
-       if(e.caplayer == 1 && (IS_DEAD(e) || e.frags == FRAGS_LMS_LOSER))
+       if(e.caplayer == 1 && (IS_DEAD(e) || e.frags == FRAGS_PLAYER_OUT_OF_GAME))
                return true;
        if(e.caplayer == 0.5)
                return true;
@@ -312,7 +312,7 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
        if (player.killindicator_teamchange == -2) // player wants to spectate
                player.caplayer = 0;
        if (player.caplayer)
-               player.frags = FRAGS_LMS_LOSER;
+               player.frags = FRAGS_PLAYER_OUT_OF_GAME;
        if (!warmup_stage)
                eliminatedPlayers.SendFlags |= 1;
        if (!player.caplayer)
index 31bdae0..4e219ea 100644 (file)
@@ -208,7 +208,7 @@ MUTATOR_HOOKFUNCTION(cts, MakePlayerObserver)
        entity player = M_ARGV(0, entity);
 
        if(GameRules_scoring_add(player, RACE_FASTEST, 0))
-               player.frags = FRAGS_LMS_LOSER;
+               player.frags = FRAGS_PLAYER_OUT_OF_GAME;
        else
                player.frags = FRAGS_SPECTATOR;
 
index e30d958..6d420c7 100644 (file)
@@ -37,7 +37,7 @@ int WinningCondition_LMS()
 {
        entity first_player = NULL;
        int totalplayers = 0;
-       FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_LMS_LOSER, {
+       FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
                if (!totalplayers)
                        first_player = it;
                ++totalplayers;
@@ -185,21 +185,21 @@ void lms_RemovePlayer(entity player)
        if (!player_rank)
        {
                int pl_cnt = 0;
-               FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_LMS_LOSER, {
+               FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
                        pl_cnt++;
                });
                if (player.lms_spectate_warning < 2)
                {
                        if(IS_BOT_CLIENT(player))
                                bot_clear(player);
-                       player.frags = FRAGS_LMS_LOSER;
+                       player.frags = FRAGS_PLAYER_OUT_OF_GAME;
                        GameRules_scoring_add(player, LMS_RANK, pl_cnt + 1);
                }
                else
                {
                        lms_lowest_lives = 999;
                        FOREACH_CLIENT(true, {
-                               if (it.frags == FRAGS_LMS_LOSER)
+                               if (it.frags == FRAGS_PLAYER_OUT_OF_GAME)
                                {
                                        float it_rank = GameRules_scoring_add(it, LMS_RANK, 0);
                                        if (it_rank > player_rank && it_rank <= 256)
@@ -219,7 +219,7 @@ void lms_RemovePlayer(entity player)
                                GameRules_scoring_add(player, LMS_LIVES, -GameRules_scoring_add(player, LMS_LIVES, 0));
                                ++quitters;
                        }
-                       player.frags = FRAGS_LMS_LOSER;
+                       player.frags = FRAGS_PLAYER_OUT_OF_GAME;
                        TRANSMUTE(Observer, player);
                }
        }
@@ -307,12 +307,12 @@ MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill)
                if(tl <= 0)
                {
                        int pl_cnt = 0;
-                       FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_LMS_LOSER, {
+                       FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
                                pl_cnt++;
                        });
                        if(IS_BOT_CLIENT(frag_target))
                                bot_clear(frag_target);
-                       frag_target.frags = FRAGS_LMS_LOSER;
+                       frag_target.frags = FRAGS_PLAYER_OUT_OF_GAME;
                        GameRules_scoring_add(frag_target, LMS_RANK, pl_cnt);
                }
        }
@@ -413,7 +413,7 @@ MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate)
        }
        else
        {
-               if(player.frags != FRAGS_SPECTATOR && player.frags != FRAGS_LMS_LOSER)
+               if(player.frags != FRAGS_SPECTATOR && player.frags != FRAGS_PLAYER_OUT_OF_GAME)
                {
                        player.lms_spectate_warning = 1;
                        sprint(player, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n");
index 66b23f6..bef3b19 100644 (file)
@@ -261,7 +261,7 @@ MUTATOR_HOOKFUNCTION(rc, MakePlayerObserver)
        if(g_race_qualifying)
        {
                if(GameRules_scoring_add(player, RACE_FASTEST, 0))
-                       player.frags = FRAGS_LMS_LOSER;
+                       player.frags = FRAGS_PLAYER_OUT_OF_GAME;
                else
                        player.frags = FRAGS_SPECTATOR;
        }
index c66ad28..28a61cf 100644 (file)
@@ -244,7 +244,7 @@ int autocvar__independent_players;
 bool independent_players;
 #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players)
 #define IS_INDEPENDENT_PLAYER(e) ((e).solid == SOLID_TRIGGER)
-#define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER), ((e).frags = FRAGS_PLAYER_NONSOLID))
+#define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER), ((e).frags = FRAGS_PLAYER_OUT_OF_GAME))
 
 string clientstuff;
 .float phase;