From c55819b1ac50a3f1ed3e3992659d42948c7431ef Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 14 Jun 2011 01:06:42 +0200 Subject: [PATCH] Remove the priority system for centerprint messages in the server, we no longer need it centerprint_expire calls in vote.qc were useless since votes called aren't centerprinted anymore (there is the vote panel) --- qcsrc/common/constants.qh | 1 + qcsrc/server/cl_client.qc | 2 +- qcsrc/server/clientcommands.qc | 2 +- qcsrc/server/ctf.qc | 6 ++-- qcsrc/server/defs.qh | 2 -- qcsrc/server/gamecommand.qc | 2 +- qcsrc/server/miscfunctions.qc | 39 +--------------------- qcsrc/server/mutators/gamemode_keepaway.qc | 2 +- qcsrc/server/mutators/gamemode_keyhunt.qc | 13 ++++---- qcsrc/server/teamplay.qc | 2 +- qcsrc/server/vote.qc | 4 --- 11 files changed, 17 insertions(+), 58 deletions(-) diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index ffabf0eb8..8dc7a7546 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -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; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index d3a8ba3aa..b9c7b1242 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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); } } diff --git a/qcsrc/server/clientcommands.qc b/qcsrc/server/clientcommands.qc index ac08cc916..0b6a956db 100644 --- a/qcsrc/server/clientcommands.qc +++ b/qcsrc/server/clientcommands.qc @@ -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" ) { diff --git a/qcsrc/server/ctf.qc b/qcsrc/server/ctf.qc index f5cbae51b..d76eba938 100644 --- a/qcsrc/server/ctf.qc +++ b/qcsrc/server/ctf.qc @@ -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() diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index ae9648304..c7052ceee 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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 diff --git a/qcsrc/server/gamecommand.qc b/qcsrc/server/gamecommand.qc index a83be998a..549ac70a6 100644 --- a/qcsrc/server/gamecommand.qc +++ b/qcsrc/server/gamecommand.qc @@ -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"); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 02f1d3283..51a06af2e 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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 diff --git a/qcsrc/server/mutators/gamemode_keepaway.qc b/qcsrc/server/mutators/gamemode_keepaway.qc index 85a29031a..4d67e1aa8 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -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); diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index 85623f79d..bd4b3d5d7 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -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) { diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 310bd81cd..c4efe0038 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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 diff --git a/qcsrc/server/vote.qc b/qcsrc/server/vote.qc index bad3eafe4..ebb11a64d 100644 --- a/qcsrc/server/vote.qc +++ b/qcsrc/server/vote.qc @@ -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) -- 2.39.2