]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
initial work on supporting kill messages
authorFruitieX <rasse@rasse-lappy.localdomain>
Sun, 6 Jun 2010 11:39:47 +0000 (14:39 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Sun, 6 Jun 2010 11:39:47 +0000 (14:39 +0300)
defaultXonotic.cfg
qcsrc/client/hud.qc
qcsrc/server/g_damage.qc

index 2928197a5d308b1245598e3d190bffae2e44bf36..f82d767b29653ad9a0ae0403dd8e09747ab85d16 100644 (file)
@@ -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"
index 2cdd8a9160c5fec30ffa0668dbe92e1ee763dfb1..0a83238503697e91330891be4055fdab4d998680 100644 (file)
@@ -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;
index 1946319403a4cc4038d0a0781620f60b580474f0..7f7f8f1c54f5aca54169786147aa8dfe71abdad1 100644 (file)
@@ -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;