]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove the priority system for centerprint messages in the server, we no longer need it
authorterencehill <piuntn@gmail.com>
Mon, 13 Jun 2011 23:06:42 +0000 (01:06 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 13 Jun 2011 23:06:42 +0000 (01:06 +0200)
centerprint_expire calls in vote.qc were useless since votes called aren't centerprinted anymore (there is the vote panel)

qcsrc/common/constants.qh
qcsrc/server/cl_client.qc
qcsrc/server/clientcommands.qc
qcsrc/server/ctf.qc
qcsrc/server/defs.qh
qcsrc/server/gamecommand.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/teamplay.qc
qcsrc/server/vote.qc

index ffabf0eb88cc12f8954af2d6842093e6b8c434b1..8dc7a75464251216f3c455e46517f01334033437 100644 (file)
@@ -591,6 +591,7 @@ float CPID_ROUND_STARTING = 6;
 float CPID_GAME_STARTING = 7;
 float CPID_TIMEOUT_COUNTDOWN = 8;
 float CPID_MOTD = 9;
+float CPID_KH_MSG = 10;
 
 // CSQC centerprint/notify message types
 float MSG_SUICIDE = 0;
index d3a8ba3aa861e9da431ed384cb7518e63501a98d..b9c7b12426b02f3a84aee1018a3079a509d6dbca 100644 (file)
@@ -2465,7 +2465,7 @@ void LeaveSpectatorMode()
        }
        else {
                //player may not join because of g_maxplayers is set
-               centerprint_atprio(self, CENTERPRIO_MAPVOTE, PREVENT_JOIN_TEXT);
+               centerprint(self, PREVENT_JOIN_TEXT);
        }
 }
 
index ac08cc916a43bc343ce896afed07fe208d108825..0b6a956db913554ab688da06de9a7b615ac1c7e1 100644 (file)
@@ -237,7 +237,7 @@ void SV_ParseClientCommand(string s) {
                        }
                        else {
                                //player may not join because of g_maxplayers is set
-                               centerprint_atprio(self, CENTERPRIO_MAPVOTE, PREVENT_JOIN_TEXT);
+                               centerprint(self, PREVENT_JOIN_TEXT);
                        }
                }
        } else if( cmd == "selectteam" ) {
index f5cbae51b505e157ba501b5cd1820d667454bd12..d76eba938da2dc96af647ba9ca3d26ea0734b63a 100644 (file)
@@ -66,12 +66,12 @@ void ctf_captureshield_update(entity p, float dir)
                {
                        if(should)
                        {
-                               centerprint_atprio(p, CENTERPRIO_SHIELDING, "^3You are now ^4shielded^3 from the flag\n^3for ^1too many unsuccessful attempts^3 to capture.\n\n^3Make some defensive scores before trying again.");
+                               centerprint(p, "^3You are now ^4shielded^3 from the flag\n^3for ^1too many unsuccessful attempts^3 to capture.\n\n^3Make some defensive scores before trying again.");
                                // TODO csqc notifier for this
                        }
                        else
                        {
-                               centerprint_atprio(p, CENTERPRIO_SHIELDING, "^3You are now free.\n\n^3Feel free to ^1try to capture^3 the flag again\n^3if you think you will succeed.");
+                               centerprint(p, "^3You are now free.\n\n^3Feel free to ^1try to capture^3 the flag again\n^3if you think you will succeed.");
                                // TODO csqc notifier for this
                        }
                        p.ctf_captureshielded = should;
@@ -99,7 +99,7 @@ void ctf_captureshield_touch()
        mymid = (self.absmin + self.absmax) * 0.5;
        othermid = (other.absmin + other.absmax) * 0.5;
        Damage(other, self, self, 0, DEATH_HURTTRIGGER, mymid, normalize(othermid - mymid) * captureshield_force);
-       centerprint_atprio(other, CENTERPRIO_SHIELDING, "^3You are ^4shielded^3 from the flag\n^3for ^1too many unsuccessful attempts^3 to capture.\n\n^3Get some defensive scores before trying again.");
+       centerprint(other, "^3You are ^4shielded^3 from the flag\n^3for ^1too many unsuccessful attempts^3 to capture.\n\n^3Get some defensive scores before trying again.");
 }
 
 void ctf_flag_spawnstuff()
index ae9648304da9dd9a6368ef74994fcb29db0bed66..c7052ceee943a9cc4d49bffe1d8a7e3afd369c45 100644 (file)
@@ -368,8 +368,6 @@ void FixClientCvars(entity e);
 
 float weaponsInMap;
 
-void centerprint_atprio(entity e, float prio, string s);
-void centerprint_expire(entity e, float prio);
 void centerprint(entity e, string s);
 
 .float respawn_countdown; // next number to count
index a83be998a86e3835e5a95573c26c5a045f11075a..549ac70a6c13b39fd4d0f8dfa1071865a22fa108 100644 (file)
@@ -787,7 +787,7 @@ void GameCommand(string command)
                                }
                                else
                                {
-                                       centerprint_atprio(client, CENTERPRIO_ADMIN, strcat("^3", admin_name(), ":\n\n^7", argv(2)));
+                                       centerprint(client, strcat("^3", admin_name(), ":\n\n^7", argv(2)));
                                        sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", argv(2), "\n"));
                                }
                                print("Message sent to ", client.netname, "\n");
