From 67b0ed3729e3e9245067180fc2f672a7f51b65b8 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 12 Sep 2013 15:24:19 +1000 Subject: [PATCH] Move most centerprints into the notifications system --- qcsrc/common/notifications.qh | 23 +++++++++- qcsrc/server/command/sv_cmd.qc | 13 +++--- qcsrc/server/g_triggers.qc | 48 +++++++++------------ qcsrc/server/item_key.qc | 8 ++-- qcsrc/server/mutators/gamemode_assault.qc | 14 ++---- qcsrc/server/mutators/gamemode_onslaught.qc | 7 ++- qcsrc/server/mutators/mutator_superspec.qc | 4 +- qcsrc/server/secret.qc | 2 +- qcsrc/server/t_items.qc | 4 +- qcsrc/server/t_jumppads.qc | 2 +- qcsrc/server/t_plats.qc | 10 ++--- qcsrc/server/teamplay.qc | 2 +- qcsrc/server/w_porto.qc | 10 ++--- 13 files changed, 72 insertions(+), 75 deletions(-) diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index ce2842ea80..58ce7b1e36 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -245,6 +245,8 @@ void Send_Notification_WOVA( MSG_INFO_NOTIF(default, prefix##PINK, strnum, flnum, args, hudargs, sprintf(icon, strtolower(STATIC_NAME_TEAM_4)), TCR(normal, COL_TEAM_4, strtoupper(NAME_TEAM_4)), TCR(gentle, COL_TEAM_4, strtoupper(NAME_TEAM_4))) \ #endif #define MSG_INFO_NOTIFICATIONS \ + MSG_INFO_NOTIF(2, INFO_ADMINMESSAGE, 2, 0, "s1 s2", "", "", _("^F2%s^BG: %s\n"), "") \ + MSG_INFO_NOTIF(2, INFO_COINTOSS, 1, 0, "s1", "", "", _("^F2Throwing coin... Result: %s^F2!\n"), "") \ MULTITEAM_INFO(1, INFO_CTF_CAPTURE_, 2, 1, 0, "s1", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag\n"), "") \ MULTITEAM_INFO(1, INFO_CTF_CAPTURE_BROKEN_, 2, 2, 2, "s1 f1p2dec s2 f2p2dec", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds, breaking ^BG%s^BG's previous record of ^F2%s^BG seconds\n"), "") \ MULTITEAM_INFO(1, INFO_CTF_CAPTURE_TIME_, 2, 1, 1, "s1 f1p2dec", "s1", "notify_%s_captured", _("^BG%s^BG captured the ^TC^TT^BG flag in ^F1%s^BG seconds\n"), "") \ @@ -369,6 +371,7 @@ void Send_Notification_WOVA( MSG_INFO_NOTIF(1, INFO_RACE_NEW_SET, 1, 2, "s1 race_col f1ord race_col f2race_time", "s1", "race_newrecordserver", _("^BG%s^BG set the %s%s^BG place record with %s%s\n"), "") \ MULTITEAM_INFO(1, INFO_SCORES_, 4, 0, 0, "", "", "", _("^TC^TT ^BGteam scores!\n"), "") \ MSG_INFO_NOTIF(1, INFO_SPECTATE_WARNING, 0, 1, "f1secs", "", "", _("^F2You have to become a player within the next %s, otherwise you will be kicked, because spectating isn't allowed at this time!\n"), "") \ + MSG_INFO_NOTIF(2, INFO_SUPERSPEC_MISSING_UID, 0, 0, "", "", "", _("^F2You lack a UID, superspec options will not be saved/restored\n"), "") \ MSG_INFO_NOTIF(1, INFO_SUPERWEAPON_PICKUP, 1, 0, "s1", "s1", "strength", _("^BG%s^K1 picked up a Superweapon\n"), "") \ MSG_INFO_NOTIF(2, INFO_VERSION_BETA, 2, 0, "s1 s2", "", "", _("^F4NOTE: ^BGThe server is running ^F1Xonotic %s (beta)^BG, you have ^F2Xonotic %s\n"), "") \ MSG_INFO_NOTIF(2, INFO_VERSION_OLD, 2, 0, "s1 s2", "", "", _("^F4NOTE: ^BGThe server is running ^F1Xonotic %s^BG, you have ^F2Xonotic %s\n"), "") \ @@ -433,6 +436,7 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(default, prefix##PINK, strnum, flnum, args, cpid, durcnt, TCR(normal, COL_TEAM_4, strtoupper(NAME_TEAM_4)), TCR(gentle, COL_TEAM_4, strtoupper(NAME_TEAM_4))) \ #endif #define MSG_CENTER_NOTIFICATIONS \ + MSG_CENTER_NOTIF(1, CENTER_ADMINMESSAGE, 2, 0, "s1 s2", NO_CPID, "3 0", _("^F2%s^BG:\n^BG%s"), "") \ 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_ROUND, "2 0", _("^F4Begin!"), "") \ @@ -442,6 +446,7 @@ void Send_Notification_WOVA( 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_CAMPCHECK, 0, 0, "", CPID_CAMPCHECK, "0 0", _("^F2Don't camp!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_COINTOSS, 1, 0, "s1", NO_CPID, "0 0", _("^F2Throwing coin... Result: %s^F2!"), "") \ 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!"), "") \ @@ -502,6 +507,9 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(1, CENTER_DEATH_TEAMKILL_FRAG, 1, 0, "s1", NO_CPID, "0 0", _("^K1Moron! You fragged ^BG%s^K1, a team mate!"), _("^K1Moron! You went against ^BG%s^K1, a team mate!")) \ MSG_CENTER_NOTIF(1, CENTER_DEATH_TEAMKILL_FRAGGED, 1, 0, "s1", NO_CPID, "0 0", _("^K1You were fragged by ^BG%s^K1, a team mate"), _("^K1You were scored against by ^BG%s^K1, a team mate")) \ MSG_CENTER_NOTIF(1, CENTER_DISCONNECT_IDLING, 0, 1, "", CPID_IDLING, "1 f1", _("^K1Stop idling!\n^BGDisconnecting in ^COUNT..."), "") \ + MSG_CENTER_NOTIF(1, CENTER_DOOR_LOCKED_NEED, 0, 0, "", NO_CPID, "0 0", _("^BGYou need %s^BG!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_DOOR_LOCKED_ALSONEED, 0, 0, "", NO_CPID, "0 0", _("^BGYou also need %s^BG!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_DOOR_UNLOCKED, 0, 0, "", NO_CPID, "0 0", _("^BGDoor unlocked!"), "") \ MSG_CENTER_NOTIF(1, CENTER_EXTRALIVES, 0, 0, "", NO_CPID, "0 0", _("^F2You picked up some extra lives"), "") \ MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_FREEZE, 1, 0, "s1", NO_CPID, "0 0", _("^K3You froze ^BG%s"), "") \ MSG_CENTER_NOTIF(1, CENTER_FREEZETAG_FROZEN, 1, 0, "s1", NO_CPID, "0 0", _("^K1You were frozen by ^BG%s"), "") \ @@ -541,8 +549,13 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(1, CENTER_NIX_COUNTDOWN, 0, 2, "item_wepname", CPID_NIX, "1 f2", _("^F2^COUNT^BG until weapon change...\nNext weapon: ^F1%s"), "") \ MSG_CENTER_NOTIF(1, CENTER_NIX_NEWWEAPON, 0, 1, "item_wepname", CPID_NIX, "0 0", _("^F2Active weapon: ^F1%s"), "") \ MSG_CENTER_NOTIF(1, CENTER_NADE, 0, 0, "", NO_CPID, "0 0", _("^BGPress ^F2DROPWEAPON^BG again to toss the grenade!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_ONS_NOTSHIELDED, 0, 0, "", CPID_ONSLAUGHT, "0 0", _("^K1Your generator is NOT shielded!\n^BGRe-capture controlpoints to shield it!"), "") \ MSG_CENTER_NOTIF(1, CENTER_OVERTIME_FRAG, 0, 0, "", CPID_OVERTIME, "0 0", _("^F2Now playing ^F4OVERTIME^F2!\nKeep fragging until we have a winner!"), _("^F2Now playing ^F4OVERTIME^F2!\nKeep scoring until we have a winner!")) \ + MSG_CENTER_NOTIF(1, CENTER_OVERTIME_CONTROLPOINT, 0, 0, "", CPID_OVERTIME, "3 0", _("^F2Now playing ^F4OVERTIME^F2!\n\nGenerators start now to decay.\nThe more control points your team holds,\nthe faster the enemy generator decays"), "") \ MSG_CENTER_NOTIF(1, CENTER_OVERTIME_TIME, 0, 1, "f1time", CPID_OVERTIME, "0 0", _("^F2Now playing ^F4OVERTIME^F2!\n^BGAdded ^F4%s^BG to the game!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_PORTO_FAILED, 0, 0, "", NO_CPID, "0 0", _("^K1Portal deployment failed.\n\n^F2Catch it to try again!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_PORTO_CREATED_IN, 0, 0, "", NO_CPID, "0 0", _("^K1In^BG-portal created"), "") \ + MSG_CENTER_NOTIF(1, CENTER_PORTO_CREATED_OUT, 0, 0, "", NO_CPID, "0 0", _("^F3Out^BG-portal created"), "") \ MSG_CENTER_NOTIF(1, CENTER_POWERDOWN_INVISIBILITY, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Invisibility has worn off"), "") \ MSG_CENTER_NOTIF(1, CENTER_POWERDOWN_SHIELD, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Shield has worn off"), "") \ MSG_CENTER_NOTIF(1, CENTER_POWERDOWN_SPEED, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Speed has worn off"), "") \ @@ -552,6 +565,9 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(1, CENTER_POWERUP_SPEED, 0, 0, "", CPID_POWERUP, "0 0", _("^F2You are on speed"), "") \ MSG_CENTER_NOTIF(1, CENTER_POWERUP_STRENGTH, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Strength infuses your weapons with devastating power"), "") \ MSG_CENTER_NOTIF(1, CENTER_RACE_FINISHLAP, 0, 0, "", CPID_RACE_FINISHLAP, "0 0", _("^F2The race is over, finish your lap!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_SEQUENCE_COMPLETED, 0, 0, "", NO_CPID, "0 0", _("^BGSequence completed!"), "") \ + MSG_CENTER_NOTIF(1, CENTER_SEQUENCE_COUNTER, 0, 0, "", NO_CPID, "0 0", _("^BGThere are more to go..."), "") \ + MSG_CENTER_NOTIF(1, CENTER_SEQUENCE_COUNTER_FEWMORE, 0, 1, "f1", NO_CPID, "0 0", _("^BGOnly %s^BG more to go..."), "") \ MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_BROKEN, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Superweapons have broken down"), "") \ MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_LOST, 0, 0, "", CPID_POWERUP, "0 0", _("^F2Superweapons have been lost"), "") \ MSG_CENTER_NOTIF(1, CENTER_SUPERWEAPON_PICKUP, 0, 0, "", CPID_POWERUP, "0 0", _("^F2You now have a superweapon"), "") \ @@ -560,7 +576,8 @@ void Send_Notification_WOVA( MSG_CENTER_NOTIF(1, CENTER_TEAMCHANGE_SPECTATE, 0, 1, "", CPID_TEAMCHANGE, "1 f1", _("^K1Spectating in ^COUNT"), "") \ MSG_CENTER_NOTIF(1, CENTER_TEAMCHANGE_SUICIDE, 0, 1, "", CPID_TEAMCHANGE, "1 f1", _("^K1Suicide in ^COUNT"), "") \ MSG_CENTER_NOTIF(1, CENTER_TIMEOUT_BEGINNING, 0, 1, "", CPID_TIMEOUT, "1 f1", _("^F4Timeout begins in ^COUNT"), "") \ - MSG_CENTER_NOTIF(1, CENTER_TIMEOUT_ENDING, 0, 1, "", CPID_TIMEOUT, "1 f1", _("^F4Timeout ends in ^COUNT"), "") + MSG_CENTER_NOTIF(1, CENTER_TIMEOUT_ENDING, 0, 1, "", CPID_TIMEOUT, "1 f1", _("^F4Timeout ends in ^COUNT"), "") \ + MSG_CENTER_NOTIF(1, CENTER_TRIGGER, 1, 0, "s1", NO_CPID, "0 0", _("^BG%s"), "") #define MSG_MULTI_NOTIFICATIONS \ MSG_MULTI_NOTIF(1, DEATH_MURDER_CHEAT, NO_MSG, INFO_DEATH_MURDER_CHEAT, NO_MSG) \ @@ -568,7 +585,7 @@ void Send_Notification_WOVA( MSG_MULTI_NOTIF(1, DEATH_MURDER_FALL, NO_MSG, INFO_DEATH_MURDER_FALL, NO_MSG) \ MSG_MULTI_NOTIF(1, DEATH_MURDER_FIRE, NO_MSG, INFO_DEATH_MURDER_FIRE, NO_MSG) \ MSG_MULTI_NOTIF(1, DEATH_MURDER_LAVA, NO_MSG, INFO_DEATH_MURDER_LAVA, NO_MSG) \ - MSG_MULTI_NOTIF(1, DEATH_MURDER_NADE, NO_MSG, INFO_DEATH_MURDER_NADE, NO_MSG) \ + MSG_MULTI_NOTIF(1, DEATH_MURDER_NADE, NO_MSG, INFO_DEATH_MURDER_NADE, NO_MSG) \ MSG_MULTI_NOTIF(1, DEATH_MURDER_SHOOTING_STAR, NO_MSG, INFO_DEATH_MURDER_SHOOTING_STAR, NO_MSG) \ MSG_MULTI_NOTIF(1, DEATH_MURDER_SLIME, NO_MSG, INFO_DEATH_MURDER_SLIME, NO_MSG) \ MSG_MULTI_NOTIF(1, DEATH_MURDER_SWAMP, NO_MSG, INFO_DEATH_MURDER_SWAMP, NO_MSG) \ @@ -634,6 +651,8 @@ void Send_Notification_WOVA( MSG_MULTI_NOTIF(1, ITEM_WEAPON_NOAMMO, NO_MSG, INFO_ITEM_WEAPON_NOAMMO, CENTER_ITEM_WEAPON_NOAMMO) \ MSG_MULTI_NOTIF(1, ITEM_WEAPON_PRIMORSEC, NO_MSG, INFO_ITEM_WEAPON_PRIMORSEC, CENTER_ITEM_WEAPON_PRIMORSEC) \ MSG_MULTI_NOTIF(1, ITEM_WEAPON_UNAVAILABLE, NO_MSG, INFO_ITEM_WEAPON_UNAVAILABLE, CENTER_ITEM_WEAPON_UNAVAILABLE) \ + MSG_MULTI_NOTIF(1, MULTI_ADMINMESSAGE, NO_MSG, INFO_ADMINMESSAGE, CENTER_ADMINMESSAGE) \ + MSG_MULTI_NOTIF(1, MULTI_COINTOSS, NO_MSG, INFO_COINTOSS, CENTER_COINTOSS) \ MSG_MULTI_NOTIF(1, MULTI_COUNTDOWN_BEGIN, ANNCE_BEGIN, NO_MSG, CENTER_COUNTDOWN_BEGIN) \ MSG_MULTI_NOTIF(1, MULTI_MINSTA_FINDAMMO, ANNCE_NUM_10, NO_MSG, CENTER_MINSTA_FINDAMMO_FIRST) \ MSG_MULTI_NOTIF(1, WEAPON_ACCORDEON_MURDER, NO_MSG, INFO_WEAPON_ACCORDEON_MURDER, NO_MSG) \ diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index b336d3ee26..282ada6512 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -106,8 +106,7 @@ void GameCommand_adminmsg(float request, float argc) } else { - centerprint(client, strcat("^3", admin_name(), ":\n^7", admin_message)); - sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", admin_message, "\n")); + Send_Notification(NOTIF_ONE_ONLY, client, MSG_MULTI, MULTI_ADMINMESSAGE, admin_name(), admin_message); } successful = strcat(successful, (successful ? ", " : ""), client.netname); @@ -435,14 +434,12 @@ void GameCommand_cointoss(float request, float argc) { case CMD_REQUEST_COMMAND: { - entity client; - string result1 = (argv(2) ? strcat("^7", argv(1), "^3!\n") : "^1HEADS^3!\n"); - string result2 = (argv(2) ? strcat("^7", argv(2), "^3!\n") : "^4TAILS^3!\n"); + string result1 = (argv(2) ? strcat("^7", argv(1)) : "^1HEADS"); + string result2 = (argv(2) ? strcat("^7", argv(2)) : "^4TAILS"); string choice = ((random() > 0.5) ? result1 : result2); - FOR_EACH_CLIENT(client) - centerprint(client, strcat("^3Throwing coin... Result: ", choice)); - bprint(strcat("^3Throwing coin... Result: ", choice)); + Send_Notification(NOTIF_ALL, world, MSG_MULTI, MULTI_COINTOSS, choice); + return; } diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index 359bf84a36..725eb9b1ab 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -61,14 +61,12 @@ void SUB_UseTargets() // // print the message // - if (IS_PLAYER(activator) && self.message != "") + if(IS_PLAYER(activator) && self.message != "") + if(IS_REAL_CLIENT(activator)) { - if(IS_REAL_CLIENT(activator)) - { - centerprint (activator, self.message); - if (self.noise == "") - play2(activator, "misc/talk.wav"); - } + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_TRIGGER, self.message); + if (self.noise == "") + play2(activator, "misc/talk.wav"); } // @@ -378,32 +376,26 @@ void spawnfunc_trigger_delay() void counter_use() { - self.count = self.count - 1; + self.count -= 1; if (self.count < 0) return; - if (self.count != 0) + if (self.count == 0) { - if (IS_PLAYER(activator) - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) - { - if (self.count >= 4) - centerprint (activator, "There are more to go..."); - else if (self.count == 3) - centerprint (activator, "Only 3 more to go..."); - else if (self.count == 2) - centerprint (activator, "Only 2 more to go..."); - else - centerprint (activator, "Only 1 more to go..."); - } - return; + if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COMPLETED); + + self.enemy = activator; + multi_trigger (); + } + else + { + if(IS_PLAYER(activator) && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) + if(self.count >= 4) + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER); + else + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_SEQUENCE_COUNTER_FEWMORE, self.count); } - - if (IS_PLAYER(activator) - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) - centerprint(activator, "Sequence completed!"); - self.enemy = activator; - multi_trigger (); } void counter_reset() diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 5c7e30e36e..59cd9129af 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -73,7 +73,7 @@ void item_key_touch(void) { other.itemkeys |= self.itemkeys; play2(other, self.noise); - centerprint(other, self.message); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_TRIGGER, self.message); }; /** @@ -333,12 +333,12 @@ void trigger_keylock_touch(void) { if (key_used) { // one or more keys were given, but others are still missing! play2(other, self.noise1); - centerprint(other, strcat("You also need ", item_keys_keylist(self.itemkeys), "!")); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(self.itemkeys)); other.key_door_messagetime = time + 2; } else if (other.key_door_messagetime <= time) { // no keys were given play2(other, self.noise2); - centerprint(other, strcat("You need ", item_keys_keylist(self.itemkeys), "!")); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(self.itemkeys)); other.key_door_messagetime = time + 2; } @@ -352,7 +352,7 @@ void trigger_keylock_touch(void) { } else { // all keys were given! play2(other, self.noise); - centerprint(other, self.message); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_TRIGGER, self.message); if (self.target) trigger_keylock_trigger(self.target); diff --git a/qcsrc/server/mutators/gamemode_assault.qc b/qcsrc/server/mutators/gamemode_assault.qc index 94e104728f..dddec6ec65 100644 --- a/qcsrc/server/mutators/gamemode_assault.qc +++ b/qcsrc/server/mutators/gamemode_assault.qc @@ -68,15 +68,7 @@ void assault_objective_decrease_use() oldself = self; self = oldself.enemy; if(self.message) - { - entity player; - string s; - FOR_EACH_PLAYER(player) - { - s = strcat(self.message, "\n"); - centerprint(player, s); - } - } + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_TRIGGER, self.message); oldactivator = activator; activator = oldself; @@ -546,9 +538,9 @@ void havocbot_ast_reset_role(entity bot) MUTATOR_HOOKFUNCTION(assault_PlayerSpawn) { if(self.team == assault_attacker_team) - centerprint(self, "You are attacking!"); + Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING); else - centerprint(self, "You are defending!"); + Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_DEFENDING); return FALSE; } diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index cf8d52cd2c..5969dbb4a6 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -391,8 +391,7 @@ void onslaught_generator_think() { if (!overtime_msg_time) { - FOR_EACH_PLAYER(e) - centerprint(e, "^3Now playing ^1OVERTIME^3!\n^3Generators start now to decay.\n^3The more control points your team holds,\n^3the faster the enemy generator decays."); + Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_OVERTIME_CONTROLPOINT); overtime_msg_time = time; } // self.max_health / 300 gives 5 minutes of overtime. @@ -423,9 +422,9 @@ void onslaught_generator_think() self.wait = time + 5; FOR_EACH_REALPLAYER(e) { - if(e.team == self.team) + if not(IsDifferentTeam(e, self)) { - centerprint(e, "^1Your generator is NOT shielded!\n^7Re-capture controlpoints to shield it!"); + Send_Notification(NOTIF_ONE, e, MSG_CENTER, CENTER_ONS_NOTSHIELDED); soundto(MSG_ONE, e, CHAN_AUTO, "kh/alarm.wav", VOL_BASE, ATTEN_NONE); // FIXME: Uniqe sound? } } diff --git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc index fc9fc7966b..2ac2f351ca 100644 --- a/qcsrc/server/mutators/mutator_superspec.qc +++ b/qcsrc/server/mutators/mutator_superspec.qc @@ -429,9 +429,7 @@ MUTATOR_HOOKFUNCTION(superspec_BuildMutatorsPrettyString) void superspec_hello() { if(self.enemy.crypto_idfp == "") - centerprint(self.enemy, "Your client have/allow no crypto id, superspec options will not be saved/restored."); - else - centerprint(self.enemy, sprintf("Hello %s\nSince your client has a Crypto ID, your superspec preferences will be persisted on this server.", self.enemy.netname)); + Send_Notification(NOTIF_ONE_ONLY, self.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID); remove(self); } diff --git a/qcsrc/server/secret.qc b/qcsrc/server/secret.qc index 9af13eca28..47f849f24b 100644 --- a/qcsrc/server/secret.qc +++ b/qcsrc/server/secret.qc @@ -19,7 +19,7 @@ void trigger_secret_touch() { //print(ftos(secret_counter.count), "\n"); // centerprint message (multi_touch() doesn't always call centerprint()) - centerprint(other, self.message); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_TRIGGER, self.message); self.message = ""; // handle normal trigger features diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 31aa5caf79..6d9ec73954 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -627,7 +627,7 @@ float Item_GiveTo(entity item, entity player) { pickedup = TRUE; player.items |= it; - sprint (player, strcat("You got the ^2", item.netname, "\n")); + Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_ITEM_WEAPON_GOT, item.netname); } if (item.strength_finished) @@ -1494,7 +1494,7 @@ void target_items_use (void) remove(e); if(GiveItems(activator, 0, tokenize_console(self.netname))) - centerprint(activator, self.message); + Send_Notification(NOTIF_ONE, activator, MSG_CENTER, CENTER_TRIGGER, self.message); } void spawnfunc_target_items (void) diff --git a/qcsrc/server/t_jumppads.qc b/qcsrc/server/t_jumppads.qc index 3c797f9771..067e889d0b 100644 --- a/qcsrc/server/t_jumppads.qc +++ b/qcsrc/server/t_jumppads.qc @@ -195,7 +195,7 @@ void trigger_push_touch() if(IS_REAL_CLIENT(other)) { if(self.message) - centerprint(other, self.message); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_TRIGGER, self.message); } else other.lastteleporttime = time; diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index 24da476d72..affed93c80 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -904,14 +904,14 @@ float door_check_keys(void) { // some keys were used if (other.key_door_messagetime <= time) { play2(other, "misc/talk.wav"); - centerprint(other, strcat("You also need ", item_keys_keylist(door.itemkeys), "!")); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(door.itemkeys)); other.key_door_messagetime = time + 2; } } else { // no keys were used if (other.key_door_messagetime <= time) { play2(other, "misc/talk.wav"); - centerprint(other, strcat("You need ", item_keys_keylist(door.itemkeys), "!")); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(door.itemkeys)); other.key_door_messagetime = time + 2; } } @@ -919,7 +919,7 @@ float door_check_keys(void) { if (door.itemkeys) { // door is now unlocked play2(other, "misc/talk.wav"); - centerprint(other, "Door unlocked!"); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_UNLOCKED); return TRUE; } else return FALSE; @@ -1068,7 +1068,7 @@ void door_touch() if (!(self.owner.dmg) && (self.owner.message != "")) { if (IS_CLIENT(other)) - centerprint (other, self.owner.message); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_TRIGGER, self.owner.message); play2(other, "misc/talk.wav"); } } @@ -1741,7 +1741,7 @@ void secret_touch() if (self.message) { if (IS_CLIENT(other)) - centerprint (other, self.message); + Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_TRIGGER, self.message); play2(other, "misc/talk.wav"); } } diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 81c877db90..3468bdbdb2 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -987,7 +987,7 @@ void ShufflePlayerOutOfTeam (float source_team) if(selected.deadflag == DEAD_NO) Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0'); - centerprint(selected, strcat("You have been moved into a different team to improve team balance\nYou are now on: ", Team_ColoredFullName(selected.team))); + Send_Notification(NOTIF_ONE, selected, MSG_CENTER, CENTER_DEATH_SELF_AUTOTEAMCHANGE, selected.team); } // code from here on is just to support maps that don't have team entities diff --git a/qcsrc/server/w_porto.qc b/qcsrc/server/w_porto.qc index 1eb0f4b0bc..491e1788f6 100644 --- a/qcsrc/server/w_porto.qc +++ b/qcsrc/server/w_porto.qc @@ -58,7 +58,7 @@ void W_Porto_Fail (float failhard) if(vlen(trace_endpos - self.realowner.origin) < 128) { W_ThrowNewWeapon(self.realowner, WEP_PORTO, 0, self.origin, self.velocity); - centerprint(self.realowner, "^1Portal deployment failed.\n\n^2Catch it to try again!"); + Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_FAILED); } } } @@ -134,7 +134,7 @@ void W_Porto_Touch (void) { sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - centerprint(self.realowner, "^1In^7-portal created."); + Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN); W_Porto_Success(); } else @@ -151,7 +151,7 @@ void W_Porto_Touch (void) { sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - centerprint(self.realowner, "^4Out^7-portal created."); + Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT); W_Porto_Success(); } else @@ -168,7 +168,7 @@ void W_Porto_Touch (void) { sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - centerprint(self.realowner, "^1In^7-portal created."); + Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_IN); self.right_vector = self.right_vector - 2 * trace_plane_normal * (self.right_vector * norm); self.angles = vectoangles(self.velocity - 2 * trace_plane_normal * (self.velocity * norm)); CSQCProjectile(self, TRUE, PROJECTILE_PORTO_BLUE, TRUE); // change type @@ -189,7 +189,7 @@ void W_Porto_Touch (void) { sound(self, CH_SHOTS, "porto/create.wav", VOL_BASE, ATTEN_NORM); trace_plane_normal = norm; - centerprint(self.realowner, "^4Out^7-portal created."); + Send_Notification(NOTIF_ONE, self.realowner, MSG_CENTER, CENTER_PORTO_CREATED_OUT); W_Porto_Success(); } else -- 2.39.2