From 748ddc43b328660e11fb54634f3d4141074e6c1b Mon Sep 17 00:00:00 2001
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Date: Sat, 9 Jul 2011 03:19:40 +0300
Subject: [PATCH] Offset the names for scaled players, to match the proper
 scale

---
 data/defaultVT.cfg             | 3 ++-
 data/qcsrc/client/Main.qc      | 1 +
 data/qcsrc/client/main.qh      | 1 +
 data/qcsrc/client/shownames.qc | 4 ++++
 data/qcsrc/server/cl_client.qc | 1 +
 data/qcsrc/server/ent_cs.qc    | 2 +-
 6 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg
index c16e6eb7..1c906113 100644
--- a/data/defaultVT.cfg
+++ b/data/defaultVT.cfg
@@ -921,7 +921,7 @@ sv_curl_defaulturl "http://www.alientrap.org/voretournament/contentdownload/getm
 
 set sv_motd ""
 
-seta cl_shownames 2	"show player names pointed to (0: never, 1: teamplay only, 2: always)"
+seta cl_shownames 0	"show player names pointed to (0: never, 1: teamplay only, 2: always) (deprecated in VoreTournament)"
 set sv_allow_shownames 1
 
 set g_waypoints_for_items 1	"make waypoints out of items, values: 0 = never, 1 = unless the mapper prevents it by worldspawn.spawnflags & 1, 2 = always"
@@ -1161,6 +1161,7 @@ seta hud_shownames_maxdistance 2500 "alpha/size is 0 at this distance"
 seta hud_shownames_antioverlap 1 "if two tags get too close to each other, fade out the one further away from you"
 seta hud_shownames_antioverlap_distance 125 "2d distance to other tag after which to fade out"
 seta hud_shownames_offset 52 "offset (along z-axis) tag from player origin by this many units"
+seta hud_shownames_offset_healthsize 0.25 "offset (along z-axis) tag from player origin by this many units, based on player size"
 
 sbar_info_pos 50
 seta sbar_alpha_bg 0.8 "alpha value of the HUD background"
diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc
index e7fd1ea2..f7b08497 100644
--- a/data/qcsrc/client/Main.qc
+++ b/data/qcsrc/client/Main.qc
@@ -1057,6 +1057,7 @@ void Ent_Init()
 
 	g_vore = ReadCoord();
 	g_balance_vore_swallow_limit = ReadCoord();
+	g_healthsize = ReadCoord();
 
 	armor_max = ReadCoord();
 
diff --git a/data/qcsrc/client/main.qh b/data/qcsrc/client/main.qh
index eac98e3d..f1e52b94 100644
--- a/data/qcsrc/client/main.qh
+++ b/data/qcsrc/client/main.qh
@@ -168,6 +168,7 @@ float g_weaponswitchdelay;
 
 float g_vore;
 float g_balance_vore_swallow_limit;
+float g_healthsize;
 float armor_max;
 
 //hooks
diff --git a/data/qcsrc/client/shownames.qc b/data/qcsrc/client/shownames.qc
index fac602ee..7dac25a5 100644
--- a/data/qcsrc/client/shownames.qc
+++ b/data/qcsrc/client/shownames.qc
@@ -21,6 +21,10 @@ void Draw_ShowNames(entity ent)
 	{
 		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");
+
 		if(!ent.sameteam)
 		{
 			/* WIP, why does trace_ent != ent not work as intended here?
diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc
index 66b11a02..94f5936c 100644
--- a/data/qcsrc/server/cl_client.qc
+++ b/data/qcsrc/server/cl_client.qc
@@ -1044,6 +1044,7 @@ float ClientInit_SendEntity(entity to, float sf)
 
 	WriteCoord(MSG_ENTITY, cvar("g_vore"));
 	WriteCoord(MSG_ENTITY, g_balance_vore_swallow_limit);
+	WriteCoord(MSG_ENTITY, cvar("g_healthsize"));
 
 	// tell the client if this server uses armor
 	float armor_max;
diff --git a/data/qcsrc/server/ent_cs.qc b/data/qcsrc/server/ent_cs.qc
index dfb8a406..ff20effe 100644
--- a/data/qcsrc/server/ent_cs.qc
+++ b/data/qcsrc/server/ent_cs.qc
@@ -62,7 +62,7 @@ float entcs_send(entity to, float sf)
 
 void entcs_think()
 {
-	self.nextthink = time + 0.01;
+	self.nextthink = time + 0.03;
 
 	entity o;
 	o = self.owner;
-- 
2.39.5