index 02f1d3283a28fa14f67b6d369ed5857534e03bb4..51a06af2e37b8f50e3423cbf01000dde85202d97 100644 (file)
@@ -718,47 +718,10 @@ float NumberToTeamNumber(float number)
        return -1;
 }
 
-#define CENTERPRIO_POINT 1
-#define CENTERPRIO_SPAM 2
-#define CENTERPRIO_VOTE 4
-#define CENTERPRIO_NORMAL 5
-#define CENTERPRIO_SHIELDING 7
-#define CENTERPRIO_MAPVOTE 9
-#define CENTERPRIO_IDLEKICK 50
-#define CENTERPRIO_ADMIN 99
-.float centerprint_priority;
-.float centerprint_expires;
 void Send_CSQC_Centerprint_Generic(entity e, float id, string s1, float duration, float countdown_num);
-void centerprint_atprio(entity e, float prio, string s)
-{
-    if (intermission_running)
-        if (prio < CENTERPRIO_MAPVOTE)
-            return;
-    if (time > e.centerprint_expires)
-        e.centerprint_priority = 0;
-    if (prio >= e.centerprint_priority)
-    {
-        e.centerprint_priority = prio;
-        if (timeoutStatus == 2)
-            e.centerprint_expires = time + (e.cvar_hud_panel_centerprint_time * TIMEOUT_SLOWMO_VALUE);
-        else
-            e.centerprint_expires = time + e.cvar_hud_panel_centerprint_time;
-        // centerprint_builtin(e, s);
-        Send_CSQC_Centerprint_Generic(e, 0, s, 0, 0);
-    }
-}
-void centerprint_expire(entity e, float prio)
-{
-    if (prio == e.centerprint_priority)
-    {
-        e.centerprint_priority = 0;
-        // centerprint_builtin(e, "");
-        Send_CSQC_Centerprint_Generic(e, 0, "", 0, 0);
-    }
-}
 void centerprint(entity e, string s)
 {
-    centerprint_atprio(e, CENTERPRIO_NORMAL, s);
+       Send_CSQC_Centerprint_Generic(e, 0, s, 0, 0);
 }
 
 // decolorizes and team colors the player name when needed
index 85a29031a8ec8ecc8a55bb9a60f3f6a8c7613e9a..4d67e1aa82b59df5e5bc26982e8d48a0d54d504a 100644 (file)
@@ -216,7 +216,7 @@ MUTATOR_HOOKFUNCTION(ka_Scoring)
                }
                else if(!frag_attacker.ballcarried)
                        if(autocvar_g_keepaway_noncarrier_warn)
-                               centerprint_atprio(frag_attacker, (CENTERPRIO_SPAM + 5), "Killing people while you don't have the ball gives no points!");
+                               centerprint(frag_attacker, "Killing people while you don't have the ball gives no points!");
 
                if(frag_attacker.ballcarried) // add to amount of kills while ballcarrier
                        PlayerScore_Add(frag_attacker, SP_SCORE, autocvar_g_keepaway_score_killac);
index 85623f79d8a3a17518177b351f5f79aa788e205d..bd4b3d5d718f4cdf5de7811e6126dc39460066f0 100644 (file)
@@ -152,9 +152,10 @@ void kh_Controller_Think()  // called a lot
 
                        //dprint(s, "\n");
 
+                       // TODO limit centerprint spam and set the appropriated duration for each centerprinted msg 
                        FOR_EACH_PLAYER(e)
                                if(clienttype(e) == CLIENTTYPE_REAL)
