From: FruitieX Date: Tue, 8 Jun 2010 09:58:50 +0000 (+0300) Subject: move more of the weapon stuff to CSQC X-Git-Tag: xonotic-v0.1.0preview~541^2~105 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=93a5b591cd2cb527abab50a73fe279fe02efab7e;p=xonotic%2Fxonotic-data.pk3dir.git move more of the weapon stuff to CSQC --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 088424eab..f2a5a34f3 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1999,9 +1999,12 @@ void HUD_HealthArmor(void) // 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"; @@ -2010,17 +2013,20 @@ string Weapon_SuicideMessage(float id) 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 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"; @@ -2035,7 +2041,7 @@ string Weapon_KillMessage(float id) 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]; @@ -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(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")) - 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"); @@ -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(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 { @@ -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 == 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) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 14ef6ef26..3b4a73bc9 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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) @@ -531,16 +523,10 @@ void Obituary (entity attacker, entity inflictor, entity targ, float 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); - Send_KillNotification(s, msg, ftos(w), deathtype, MSG_KILL); + Send_KillNotification(s, a, msg, deathtype, MSG_KILL); //} if(g_ctf && targ.flagcarried)