From: terencehill Date: Sat, 16 Jul 2022 17:34:37 +0000 (+0200) Subject: Move the missing teams message from centerprint to infomessages panel. Also remove... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fterencehill%2Fmissing_teams_infomessage;p=xonotic%2Fxonotic-data.pk3dir.git Move the missing teams message from centerprint to infomessages panel. Also remove unused MISSING_PLAYERS notifications --- diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index 5169ea5f3..92ab616c7 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -58,6 +58,16 @@ vector InfoMessages_drawstring(string s, vector pos, vector sz, float a, vector img_curr_group = -1; \ MACRO_END +string get_team_list(int team_mask) +{ + return strcat( + ((team_mask & BIT(0)) ? strcat(Team_ColoredFullName(NUM_TEAM_1), (team_mask >> 1) ? ", " : "") : ""), + ((team_mask & BIT(1)) ? strcat(Team_ColoredFullName(NUM_TEAM_2), (team_mask >> 2) ? ", " : "") : ""), + ((team_mask & BIT(2)) ? strcat(Team_ColoredFullName(NUM_TEAM_3), (team_mask >> 3) ? ", " : "") : ""), + ((team_mask & BIT(3)) ? Team_ColoredFullName(NUM_TEAM_4) : "") + ); +} + void HUD_InfoMessages() { if(!autocvar__hud_configure) @@ -174,6 +184,14 @@ void HUD_InfoMessages() InfoMessage(s); } + int missing_teams_mask = STAT(MISSING_TEAMS_MASK); + if (missing_teams_mask) + { + string missing_teams_list = get_team_list(missing_teams_mask); + s = sprintf(_("%sNeed active players for: %s"), blinkcolor, missing_teams_list); + InfoMessage(s); + } + if(teamplay && !spectatee_status && teamnagger) { float ts_min = 0, ts_max = 0; diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index 7803108c6..622419db0 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -94,21 +94,11 @@ bool CA_CheckTeams() static int prev_missing_teams_mask; allowed_to_spawn = true; CA_count_alive_players(); + missing_teams_mask = 0; if (Team_GetNumberOfAliveTeams() == NumTeams(ca_teams)) - { - if(prev_missing_teams_mask > 0) - Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS); - prev_missing_teams_mask = -1; return true; - } if(total_players == 0) - { - if(prev_missing_teams_mask > 0) - Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS); - prev_missing_teams_mask = -1; return false; - } - int missing_teams_mask = 0; for (int i = 1; i <= NUM_TEAMS; ++i) { if ((ca_teams & Team_IndexToBit(i)) && @@ -118,10 +108,7 @@ bool CA_CheckTeams() } } if(prev_missing_teams_mask != missing_teams_mask) - { - Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask); prev_missing_teams_mask = missing_teams_mask; - } return false; } diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index 4c50abb46..84be71b16 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -52,21 +52,11 @@ void freezetag_count_alive_players() bool freezetag_CheckTeams() { static float prev_missing_teams_mask; + missing_teams_mask = 0; if (Team_GetNumberOfAliveTeams() == NumTeams(freezetag_teams)) - { - if(prev_missing_teams_mask > 0) - Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS); - prev_missing_teams_mask = -1; return true; - } if(total_players == 0) - { - if(prev_missing_teams_mask > 0) - Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS); - prev_missing_teams_mask = -1; return false; - } - int missing_teams_mask = 0; for (int i = 1; i <= NUM_TEAMS; ++i) { if ((freezetag_teams & Team_IndexToBit(i)) && @@ -76,10 +66,7 @@ bool freezetag_CheckTeams() } } if(prev_missing_teams_mask != missing_teams_mask) - { - Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask); prev_missing_teams_mask = missing_teams_mask; - } return false; } diff --git a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc index 5f90c390f..4a8b3b54b 100644 --- a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc +++ b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc @@ -862,39 +862,24 @@ int kh_GetMissingTeams() void kh_WaitForPlayers() // delay start of the round until enough players are present { static int prev_missing_teams_mask; + missing_teams_mask = kh_GetMissingTeams(); if(time < game_starttime) { - if (prev_missing_teams_mask > 0) - Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS); - prev_missing_teams_mask = -1; kh_Controller_SetThink(game_starttime - time + 0.1, kh_WaitForPlayers); return; } - int missing_teams_mask = kh_GetMissingTeams(); if(!missing_teams_mask) { - if(prev_missing_teams_mask > 0) - Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS); - prev_missing_teams_mask = -1; Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round); kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_round, kh_StartRound); } else { - if(player_count == 0) - { - if(prev_missing_teams_mask > 0) - Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS); - prev_missing_teams_mask = -1; - } - else + if(player_count != 0) { if(prev_missing_teams_mask != missing_teams_mask) - { - Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask); prev_missing_teams_mask = missing_teams_mask; - } } kh_Controller_SetThink(1, kh_WaitForPlayers); } diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 69483bfc3..2896d05de 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -707,10 +707,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != MSG_CENTER_NOTIF(LMS_SPECWARN, N_ENABLE, 0, 0, "", CPID_LMS, "0 0", _("^F4WARNING:^BG you can't rejoin this match after spectating.\nUse the same command again to spectate anyway."), "") MSG_CENTER_NOTIF(LMS_VISIBLE_LEADER, N_ENABLE, 0, 0, "", CPID_LMS, "0 0", _("^BGEnemies can now see you on radar!"), "") MSG_CENTER_NOTIF(LMS_VISIBLE_OTHER, N_ENABLE, 0, 0, "", CPID_LMS, "0 0", _("^BGLeaders can now be seen by enemies on radar!"), "") - - MSG_CENTER_NOTIF(MISSING_TEAMS, N_ENABLE, 0, 1, "missing_teams", CPID_MISSING_TEAMS, "-1 0", _("^BGWaiting for players to join...\nNeed active players for: %s"), "") - MSG_CENTER_NOTIF(MISSING_PLAYERS, N_ENABLE, 0, 1, "f1", CPID_MISSING_PLAYERS, "-1 0", _("^BGWaiting for %s player(s) to join..."), "") - +// TODO update notifications.cfg MSG_CENTER_NOTIF(INSTAGIB_DOWNGRADE, N_ENABLE, 0, 0, "", CPID_INSTAGIB_FINDAMMO, "5 0", _("^BGYour weapon has been downgraded until you find some ammo!"), "") MSG_CENTER_NOTIF(INSTAGIB_FINDAMMO, N_ENABLE, 0, 0, "", CPID_INSTAGIB_FINDAMMO, "1 9", _("^F4^COUNT^BG left to find some ammo!"), "") MSG_CENTER_NOTIF(INSTAGIB_FINDAMMO_FIRST, N_ENABLE, 0, 0, "", CPID_INSTAGIB_FINDAMMO, "1 10", _("^BGGet some ammo or you'll be dead in ^F4^COUNT^BG!"), _("^BGGet some ammo! ^F4^COUNT^BG left!")) diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index fb06d264a..87dfa47db 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -59,8 +59,6 @@ ENUMCLASS(CPID) CASE(CPID, KEYHUNT) CASE(CPID, KEYHUNT_OTHER) CASE(CPID, LMS) - CASE(CPID, MISSING_TEAMS) - CASE(CPID, MISSING_PLAYERS) CASE(CPID, INSTAGIB_FINDAMMO) CASE(CPID, MOTD) CASE(CPID, NIX) @@ -362,7 +360,6 @@ float autocvar_notification_show_sprees_center_specialonly = true; f2race_time: TIME_ENCODED_TOSTRING of f2 race_col: color of race time/position (i.e. good or bad) race_diff: show time difference between f2 and f3 - missing_teams: show which teams still need players pass_key: find the keybind for "passing" or "dropping" in CTF game mode nade_key: find the keybind for nade throwing frag_ping: show the ping of a player @@ -423,7 +420,6 @@ string BUFF_NAME(int i); ARG_CASE(ARG_CS_SV_HA, "f3race_time", TIME_ENCODED_TOSTRING(f3, true)) \ 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]"), TIME_ENCODED_TOSTRING(f2 - f3, true)) : sprintf(CCR("^2[-%s]"), TIME_ENCODED_TOSTRING(f3 - f2, true)))) \ - ARG_CASE(ARG_CS, "missing_teams", notif_arg_missing_teams(f1)) \ ARG_CASE(ARG_CS, "pass_key", getcommandkey(_("drop flag"), "+use")) \ ARG_CASE(ARG_CS, "nade_key", getcommandkey(_("throw nade"), "dropweapon")) \ ARG_CASE(ARG_CS, "join_key", getcommandkey(_("jump"), "+jump")) \ @@ -478,16 +474,6 @@ string notif_arg_frag_stats(float fhealth, float farmor, float fping) return sprintf(CCR(_("\n(^F4Dead^BG)%s")), s); } -string notif_arg_missing_teams(float f1) -{ - return strcat( - ((f1 & BIT(0)) ? strcat(Team_ColoredFullName(NUM_TEAM_1), (f1 >> 1) ? ", " : "") : ""), - ((f1 & BIT(1)) ? strcat(Team_ColoredFullName(NUM_TEAM_2), (f1 >> 2) ? ", " : "") : ""), - ((f1 & BIT(2)) ? strcat(Team_ColoredFullName(NUM_TEAM_3), (f1 >> 3) ? ", " : "") : ""), - ((f1 & BIT(3)) ? Team_ColoredFullName(NUM_TEAM_4) : "") - ); -} - string notif_arg_spree_cen(float spree) { // 0 = off, 1 = target (but only for first victim) and attacker diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 128f090c4..58b84fa67 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -78,6 +78,7 @@ float W_WeaponRateFactor(entity this); float game_stopped; float game_starttime; //point in time when the countdown to game start is over float round_starttime; //point in time when the countdown to round start is over +int missing_teams_mask; int autocvar_leadlimit; int overtimes; // overtimes added (-1 = sudden death) int timeout_status; // (values: 0, 1, 2) contains whether a timeout is not active (0), was called but still at leadtime (1) or is active (2) @@ -91,6 +92,7 @@ int timeout_status; // (values: 0, 1, 2) contains whether a timeout is not activ REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this)) REGISTER_STAT(GAME_STOPPED, int, game_stopped) REGISTER_STAT(GAMESTARTTIME, float, game_starttime) +REGISTER_STAT(MISSING_TEAMS_MASK, float, missing_teams_mask) /** arc heat in [0,1] */ REGISTER_STAT(PRESSED_KEYS, int) REGISTER_STAT(FUEL, int)