fputs(fh, strcat("seta hud_skin \"", cvar_string("hud_skin"), "\"", "\n"));
fputs(fh, strcat("seta hud_bg \"", cvar_string("hud_bg"), "\"", "\n"));
fputs(fh, strcat("seta hud_bg_color \"", cvar_string("hud_bg_color"), "\"", "\n"));
+ fputs(fh, strcat("seta hud_bg_color_team \"", cvar_string("hud_bg_color_team"), "\"", "\n"));
fputs(fh, strcat("seta hud_bg_alpha \"", cvar_string("hud_bg_alpha"), "\"", "\n"));
fputs(fh, strcat("seta hud_bg_border \"", cvar_string("hud_bg_border"), "\"", "\n"));
fputs(fh, strcat("seta hud_bg_padding \"", cvar_string("hud_bg_padding"), "\"", "\n"));
fputs(fh, strcat("seta hud_dock \"", cvar_string("hud_dock"), "\"", "\n"));
fputs(fh, strcat("seta hud_dock_color \"", cvar_string("hud_dock_color"), "\"", "\n"));
+ fputs(fh, strcat("seta hud_dock_color_team \"", cvar_string("hud_dock_color_team"), "\"", "\n"));
fputs(fh, strcat("seta hud_dock_alpha \"", ftos(cvar("hud_dock_alpha")), "\"", "\n"));
fputs(fh, "\n");
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_size \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_size")), "\"", "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg")), "\"", "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_color \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_color")), "\"", "\n"));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_color_team \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_color_team")), "\"", "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_alpha \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_alpha")), "\"", "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_border \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_border")), "\"", "\n"));
fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_padding \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_padding")), "\"", "\n"));
float f;
vector color_vec;
string color;
- color = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color"));
+
+ // fetch per-panel color
+ if(teamplay && cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color_team")) != "") {
+ f = stof(getplayerkey(self.sv_entnum, "colors"));
+ color = vtos(colormapPaletteColor(mod(f, 16), 1) * cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_color_team")));
+ }
+ else
+ color = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color"));
color_vec = stov(color);
- if(color == "") {
+
+ if(color == "") { // fetch default color
color = cvar_string("hud_bg_color");
color_vec = stov(color);
- if(color == "shirt") {
+ if(teamplay && cvar(strcat("hud_bg_color_team"))) {
+ f = stof(getplayerkey(self.sv_entnum, "colors"));
+ color_vec = colormapPaletteColor(mod(f, 16), 1) * cvar("hud_bg_color_team");
+ }
+ else if(color == "shirt") {
f = stof(getplayerkey(self.sv_entnum, "colors"));
color_vec = colormapPaletteColor(floor(f / 16), 0);
}
string color;
color = cvar_string("hud_dock_color");
color_vec = stov(color);
- if(color == "shirt") {
+ if(teamplay && cvar(strcat("hud_dock_color_team"))) {
+ f = stof(getplayerkey(self.sv_entnum, "colors"));
+ color_vec = colormapPaletteColor(mod(f, 16), 1) * cvar("hud_dock_color_team");
+ }
+ else if(color == "shirt") {
f = stof(getplayerkey(self.sv_entnum, "colors"));
color_vec = colormapPaletteColor(floor(f / 16), 0);
}
// 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 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";
case 2:
return "was gunned by";
case 3:
- if(id & HITTYPE_SECONDARY)
+ if(deathtype & HITTYPE_SECONDARY)
return "was sniped by";
return "was riddled full of holes by";
case 4:
- if(id & HITTYPE_BOUNCE)
+ if(deathtype & HITTYPE_BOUNCE)
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_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_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_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) {
- float w;
- string w_typestring;
+ HUD_KillNotify_Push(s1, "", DEATH_KILL);
- 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");
+ w = DEATH_WEAPONOF(type);
+ if(WEP_VALID(w)) {
+ if (!HUD_Panel_CheckActive(4) || cvar("hud_notify_print"))
+ 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_ROT)
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) {
+ w = DEATH_WEAPONOF(type);
+ if(WEP_VALID(w)) {
+ HUD_KillNotify_Push(s2, s1, 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 {
}
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_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 needs a restart\n");
else
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
mySize -= '2 2 0' * padding;
}
+ float entries, height;
+ entries = 8 * mySize_y/mySize_x;
+ height = mySize_y/entries;
+
+ vector fontsize;
+ fontsize = '0.33 0.33 0' * height;
+
+ float a;
+ float when;
+ when = 5;
+ float fadetime;
+ fadetime = 2;
+
+ float i;
+ for(i = 0; i <= entries; ++i)
+ {
+ a = bound(0, when + (fadetime - (time - killnotify_times[i]))/fadetime, 1);
+ drawcolorcodedstring(pos + eY * 0.33 * height + eY * i * height, textShortenToWidth(killnotify_attackers[i], 0.5 * mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ drawcolorcodedstring(pos + eY * 0.33 * height + eX * 0.5 * mySize_x + eX * height + eY * i * height, textShortenToWidth(killnotify_victims[i], 0.5 * mySize_x - height, fontsize, stringwidth_colors), fontsize, hud_alpha_fg * a, DRAWFLAG_NORMAL);
+
+ if(WEP_VALID(killnotify_deathtype[i]))
+ {
+ self = get_weaponinfo(killnotify_deathtype[i]);
+ drawpic_skin(pos + eX * 0.5 * mySize_x - eX * (mySize_y/entries) + eY * i * (mySize_y/entries), strcat("weapon", self.netname), '2 1 0' * (mySize_y/entries), '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
+ else if(killnotify_deathtype[i] == DEATH_KILL)
+ {
+ drawpic_skin(pos + eX * 0.5 * mySize_x - eX * (mySize_y/entries) + eY * i * (mySize_y/entries), "notify_selfkill", '2 1 0' * (mySize_y/entries), '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
+ else if(killnotify_deathtype[i] == DEATH_FALL)
+ {
+ drawpic_skin(pos + eX * 0.5 * mySize_x - eX * (mySize_y/entries) + eY * i * (mySize_y/entries), "notify_pushoffedge", '2 1 0' * (mySize_y/entries), '1 1 1', hud_alpha_fg * a, DRAWFLAG_NORMAL);
+ }
+ }
/* This will come later.
string s;
entity tm;
hud_configure = cvar("_hud_configure");
// Drawing stuff
+
+ // HUD configure visible grid
+ if(hud_configure && cvar("hud_configure_grid") && cvar("hud_configure_grid_alpha"))
+ {
+ float i;
+ // x-axis
+ for(i = 0; i < vid_conwidth/cvar("hud_configure_grid_x"); ++i)
+ {
+ drawfill(eX * i * cvar("hud_configure_grid_x"), eX + eY * vid_conheight, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
+ }
+ // y-axis
+ for(i = 0; i < vid_conheight/cvar("hud_configure_grid_y"); ++i)
+ {
+ drawfill(eY * i * cvar("hud_configure_grid_y"), eY + eX * vid_conwidth, '0.5 0.5 0.5', cvar("hud_configure_grid_alpha"), DRAWFLAG_NORMAL);
+ }
+ }
+
if(cvar_string("hud_dock") != "")
drawpic_skin('0 0 0', cvar_string("hud_dock"), eX * vid_conwidth + eY * vid_conheight, HUD_Panel_Dock_GetColor(), cvar("hud_dock_alpha"), DRAWFLAG_NORMAL);