]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move the missing teams message from centerprint to infomessages panel. Also remove... terencehill/missing_teams_infomessage 1054/head
authorterencehill <piuntn@gmail.com>
Sat, 16 Jul 2022 17:34:37 +0000 (19:34 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 16 Jul 2022 17:34:37 +0000 (19:34 +0200)
qcsrc/client/hud/panel/infomessages.qc
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc
qcsrc/common/notifications/all.inc
qcsrc/common/notifications/all.qh
qcsrc/common/stats.qh

index 5169ea5f384d34ae16ea80f3b46da767fae0ed5d..92ab616c7018b9a26479aaf123522f542ff79af1 100644 (file)
@@ -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;
index 7803108c6c00010cb896fce7fde81da0fbfebc00..622419db0f09e4081a0f5a1710d5497db18ac5b8 100644 (file)
@@ -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;
 }
 
index 4c50abb464e3737b0284849e98c69671580e5aa2..84be71b16d72f3f04491e4dbf1fed4be4f3e6195 100644 (file)
@@ -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;
 }
 
index 5f90c390f617ad394c61a454e5a273d07aa0811d..4a8b3b54b04c374665bb32c9e92d698dc4914602 100644 (file)
@@ -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);
        }
index 69483bfc3c075b19427b39d1eb808c7b4d857075..2896d05de25bad96b2f1687852b21e67479a5ee5 100644 (file)
@@ -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!"))
index fb06d264af250212cea590a3e0b9b51224281898..87dfa47db84e4f1fdcf764a1c330c1159ad9f9bb 100644 (file)
@@ -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
index 128f090c4fd9ec94ff1269b3336bda705be60c8e..58b84fa6774d9481563cd0960df7cbf46f35ff84 100644 (file)
@@ -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)