From 5ac3c3d06950a44119698d6ab95464e95f78cf40 Mon Sep 17 00:00:00 2001 From: FruitieX Date: Sat, 24 Jul 2010 14:15:22 +0300 Subject: [PATCH] attempt at melee icon sending/receiving code for notify panel --- qcsrc/client/hud.qc | 27 +++++++++++++++++++++++ qcsrc/common/constants.qh | 45 +++++++++++++++++++++------------------ qcsrc/server/g_damage.qc | 34 +++++++++++++++++++---------- 3 files changed, 74 insertions(+), 32 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index ddc7848a4e..c5cc244f9f 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2434,6 +2434,25 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) if (stof(s2) > 2) // killcount > 2 print ("^1",s1,"^1 ended it all after a ",s2," kill spree\n"); + } else if(msg == MSG_KILL_MELEE) { // handle melee types separately + if(type == KILL_FRAG_GAUNTLET) { + if(alsoprint) + { + if(gentle) { + print ("^1", s1, "^1 got too close to", s2, "^1's gauntlet\n"); + } else { + print ("^1", s1, "^1 was cut in half by", s2, "^1's gauntlet\n"); + } + } + } + else if(type == KILL_FRAG_SHOTGUN_MELEE) + { + if(alsoprint) + { + print ("^7", s2, "^7 slapped ", s1, "^7 around a bit with a large ^2shotgun\n"); + } + } + HUD_KillNotify_Push(s1, s2, 1, type); } else if(msg == MSG_KILL) { w = DEATH_WEAPONOF(type); if(WEP_VALID(w)) { @@ -2999,6 +3018,14 @@ void HUD_Notify (void) self = get_weaponinfo(killnotify_deathtype[j]); s = strcat("weapon", self.netname); } + else if(killnotify_deathtype[j] == KILL_FRAG_GAUNTLET) + { + s = "notify_melee"; + } + else if(killnotify_deathtype[j] == KILL_FRAG_SHOTGUN_MELEE) + { + s = "notify_melee"; + } else if(killnotify_deathtype[j] == KILL_TEAM_RED) { s = "notify_teamkill_red"; diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index d48cff2227..dfd20972ef 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -546,11 +546,12 @@ float MAX_SHOT_DISTANCE = 32768; // CSQC centerprint/notify message types float MSG_SUICIDE = 0; -float MSG_KILL = 1; -float MSG_SPREE = 2; -float MSG_KILL_ACTION = 3; -float MSG_KILL_ACTION_SPREE = 4; -float MSG_INFO = 5; +float MSG_KILL_MELEE = 1; +float MSG_KILL = 2; +float MSG_SPREE = 3; +float MSG_KILL_ACTION = 4; +float MSG_KILL_ACTION_SPREE = 5; +float MSG_INFO = 6; float KILL_TEAM_RED = 10301; float KILL_TEAM_BLUE = 10302; @@ -560,22 +561,24 @@ float KILL_FIRST_VICTIM = 10305; float KILL_TYPEFRAG = 10306; float KILL_TYPEFRAGGED = 10307; float KILL_FRAG = 10308; -float KILL_FRAGGED = 10309; -float KILL_SPREE = 10310; -float KILL_END_SPREE = 10311; -float KILL_SPREE_3 = 10312; -float KILL_SPREE_5 = 10313; -float KILL_SPREE_10 = 10314; -float KILL_SPREE_15 = 10315; -float KILL_SPREE_20 = 10316; -float KILL_SPREE_25 = 10317; -float KILL_SPREE_30 = 10318; - -float INFO_GOTFLAG = 10319; -float INFO_PICKUPFLAG = 10320; -float INFO_LOSTFLAG = 10321; -float INFO_RETURNFLAG = 10322; -float INFO_CAPTUREFLAG = 10323; +float KILL_FRAG_GAUNTLET = 10309; +float KILL_FRAG_SHOTGUN_MELEE = 10310; +float KILL_FRAGGED = 10311; +float KILL_SPREE = 10312; +float KILL_END_SPREE = 10313; +float KILL_SPREE_3 = 10314; +float KILL_SPREE_5 = 10315; +float KILL_SPREE_10 = 10316; +float KILL_SPREE_15 = 10317; +float KILL_SPREE_20 = 10318; +float KILL_SPREE_25 = 10319; +float KILL_SPREE_30 = 10320; + +float INFO_GOTFLAG = 10321; +float INFO_PICKUPFLAG = 10322; +float INFO_LOSTFLAG = 10323; +float INFO_RETURNFLAG = 10324; +float INFO_CAPTUREFLAG = 10325; // weapon requests float WR_SETUP = 1; // (SVQC) setup weapon data diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 3b4386b57d..e11a6d428f 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -363,13 +363,27 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) attacker.taunt_soundtime = time + 1; // TODO: fix this? - if (deathtype == DEATH_CUSTOM) - msg = strcat(deathmessage, " by ^1", msg); - else if (deathtype == DEATH_HURTTRIGGER && inflictor.message2 != "") - { - msg = ftos(strstrofs(inflictor.message2, "#", 0)); - } - Send_KillNotification(s, a, msg, deathtype, MSG_KILL); + if (deathtype == DEATH_CUSTOM) + msg = strcat(deathmessage, " by ^1", msg); + else if (deathtype == DEATH_HURTTRIGGER && inflictor.message2 != "") + { + msg = ftos(strstrofs(inflictor.message2, "#", 0)); + } + + float msgtype; + w = DEATH_WEAPONOF(deathtype); + if(w == WEP_LASER && ((cvar("g_balance_laser_secondary_gauntlet") && w & HITTYPE_SECONDARY) || (cvar("g_balance_laser_primary_gauntlet") && !(w & HITTYPE_SECONDARY)))) + { + msgtype = MSG_KILL_MELEE; + deathtype = KILL_FRAG_GAUNTLET; + } + else if(w == WEP_SHOTGUN && (cvar("g_balance_shotgun_secondary_melee") && w & HITTYPE_SECONDARY)) + { + msgtype = MSG_KILL_MELEE; + deathtype = KILL_FRAG_SHOTGUN_MELEE; + } + + Send_KillNotification(s, a, msg, deathtype, MSG_KILL); if(g_ctf && targ.flagcarried) { @@ -389,10 +403,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) if (attacker.killcount > 2) { Send_KillNotification(a, ftos(attacker.killcount), "", KILL_SPREE, MSG_SPREE); } - - LogDeath("frag", deathtype, attacker, targ); - - if (attacker.killcount == 3) + else if (attacker.killcount == 3) { Send_KillNotification(a, "", "", KILL_SPREE_3, MSG_SPREE); AnnounceTo(attacker, "03kills"); @@ -427,6 +438,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) Send_KillNotification(a, "", "", KILL_SPREE_30, MSG_SPREE); AnnounceTo(attacker, "30kills"); } + LogDeath("frag", deathtype, attacker, targ); } } else -- 2.39.2