]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Only show the health and armor of team mates, not enemies. Sadly, the health of all...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 9 Jul 2011 01:29:27 +0000 (04:29 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 9 Jul 2011 01:29:27 +0000 (04:29 +0300)
data/qcsrc/client/Main.qc
data/qcsrc/client/main.qh
data/qcsrc/client/shownames.qc
data/qcsrc/client/shownames.qh
data/qcsrc/server/cl_client.qc
data/qcsrc/server/ent_cs.qc

index f7b08497e608a85ca1af56dcae63ead97fc968b2..7686d9ec3d270677f29333ec122a9b70a23bef1a 100644 (file)
@@ -683,9 +683,9 @@ void Ent_ReadEntCS()
                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
@@ -1060,6 +1060,7 @@ void Ent_Init()
        g_healthsize = ReadCoord();\r
 \r
        armor_max = ReadCoord();\r
+       teamheal_max = ReadCoord();\r
 \r
        if(!postinit)\r
                PostInit();\r
index f1e52b9441b7619edde2fa09f23b5930b5aef838..ccf46ac47969b3ba965196b04cc241015e271be9 100644 (file)
@@ -170,6 +170,7 @@ float g_vore;
 float g_balance_vore_swallow_limit;\r
 float g_healthsize;\r
 float armor_max;\r
+float teamheal_max;\r
 \r
 //hooks\r
 float calledhooks;\r
index 7dac25a5254eca2a6fbc741d023fe17b7a724c39..fe8f768423e350e741fbf4d12cc63443cfe24694 100644 (file)
@@ -3,7 +3,6 @@
 // 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)
@@ -17,7 +16,11 @@ 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");
 
@@ -25,7 +28,7 @@ void Draw_ShowNames(entity ent)
                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
@@ -64,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);
@@ -127,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), ")");
                                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;
@@ -174,14 +181,12 @@ 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;
                }
 
index 0509dd3e195d68c531c945fd226d7fe872ba943c..630f8e2eb2447582f7e0323c68b3b6df1e11898b 100644 (file)
@@ -1,4 +1,3 @@
 .float healthvalue;
 .float armorvalue;
 .float predator;
-.float sameteam;
index d9b9437d4c131af06041a9b5df0316a5d99f9663..39b891f21c988093330bee13a71a107d898d4d76 100644 (file)
@@ -1052,6 +1052,11 @@ float ClientInit_SendEntity(entity to, float sf)
                armor_max = cvar("g_balance_armor_limit");\r
        WriteCoord(MSG_ENTITY, armor_max);\r
 \r
+       float teamheal_max;\r
+       if(cvar("g_vore") && cvar("g_vore_teamvore") && cvar("g_balance_vore_teamheal"))\r
+               teamheal_max = cvar("g_balance_vore_teamheal_stable");\r
+       WriteCoord(MSG_ENTITY, teamheal_max);\r
+\r
        return TRUE;\r
 }\r
 \r
index 9fc1ecb59b0d5ce7f2cb005dbc554b13d36b8079..9bed96b77f1b826748f8fae34eb2338b688491c0 100644 (file)
@@ -48,9 +48,9 @@ float entcs_send(entity to, float sf)
        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