From 5e0e1e6c08882641b637d8067f89e628a85850f8 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Wed, 24 Oct 2012 17:37:21 -0400 Subject: [PATCH] Refactor obituary code, and move the frag messages over to new system :D --- qcsrc/common/notifications.qc | 101 +++++++++++++++++++------- qcsrc/server/g_damage.qc | 55 +++++++------- qcsrc/server/mutators/gamemode_ctf.qc | 54 +++++++------- 3 files changed, 130 insertions(+), 80 deletions(-) diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 49504c936..853ab0ad3 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -22,6 +22,8 @@ #define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0 #endif +#define BOT_PING -1 + #define NOTIF_MATCH(a,b) if(min(NOTIF_MAX, a) == b) #ifdef CSQC string got_commandkey; @@ -32,11 +34,33 @@ var float autocvar_notification_ctf_pickup_enemy_verbose = TRUE; #define CHECK_AUTOCVAR(name) if(autocvar_notification_##name) #define HANDLE_CPID(cpid) ((min(NOTIF_MAX, cpid) == NO_CPID) ? FALSE : cpid) #define PASS_KEY ((((got_commandkey = getcommandkey("pass", "+use")) != "pass") && !(strstrofs(got_commandkey, "not bound", 0) >= 0)) ? sprintf(CCR(_(" ^F1(Press %s)")), got_commandkey) : "") +#define FRAG_SPREE (((f1 == 3) || (f1 == 5) || (f1 == 10) || (f1 == 15) || (f1 == 20) || (f1 == 25) || (f1 == 30)) ? sprintf(normal_or_gentle(_("%d kill spree! "), _("%d score spree! ")), f1) : "") +#define FRAG_PING ((f2 != BOT_PING) ? sprintf(CCR(_("\n(Ping ^2%d^BG)")), f2) : "") +#define FRAG_STATS sprintf(CCR(_("\n(Health ^1%d^BG / Armor ^2%d^BG)%s")), f1, f2, ((f3 != BOT_PING) ? sprintf(CCR(_(" (Ping ^2%d^BG)")), f3) : "")) +//#define FRAG_POS ((Should_Print_Score_Pos(f1)) ? sprintf("\n^BG%s", Read_Score_Pos(f1)) : "") #else #define ADD_CSQC_AUTOCVAR(name) #endif +/* + If BELOW negative maxplayers, you dropped a place lower + If below 0, you are tied for that place + If above 0, you are holding that place alone + If above positive maxplayers, you moved up a place +* +float Should_Print_Score_Pos + +string Read_Score_Pos(float num) +{ + +} + +float Form_Score_Pos(entity player) +{ + return +}*/ + // ==================================== // Notifications List and Information // ==================================== @@ -134,7 +158,22 @@ var float autocvar_notification_ctf_pickup_enemy_verbose = TRUE; MSG_CENTER_NOTIF(CENTER_CTF_STALEMATE_CARRIER, 0, 0, NO_STR_ARG, CPID_STALEMATE, XPND2(0, 0), _("^BGStalemate! Enemies can now see you on radar!"), "") \ MSG_CENTER_NOTIF(CENTER_CTF_STALEMATE_OTHER, 0, 0, NO_STR_ARG, CPID_STALEMATE, XPND2(0, 0), _("^BGStalemate! Flag carriers can now be seen by enemies on radar!"), "") \ MSG_CENTER_NOTIF(CENTER_CTF_FLAG_THROW_PUNISH, 0, 1, f1, CPID_CTF_LOWPRIO, XPND2(0, 0), _("^BGToo many flag throws! Throwing disabled for %d seconds."), "") \ - MSG_CENTER_NOTIF(CENTER_EMPTY, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), "", "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_FRAG, 1, 1, XPND2(FRAG_SPREE, s1), NO_CPID, XPND2(0, 0), _("^K3%sYou fragged ^BG%s"), _("^K3%sYou scored against ^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_FRAGGED, 1, 0, s1, NO_CPID, XPND2(0, 0), _("^K1You were fragged by ^BG%s"), _("^K1You were scored against by ^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TYPEFRAG, 1, 1, XPND2(FRAG_SPREE, s1), NO_CPID, XPND2(0, 0), _("^K1%sYou typefragged ^BG%s"), _("^K1%sYou scored against ^BG%s^K1 while they were typing")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TYPEFRAGGED, 1, 0, s1, NO_CPID, XPND2(0, 0), _("^K1You were typefragged by ^BG%s"), _("^K1You were scored against by ^BG%s^K1 while typing!")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_FRAG_FIRST, 1, 0, s1, NO_CPID, XPND2(0, 0), _("^K3First blood! You fragged ^BG%s"), _("^K3First score! You scored against ^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_FRAGGED_FIRST, 1, 0, s1, NO_CPID, XPND2(0, 0), _("^K1First victim! You were fragged by ^BG%s"), _("^K1First casualty! You were scored against by ^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TYPEFRAG_FIRST, 1, 0, s1, NO_CPID, XPND2(0, 0), _("^K1First blood! You typefragged ^BG%s"), _("^K1First score! You scored against ^BG%s^K1 while they were typing")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TYPEFRAGGED_FIRST, 1, 0, s1, NO_CPID, XPND2(0, 0), _("^K1First victim! You were typefragged by ^BG%s"), _("^K1First casualty! You were scored against by ^BG%s^K1 while typing!")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_FRAG_VERBOSE, 1, 2, XPND3(FRAG_SPREE, s1, FRAG_PING), NO_CPID, XPND2(0, 0), _("^K3You fragged ^BG%s^BG%s"), _("^K3You scored against ^BG%s^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_FRAGGED_VERBOSE, 1, 3, XPND2(s1, FRAG_STATS), NO_CPID, XPND2(0, 0), _("^K1You were fragged by ^BG%s^BG%s"), _("^K1You were scored against by ^BG%s^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TYPEFRAG_VERBOSE, 1, 2, XPND3(FRAG_SPREE, s1, FRAG_PING), NO_CPID, XPND2(0, 0), _("^K1You typefragged ^BG%s^BG%s"), _("^K1You scored against ^BG%s^K1 while they were typing^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TYPEFRAGGED_VERBOSE, 1, 3, XPND2(s1, FRAG_STATS), NO_CPID, XPND2(0, 0), _("^K1You were typefragged by ^BG%s^BG%s"), _("^K1You were scored against by ^BG%s^K1 while typing^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_FRAG_FIRST_VERBOSE, 1, 1, s1, NO_CPID, XPND2(0, 0), _("^K3First blood! You fragged ^BG%s"), _("^K3First score! You scored against ^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_FRAGGED_FIRST_VERBOSE, 1, 3, s1, NO_CPID, XPND2(0, 0), _("^K1First victim! You were fragged by ^BG%s"), _("^K1First casualty! You were scored against by ^BG%s")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TYPEFRAG_FIRST_VERBOSE, 1, 1, s1, NO_CPID, XPND2(0, 0), _("^K1First blood! You typefragged ^BG%s"), _("^K1First score! You scored against ^BG%s^K1 while they were typing")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TYPEFRAGGED_FIRST_VERBOSE,1, 3, s1, NO_CPID, XPND2(0, 0), _("^K1First victim! You were typefragged by ^BG%s"), _("^K1First casualty! You were scored against by ^BG%s^K1 while typing!")) \ #undef MSG_CENTER_NOTIF #define MSG_WEAPON_NOTIFICATIONS \ @@ -279,12 +318,18 @@ string TCR(string input, string teamcolor, string teamtext) // color code replace, place inside of sprintf and parse the string string CCR(string input) { - input = strreplace("^F1", "^2", input); // autocvar_notification_colors_F1 - input = strreplace("^F2", "^3", input); // autocvar_notification_colors_F2 - input = strreplace("^K1", "^1", input); // autocvar_notification_colors_K1 - input = strreplace("^K2", "^3", input); // autocvar_notification_colors_K2 - input = strreplace("^BG", "^7", input); // autocvar_notification_colors_BG - input = strreplace("^N", "^7", input); // "none"-- reset to white + // foreground/normal colors + input = strreplace("^F1", "^2", input); // primary priority (important names, etc) + input = strreplace("^F2", "^3", input); // secondary priority (items, locations, numbers, etc) + + // "kill" colors + input = strreplace("^K1", "^1", input); // "bad" or "dangerous" text (death messages against you, kill notifications, etc) + input = strreplace("^K2", "^3", input); // similar to above, but less important... OR, a highlight out of above message type + input = strreplace("^K3", "^4", input); // "good" or "beneficial" text (you fragging someone, etc) + + // background colors + input = strreplace("^BG", "^7", input); // neutral/unimportant text + input = strreplace("^N", "^7", input); // "none"-- reset to white... return input; } @@ -403,7 +448,7 @@ void Read_Notification(void) #endif #ifdef SVQC -void Send_Notification(entity client, float net_type, float net_name, string s1, string s2, float f1, float f2, float f3) +void Send_Notification(entity client, float broadcast, float net_type, float net_name, string s1, string s2, float f1, float f2, float f3) { if(net_type && net_name) { @@ -414,24 +459,27 @@ void Send_Notification(entity client, float net_type, float net_name, string s1, if(notif_stringcount(s1, s2) > stringcount) { backtrace("Too many string arguments for notification!\n"); return; } if(notif_floatcount(f1, f2, f3) > floatcount) { backtrace("Too many float arguments for notification!\n"); return; } - - if(client && (clienttype(client) == CLIENTTYPE_REAL) && (client.flags & FL_CLIENT)) + + if(broadcast == MSG_ONE) { - // personal/direct notification sent to ONE person and their spectators - msg_entity = client; - WRITESPECTATABLE_MSG_ONE({ - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_NOTIFICATION); - WriteByte(MSG_ONE, net_type); - WriteShort(MSG_ONE, net_name); - if(stringcount >= 1) { WriteString(MSG_ONE, s1); } - if(stringcount == 2) { WriteString(MSG_ONE, s2); } - if(floatcount >= 1) { WriteLong(MSG_ONE, f1); } - if(floatcount >= 2) { WriteLong(MSG_ONE, f2); } - if(floatcount == 3) { WriteLong(MSG_ONE, f3); } - }); + if(client && (clienttype(client) == CLIENTTYPE_REAL) && (client.flags & FL_CLIENT)) + { + // personal/direct notification sent to ONE person and their spectators + msg_entity = client; + WRITESPECTATABLE_MSG_ONE({ + WriteByte(MSG_ONE, SVC_TEMPENTITY); + WriteByte(MSG_ONE, TE_CSQC_NOTIFICATION); + WriteByte(MSG_ONE, net_type); + WriteShort(MSG_ONE, net_name); + if(stringcount >= 1) { WriteString(MSG_ONE, s1); } + if(stringcount == 2) { WriteString(MSG_ONE, s2); } + if(floatcount >= 1) { WriteLong(MSG_ONE, f1); } + if(floatcount >= 2) { WriteLong(MSG_ONE, f2); } + if(floatcount == 3) { WriteLong(MSG_ONE, f3); } + }); + } } - else + else if(broadcast == MSG_ALL) { // global notification sent to EVERYONE WriteByte(MSG_ALL, SVC_TEMPENTITY); @@ -444,6 +492,7 @@ void Send_Notification(entity client, float net_type, float net_name, string s1, if(floatcount >= 2) { WriteLong(MSG_ALL, f2); } if(floatcount == 3) { WriteLong(MSG_ALL, f3); } } + else { backtrace("Unknown MSG_ type to write with!\n"); } if(!server_is_local && (net_type == MSG_INFO)) { @@ -464,7 +513,7 @@ void Send_Notification_ToTeam(float targetteam, entity except, float net_type, f if(tmp_entity.team == targetteam) if(tmp_entity != except) { - Send_Notification(tmp_entity, net_type, net_name, s1, s2, f1, f2, f3); + Send_Notification(tmp_entity, MSG_ONE, net_type, net_name, s1, s2, f1, f2, f3); } } } @@ -478,7 +527,7 @@ void Send_Notification_ToAll(entity except, float spectators, float net_type, fl if((tmp_entity.classname == STR_PLAYER) || spectators) if(tmp_entity != except) { - Send_Notification(tmp_entity, net_type, net_name, s1, s2, f1, f2, f3); + Send_Notification(tmp_entity, MSG_ONE, net_type, net_name, s1, s2, f1, f2, f3); } } } diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index a8ef09a7c..09f1bcfa0 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -316,8 +316,8 @@ void Obituary_SpecialDeath(entity notif_target, float deathtype, string s1, stri #define DEATHTYPE(name,msg_info,msg_center,position) \ { if(deathtype == max(0, name)) \ { \ - if(max(0, msg_info)) { Send_Notification(world, MSG_INFO, msg_info, s1, s2, f1, f2, f3); ++handled; } \ - if(max(0, msg_center)) { Send_Notification(notif_target, MSG_CENTER, msg_center, s1, s2, f1, f2, f3); ++handled; } \ + if(max(0, msg_info)) { Send_Notification(world, MSG_ALL, MSG_INFO, msg_info, s1, s2, f1, f2, f3); ++handled; } \ + if(max(0, msg_center)) { Send_Notification(notif_target, MSG_ONE, MSG_CENTER, msg_center, s1, s2, f1, f2, f3); ++handled; } \ ++hits; \ } } @@ -335,17 +335,12 @@ void Obituary_SpecialDeath(entity notif_target, float deathtype, string s1, stri } } -float Form_Score_Pos(entity player) -{ - return 20; -} - -#define BOT_PING -489 +.float FRAG_VERBOSE; void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) { // Sanity check - if(targ.classname == "player") { backtrace("Obituary called on non-player?!\n"); return; } + if not(targ.classname == "player") { backtrace("Obituary called on non-player?!\n"); return; } // Declarations string s, a, msg; @@ -433,10 +428,12 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) s1 = attacker.netname; s2 = targ.netname; + attacker.FRAG_VERBOSE = TRUE; + targ.FRAG_VERBOSE = TRUE; + LogDeath("frag", deathtype, attacker, targ); GiveFrags(attacker, targ, 1, deathtype); - float Obituary_Score_Position = Form_Score_Pos(attacker); attacker.taunt_soundtime = time + 1; attacker.killcount = attacker.killcount + 1; if(targ.killcount > 2) { Send_KillNotification(s, ftos(targ.killcount), a, KILL_END_SPREE, MSG_SPREE); } @@ -455,7 +452,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) ADD_ACHIEVEMENT_CASE(10, 10) ADD_ACHIEVEMENT_CASE(15, 15) ADD_ACHIEVEMENT_CASE(20, 20) - ADD_ACHIEVEMENT_CASE(20, 20) + ADD_ACHIEVEMENT_CASE(25, 25) ADD_ACHIEVEMENT_CASE(30, 30) default: break; } @@ -473,17 +470,19 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) { if(targ.istypefrag) { - Send_Notification(attacker, MSG_CENTER, (attacker.FRAG_VERBOSE ? CENTER_DEATH_TYPEFRAG_FIRSTBLOOD_VERBOSE : CENTER_DEATH_TYPEFRAG_FIRSTBLOOD), - s2, NO_STR_ARG, (attacker.FRAG_VERBOSE ? ((clienttype(player) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG), NO_FL_ARG, NO_FL_ARG); - Send_Notification(targ, MSG_CENTER, (targ.FRAG_VERBOSE ? CENTER_DEATH_TYPEFRAGGED_FIRSTVICTIM_VERBOSE : CENTER_DEATH_TYPEFRAGGED_FIRSTVICTIM), - s1, NO_STR_ARG, (targ.FRAG_VERBOSE ? attacker.health : NO_FL_ARG), (targ.FRAG_VERBOSE ? attacker.armorvalue : NO_FL_ARG), (targ.FRAG_VERBOSE ? ((clienttype(player) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG)); + Send_Notification(attacker, MSG_ONE, MSG_CENTER, (attacker.FRAG_VERBOSE ? CENTER_DEATH_TYPEFRAG_FIRST_VERBOSE : CENTER_DEATH_TYPEFRAG_FIRST), + s2, NO_STR_ARG, (attacker.FRAG_VERBOSE ? ((clienttype(targ) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG), NO_FL_ARG, NO_FL_ARG); + + Send_Notification(targ, MSG_ONE, MSG_CENTER, (targ.FRAG_VERBOSE ? CENTER_DEATH_TYPEFRAGGED_FIRST_VERBOSE : CENTER_DEATH_TYPEFRAGGED_FIRST), + s1, NO_STR_ARG, (targ.FRAG_VERBOSE ? attacker.health : NO_FL_ARG), (targ.FRAG_VERBOSE ? attacker.armorvalue : NO_FL_ARG), (targ.FRAG_VERBOSE ? ((clienttype(attacker) == CLIENTTYPE_BOT) ? BOT_PING : attacker.ping) : NO_FL_ARG)); } else { - Send_Notification(attacker, MSG_CENTER, (attacker.FRAG_VERBOSE ? CENTER_DEATH_FRAG_FIRSTBLOOD_VERBOSE : CENTER_DEATH_FRAG_FIRSTBLOOD), - s2, NO_STR_ARG, (attacker.FRAG_VERBOSE ? ((clienttype(player) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG), NO_FL_ARG, NO_FL_ARG); - Send_Notification(targ, MSG_CENTER, (targ.FRAG_VERBOSE ? CENTER_DEATH_FRAGGED_FIRSTVICTIM_VERBOSE : CENTER_DEATH_FRAGGED_FIRSTVICTIM), - s1, NO_STR_ARG, (targ.FRAG_VERBOSE ? attacker.health : NO_FL_ARG), (targ.FRAG_VERBOSE ? attacker.armorvalue : NO_FL_ARG), (targ.FRAG_VERBOSE ? ((clienttype(player) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG)); + Send_Notification(attacker, MSG_ONE, MSG_CENTER, (attacker.FRAG_VERBOSE ? CENTER_DEATH_FRAG_FIRST_VERBOSE : CENTER_DEATH_FRAG_FIRST), + s2, NO_STR_ARG, (attacker.FRAG_VERBOSE ? ((clienttype(targ) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG), NO_FL_ARG, NO_FL_ARG); + + Send_Notification(targ, MSG_ONE, MSG_CENTER, (targ.FRAG_VERBOSE ? CENTER_DEATH_FRAGGED_FIRST_VERBOSE : CENTER_DEATH_FRAGGED_FIRST), + s1, NO_STR_ARG, (targ.FRAG_VERBOSE ? attacker.health : NO_FL_ARG), (targ.FRAG_VERBOSE ? attacker.armorvalue : NO_FL_ARG), (targ.FRAG_VERBOSE ? ((clienttype(attacker) == CLIENTTYPE_BOT) ? BOT_PING : attacker.ping) : NO_FL_ARG)); } //Send_Notification(world, MSG_INFO, INFO_DEATH_FRAG_FIRSTBLOOD, s1, s2, attacker.team, NO_FL_ARG, NO_FL_ARG); } @@ -491,17 +490,19 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) { if(targ.istypefrag) { - Send_Notification(attacker, MSG_CENTER, (attacker.FRAG_VERBOSE ? CENTER_DEATH_TYPEFRAG_VERBOSE : CENTER_DEATH_TYPEFRAG), - s2, NO_STR_ARG, attacker.killcount, Obituary_Score_Position, (attacker.FRAG_VERBOSE ? ((clienttype(player) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG)); - Send_Notification(targ, MSG_CENTER, (targ.FRAG_VERBOSE ? CENTER_DEATH_TYPEFRAGGED_VERBOSE : CENTER_DEATH_TYPEFRAGGED), - s1, NO_STR_ARG, (targ.FRAG_VERBOSE ? attacker.health : NO_FL_ARG), (targ.FRAG_VERBOSE ? attacker.armorvalue : NO_FL_ARG), (targ.FRAG_VERBOSE ? ((clienttype(player) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG)); + Send_Notification(attacker, MSG_ONE, MSG_CENTER, (attacker.FRAG_VERBOSE ? CENTER_DEATH_TYPEFRAG_VERBOSE : CENTER_DEATH_TYPEFRAG), + s2, NO_STR_ARG, attacker.killcount, (attacker.FRAG_VERBOSE ? ((clienttype(targ) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG), NO_FL_ARG); + + Send_Notification(targ, MSG_ONE, MSG_CENTER, (targ.FRAG_VERBOSE ? CENTER_DEATH_TYPEFRAGGED_VERBOSE : CENTER_DEATH_TYPEFRAGGED), + s1, NO_STR_ARG, (targ.FRAG_VERBOSE ? attacker.health : NO_FL_ARG), (targ.FRAG_VERBOSE ? attacker.armorvalue : NO_FL_ARG), (targ.FRAG_VERBOSE ? ((clienttype(attacker) == CLIENTTYPE_BOT) ? BOT_PING : attacker.ping) : NO_FL_ARG)); } else { - Send_Notification(attacker, MSG_CENTER, (attacker.FRAG_VERBOSE ? CENTER_DEATH_FRAG_VERBOSE : CENTER_DEATH_FRAG), - s2, NO_STR_ARG, attacker.killcount, Obituary_Score_Position, (attacker.FRAG_VERBOSE ? ((clienttype(player) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG)); - Send_Notification(targ, MSG_CENTER, (targ.FRAG_VERBOSE ? CENTER_DEATH_FRAGGED_VERBOSE : CENTER_DEATH_FRAGGED), - s1, NO_STR_ARG, (targ.FRAG_VERBOSE ? attacker.health : NO_FL_ARG), (targ.FRAG_VERBOSE ? attacker.armorvalue : NO_FL_ARG), (targ.FRAG_VERBOSE ? ((clienttype(player) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG)); + Send_Notification(attacker, MSG_ONE, MSG_CENTER, (attacker.FRAG_VERBOSE ? CENTER_DEATH_FRAG_VERBOSE : CENTER_DEATH_FRAG), + s2, NO_STR_ARG, attacker.killcount, (attacker.FRAG_VERBOSE ? ((clienttype(targ) == CLIENTTYPE_BOT) ? BOT_PING : targ.ping) : NO_FL_ARG), NO_FL_ARG); + + Send_Notification(targ, MSG_ONE, MSG_CENTER, (targ.FRAG_VERBOSE ? CENTER_DEATH_FRAGGED_VERBOSE : CENTER_DEATH_FRAGGED), + s1, NO_STR_ARG, (targ.FRAG_VERBOSE ? attacker.health : NO_FL_ARG), (targ.FRAG_VERBOSE ? attacker.armorvalue : NO_FL_ARG), (targ.FRAG_VERBOSE ? ((clienttype(attacker) == CLIENTTYPE_BOT) ? BOT_PING : attacker.ping) : NO_FL_ARG)); } //if(DEATH_WEAPONOF(deathtype)) { Send_Notification(world, MSG_WEAPON, 50, s1, s2, attacker.killcount, targ.killcount, Obituary_Score_Position); } //else { Obituary_SpecialDeath(world, deathtype, s1, s2, attacker.killcount, targ.killcount, Obituary_Score_Position); } diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 1ed74d5b5..bdfdfea5a 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -42,7 +42,7 @@ void ctf_CaptureRecord(entity flag, entity player) FOR_EACH_REALCLIENT(tmp_entity) { if not(tmp_entity.CAPTURE_VERBOSE) { notification = APP_TEAM_ENT_2(flag, INFO_CTF_CAPTURE_); s2 = NO_STR_ARG; f1 = f2 = NO_FL_ARG; } - Send_Notification(tmp_entity, MSG_INFO, notification, s1, s2, f1, f2, NO_FL_ARG); + Send_Notification(tmp_entity, MSG_ONE, MSG_INFO, notification, s1, s2, f1, f2, NO_FL_ARG); } // write that shit in the database @@ -169,9 +169,9 @@ void ctf_CaptureShield_Update(entity player, float wanted_status) if((wanted_status == player.ctf_captureshielded) && (updated_status != wanted_status)) // 0: shield only, 1: unshield only { if(updated_status) // TODO csqc notifier for this // Samual: How? - Send_Notification(player, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(player, MSG_ONE, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); else - Send_Notification(player, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_FREE, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(player, MSG_ONE, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_FREE, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); player.ctf_captureshielded = updated_status; } @@ -194,7 +194,7 @@ void ctf_CaptureShield_Touch() vector othermid = (other.absmin + other.absmax) * 0.5; Damage(other, self, self, 0, DEATH_HURTTRIGGER, mymid, normalize(othermid - mymid) * ctf_captureshield_force); - Send_Notification(other, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(other, MSG_ONE, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } void ctf_CaptureShield_Spawn(entity flag) @@ -237,7 +237,7 @@ void ctf_Handle_Drop(entity flag, entity player, float droptype) flag.ctf_status = FLAG_DROPPED; // messages and sounds - Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_LOST_), player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_LOST_), player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTN_NONE); ctf_EventLog("dropped", player.team, player); @@ -290,11 +290,11 @@ void ctf_Handle_Retrieve(entity flag, entity player) FOR_EACH_REALPLAYER(tmp_player) { if(tmp_player == sender) - Send_Notification(tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_SENT_), player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(tmp_player, MSG_ONE, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_SENT_), player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); else if(tmp_player == player) - Send_Notification(tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_RECEIVED_), sender.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(tmp_player, MSG_ONE, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_RECEIVED_), sender.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); else if(!IsDifferentTeam(tmp_player, sender)) - Send_Notification(tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_OTHER_), sender.netname, player.netname, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(tmp_player, MSG_ONE, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PASS_OTHER_), sender.netname, player.netname, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } // create new waypoint @@ -448,8 +448,8 @@ void ctf_Handle_Capture(entity flag, entity toucher, float capturetype) void ctf_Handle_Return(entity flag, entity player) { // messages and sounds - Send_Notification(player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_RETURN_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); - Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_RETURN_), player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(player, MSG_ONE, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_RETURN_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_RETURN_), player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTN_NONE); ctf_EventLog("return", flag.team, player); @@ -497,20 +497,20 @@ void ctf_Handle_Pickup(entity flag, entity player, float pickuptype) } // messages and sounds - Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_PICKUP_), player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_PICKUP_), player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTN_NONE); FOR_EACH_REALPLAYER(tmp_player) { if(tmp_player == player) { - Send_Notification(tmp_player, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PICKUP_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); - if(ctf_stalemate) { Send_Notification(player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } + Send_Notification(tmp_player, MSG_ONE, MSG_CENTER, APP_TEAM_ENT_2(flag, CENTER_CTF_PICKUP_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + if(ctf_stalemate) { Send_Notification(player, MSG_ONE, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } else if(!IsDifferentTeam(tmp_player, player) && tmp_player != player) - Send_Notification(tmp_player, MSG_CENTER, (tmp_player.PICKUP_TEAM_VERBOSE ? CENTER_CTF_PICKUP_TEAM_VERBOSE : CENTER_CTF_PICKUP_TEAM), Team_ColorCode(player.team), (tmp_player.PICKUP_TEAM_VERBOSE ? player.netname : NO_STR_ARG), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(tmp_player, MSG_ONE, MSG_CENTER, (tmp_player.PICKUP_TEAM_VERBOSE ? CENTER_CTF_PICKUP_TEAM_VERBOSE : CENTER_CTF_PICKUP_TEAM), Team_ColorCode(player.team), (tmp_player.PICKUP_TEAM_VERBOSE ? player.netname : NO_STR_ARG), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); else if(IsDifferentTeam(tmp_player, player)) - Send_Notification(tmp_player, MSG_CENTER, (tmp_player.PICKUP_ENEMY_VERBOSE ? CENTER_CTF_PICKUP_ENEMY_VERBOSE : CENTER_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), (tmp_player.PICKUP_ENEMY_VERBOSE ? player.netname : NO_STR_ARG), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(tmp_player, MSG_ONE, MSG_CENTER, (tmp_player.PICKUP_ENEMY_VERBOSE ? CENTER_CTF_PICKUP_ENEMY_VERBOSE : CENTER_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), (tmp_player.PICKUP_ENEMY_VERBOSE ? player.netname : NO_STR_ARG), NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } // scoring @@ -569,14 +569,14 @@ void ctf_CheckFlagReturn(entity flag, float returntype) { switch(returntype) { - case RETURN_DROPPED: Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_DROPPED_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); break; - case RETURN_DAMAGE: Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_DAMAGED_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); break; - case RETURN_SPEEDRUN: Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_SPEEDRUN_), NO_STR_ARG, NO_STR_ARG, ctf_captimerecord, NO_FL_ARG, NO_FL_ARG); break; - case RETURN_NEEDKILL: Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_NEEDKILL_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); break; + case RETURN_DROPPED: Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_DROPPED_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); break; + case RETURN_DAMAGE: Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_DAMAGED_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); break; + case RETURN_SPEEDRUN: Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_SPEEDRUN_), NO_STR_ARG, NO_STR_ARG, ctf_captimerecord, NO_FL_ARG, NO_FL_ARG); break; + case RETURN_NEEDKILL: Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_NEEDKILL_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); break; default: case RETURN_TIMEOUT: - { Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_TIMEOUT_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); break; } + { Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(flag, INFO_CTF_FLAGRETURN_TIMEOUT_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); break; } } sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTN_NONE); ctf_EventLog("returned", flag.team, world); @@ -631,9 +631,9 @@ void ctf_CheckStalemate(void) { FOR_EACH_REALPLAYER(tmp_entity) if(tmp_entity.flagcarried) - Send_Notification(tmp_entity, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(tmp_entity, MSG_ONE, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); else - Send_Notification(tmp_entity, MSG_CENTER, CENTER_CTF_STALEMATE_OTHER, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(tmp_entity, MSG_ONE, MSG_CENTER, CENTER_CTF_STALEMATE_OTHER, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); wpforenemy_announced = TRUE; } @@ -1843,13 +1843,13 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey) { if(clienttype(head) == CLIENTTYPE_BOT) { - Send_Notification(player, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(player, MSG_ONE, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); ctf_Handle_Throw(head, player, DROP_PASS); } else { - Send_Notification(head, MSG_CENTER, CENTER_CTF_PASS_REQUESTED, player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); - Send_Notification(player, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(head, MSG_ONE, MSG_CENTER, CENTER_CTF_PASS_REQUESTED, player.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(player, MSG_ONE, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } player.throw_antispam = time + autocvar_g_ctf_pass_wait; return TRUE; @@ -1886,7 +1886,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey) } else { - Send_Notification(player, MSG_CENTER, CENTER_CTF_FLAG_THROW_PUNISH, NO_STR_ARG, NO_STR_ARG, rint((player.throw_prevtime + autocvar_g_ctf_throw_punish_delay) - time), NO_FL_ARG, NO_FL_ARG); + Send_Notification(player, MSG_ONE, MSG_CENTER, CENTER_CTF_FLAG_THROW_PUNISH, NO_STR_ARG, NO_STR_ARG, rint((player.throw_prevtime + autocvar_g_ctf_throw_punish_delay) - time), NO_FL_ARG, NO_FL_ARG); return FALSE; } } @@ -1961,7 +1961,7 @@ MUTATOR_HOOKFUNCTION(ctf_AbortSpeedrun) { if(self.flagcarried) { - Send_Notification(world, MSG_INFO, APP_TEAM_ENT_2(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + Send_Notification(world, MSG_ALL, MSG_INFO, APP_TEAM_ENT_2(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN_), NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); ctf_RespawnFlag(self.flagcarried); return TRUE; } -- 2.39.2