self.angles_x = self.angles_z = 0;\r
}\r
if(sf & 8)\r
- self.healthvalue = ReadByte() * 10;\r
+ self.healthvalue = ReadCoord();\r
if(sf & 16)\r
- self.armorvalue = ReadByte() * 10;\r
+ self.armorvalue = ReadCoord();\r
if(sf & 32)\r
self.predator = ReadByte();\r
\r
g_healthsize = ReadCoord();\r
\r
armor_max = ReadCoord();\r
+ teamheal_max = ReadCoord();\r
\r
if(!postinit)\r
PostInit();\r
// self.healthvalue
// self.armorvalue
// self.eaten
-// self.sameteam = player is on same team as local client
//
const float SHOWNAMES_FADESPEED = 4;
void Draw_ShowNames(entity ent)
if(ent.predator) // don't show names for prey
return;
- if(ent.sameteam || (!ent.sameteam && cvar("hud_shownames_enemies")))
+ 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(g_healthsize)
ent.origin_z -= (g_healthsize - ent.healthvalue) * cvar("hud_shownames_offset_healthsize");
- if(!ent.sameteam)
+ 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
}
}
- 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);
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), ")");
else
s = strcat(s, " (", ftos(ent.healthvalue), ")");
+
+ // if team healing is enabled, mark the team mate as possible to heal
+ if(ent.healthvalue < teamheal_max)
+ s = strcat(s, " [HEAL]");
}
float width;
{
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;
}
if(sf & 4)\r
WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360);\r
if(sf & 8)\r
- WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?\r
+ WriteCoord(MSG_ENTITY, self.health);\r
if(sf & 16)\r
- WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?\r
+ WriteCoord(MSG_ENTITY, self.armorvalue);\r
if(sf & 32)\r
WriteByte(MSG_ENTITY, num_for_edict(self.predator));\r
return TRUE;\r