]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/shownames.qc
Make bots jump while being swallowed, to make it even harder to eat them. They should...
[voretournament/voretournament.git] / data / qcsrc / client / shownames.qc
index cfadaf8b70292ba5f2abe59ace494e881b34fb34..f00e9a407dc9c8c647bfc9751a069c8f17522744 100644 (file)
@@ -13,34 +13,19 @@ void Draw_ShowNames(entity ent)
        if(ent.sv_entnum == player_localentnum && !cvar("chase_active"))
                return;
 
-       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")))
+       if(sameteam || (!sameteam && cvar("hud_shownames") > 1))
        {
                ent.origin_z += cvar("hud_shownames_offset");
 
                // offset the name by player scale, decided by health
                if(g_healthsize)
-                       ent.origin_z -= (g_healthsize - ent.healthvalue) * cvar("hud_shownames_offset_healthsize");
+                       ent.origin_z -= (g_healthsize - bound(g_healthsize_min, ent.healthvalue, g_healthsize_max)) * 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
-                          {
-                          traceline(view_origin, view_origin + view_forward * MAX_SHOT_DISTANCE, MOVETYPE_FLY, world);
-                          print("trace_endpos: ", vtos(trace_endpos), " view_origin: ", vtos(view_origin), "\n");
-                          if(trace_ent != ent)
-                          return;
-                          }*/
-
-                       traceline(ent.origin, view_origin, 1, ent);
-               }
+               traceline(ent.origin, view_origin, 1, ent);
 
                vector o, eo;
                o = project_3d_to_2d(ent.origin);
@@ -67,7 +52,7 @@ void Draw_ShowNames(entity ent)
                        }
                }
 
-               if(!sameteam && trace_endpos != view_origin) // out of view, fade out
+               if(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);
@@ -130,16 +115,15 @@ 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"))
                        if(sameteam && ent.healthvalue > 0)
                        {
-                               if(ent.armorvalue)
-                                       s = strcat(s, "^7 (^1", ftos(ent.healthvalue), "^7|^2", ftos(ent.armorvalue), "^7)");
-                               else
-                                       s = strcat(s, "^7 (^1", ftos(ent.healthvalue), "^7)");
+                               if(cvar("hud_shownames_status") > 2 && ent.armorvalue)
+                                       s = strcat(s, "^7 (^1+", ftos(ent.healthvalue), "^7|^2*", ftos(ent.armorvalue), "^7)");
+                               else if(cvar("hud_shownames_status") > 1)
+                                       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)
+                               if(cvar("hud_shownames_status") && ent.healthvalue < teamheal_max)
                                        s = strcat(s, "^7 [^5HEAL^7]");
                        }
 
@@ -181,13 +165,11 @@ void Draw_ShowNames_All()
                {
                        e.healthvalue = entcs.healthvalue;
                        e.armorvalue = entcs.armorvalue;
-                       e.predator = entcs.predator;
                }
                else
                {
                        e.healthvalue = 2342;
                        e.armorvalue = 0;
-                       e.predator = 0;
                }
 
                e.origin = getplayerorigin(i);