From: FruitieX Date: Sun, 6 Jun 2010 11:39:47 +0000 (+0300) Subject: initial work on supporting kill messages X-Git-Tag: xonotic-v0.1.0preview~541^2~108 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=18e9965b8e9960d8f20a0d29a581c553ee901f7f;p=xonotic%2Fxonotic-data.pk3dir.git initial work on supporting kill messages --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 2928197a5..f82d767b2 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1398,6 +1398,7 @@ seta hud_notify_bg_color "" "if set to something else than \"\" = override defau seta hud_notify_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" seta hud_notify_bg_border "" "if set to something else than \"\" = override default size of border around the background" seta hud_notify_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" +seta hud_notify_print 0 "also con_notify print the messages that are shown on the notify panel" seta hud_timer 1 "enable/disable this panel" seta hud_timer_pos "-0.213725 0" "position of this base of the panel" diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 2cdd8a916..0a8323850 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2019,17 +2019,35 @@ string Weapon_KillMessage(float id) return strcat("[no suicide message for weapon ", ftos(id), "!]"); } +float killnotify_times[10]; +float killnotify_weapons[10]; +string killnotify_attackers[10]; +string killnotify_victims[10]; +void HUD_KillNotify_Push(string attacker, string victim, float wpn) +{ + float i; + for (i = 9; i > 0; --i) { + killnotify_times[i] = killnotify_times[i-1]; + killnotify_weapons[i] = killnotify_weapons[i-1]; + killnotify_attackers[i] = killnotify_attackers[i-1]; + killnotify_victims[i] = killnotify_victims[i-1]; + } + killnotify_times[0] = time; + killnotify_weapons[0] = wpn; + killnotify_attackers[0] = attacker; + killnotify_victims[0] = victim; +} + void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) { if(msg == MSG_SUICIDE) { - float w; - string w_typestring; - - w = DEATH_WEAPONOF(type); // TODO: cl_gentle // TODO: way of finding out secondary? - if(type == DEATH_WEAPON) - print("^1", s1, "^1 ", Weapon_SuicideMessage(stof(s3)), "\n"); + if(type == DEATH_WEAPON) { + HUD_KillNotify_Push(s1, "", stof(s3)); + if (!HUD_Panel_CheckActive(4) || cvar("hud_notify_print")) + print("^1", s1, "^1 ", Weapon_SuicideMessage(stof(s3)), "\n"); + } else if (type == DEATH_KILL) print ("^1",s1, "^1 couldn't take it anymore\n"); else if (type == DEATH_ROT) @@ -2070,8 +2088,11 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) } else if(type == KILL_FIRST_BLOOD) print("^1",s1, "^1 drew first blood", "\n"); - else if (type == DEATH_WEAPON) - print("^1", s1, "^1 ", Weapon_KillMessage(stof(s3)), "\n"); + else if (type == DEATH_WEAPON) { + HUD_KillNotify_Push(s1, s2, stof(s3)); + if (!HUD_Panel_CheckActive(4) || cvar("hud_notify_print")) + print("^1", s1, "^1 ", Weapon_KillMessage(stof(s3)), "\n"); + } else if (type == DEATH_TELEFRAG) print ("^1",s1, "^1 was telefragged by ", s2, "\n"); else if (type == DEATH_DROWN) @@ -2283,6 +2304,15 @@ void HUD_Notify (void) mySize -= '2 2 0' * padding; } + float entries; + entries = 4 * mySize_y/mySize_x; + float i; + for(i = 0; i <= entries; ++i) + { + drawcolorcodedstring(pos + eY * i * (mySize_y/entries),killnotify_attackers[i], '1 1 0' * (mySize_y/entries), hud_alpha_fg, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.35 * mySize_x + eY * i * (mySize_y/entries),ftos(killnotify_weapons[i]), '1 1 0' * (mySize_y/entries), hud_alpha_fg, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos + eX * 0.75 * mySize_x + eY * i * (mySize_y/entries),killnotify_victims[i], '1 1 0' * (mySize_y/entries), hud_alpha_fg, DRAWFLAG_NORMAL); + } /* This will come later. string s; entity tm; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 194631940..7f7f8f1c5 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -363,10 +363,11 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) } */ - w = DEATH_WEAPONOF(deathtype); - if(!(WEP_VALID(w))) + //w = DEATH_WEAPONOF(deathtype); + bprint("deathtype: ", ftos(deathtype), "\n"); + if(WEP_VALID(w)) { - w = -1; + deathtype = DEATH_WEAPON; } // TODO: wut is this? @@ -504,6 +505,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) else if(deathtype == DEATH_SBROCKET) bprint ("^1",s, "^1 was blased to bits by ^1", a, "\n"); else if(deathtype == DEATH_SBBLOWUP) + [ bprint ("^1",s, "^1 got cought in the destruction of ^1", a, "'s vehicle\n"); else if(deathtype == DEATH_WAKIGUN) @@ -527,10 +529,11 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype) bprint ("^1",s, "^1 was fragged by ", a, "\n"); */ - w = DEATH_WEAPONOF(deathtype); - if(!(WEP_VALID(w))) + //w = DEATH_WEAPONOF(deathtype); + bprint("deathtype: ", ftos(deathtype), "\n"); + if(WEP_VALID(w)) { - w = -1; + deathtype = DEATH_WEAPON; } msg = a;