X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fclient%2Fshownames.qc;h=cfadaf8b70292ba5f2abe59ace494e881b34fb34;hp=eb15a240441ecc7d79dfe72000ac66b7b3f956c7;hb=ada169bcf6aa1b61d87a4ed296c9b7407d5b5419;hpb=6bb8b568e6a29fa9ca5c6c17fea48ce63f399491 diff --git a/data/qcsrc/client/shownames.qc b/data/qcsrc/client/shownames.qc index eb15a240..cfadaf8b 100644 --- a/data/qcsrc/client/shownames.qc +++ b/data/qcsrc/client/shownames.qc @@ -2,7 +2,7 @@ // self.origin = player origin TODO: should maybe move this so it's the origin of the shownames tag already in SSQC for culling? // self.healthvalue // self.armorvalue -// self.sameteam = player is on same team as local client +// self.eaten // const float SHOWNAMES_FADESPEED = 4; void Draw_ShowNames(entity ent) @@ -13,11 +13,22 @@ void Draw_ShowNames(entity ent) if(ent.sv_entnum == player_localentnum && !cvar("chase_active")) return; - if(ent.sameteam || (!ent.sameteam && cvar("hud_shownames_enemies"))) + if(ent.predator) // don't show names for prey + return; + + float sameteam; + if(teamplay && (GetPlayerColor(player_localentnum - 1) == GetPlayerColor(ent.sv_entnum - 1))) + sameteam = TRUE; + + if(sameteam || (!sameteam && cvar("hud_shownames_enemies"))) { ent.origin_z += cvar("hud_shownames_offset"); - if(!ent.sameteam) + // offset the name by player scale, decided by health + if(g_healthsize) + ent.origin_z -= (g_healthsize - ent.healthvalue) * cvar("hud_shownames_offset_healthsize"); + + if(!sameteam) { /* WIP, why does trace_ent != ent not work as intended here? if(cvar("hud_shownames_enemies") != 2) // player has to point at enemy if so @@ -56,7 +67,7 @@ void Draw_ShowNames(entity ent) } } - if(!ent.sameteam && trace_endpos != view_origin) // out of view, fade out + if(!sameteam && trace_endpos != view_origin) // out of view, fade out ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime); else if(ent.healthvalue < 1) // dead player, fade out slowly ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * 0.25 * frametime); @@ -119,13 +130,17 @@ void Draw_ShowNames(entity ent) drawfontscale = '1 1 0' * resize; s = textShortenToWidth(s, namewidth, '1 1 0' * cvar("hud_shownames_fontsize"), stringwidth_colors); - if(cvar("hud_shownames_status") && teamplay) - if(ent.sameteam && ent.healthvalue > 0) + if(cvar("hud_shownames_status")) + if(sameteam && ent.healthvalue > 0) { if(ent.armorvalue) - s = strcat(s, " (", ftos(ent.healthvalue), "|", ftos(ent.armorvalue), ")"); + s = strcat(s, "^7 (^1", ftos(ent.healthvalue), "^7|^2", ftos(ent.armorvalue), "^7)"); else - s = strcat(s, " (", ftos(ent.healthvalue), ")"); + s = strcat(s, "^7 (^1", ftos(ent.healthvalue), "^7)"); + + // if team healing is enabled, mark the team mate as possible to heal + if(ent.healthvalue < teamheal_max) + s = strcat(s, "^7 [^5HEAL^7]"); } float width; @@ -166,13 +181,13 @@ void Draw_ShowNames_All() { e.healthvalue = entcs.healthvalue; e.armorvalue = entcs.armorvalue; - e.sameteam = 1; /* (teamplay && (t == myteam)); */ + e.predator = entcs.predator; } else { e.healthvalue = 2342; e.armorvalue = 0; - e.sameteam = 0; + e.predator = 0; } e.origin = getplayerorigin(i);