From 45f998a527b32fbc30edafac9419f38b85846b28 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Sun, 25 Nov 2012 23:28:26 -0500 Subject: [PATCH] Massive progress with the notification system, plus some cleanup/comments --- qcsrc/common/deathtypes.qh | 102 +++++++++++++------------- qcsrc/common/notifications.qc | 78 +++++++++++++++----- qcsrc/server/g_damage.qc | 83 ++++++++++++++------- qcsrc/server/mutators/gamemode_ctf.qh | 6 ++ 4 files changed, 173 insertions(+), 96 deletions(-) diff --git a/qcsrc/common/deathtypes.qh b/qcsrc/common/deathtypes.qh index e1c93024f..c4a3ba59f 100644 --- a/qcsrc/common/deathtypes.qh +++ b/qcsrc/common/deathtypes.qh @@ -6,7 +6,7 @@ float DT_COUNT; #define DT_MATCH(a,b) if(min(DT_MAX, a) == b) -#define DEATHTYPE(name,msg_info,msg_center,position) \ +#define DEATHTYPE(name,msg_info,msg_center,msg_info_by,msg_center_by,position) \ float name; \ float position; \ void RegisterDeathtype_##name() \ @@ -18,55 +18,55 @@ float DT_COUNT; ACCUMULATE_FUNCTION(RegisterDeathtypes, RegisterDeathtype_##name) #define DEATHTYPES \ - DEATHTYPE(DEATH_FALL, FALSE, FALSE, DEATH_SPECIAL_START) \ - DEATHTYPE(DEATH_TELEFRAG, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_DROWN, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_HURTTRIGGER, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_LAVA, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_SLIME, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_KILL, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_NOAMMO, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_SWAMP, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TEAMCHANGE, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_AUTOTEAMCHANGE, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_CAMP, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_SHOOTING_STAR, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_ROT, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_MIRRORDAMAGE, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TOUCHEXPLODE, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_CHEAT, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_FIRE, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_VHCRUSH, FALSE, FALSE, DEATH_VHFIRST) \ - DEATHTYPE(DEATH_SBMINIGUN, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_SBROCKET, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_SBBLOWUP, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_WAKIGUN, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_WAKIROCKET, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_WAKIBLOWUP, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_RAPTOR_CANNON, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_RAPTOR_BOMB, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_RAPTOR_BOMB_SPLIT, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_RAPTOR_DEATH, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_BUMB_GUN, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_BUMB_RAY, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_BUMB_RAY_HEAL, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_BUMB_DEATH, FALSE, FALSE, DEATH_VHLAST) \ - DEATHTYPE(DEATH_TURRET, FALSE, FALSE, DEATH_TURRET_FIRST) \ - DEATHTYPE(DEATH_TURRET_EWHEEL, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_FLAC, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_MACHINEGUN, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_WALKER_GUN, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_WALKER_MEELE, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_WALKER_ROCKET, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_HELLION, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_HK, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_MLRS, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_PLASMA, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_PHASER, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_TURRET_TESLA, FALSE, FALSE, DEATH_TURRET_LAST) \ - DEATHTYPE(DEATH_GENERIC, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_WEAPON, FALSE, FALSE, NORMAL_POS) \ - DEATHTYPE(DEATH_CUSTOM, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_FALL, FALSE, CENTER_DEATH_FALL, FALSE, FALSE, DEATH_SPECIAL_START) \ + DEATHTYPE(DEATH_TELEFRAG, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_DROWN, FALSE, CENTER_DEATH_DROWN, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_HURTTRIGGER, FALSE, CENTER_DEATH_CUSTOM, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_LAVA, FALSE, CENTER_DEATH_LAVA, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_SLIME, FALSE, CENTER_DEATH_SLIME, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_KILL, FALSE, CENTER_DEATH_SUICIDE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_NOAMMO, FALSE, CENTER_DEATH_NOAMMO, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_SWAMP, FALSE, CENTER_DEATH_SWAMP, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TEAMCHANGE, FALSE, CENTER_DEATH_TEAMCHANGE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_AUTOTEAMCHANGE, FALSE, CENTER_DEATH_AUTOTEAMCHANGE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_CAMP, FALSE, CENTER_DEATH_CAMP, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_SHOOTING_STAR, FALSE, CENTER_DEATH_SHOOTING_STAR, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_ROT, FALSE, CENTER_DEATH_ROT, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_MIRRORDAMAGE, FALSE, CENTER_DEATH_BETRAYAL, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TOUCHEXPLODE, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_CHEAT, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_FIRE, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_VHCRUSH, FALSE, FALSE, FALSE, FALSE, DEATH_VHFIRST) \ + DEATHTYPE(DEATH_SBMINIGUN, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_SBROCKET, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_SBBLOWUP, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_WAKIGUN, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_WAKIROCKET, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_WAKIBLOWUP, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_RAPTOR_CANNON, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_RAPTOR_BOMB, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_RAPTOR_BOMB_SPLIT, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_RAPTOR_DEATH, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_BUMB_GUN, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_BUMB_RAY, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_BUMB_RAY_HEAL, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_BUMB_DEATH, FALSE, FALSE, FALSE, FALSE, DEATH_VHLAST) \ + DEATHTYPE(DEATH_TURRET, FALSE, FALSE, FALSE, FALSE, DEATH_TURRET_FIRST) \ + DEATHTYPE(DEATH_TURRET_EWHEEL, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_FLAC, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_MACHINEGUN, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_WALKER_GUN, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_WALKER_MEELE, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_WALKER_ROCKET, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_HELLION, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_HK, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_MLRS, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_PLASMA, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_PHASER, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_TURRET_TESLA, FALSE, FALSE, FALSE, FALSE, DEATH_TURRET_LAST) \ + DEATHTYPE(DEATH_GENERIC, FALSE, CENTER_DEATH_GENERIC, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_WEAPON, FALSE, FALSE, FALSE, FALSE, NORMAL_POS) \ + DEATHTYPE(DEATH_CUSTOM, FALSE, CENTER_DEATH_CUSTOM, FALSE, FALSE, NORMAL_POS) \ #undef DEATHTYPE DEATHTYPES @@ -83,7 +83,7 @@ string Deathtype_Name(float deathtype) { if(DEATH_ISSPECIAL(deathtype)) { - #define DEATHTYPE(name,msg_info,msg_center,position) \ + #define DEATHTYPE(name,msg_info,msg_center,msg_info_by,msg_center_by,position) \ { if(deathtype == max(0, name)) return VAR_TO_TEXT(name); } DEATHTYPES diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index a6edcf07a..ecbdb5231 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -1,6 +1,6 @@ // ================================================ // Unified notification system, written by Samual -// Last updated: September, 2012 +// Last updated: November, 2012 // ================================================ // main types/groups of notifications @@ -15,30 +15,50 @@ #define F_STRNUM 2 #define F_FLNUM 3 -// allow sending of notifications to also pass through to spectators (specifically for centerprints) -#ifdef SVQC -#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname -#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement) -#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0 -#endif - #define BOT_PING -1 +// Since this is code uses macro processors to list notifications, +// the normal compiler sees these checks as "constant" and throws +// a warning. We have to get around this by using another function. #define NOTIF_MATCH(a,b) if(min(NOTIF_MAX, a) == b) + #ifdef CSQC +/* + Acquire special information to generate for display in the + notification from variables networked to the client. + Macro descriptions: + PASS_KEY: find the keybind for "passing" or "dropping" in CTF game mode + FRAG_SPREE: find out if the player is on a kill spree/how many kills they have + FRAG_PING: show the ping of a player + FRAG_STATS: show health/armor/ping of a player + FRAG_POS: show score status and position in the match of a player + DEATH_TEAM: show the full name of the team a player is switching from +*/ string got_commandkey; -#define ADD_CSQC_AUTOCVAR(name) var float autocvar_notification_##name = TRUE; -var float autocvar_notification_ctf_capture_verbose = TRUE; -var float autocvar_notification_ctf_pickup_team_verbose = TRUE; -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)) : "") +#define DEATH_TEAM Team_ColoredFullName(f1) + +// NO_CPID normally has a variable value, so we need to check and see +// whether a notification uses it. If so, cancel out the centerprint ID. +#define HANDLE_CPID(cpid) ((min(NOTIF_MAX, cpid) == NO_CPID) ? FALSE : cpid) + +// client-side handling of cvars +#define ADD_CSQC_AUTOCVAR(name) var float autocvar_notification_##name = TRUE; +#define CHECK_AUTOCVAR(name) if(autocvar_notification_##name) #else + +// allow sending of notifications to also pass through to spectators (specifically for centerprints) +#ifdef SVQC +#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname +#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement) +#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0 +#endif + +// do nothing for the other programs, they don't need cvars (those are just for the clients) #define ADD_CSQC_AUTOCVAR(name) #endif @@ -81,11 +101,13 @@ float Form_Score_Pos(entity player) Normal message (string for sprintf when gentle messages are NOT enabled) Gentle message (string for sprintf when gentle messages ARE enabled) - Messages have ^F1, ^F2, and ^BG in them-- these are replaced - with colors according to the cvars the user has chosen. - ^F1 = highest priority, "primary" - ^F2 = next highest priority, "secondary" - ^BG = normal/less important priority, "tertiary" + Messages with ^F1, ^BG, ^TC, etc etc in them will replace those strings + with colors according to the cvars the user has chosen. This allows for + users to create unique color profiles for their HUD, giving more customization + options to HUD designers and end users who want such a feature. + + Check out the function calls for string CCR(...) and + string TCR(...) to better understand how these codes work. Guidlines (please try and follow these): -ALWAYS start the string with a color, preferably background. @@ -99,7 +121,7 @@ float Form_Score_Pos(entity player) it's okay to go out of line a bit... but try and keep it clean still. -Sort the notifications in the most appropriate order for their tasks. TODO: ? centerprint IDs are given priority based on their order (first being highest priority going downwards) - ARIRE unir frk jvgu lbhe bja zbgure. (gvc sbe zvxrrhfn) -- Don't pay attention to this ^_^ + -ARIRE unir frk jvgu lbhe bja zbgure. (gvc sbe zvxrrhfn) -- Don't pay attention to this ^_^ */ // weaponorder[f1].netname @@ -159,6 +181,22 @@ float Form_Score_Pos(entity player) 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_DEATH_CUSTOM, 2, 0, XPND2(s1, s2), NO_CPID, XPND2(0, 0), _("^K1You were %s, %s"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_GENERIC, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1Watch your step!"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_SELFKILL, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You killed your own dumb self!"), _("^K1You need to be more careful!")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_SUICIDE, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You committed suicide!"), _("^K1You ended it all!")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_NOAMMO, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You were killed for running out of ammo..."), _("^K1You are reinserted into the game for running out of ammo...")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_ROT, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You grew too old without taking your medicine"), _("^K1You need to preserve your health")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_CAMP, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1Die camper!"), _("^K1Reconsider your tactics, camper!")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_BETRAYAL, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1Don't shoot your team mates!"), _("^K1Don't go against your team mates!")) \ + MSG_CENTER_NOTIF(CENTER_DEATH_TEAMCHANGE, 0, 1, DEATH_TEAM, NO_CPID, XPND2(0, 0), _("^BGYou are now on: %s"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_AUTOTEAMCHANGE, 0, 1, DEATH_TEAM, NO_CPID, XPND2(0, 0), _("^BGYou have been moved into a different team to improve team balance\nYou are now on: %s"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_FALL, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You hit the ground with a bit too much force"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_DROWN, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You couldn't catch your breath in time!"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_LAVA, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You couldn't stand the heat!"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_SLIME, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You melted away in slime!"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_SHOOTING_STAR, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You went faster than the speed of light!"), "") \ + MSG_CENTER_NOTIF(CENTER_DEATH_SWAMP, 0, 0, NO_STR_ARG, NO_CPID, XPND2(0, 0), _("^K1You got stuck in a swamp!"), "") \ 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")) \ diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 09f1bcfa0..7c007c89d 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -308,7 +308,39 @@ void LogDeath(string mode, float deathtype, entity killer, entity killed) GameLogEcho(s); } -void Obituary_SpecialDeath(entity notif_target, float deathtype, string s1, string s2, float f1, float f2, float f3) +void Obituary_SpecialDeath(entity notif_target, float murder, float deathtype, string s1, string s2, float f1, float f2, float f3) +{ + float handled, hits; + if(DEATH_ISSPECIAL(deathtype)) + { + #define DEATHTYPE(name,msg_info,msg_center,msg_info_by,msg_center_by,position) \ + { if(deathtype == max(0, name)) \ + { \ + #if murder \ + if(max(0, msg_info_by)) { Send_Notification(world, MSG_ALL, MSG_INFO, msg_info_by, s1, s2, f1, f2, f3); ++handled; } \ + if(max(0, msg_center_by)) { Send_Notification(notif_target, MSG_ONE, MSG_CENTER, msg_center_by, s1, s2, f1, f2, f3); ++handled; } \ + #else \ + 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; } \ + #endif \ + ++hits; \ + } } + + DEATHTYPES + if not(hits) + { + backtrace("Unhandled deathtype. Please notify Samual!\n"); + //return; + } + if not(handled) + { + print(sprintf("Obituary_SpecialDeath(): ^1Deathtype ^7(%s-%d)^1 has no notification!\n", Deathtype_Name(deathtype), deathtype)); + return; + } + } +} + +void Obituary_WeaponDeath(entity notif_target, float deathtype, string s1, string s2, float f1, float f2, float f3) { float handled, hits; if(DEATH_ISSPECIAL(deathtype)) @@ -325,7 +357,7 @@ void Obituary_SpecialDeath(entity notif_target, float deathtype, string s1, stri if not(hits) { backtrace("Unhandled deathtype. Please notify Samual!\n"); - return; + //return; } if not(handled) { @@ -365,29 +397,30 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) { s1 = targ.netname; f1 = targ.team; - f2 = NO_FL_ARG; } else { - if(deathtype == DEATH_MIRRORDAMAGE) - { - s1 = targ.netname; - f1 = targ.team; - f2 = targ.killcount; - } - else + switch(deathtype) { - s1 = targ.netname; - f1 = targ.killcount; - f2 = NO_FL_ARG; + case DEATH_MIRRORDAMAGE: + { + s1 = targ.netname; + f1 = targ.team; + //f2 = targ.killcount; + break; + } + + default: + { + s1 = s2 = NO_STR_ARG; + f1 = f2 = f3 = NO_FL_ARG; + break; + } } - - // Do this manually inside of each if statement where necessary, - // DEATH_TEAMCHANGE and such are not supposed to have this. LogDeath("suicide", deathtype, targ, targ); GiveFrags(attacker, targ, -1, deathtype); } - Obituary_SpecialDeath(targ, deathtype, s1, NO_STR_ARG, f1, f2, NO_FL_ARG); + Obituary_SpecialDeath(targ, FALSE, deathtype, s1, s2, f1, f2, NO_FL_ARG); } else if(DEATH_WEAPONOF(deathtype)) { @@ -409,7 +442,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) { if(DEATH_ISSPECIAL(deathtype)) { - print("hmm death was special?\n"); + backtrace("hmm death was special?\n"); } else if(DEATH_WEAPONOF(deathtype)) { @@ -515,27 +548,27 @@ void Obituary(entity attacker, entity inflictor, entity targ, float deathtype) // ============= else { - Send_CSQC_KillCenterprint(targ, "", "", deathtype, MSG_KILL_ACTION); if (deathtype == DEATH_HURTTRIGGER && inflictor.message != "") msg = inflictor.message; else if (deathtype == DEATH_CUSTOM) msg = deathmessage; else msg = ""; - if(strstrofs(msg, "%", 0) < 0) - msg = strcat("%s ", msg); + + if(strstrofs(msg, "%", 0) < 0) { msg = strcat("%s ", msg); } + LogDeath("accident", deathtype, targ, targ); GiveFrags(targ, targ, -1, deathtype); if(PlayerScore_Add(targ, SP_SCORE, 0) == -5) { AnnounceTo(targ, "botlike"); PlayerStats_Event(attacker, PLAYERSTATS_ACHIEVEMENT_BOTLIKE, 1); } - Send_KillNotification(s, msg, "", deathtype, MSG_KILL_ACTION); + //Send_KillNotification(s, msg, "", deathtype, MSG_KILL_ACTION); - if (targ.killcount > 2) - Send_KillNotification(s, ftos(targ.killcount), "", 0, MSG_KILL_ACTION_SPREE); + //if (targ.killcount > 2) + // Send_KillNotification(s, ftos(targ.killcount), "", 0, MSG_KILL_ACTION_SPREE); - LogDeath("accident", deathtype, targ, targ); + Obituary_SpecialDeath(targ, FALSE, deathtype, s1, s2, f1, f2, NO_FL_ARG); } targ.death_origin = targ.origin; diff --git a/qcsrc/server/mutators/gamemode_ctf.qh b/qcsrc/server/mutators/gamemode_ctf.qh index f9fdda609..195b2434d 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qh +++ b/qcsrc/server/mutators/gamemode_ctf.qh @@ -1,5 +1,6 @@ // these are needed since mutators are compiled last +#ifdef SVQC // used in cheats.qc void ctf_RespawnFlag(entity flag) @@ -135,3 +136,8 @@ void havocbot_role_ctf_setrole(entity bot, float role); .float CAPTURE_VERBOSE; .float PICKUP_TEAM_VERBOSE; .float PICKUP_ENEMY_VERBOSE; +#else +var float autocvar_notification_ctf_capture_verbose = TRUE; +var float autocvar_notification_ctf_pickup_team_verbose = TRUE; +var float autocvar_notification_ctf_pickup_enemy_verbose = TRUE; +#endif -- 2.39.2