move more of the weapon stuff to CSQC
authorFruitieX <rasse@rasse-lappy.localdomain>
Tue, 8 Jun 2010 09:58:50 +0000 (12:58 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Tue, 8 Jun 2010 09:58:50 +0000 (12:58 +0300)
qcsrc/client/hud.qc
qcsrc/server/g_damage.qc

index 088424e..f2a5a34 100644 (file)
@@ -1999,9 +1999,12 @@ void HUD_HealthArmor(void)
 // Notification area (#4)
 //
 
 // Notification area (#4)
 //
 
-string Weapon_SuicideMessage(float id)
+string Weapon_SuicideMessage(float deathtype)
 {
 {
-       switch (id)
+       float w;
+       w = DEATH_WEAPONOF(deathtype);
+
+       switch (w)
        {
                case 1:
                        return "lasered himself to hell";
        {
                case 1:
                        return "lasered himself to hell";
@@ -2010,17 +2013,20 @@ string Weapon_SuicideMessage(float id)
                case 3:
                        return "did the impossible";
                case 4:
                case 3:
                        return "did the impossible";
                case 4:
-                       if(id & HITTYPE_SECONDARY)
+                       if(deathtype & HITTYPE_SECONDARY)
                                return "tried out his own grenade";
                        return "detonated";
        }
        // TODO: was blasted by?
                                return "tried out his own grenade";
                        return "detonated";
        }
        // TODO: was blasted by?
-       return strcat("[no kill message for weapon ", ftos(id), "!]");
+       return strcat("[no kill message for weapon ", ftos(w), "!]");
 }
 
 }
 
-string Weapon_KillMessage(float id)
+string Weapon_KillMessage(float deathtype)
 {
 {
-       switch (id)
+       float w;
+       w = DEATH_WEAPONOF(deathtype);
+
+       switch (w)
        {
                case 1:
                        return "was lasered to death by";
        {
                case 1:
                        return "was lasered to death by";
@@ -2035,7 +2041,7 @@ string Weapon_KillMessage(float id)
                                return "didn't see #'s grenade";
                        return "almost dodged #'s grenade";
        }
                                return "didn't see #'s grenade";
                        return "almost dodged #'s grenade";
        }
-       return strcat("[no suicide message for weapon ", ftos(id), "!]");
+       return strcat("[no suicide message for weapon ", ftos(w), "!]");
 }
 
 float killnotify_times[10];
 }
 
 float killnotify_times[10];
@@ -2062,10 +2068,14 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
        if(msg == MSG_SUICIDE) {
                // TODO: cl_gentle
                // TODO: way of finding out secondary?
        if(msg == MSG_SUICIDE) {
                // TODO: cl_gentle
                // TODO: way of finding out secondary?
-               if(type == DEATH_WEAPON) {
-                       HUD_KillNotify_Push(s1, "", stof(s3));
+               print("deathtype: ", ftos(type), "\n");
+
+               float w;
+               w = DEATH_WEAPONOF(type);
+               if(WEP_VALID(w)) {
+                       HUD_KillNotify_Push(s1, "", w);
                        if (!HUD_Panel_CheckActive(4) || cvar("hud_notify_print"))
                        if (!HUD_Panel_CheckActive(4) || cvar("hud_notify_print"))
-                               print("^1", s1, "^1 ", Weapon_SuicideMessage(stof(s2)), "\n");
+                               print("^1", s1, "^1 ", Weapon_SuicideMessage(type), "\n");
                }
                else if (type == DEATH_KILL)
                        print ("^1",s1, "^1 couldn't take it anymore\n");
                }
                else if (type == DEATH_KILL)
                        print ("^1",s1, "^1 couldn't take it anymore\n");
@@ -2086,7 +2096,16 @@ 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) {
                if (stof(s2) > 2) // killcount > 2
                        print ("^1",s1,"^1 ended it all after a ",s2," kill spree\n");
        } else if(msg == MSG_KILL) {
-               if(type == KILL_TEAM || type == KILL_TEAM_SPREE) {
+               print("deathtype: ", ftos(type), "\n");
+
+               float w;
+               w = DEATH_WEAPONOF(type);
+               if(WEP_VALID(w)) {
+                       HUD_KillNotify_Push(s1, s2, w);
+                       if (!HUD_Panel_CheckActive(4) || cvar("hud_notify_print"))
+                               print("^1", s1, "^1 ", Weapon_KillMessage(type), "\n");
+               }
+               else if(type == KILL_TEAM || type == KILL_TEAM_SPREE) {
                                if(cvar("cl_gentle")) {
                                        print ("^1", s1, "^1 took action against a team mate\n");
                                } else {
                                if(cvar("cl_gentle")) {
                                        print ("^1", s1, "^1 took action against a team mate\n");
                                } else {
@@ -2107,11 +2126,6 @@ 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 == KILL_FIRST_BLOOD)
                        print("^1",s1, "^1 drew first blood", "\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)
                else if (type == DEATH_TELEFRAG)
                        print ("^1",s1, "^1 was telefragged by ", s2, "\n");
                else if (type == DEATH_DROWN)
index 14ef6ef..3b4a73b 100644 (file)
@@ -363,14 +363,6 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                        }
                        */
 
                        }
                        */
 
-                       w = DEATH_WEAPONOF(deathtype);
-                       bprint("deathtype: ", ftos(deathtype), "\n");
-                       if(WEP_VALID(w))
-                       {
-                               msg = ftos(deathtype);
-                               deathtype = DEATH_WEAPON;
-                       }
-
                        // TODO: wut is this?
                        // givefrags for logging apparently?
                        if(deathtype != DEATH_TEAMCHANGE && deathtype != DEATH_QUIET)
                        // TODO: wut is this?
                        // givefrags for logging apparently?
                        if(deathtype != DEATH_TEAMCHANGE && deathtype != DEATH_QUIET)
@@ -531,16 +523,10 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                        */
 
                                        //w = DEATH_WEAPONOF(deathtype);
                                        */
 
                                        //w = DEATH_WEAPONOF(deathtype);
-                                       bprint("deathtype: ", ftos(deathtype), "\n");
-                                       if(WEP_VALID(w))
-                                       {
-                                               deathtype = DEATH_WEAPON;
-                                       }
 
 
-                                       msg = a;
                                        if (deathtype == DEATH_CUSTOM)
                                                msg = strcat(deathmessage, " by ^1", msg);
                                        if (deathtype == DEATH_CUSTOM)
                                                msg = strcat(deathmessage, " by ^1", msg);
-                                       Send_KillNotification(s, msg, ftos(w), deathtype, MSG_KILL);
+                                       Send_KillNotification(s, a, msg, deathtype, MSG_KILL);
                                //}
 
                                if(g_ctf && targ.flagcarried)
                                //}
 
                                if(g_ctf && targ.flagcarried)