From 6f2c502485d481af6580321a27311c3a097552ac Mon Sep 17 00:00:00 2001 From: byteManiak Date: Fri, 29 Mar 2019 23:12:56 +0000 Subject: [PATCH] LMS loser / CTS nonsolid frags merging --- qcsrc/common/constants.qh | 4 +--- .../gamemodes/gamemode/clanarena/sv_clanarena.qc | 4 ++-- qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc | 2 +- qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc | 16 ++++++++-------- qcsrc/common/gamemodes/gamemode/race/sv_race.qc | 2 +- qcsrc/server/defs.qh | 2 +- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 675b75c0a4..15c1366ea1 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -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; diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index 56cfabc501..4105f7ce8c 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -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) diff --git a/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc b/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc index 31bdae0790..4e219eae7e 100644 --- a/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc +++ b/qcsrc/common/gamemodes/gamemode/cts/sv_cts.qc @@ -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; diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index e30d958a14..6d420c7a95 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -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"); diff --git a/qcsrc/common/gamemodes/gamemode/race/sv_race.qc b/qcsrc/common/gamemodes/gamemode/race/sv_race.qc index 66b23f6a68..bef3b19712 100644 --- a/qcsrc/common/gamemodes/gamemode/race/sv_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/sv_race.qc @@ -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; } diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index c66ad28fe3..28a61cf1cd 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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; -- 2.39.2