if(cvar("hud_healtharmor") == 2)
mySize_y = 0.23; // 0.23 * width, trial and error...
break;
+ case 4:
+ mySize_x = 0.8; // 8/10 * height, as panel cant support more than 10 entries...
+ mySize_y = 1/8; // 1/8 * width
+ break;
case 5:
mySize_y = 1/4.1; // 1/4.1 * width, trial and error...
break;
string Weapon_SuicideMessage(float deathtype)
{
- float w;
- w = DEATH_WEAPONOF(deathtype);
-
- switch (w)
- {
- case 1:
- return "lasered himself to hell";
- case 2:
- return "did the impossible";
- case 3:
- return "did the impossible";
- case 4:
- if(deathtype & HITTYPE_SECONDARY)
- return "tried out his own grenade";
- return "detonated";
- }
- // TODO: was blasted by?
- return strcat("[no kill message for weapon ", ftos(w), "!]");
+ w_deathtype = deathtype;
+ get_weaponinfo(DEATH_WEAPONOF(deathtype)).weapon_func(WR_SUICIDEMESSAGE);
+ return w_deathtypestring;
}
string Weapon_KillMessage(float deathtype)
{
- float w;
- w = DEATH_WEAPONOF(deathtype);
-
- switch (w)
- {
- case 1:
- return "was lasered to death by";
- case 2:
- return "was gunned by";
- case 3:
- if(deathtype & HITTYPE_SECONDARY)
- return "was sniped by";
- return "was riddled full of holes by";
- case 4:
- if(deathtype & HITTYPE_BOUNCE)
- return "didn't see #'s grenade";
- return "almost dodged #'s grenade";
- }
- return strcat("[no suicide message for weapon ", ftos(w), "!]");
+ w_deathtype = deathtype;
+ get_weaponinfo(DEATH_WEAPONOF(deathtype)).weapon_func(WR_KILLMESSAGE);
+ return w_deathtypestring;
}
float killnotify_times[10];
-float killnotify_weapons[10];
+float killnotify_deathtype[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_deathtype[i] = killnotify_deathtype[i-1];
+ if(killnotify_attackers[i])
+ strunzone(killnotify_attackers[i]);
+ killnotify_attackers[i] = strzone(killnotify_attackers[i-1]);
+ if(killnotify_victims[i])
+ strunzone(killnotify_victims[i]);
+ killnotify_victims[i] = strzone(killnotify_victims[i-1]);
}
killnotify_times[0] = time;
- killnotify_weapons[0] = wpn;
- killnotify_attackers[0] = attacker;
- killnotify_victims[0] = victim;
+ killnotify_deathtype[0] = wpn;
+ if(killnotify_attackers[0])
+ strunzone(killnotify_attackers[0]);
+ killnotify_attackers[0] = strzone(attacker);
+ if(killnotify_victims[0])
+ strunzone(killnotify_victims[0]);
+ killnotify_victims[0] = strzone(victim);
}
void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
{
float w;
if(msg == MSG_SUICIDE) {
- // TODO: cl_gentle
- // TODO: way of finding out secondary?
- print("deathtype: ", ftos(type), "\n");
+ HUD_KillNotify_Push(s1, "", DEATH_KILL);
+ // TODO: cl_gentle
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(type), "\n");
}
if (stof(s2) > 2) // killcount > 2
print ("^1",s1,"^1 ended it all after a ",s2," kill spree\n");
} else if(msg == MSG_KILL) {
- print("deathtype: ", ftos(type), "\n");
-
w = DEATH_WEAPONOF(type);
if(WEP_VALID(w)) {
- HUD_KillNotify_Push(s1, s2, w);
+ HUD_KillNotify_Push(s2, s1, w);
if (!HUD_Panel_CheckActive(4) || cvar("hud_notify_print"))
print("^1", s1, "^1 ", Weapon_KillMessage(type), "\n");
}
print("^1",s1, "^1 drew first blood", "\n");
else if (type == DEATH_TELEFRAG)
print ("^1",s1, "^1 was telefragged by ", s2, "\n");
- else if (type == DEATH_DROWN)
+ else if (type == DEATH_DROWN) {
+ HUD_KillNotify_Push(s2, s1, DEATH_FALL);
print ("^1",s1, "^1 was drowned by ", s2, "\n");
- else if (type == DEATH_SLIME)
+ }
+ else if (type == DEATH_SLIME) {
+ HUD_KillNotify_Push(s2, s1, DEATH_FALL);
print ("^1",s1, "^1 was slimed by ", s2, "\n");
- else if (type == DEATH_LAVA)
+ }
+ else if (type == DEATH_LAVA) {
+ HUD_KillNotify_Push(s2, s1, DEATH_FALL);
print ("^1",s1, "^1 was cooked by ", s2, "\n");
- else if (type == DEATH_FALL)
+ }
+ else if (type == DEATH_FALL) {
+ HUD_KillNotify_Push(s2, s1, DEATH_FALL);
print ("^1",s1, "^1 was grounded by ", s2, "\n");
- else if (type == DEATH_SHOOTING_STAR)
+ }
+ else if (type == DEATH_SHOOTING_STAR) {
+ HUD_KillNotify_Push(s2, s1, DEATH_FALL);
print ("^1",s1, "^1 was shot into space by ", s2, "\n");
- else if (type == DEATH_SWAMP)
+ }
+ else if (type == DEATH_SWAMP) {
+ HUD_KillNotify_Push(s2, s1, DEATH_FALL);
print ("^1",s1, "^1 was conserved by ", s2, "\n");
- // TODO
- /*else if (type == DEATH_HURTTRIGGER && inflictor.msg2 != "")
+ }
+ else if (type == DEATH_HURTTRIGGER && s3 != "")
{
- print("^1", s1, "^1 ", s2, "^1", s3, "\n");
- }*/
+ HUD_KillNotify_Push(s2, s1, DEATH_FALL);
+ // p ?!?! :o
+ //if(p < 0)
+ print("^1", s1, "^1 ", s3, " ", s2, "\n");
+ //else
+ // bprint("^1", s1, "^1 ", substring(s3, 0, p), s2, "^1", substring(s3, p+1, strlen(s3) - (p+1)), "\n");
+ }
else if(type == DEATH_SBCRUSH)
print ("^1",s1, "^1 was crushed by ^1", s2, "\n");
else if(type == DEATH_SBMINIGUN)
print (s1,"^7 unleashes ^1ARMAGEDDON!\n");
}
} else if(msg == MSG_KILL_ACTION) { // wtf is this? isnt it basically the same as MSG_SUICIDE?
+ HUD_KillNotify_Push(s1, "", DEATH_KILL);
if (type == DEATH_DROWN) {
if(cvar("cl_gentle"))
print ("^1",s1, "^1 was in the water for too long\n");
print ("^1",s1, "^1 died\n");
}
} else if(msg == MSG_KILL_ACTION_SPREE) {
+ HUD_KillNotify_Push(s1, "", DEATH_KILL);
if(cvar("cl_gentle"))
print ("^1",s1,"^1 needs a restart after a ",s2," scoring spree\n");
else
print ("^1",s1,"^1 died with a ",s2," kill spree\n");
+ } else if(msg == MSG_INFO) {
+ if(type == INFO_GOTFLAG) {
+ HUD_KillNotify_Push(s1, s2, INFO_GOTFLAG);
+ print(s1, "^7 got the ", s2, "\n");
+ } else if(type == INFO_LOSTFLAG) {
+ HUD_KillNotify_Push(s1, s2, INFO_LOSTFLAG);
+ print(s1, "^7 lost the ", s2, "\n");
+ } else if(type == INFO_PICKUPFLAG) {
+ HUD_KillNotify_Push(s1, s2, INFO_GOTFLAG);
+ print(s1, "^7 picked up the ", s2, "\n");
+ } else if(type == INFO_RETURNFLAG) {
+ HUD_KillNotify_Push(s1, s2, INFO_RETURNFLAG);
+ print(s1, "^7 returned the ", s2, "\n");
+ }
}
+
}
#define DAMAGE_CENTERPRINT_SPACER NEWLINES
-void HUD_Centerprint(string s1, float type)
+void HUD_Centerprint(string s1, float type, float msg)
{
- if (type == DEATH_TEAMCHANGE) {
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "You are now on: ", s1));
- } else if (type == DEATH_AUTOTEAMCHANGE) {
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "You have been moved into a different team to improve team balance\nYou are now on: ", s1));
- } else if (type == DEATH_CAMP) {
- if(cvar("cl_gentle"))
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Reconsider your tactics, camper!"));
- else
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Die camper!"));
- } else if (type == DEATH_NOAMMO) {
- if(cvar("cl_gentle"))
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You are reinserted into the game for running out of ammo..."));
- else
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were killed for running out of ammo..."));
- } else if (type == DEATH_ROT) {
- if(cvar("cl_gentle"))
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You need to preserve your health"));
- else
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You grew too old without taking your medicine"));
- } else if (type == DEATH_MIRRORDAMAGE) {
- if(cvar("cl_gentle"))
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Don't go against team mates!"));
- else
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Don't shoot your team mates!"));
- } else if (type == DEATH_QUIET) {
- // do nothing
- } else if (type == DEATH_KILL) {
- if(cvar("cl_gentle"))
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You need to be more careful!"));
- else
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You killed your own dumb self!"));
- } else if (type == KILL_TEAM) {
- if(cvar("cl_gentle")) {
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Moron! You went against a team mate!"));
- } else {
- centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Moron! You fragged ", s1, ", a team mate!"));
+ if(msg == MSG_SUICIDE) {
+ if (type == DEATH_TEAMCHANGE) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "You are now on: ", s1));
+ } else if (type == DEATH_AUTOTEAMCHANGE) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "You have been moved into a different team to improve team balance\nYou are now on: ", s1));
+ } else if (type == DEATH_CAMP) {
+ if(cvar("cl_gentle"))
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Reconsider your tactics, camper!"));
+ else
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Die camper!"));
+ } else if (type == DEATH_NOAMMO) {
+ if(cvar("cl_gentle"))
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You are reinserted into the game for running out of ammo..."));
+ else
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were killed for running out of ammo..."));
+ } else if (type == DEATH_ROT) {
+ if(cvar("cl_gentle"))
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You need to preserve your health"));
+ else
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You grew too old without taking your medicine"));
+ } else if (type == DEATH_MIRRORDAMAGE) {
+ if(cvar("cl_gentle"))
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Don't go against team mates!"));
+ else
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Don't shoot your team mates!"));
+ } else if (type == DEATH_QUIET) {
+ // do nothing
+ } else if (type == DEATH_KILL) {
+ if(cvar("cl_gentle"))
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You need to be more careful!"));
+ else
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You killed your own dumb self!"));
+ }
+ } else if(msg == MSG_KILL) {
+ if (type == KILL_TEAM) {
+ if(cvar("cl_gentle")) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Moron! You went against a team mate!"));
+ } else {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Moron! You fragged ", s1, ", a team mate!"));
+ }
+ } else if (type == KILL_FIRST_BLOOD) {
+ if(cvar("cl_gentle")) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1First score"));
+ } else {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1First blood"));
+ }
+ } else if (type == KILL_FIRST_VICTIM) {
+ if(cvar("cl_gentle")) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1First casualty"));
+ } else {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1First victim"));
+ }
+ } else if (type == KILL_TYPEFRAG) {
+ if(cvar("cl_gentle")) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You scored against ^7", s1, "^7 who was typing!"));
+ } else {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You typefragged ^7", s1));
+ }
+ } else if (type == KILL_TYPEFRAGGED) {
+ if(cvar("cl_gentle")) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were scored against by ^7", s1, "^7 while you were typing!"));
+ } else {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were typefragged by ^7", s1));
+ }
+ } else if (type == KILL_FRAG) {
+ if(cvar("cl_gentle")) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^4You scored against ^7", s1));
+ } else {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^4You fragged ^7", s1));
+ }
+ } else if (type == KILL_FRAGGED) {
+ if(cvar("cl_gentle")) {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^4You were scored against by ^7", s1));
+ } else {
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^4You were fragged by ^7", s1));
+ }
}
+ } else if(msg == MSG_KILL_ACTION) {
+ // TODO: invent more centerprints here?
+ centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Watch your step!", s1));
}
}
mySize -= '2 2 0' * padding;
}
- float entries;
- entries = 4 * mySize_y/mySize_x;
+ float entries, height;
+ entries = bound(1, floor(8 * mySize_y/mySize_x), 10);
+ height = mySize_y/entries;
+
+ vector fontsize;
+ fontsize = '0.33 0.33 0' * height;
+
+ float a;
+ float when;
+ when = 5;
+ float fadetime;
+ fadetime = 2;
+
+ string s;
+
float i;
- for(i = 0; i <= entries; ++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);
+ a = bound(0, when + (fadetime - (time - killnotify_times[i]))/fadetime, 1);
+
+ // X [did action to] Y
+ if(WEP_VALID(killnotify_deathtype[i]))
+ {
+ self = get_weaponinfo(killnotify_deathtype[i]);
+ drawpic_skin(pos + eX * 0.5 * mySize_x - eX * 0.5 * height + eY * 0.25 * height + eY * i * height, strcat("weapon", self.netname), '1 0.5 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], 0.5 * mySize_x - 0.5 * height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eY * 0.33 * height + eX * 0.5 * mySize_x + eX * 0.5 * height + eY * i * height, textShortenToWidth(killnotify_victims[i], 0.5 * mySize_x - 0.5 * height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
+ else if(killnotify_deathtype[i] == DEATH_FALL)
+ {
+ drawpic_skin(pos + eX * 0.5 * mySize_x - eX * 0.5 * height + eY * 0.25 * height + eY * i * height, "notify_pushoffedge", '1 0.5 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], 0.5 * mySize_x - 0.5 * height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eY * 0.33 * height + eX * 0.5 * mySize_x + eX * 0.5 * height + eY * i * height, textShortenToWidth(killnotify_victims[i], 0.5 * mySize_x - 0.5 * height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
+
+ // Y [used by] X
+ else if(killnotify_deathtype[i] == DEATH_KILL)
+ {
+ drawpic_skin(pos + eY * 0.25 * height + eY * i * height, "notify_selfkill", '1 0.5 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eX * height + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
+ else if(killnotify_deathtype[i] == INFO_GOTFLAG)
+ {
+ if(killnotify_victims[i] == "^1RED^7 flag")
+ s = "red";
+ else
+ s = "blue";
+ drawpic_skin(pos + eY * i * height, strcat("flag_", s, "_carrying"), '1 1 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eX * height + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
+ else if(killnotify_deathtype[i] == INFO_RETURNFLAG)
+ {
+ if(killnotify_victims[i] == "^1RED^7 flag")
+ s = "red";
+ else
+ s = "blue";
+ drawpic_skin(pos + eY * i * height, strcat("flag_", s, "_taken"), '1 1 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eX * height + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
+ else if(killnotify_deathtype[i] == INFO_LOSTFLAG)
+ {
+ if(killnotify_victims[i] == "^1RED^7 flag")
+ s = "red";
+ else
+ s = "blue";
+ drawpic_skin(pos + eY * i * height, strcat("flag_", s, "_lost"), '1 1 0' * height, '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eX * height + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
}
/* This will come later.
string s;