From 1ee77504702210cca8ee84e2b82f3dcf8f6fb537 Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 7 Mar 2013 18:50:33 +0100 Subject: [PATCH] Reapply some changes that got lost in the previous merge commit and update code to use the new notify system --- qcsrc/client/announcer.qc | 4 +- qcsrc/client/hud.qc | 2 +- qcsrc/common/notifications.qh | 31 ++++++---- qcsrc/server/command/vote.qc | 4 +- qcsrc/server/mutators/gamemode_arena.qc | 27 +++------ qcsrc/server/mutators/gamemode_ca.qc | 61 ++++++++------------ qcsrc/server/mutators/gamemode_freezetag.qc | 64 +++++++++------------ 7 files changed, 83 insertions(+), 110 deletions(-) diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 51c67ccab..dc4d7e2c5 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -25,8 +25,6 @@ void Announcer_Countdown() float roundstarttime = getstatf(STAT_ROUNDSTARTTIME); if(roundstarttime == -1) { - // stop countdown immediately - centerprint_generic(CPID_GAME_STARTING, "", 1, 0); remove(self); return; } @@ -49,7 +47,7 @@ void Announcer_Countdown() else // countdown is still going { if(roundstarttime == starttime) - centerprint_generic(CPID_GAME_STARTING, _("^1Round starts in %d seconds"), 1, countdown_rounded); + Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded); else Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_GAMESTART, countdown_rounded); diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 77623d5a7..dc2efb27a 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2718,7 +2718,7 @@ void HUD_Mod_CA(vector myPos, vector mySize) entity tm; float teams_count = 0; for(tm = teams.sort_next; tm; tm = tm.sort_next) - if(tm.team != COLOR_SPECTATOR) + if(tm.team != NUM_SPECTATOR) ++teams_count; float layout; diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 719e5b0bd..c41c4879e 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -258,8 +258,12 @@ void Send_Notification_WOVA( MSG_INFO_NOTIF(1, INFO_DEATH_SELF_VOID, 2, 1, "s1 s2loc spree_lost", "s1", "notify_void", _("^BG%s^K1 was in the wrong place%s%s\n"), "") \ MULTITEAM_INFO(1, INFO_DEATH_TEAMKILL_, 4, 3, 1, "s1 s2 s3loc spree_end", "s2 s1", "notify_teamkill_%s", _("^BG%s^K1 was betrayed by ^BG%s^K1%s\n"), "") \ MSG_INFO_NOTIF(1, INFO_FREEZETAG_FREEZE, 2, 0, "s1 s2", "", "", _("^BG%s^K1 was frozen by ^BG%s\n"), "") \ - MSG_INFO_NOTIF(1, INFO_FREEZETAG_REVIVE, 2, 0, "s1 s2", "", "", _("^BG%s^K3 was revived by ^BG%s\n"), "") \ - MULTITEAM_INFO(1, INFO_FREEZETAG_ROUND_WIN_, 4, 0, 0, "", "", "", _("^TC^TT^BG team wins the round, all other teams were frozen\n"), "") \ + MSG_INFO_NOTIF(1, INFO_FREEZETAG_REVIVED, 2, 0, "s1 s2", "", "", _("^BG%s^K3 was revived by ^BG%s\n"), "") \ + MSG_INFO_NOTIF(1, INFO_FREEZETAG_AUTO_REVIVED, 1, 1, "s1 f1", "", "", _("^BG%s^K3 was automatically revived after %s second(s)\n"), "") \ + MULTITEAM_INFO(1, INFO_ROUND_TEAM_WIN_, 4, 0, 0, "", "", "", _("^TC^TT^BG team wins the round\n"), "") \ + MSG_INFO_NOTIF(1, INFO_ROUND_PLAYER_WIN, 1, 0, "s1", "", "", _("^BG%s^BG wins the round\n"), "") \ + MSG_INFO_NOTIF(1, INFO_ROUND_TIED, 0, 0, "", "", "", _("^BGRound tied\n"), "") \ + MSG_INFO_NOTIF(1, INFO_ROUND_OVER, 0, 0, "", "", "", _("^BGRound over, there's no winner\n"), "") \ MSG_INFO_NOTIF(1, INFO_FREEZETAG_SELF, 1, 0, "s1", "", "", _("^BG%s^K1 froze themself\n"), "") \ MSG_INFO_NOTIF(1, INFO_GODMODE_OFF, 0, 1, "f1", "", "", _("^BGGodmode saved you %s units of damage, cheater!\n"), "") \ MSG_INFO_NOTIF(0, INFO_ITEM_WEAPON_DONTHAVE, 0, 1, "item_wepname", "", "", _("^BGYou do not have the ^F1%s\n"), "") \ @@ -367,8 +371,11 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(1, CENTER_ARENA_ROUNDSTART, 0, 1, "", CPID_ARENA, "1 f1", _("^F4Round will start in ^COUNT"), "") \ MSG_CENTER_NOTIF(1, CENTER_ASSAULT_ATTACKING, 0, 0, "", CPID_ASSAULT_ROLE, "0 0", _("^BGYou are attacking!"), "") \ MSG_CENTER_NOTIF(1, CENTER_ASSAULT_DEFENDING, 0, 0, "", CPID_ASSAULT_ROLE, "0 0", _("^BGYou are defending!"), "") \ - MSG_CENTER_NOTIF(1, CENTER_COUNTDOWN_BEGIN, 0, 0, "", CPID_GAMESTART, "2 0", _("^F4Begin!"), "") \ - MSG_CENTER_NOTIF(1, CENTER_COUNTDOWN_GAMESTART, 0, 1, "", CPID_GAMESTART, "1 f1", _("^F4Game starts in ^COUNT"), "") \ + MSG_CENTER_NOTIF(1, CENTER_COUNTDOWN_BEGIN, 0, 0, "", CPID_ROUND, "2 0", _("^F4Begin!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_COUNTDOWN_GAMESTART, 0, 1, "", CPID_ROUND, "1 f1", _("^F4Game starts in ^COUNT"), "") \ + MSG_CENTER_NOTIF(1, CENTER_COUNTDOWN_ROUNDSTART, 0, 1, "", CPID_ROUND, "1 f1", _("^F4Round starts in ^COUNT"), "") \ + MSG_CENTER_NOTIF(1, CENTER_ROUND_TIED, 0, 0, "", CPID_ROUND, "0 0", _("^BGRound tied"), "") \ + MSG_CENTER_NOTIF(1, CENTER_ROUND_OVER, 0, 0, "", CPID_ROUND, "0 0", _("^BGRound over, there's no winner"), "") \ MSG_CENTER_NOTIF(1, CENTER_CTF_CAPTURESHIELD_FREE, 0, 0, "", CPID_CTF_CAPSHIELD, "0 0", _("^BGYou are now free.\n^BGFeel free to ^F2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \ MSG_CENTER_NOTIF(1, CENTER_CTF_CAPTURESHIELD_SHIELDED, 0, 0, "", CPID_CTF_CAPSHIELD, "0 0", _("^BGYou are now ^F1shielded^BG from the flag\n^BGfor ^F2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \ MULTITEAM_CENTER(1, CENTER_CTF_CAPTURE_, 2, 0, 0, "", CPID_CTF_LOWPRIO, "0 0", _("^BGYou captured the ^TC^TT^BG flag!"), "") \ @@ -431,9 +438,11 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_FROZEN, 1, 0, "s1", NO_CPID, "0 0", _("^K1You were frozen by ^BG%s"), "") \ MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_REVIVE, 1, 0, "s1", NO_CPID, "0 0", _("^K3You revived ^BG%s"), "") \ MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_REVIVED, 1, 0, "s1", NO_CPID, "0 0", _("^K3You were revived by ^BG%s"), "") \ - MULTITEAM_CENTER(1, CENTER_FREEZETAG_ROUND_WIN_, 4, 0, 0, "", NO_CPID, "0 0", _("^TC^TT^BG team wins the round, all other teams were frozen"), "") \ + MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_AUTO_REVIVED, 0, 1, "f1", NO_CPID, "0 0", _("^K3You were automatically revived after %s second(s)"), "") \ + MULTITEAM_CENTER(1, CENTER_ROUND_TEAM_WIN_, 4, 0, 0, "", CPID_ROUND, "0 0", _("^TC^TT^BG team wins the round"), "") \ + MSG_CENTER_NOTIF(1, CENTER_ROUND_PLAYER_WIN, 1, 0, "s1", CPID_ROUND, "0 0", _("^BG%s^BG wins the round"), "") \ MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_SELF, 0, 0, "", NO_CPID, "0 0", _("^K1You froze yourself"), "") \ - MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_SPAWN_LATE, 0, 0, "", NO_CPID, "0 0", _("^K1You spawned after the round started, you'll spawn as frozen"), "") \ + MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_SPAWN_LATE, 0, 0, "", NO_CPID, "0 0", _("^K1Round already started, you spawn as frozen"), "") \ MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_DONTHAVE, 0, 1, "item_wepname", CPID_ITEM, "item_centime 0", _("^BGYou do not have the ^F1%s"), "") \ MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_DROP, 1, 1, "item_wepname item_wepammo", CPID_ITEM, "item_centime 0", _("^BGYou dropped the ^F1%s^BG%s"), "") \ MSG_CENTER_NOTIF(1, CENTER_ITEM_WEAPON_GOT, 0, 1, "item_wepname", CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1%s"), "") \ @@ -450,7 +459,9 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_MEET, 0, 0, "", CPID_KEYHUNT, "0 0", _("^BGAll keys are in your team's hands!\nMeet the other key carriers ^F4NOW^BG!"), "") \ MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_SCAN, 0, 1, "", CPID_KEYHUNT_OTHER, "f1 0", _("^BGScanning frequency range..."), "") \ MULTITEAM_CENTER(1, CENTER_KEYHUNT_START_, 4, 0, 0, "", CPID_KEYHUNT, "0 0", _("^BGYou are starting with the ^TC^TT Key"), "") \ - MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_WAIT, 0, 4, "kh_teams", CPID_KEYHUNT_OTHER, "0 0", _("^BGWaiting for players to join...\nNeed active players for: %s"), "") \ + MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_WAIT, 0, 4, "missing_teams", CPID_KEYHUNT_OTHER, "0 0", _("^BGWaiting for players to join...\nNeed active players for: %s"), "") \ + MSG_CENTER_NOTIF(1, CENTER_MISSING_TEAMS, 0, 4, "missing_teams", CPID_ROUND, "0 0", _("^BGWaiting for players to join...\nNeed active players for: %s"), "") \ + MSG_CENTER_NOTIF(1, CENTER_MISSING_PLAYERS, 0, 1, "f1", CPID_ROUND, "0 0", _("^BGWaiting for %s player(s) to join..."), "") \ MSG_CENTER_NOTIF(1, CENTER_LMS_CAMPCHECK, 0, 0, "", CPID_LMS_CAMP, "0 0", _("^F2Don't camp!"), "") \ MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO, 0, 0, "", CPID_MINSTA_FINDAMMO, "1 9", _("^F4^COUNT^BG left to find some ammo!"), "") \ MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO_FIRST, 0, 0, "", CPID_MINSTA_FINDAMMO, "1 10", _("^BGGet some ammo or you'll be dead in ^F4^COUNT^BG!"), _("^BGGet some ammo! ^F4^COUNT^BG left!")) \ @@ -670,7 +681,7 @@ var float autocvar_notification_frag_verbose = TRUE; f2race_time: mmssss of f2 race_col: color of race time/position (i.e. good or bad) race_diff: show time difference between f2 and f3 - kh_teams: show which teams still need players in keyhunt centerprint + missing_teams: show which teams still need players pass_key: find the keybind for "passing" or "dropping" in CTF game mode frag_ping: show the ping of a player frag_stats: show health/armor/ping of a player @@ -723,7 +734,7 @@ string arg_slot[NOTIF_MAX_ARGS]; ARG_CASE(ARG_CS_SV, "f2race_time", mmssss(f2)) \ ARG_CASE(ARG_CS_SV, "race_col", CCR(((f1 == 1) ? "^F1" : "^F2"))) \ ARG_CASE(ARG_CS_SV, "race_diff", ((f2 > f3) ? sprintf(CCR("^1[+%s]"), mmssss(f2 - f3)) : sprintf(CCR("^2[-%s]"), mmssss(f3 - f2)))) \ - ARG_CASE(ARG_CS, "kh_teams", notif_arg_kh_teams(f1, f2, f3, f4)) \ + ARG_CASE(ARG_CS, "missing_teams", notif_arg_missing_teams(f1, f2, f3, f4)) \ ARG_CASE(ARG_CS, "pass_key", ((((tmp_s = getcommandkey("pass", "+use")) != "pass") && !(strstrofs(tmp_s, "not bound", 0) >= 0)) ? sprintf(CCR(_(" ^F1(Press %s)")), tmp_s) : "")) \ ARG_CASE(ARG_CS, "frag_ping", notif_arg_frag_ping(TRUE, f2)) \ ARG_CASE(ARG_CS, "frag_stats", notif_arg_frag_stats(f2, f3, f4)) \ @@ -767,7 +778,7 @@ string notif_arg_frag_stats(float fhealth, float farmor, float fping) return sprintf(CCR(_("\n(^F4Dead^BG)%s")), notif_arg_frag_ping(FALSE, fping)); } -string notif_arg_kh_teams(float f1, float f2, float f3, float f4) +string notif_arg_missing_teams(float f1, float f2, float f3, float f4) { return sprintf("%s%s%s%s", (f1 ? diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 42d729caf..507fcfe28 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -319,7 +319,7 @@ void VoteThink() // Game logic for warmup // ======================= -// Resets the state of all clients, items, flags, runes, keys, weapons, waypoints, ... of the map. +// Resets the state of all clients, items, weapons, waypoints, ... of the map. void reset_map(float dorespawn) { entity oldself; @@ -392,7 +392,7 @@ void reset_map(float dorespawn) } if(g_keyhunt) - kh_Controller_SetThink_NoMsg(autocvar_g_balance_keyhunt_delay_round+(game_starttime - time), kh_StartRound); + kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round + (game_starttime - time), kh_StartRound); self = oldself; } diff --git a/qcsrc/server/mutators/gamemode_arena.qc b/qcsrc/server/mutators/gamemode_arena.qc index f5f7eb136..b0757fd82 100644 --- a/qcsrc/server/mutators/gamemode_arena.qc +++ b/qcsrc/server/mutators/gamemode_arena.qc @@ -62,9 +62,8 @@ float Arena_CheckWinner() if(round_handler_GetTimeLeft() <= 0) { - FOR_EACH_REALCLIENT(e) - centerprint(e, "Round over, there's no winner"); - bprint("Round over, there's no winner\n"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER); + Send_Notification(NOTIF_ALL, world, MSG_INFO, CENTER_ROUND_OVER); round_handler_Init(5, autocvar_g_arena_warmup, autocvar_g_arena_round_timelimit); return 1; } @@ -82,16 +81,14 @@ float Arena_CheckWinner() if(champion) { - FOR_EACH_REALCLIENT(e) - centerprint(e, strcat("The Champion is ", champion.netname)); - bprint("The Champion is ", champion.netname, "\n"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_PLAYER_WIN, champion.netname); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_PLAYER_WIN, champion.netname); UpdateFrags(champion, +1); } else { - FOR_EACH_REALCLIENT(e) - centerprint(e, "Round tied"); - bprint("Round tied\n"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_TIED); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED); } round_handler_Init(5, autocvar_g_arena_warmup, autocvar_g_arena_round_timelimit); return 1; @@ -119,25 +116,19 @@ void Arena_AddChallengers() float prev_numspawned; float Arena_CheckPlayers() { - entity e; - Arena_AddChallengers(); if(numspawned >= 2) { - if(prev_numspawned != -1) - { - FOR_EACH_REALCLIENT(e) - Send_CSQC_Centerprint_Generic_Expire(e, CPID_WAITING_PLAYERS); - } + Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_PLAYERS); prev_numspawned = -1; return 1; } if(prev_numspawned != numspawned && numspawned == 1) { - FOR_EACH_REALCLIENT(e) - Send_CSQC_Centerprint_Generic(e, CPID_WAITING_PLAYERS, "Waiting for players to join...", -1, 0); + if(maxspawned - numspawned > 0) + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_PLAYERS, maxspawned - numspawned); prev_numspawned = numspawned; } diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 561720963..f383d1296 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -9,22 +9,22 @@ void CA_count_alive_players() entity e; total_players = redalive = bluealive = yellowalive = pinkalive = 0; FOR_EACH_PLAYER(e) { - if(e.team == COLOR_TEAM1) + if(e.team == NUM_TEAM_1) { ++total_players; if (e.health >= 1) ++redalive; } - else if(e.team == COLOR_TEAM2) + else if(e.team == NUM_TEAM_2) { ++total_players; if (e.health >= 1) ++bluealive; } - else if(e.team == COLOR_TEAM3) + else if(e.team == NUM_TEAM_3) { ++total_players; if (e.health >= 1) ++yellowalive; } - else if(e.team == COLOR_TEAM4) + else if(e.team == NUM_TEAM_4) { ++total_players; if (e.health >= 1) ++pinkalive; @@ -42,21 +42,21 @@ float CA_GetWinnerTeam() { float winner_team = 0; if(redalive >= 1) - winner_team = COLOR_TEAM1; + winner_team = NUM_TEAM_1; if(bluealive >= 1) { if(winner_team) return 0; - winner_team = COLOR_TEAM2; + winner_team = NUM_TEAM_2; } if(yellowalive >= 1) { if(winner_team) return 0; - winner_team = COLOR_TEAM3; + winner_team = NUM_TEAM_3; } if(pinkalive >= 1) { if(winner_team) return 0; - winner_team = COLOR_TEAM4; + winner_team = NUM_TEAM_4; } if(winner_team) return winner_team; @@ -67,12 +67,10 @@ float CA_GetWinnerTeam() #define CA_ALIVE_TEAMS_OK() (CA_ALIVE_TEAMS() == ca_teams) float CA_CheckWinner() { - entity e; if(round_handler_GetTimeLeft() <= 0) { - FOR_EACH_REALCLIENT(e) - centerprint(e, "Round over, there's no winner"); - bprint("Round over, there's no winner.\n"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER); + Send_Notification(NOTIF_ALL, world, MSG_INFO, CENTER_ROUND_OVER); allowed_to_spawn = FALSE; round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit); return 1; @@ -82,22 +80,17 @@ float CA_CheckWinner() if(CA_ALIVE_TEAMS() > 1) return 0; - float winner_team; - string teamname; - winner_team = CA_GetWinnerTeam(); + float winner_team = CA_GetWinnerTeam(); if(winner_team > 0) { - teamname = ColoredTeamName(winner_team); - FOR_EACH_REALCLIENT(e) - centerprint(e, strcat(teamname, " wins the round")); - bprint(teamname, " wins the round.\n"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM_4(winner_team, CENTER_ROUND_TEAM_WIN_)); + Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(winner_team, INFO_ROUND_TEAM_WIN_)); TeamScore_AddToTeam(winner_team, ST_SCORE, +1); } else if(winner_team == -1) { - FOR_EACH_REALCLIENT(e) - centerprint(e, "Round tied"); - bprint("Round tied.\n"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_TIED); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED); } allowed_to_spawn = FALSE; @@ -116,32 +109,24 @@ void CA_RoundStart() float prev_total_players; float CA_CheckTeams() { - entity e; allowed_to_spawn = TRUE; CA_count_alive_players(); if(CA_ALIVE_TEAMS_OK()) { - if(prev_total_players != -1) - { - FOR_EACH_REALCLIENT(e) - Send_CSQC_Centerprint_Generic_Expire(e, CPID_WAITING_PLAYERS); - } + Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_TEAMS); prev_total_players = -1; return 1; } if(prev_total_players != total_players) { - string teams_missing = ""; - if(!redalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM1), ", "); - if(!bluealive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM2), ", "); + float p1 = 0, p2 = 0, p3 = 0, p4 = 0; + if(!redalive) p1 = NUM_TEAM_1; + if(!bluealive) p2 = NUM_TEAM_2; if(ca_teams >= 3) - if(!yellowalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM3), ", "); - if(ca_teams == 4) - if(!pinkalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM4), ", "); - teams_missing = substring(teams_missing, 0, strlen(teams_missing)-2); - - FOR_EACH_REALCLIENT(e) - Send_CSQC_Centerprint_Generic(e, CPID_WAITING_PLAYERS, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, 0); + if(!yellowalive) p3 = NUM_TEAM_3; + if(ca_teams >= 4) + if(!pinkalive) p4 = NUM_TEAM_4; + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_TEAMS, p1, p2, p3, p4); prev_total_players = total_players; } return 0; diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index 3853d49f2..5cfd1b9f5 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -11,22 +11,22 @@ void freezetag_count_alive_players() entity e; total_players = redalive = bluealive = yellowalive = pinkalive = 0; FOR_EACH_PLAYER(e) { - if(e.team == COLOR_TEAM1 && e.health >= 1) + if(e.team == NUM_TEAM_1 && e.health >= 1) { ++total_players; if (!e.freezetag_frozen) ++redalive; } - else if(e.team == COLOR_TEAM2 && e.health >= 1) + else if(e.team == NUM_TEAM_2 && e.health >= 1) { ++total_players; if (!e.freezetag_frozen) ++bluealive; } - else if(e.team == COLOR_TEAM3 && e.health >= 1) + else if(e.team == NUM_TEAM_3 && e.health >= 1) { ++total_players; if (!e.freezetag_frozen) ++yellowalive; } - else if(e.team == COLOR_TEAM4 && e.health >= 1) + else if(e.team == NUM_TEAM_4 && e.health >= 1) { ++total_players; if (!e.freezetag_frozen) ++pinkalive; @@ -45,30 +45,22 @@ void freezetag_count_alive_players() float prev_total_players; float freezetag_CheckTeams() { - entity e; if(FREEZETAG_ALIVE_TEAMS_OK()) { - if(prev_total_players != -1) - { - FOR_EACH_REALCLIENT(e) - Send_CSQC_Centerprint_Generic_Expire(e, CPID_WAITING_PLAYERS); - } + Kill_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_TEAMS); prev_total_players = -1; return 1; } if(prev_total_players != total_players) { - string teams_missing = ""; - if(!redalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM1), ", "); - if(!bluealive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM2), ", "); + float p1 = 0, p2 = 0, p3 = 0, p4 = 0; + if(!redalive) p1 = NUM_TEAM_1; + if(!bluealive) p2 = NUM_TEAM_2; if(freezetag_teams >= 3) - if(!yellowalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM3), ", "); - if(freezetag_teams == 4) - if(!pinkalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM4), ", "); - teams_missing = substring(teams_missing, 0, strlen(teams_missing)-2); - - FOR_EACH_REALCLIENT(e) - Send_CSQC_Centerprint_Generic(e, CPID_WAITING_PLAYERS, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, 0); + if(!yellowalive) p3 = NUM_TEAM_3; + if(freezetag_teams >= 4) + if(!pinkalive) p4 = NUM_TEAM_4; + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_TEAMS, p1, p2, p3, p4); prev_total_players = total_players; } return 0; @@ -78,21 +70,21 @@ float freezetag_getWinnerTeam() { float winner_team = 0; if(redalive >= 1) - winner_team = COLOR_TEAM1; + winner_team = NUM_TEAM_1; if(bluealive >= 1) { if(winner_team) return 0; - winner_team = COLOR_TEAM2; + winner_team = NUM_TEAM_2; } if(yellowalive >= 1) { if(winner_team) return 0; - winner_team = COLOR_TEAM3; + winner_team = NUM_TEAM_3; } if(pinkalive >= 1) { if(winner_team) return 0; - winner_team = COLOR_TEAM4; + winner_team = NUM_TEAM_4; } if(winner_team) return winner_team; @@ -104,9 +96,8 @@ float freezetag_CheckWinner() entity e; if(round_handler_GetTimeLeft() <= 0) { - FOR_EACH_REALCLIENT(e) - centerprint(e, "Round over, there's no winner"); - bprint("Round over, there's no winner.\n"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER); FOR_EACH_PLAYER(e) e.freezetag_frozen_timeout = 0; round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit); @@ -117,19 +108,17 @@ float freezetag_CheckWinner() return 0; float winner_team; - string teamname; winner_team = freezetag_getWinnerTeam(); if(winner_team > 0) { - Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM_4(winner.team, CENTER_FREEZETAG_ROUND_WIN_)); - Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(winner.team, INFO_FREEZETAG_ROUND_WIN_)); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM_4(winner_team, CENTER_ROUND_TEAM_WIN_)); + Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(winner_team, INFO_ROUND_TEAM_WIN_)); TeamScore_AddToTeam(winner_team, ST_SCORE, +1); } else if(winner_team == -1) { - FOR_EACH_REALCLIENT(e) - centerprint(e, "^5Round tied! All teams were frozen."); - bprint("^5Round tied! All teams were frozen.\n"); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_TIED); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED); } FOR_EACH_PLAYER(e) @@ -186,7 +175,7 @@ void freezetag_Freeze(entity attacker) ice.nextthink = time; ice.frame = floor(random() * 21); // ice model has 20 different looking frames ice.alpha = ICE_MAX_ALPHA; - ice.colormod = TeamColor(self.team); + ice.colormod = Team_ColorRGB(self.team); ice.glowmod = ice.colormod; setmodel(ice, "models/ice/ice.md3"); @@ -487,9 +476,8 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink) if(n == -1) { - string s = ftos(autocvar_g_freezetag_frozen_maxtime); - centerprint(self, strcat("^5You were automatically revived after ", s, " seconds^5.\n")); - bprint("^7", self.netname, "^5 were automatically revived after ", s, " seconds^5.\n"); + Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_AUTO_REVIVED, autocvar_g_freezetag_frozen_maxtime); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_AUTO_REVIVED, self.netname, autocvar_g_freezetag_frozen_maxtime); return 1; } @@ -505,7 +493,7 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink) Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname); Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, self.netname); - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVE, self.netname, o.netname); + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED, self.netname, o.netname); } FOR_EACH_PLAYER(other) -- 2.39.2