-                                       centerprint_atprio(e, CENTERPRIO_SPAM, s);
+                                       Send_CSQC_Centerprint_Generic(e, CPID_KH_MSG, s, 2, 0); // duration > 1 works with all the messages
                }
                self.cnt -= 1;
        }
@@ -686,11 +687,11 @@ void kh_Key_Think()  // runs all the time
                {
                        if(head.team == kh_interferemsg_team)
                                if(head.kh_next)
-                                       centerprint(head, "All keys are in your team's hands!\n\nMeet the other key carriers ^1NOW^7!");
+                                       Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, "All keys are in your team's hands!\n\nMeet the other key carriers ^1NOW^7!", 0, 0);
                                else
-                                       centerprint(head, "All keys are in your team's hands!\n\nHelp the key carriers to meet!");
+                                       Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, "All keys are in your team's hands!\n\nHelp the key carriers to meet!", 0, 0);
                        else
-                               centerprint(head, strcat("All keys are in the ", ColoredTeamName(kh_interferemsg_team), "^7's hands!\n\nInterfere ^1NOW^7!"));
+                               Send_CSQC_Centerprint_Generic(head, CPID_KH_MSG, strcat("All keys are in the ", ColoredTeamName(kh_interferemsg_team), "^7's hands!\n\nInterfere ^1NOW^7!"), 0, 0);
                }
        }
 
@@ -881,7 +882,7 @@ void kh_EnableTrackingDevice()  // runs after each round
 
        FOR_EACH_PLAYER(player)
                if(clienttype(player) == CLIENTTYPE_REAL)
-                       centerprint_expire(player, CENTERPRIO_SPAM);
+                       Send_CSQC_Centerprint_Generic(player, CPID_KH_MSG, "", 1, 0);
 
        kh_tracking_enabled = TRUE;
 }
@@ -907,7 +908,7 @@ void kh_StartRound()  // runs at the start of each round
 
        FOR_EACH_PLAYER(player)
                if(clienttype(player) == CLIENTTYPE_REAL)
-                       centerprint_expire(player, CENTERPRIO_SPAM);
+                       Send_CSQC_Centerprint_Generic(player, CPID_KH_MSG, "", 1, 0);
 
        for(i = 0; i < kh_teams; ++i)
        {
index 310bd81cd415be25447f2e6659337d88c785962e..c4efe0038473c9bcea8aef4735bb279eae7b9d11 100644 (file)
@@ -488,7 +488,7 @@ void PrintWelcomeMessage(entity pl)
                                return;
                        goto normal;
                }
-               return centerprint_atprio(self, CENTERPRIO_SPAM, specString); // TODO: convert to Send_CSQC_Centerprint_Generic(self, CPID_TIMEOUT_COUNTDOWN, ...
+               return centerprint(self, specString);
        }
 
 :normal
index bad3eafe40d3c78b5b1d2d6438c08537d7469e76..ebb11a64d62d7696d764e3cd935dc52d9fa91914 100644 (file)
@@ -287,7 +287,6 @@ float GameCommand_Vote(string s, entity e) {
                                VoteDialog_UpdateHighlight(1);
                                print_to(e, "^1You accepted the vote.");
                                e.vote_vote = 1;
-                               centerprint_expire(e, CENTERPRIO_VOTE);
                                if(!autocvar_sv_vote_singlecount) {
                                        VoteCount();
                                }
@@ -305,7 +304,6 @@ float GameCommand_Vote(string s, entity e) {
                                VoteDialog_UpdateHighlight(2);
                                print_to(e, "^1You rejected the vote.");
                                e.vote_vote = -1;
-                               centerprint_expire(e, CENTERPRIO_VOTE);
                                if(!autocvar_sv_vote_singlecount) {
                                        VoteCount();
                                }
@@ -323,7 +321,6 @@ float GameCommand_Vote(string s, entity e) {
                                VoteDialog_UpdateHighlight(3);
                                print_to(e, "^1You abstained from your vote.");
                                e.vote_vote = -2;
-                               centerprint_expire(e, CENTERPRIO_VOTE);
                                if(!autocvar_sv_vote_singlecount) {
                                        VoteCount();
                                }
@@ -466,7 +463,6 @@ void VoteReset() {
        FOR_EACH_CLIENT(player)
        {
                player.vote_vote = 0;
-               centerprint_expire(player, CENTERPRIO_VOTE);
        }
 
        if(votecalled)