From: FruitieX <fruitiex@gmail.com>
Date: Wed, 13 Apr 2011 07:37:01 +0000 (+0300)
Subject: why do i store the edict when i call this function every frame anyway... stupid ... 
X-Git-Tag: xonotic-v0.5.0~295
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=31d54dbfd770f8cd10681b159f94e765bbc2bacd;p=xonotic%2Fxonotic-data.pk3dir.git

why do i store the edict when i call this function every frame anyway... stupid :P Oh plus some other changes apparently :-P
---

diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg
index c7cd0d032..3de99c2fc 100644
--- a/defaultXonotic.cfg
+++ b/defaultXonotic.cfg
@@ -1486,6 +1486,10 @@ seta hud_contents_slime_color "0 0.4 0.1"
 seta hud_contents_water_alpha 0.5 "alpha of the water color blend when inside it"
 seta hud_contents_water_color "0.4 0.3 0.3"
 
+seta hud_shownames 1 "draw names and health/armor of nearby players"
+seta hud_shownames_enemies 1 "also draw names of enemies"
+seta hud_shownames_status 1 "draw health/armor status of teammates"
+
 // scoreboard
 seta scoreboard_columns default
 seta scoreboard_border_thickness 1 "scoreboard border thickness"
diff --git a/hud_luminos.cfg b/hud_luminos.cfg
index de45c8609..7196d32c8 100644
--- a/hud_luminos.cfg
+++ b/hud_luminos.cfg
@@ -233,14 +233,4 @@ seta hud_panel_physics_acceleration_progressbar_mode "0"
 seta hud_panel_physics_progressbar "1"
 seta hud_panel_physics_text "1"
 
-seta hud_panel_shownames 1
-seta hud_panel_shownames_pos "0.350000 0.700000"
-seta hud_panel_shownames_size "0.300000 0.050000"
-seta hud_panel_shownames_bg "0"
-seta hud_panel_shownames_bg_color ""
-seta hud_panel_shownames_bg_color_team ""
-seta hud_panel_shownames_bg_alpha ""
-seta hud_panel_shownames_bg_border ""
-seta hud_panel_shownames_bg_padding "0"
-
 menu_sync
diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index e91846941..29a3af193 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -4208,88 +4208,7 @@ void HUD_InfoMessages(void)
 	}
 }
 
-// ShowNames (#15)
-//
-float shownames_alpha;
-void HUD_ShowNames(void)
-{
-    if(shownames_time < time && shownames_alpha == 0 && !autocvar__hud_configure)
-        return;
-
-    if(autocvar__hud_configure)
-    {
-        shownames_alpha = 1;
-    }
-    else
-    {
-        if(shownames_time < time)
-            shownames_alpha = bound(0, shownames_alpha - 2 * frametime, 1);
-        else
-            shownames_alpha = bound(0, shownames_alpha + 4 * frametime, 1);
-    }
-
-	if(!autocvar_hud_panel_shownames && !autocvar__hud_configure)
-		return;
-
-	hud_configure_active_panel = HUD_PANEL_SHOWNAMES;
-	HUD_Panel_UpdateCvars(shownames);
-    panel_fg_alpha *= shownames_alpha;
-	vector myPos, mySize;
-	myPos = panel_pos;
-	mySize = panel_size;
-
-	HUD_Panel_DrawBg(shownames_alpha);
-	if(panel_bg_padding)
-	{
-		myPos += '1 1 0' * panel_bg_padding;
-		mySize -= '2 2 0' * panel_bg_padding;
-	}
-
-    vector iconpos, iconsize;
-    vector namepos, namesize;
-    if(mySize_x/mySize_y > 6)
-    {
-        iconpos = myPos;
-        iconsize = eX * 2 * mySize_y + eY * mySize_y;
-
-        namepos = myPos + eX * 2 * mySize_y;
-        namesize = eX * mySize_x - eX * 2 * mySize_y + eY * mySize_y;
-    }
-    else
-    {
-        iconpos = myPos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_y;
-        iconsize = eX * mySize_y + eY * 0.5 * mySize_y;
-
-        namepos = myPos + eY * 0.5 * mySize_y;
-        namesize = eX * mySize_x + eY * 0.5 * mySize_y;
-    }
-
-    if(shownames_health > 0) // otherwise player is an enemy
-    {
-        // "ghost" backgrounds
-        drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
-        drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
-
-        drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, shownames_health/autocvar_hud_panel_healtharmor_maxhealth), vid_conwidth, myPos_y + iconsize_y);
-        drawpic_aspect_skin(iconpos, "health", '1 1 0' * iconsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-
-        drawsetcliparea(0, myPos_y + iconsize_y - iconsize_y * min(1, shownames_armor/autocvar_hud_panel_healtharmor_maxarmor), vid_conwidth, myPos_y + iconsize_y);
-        drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor", '1 1 0' * iconsize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-        drawresetcliparea();
-    }
-    else
-    {
-        drawpic_aspect_skin(iconpos, "health_unknown", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha, DRAWFLAG_NORMAL);
-        drawpic_aspect_skin(iconpos + '0.5 0 0' * iconsize_x, "armor_unknown", '1 1 0' * iconsize_y, '0 0 0', panel_fg_alpha, DRAWFLAG_NORMAL);
-    }
-
-    if(autocvar__hud_configure)
-        drawcolorcodedstring_aspect(namepos, "Player1234", namesize, panel_fg_alpha, DRAWFLAG_NORMAL);
-    else
-        drawcolorcodedstring_aspect(namepos, shownames_netname, namesize, panel_fg_alpha, DRAWFLAG_NORMAL);
-}
-
-// Physics panel (#16)
+// Physics panel (#15)
 //
 vector acc_prevspeed;
 float acc_prevtime, acc_avg, top_speed, top_speed_time;
@@ -4563,8 +4482,6 @@ switch (id) {\
 		 HUD_InfoMessages(); break;\
 	case (HUD_PANEL_PHYSICS):\
 		 HUD_Physics(); break;\
-	case (HUD_PANEL_SHOWNAMES):\
-		 HUD_ShowNames(); break;\
 } ENDS_WITH_CURLY_BRACE
 
 void HUD_Main (void)
diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh
index 0f9c8bb44..d2fbfebef 100644
--- a/qcsrc/client/hud.qh
+++ b/qcsrc/client/hud.qh
@@ -283,7 +283,6 @@ if(menu_enabled == 2 && hud_configure_active_panel == highlightedPanel) {\
 switch(id) { \
 	case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdateCvars(infomessages) break; \
 	case HUD_PANEL_PHYSICS: HUD_Panel_UpdateCvars(physics); break;\
-	case HUD_PANEL_SHOWNAMES: HUD_Panel_UpdateCvars(shownames) break; \
 }
 
 #define HUD_Panel_UpdateCvarsForId(id) \
@@ -321,7 +320,6 @@ HUD_Panel_GetBorder()
 switch(id) { \
 	case HUD_PANEL_INFOMESSAGES: HUD_Panel_UpdatePosSize(infomessages) break;\
 	case HUD_PANEL_PHYSICS: HUD_Panel_UpdatePosSize(physics); break;\
-	case HUD_PANEL_SHOWNAMES: HUD_Panel_UpdatePosSize(shownames)\
 }
 
 #define HUD_Panel_UpdatePosSizeForId(id) \
diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc
index 5f0a08ef7..0f5db8b65 100644
--- a/qcsrc/server/cl_player.qc
+++ b/qcsrc/server/cl_player.qc
@@ -732,7 +732,6 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 	}
 }
 
-.float the_entnum;
 // sendflags use: 1 = origin, 2 = health/armor, 0x80 = same team (includes health)
 float SendEntity_ShowNames(entity to, float sendflags)
 {
@@ -746,7 +745,7 @@ float SendEntity_ShowNames(entity to, float sendflags)
     else
         sendflags &~= 2;
     WriteByte(MSG_ENTITY, sendflags);
-    WriteByte(MSG_ENTITY, self.the_entnum);
+    WriteByte(MSG_ENTITY, num_for_edict(self.owner));
     if(sendflags & 1)
     {
         WriteShort(MSG_ENTITY, rint(self.origin_x));
@@ -774,10 +773,6 @@ void shownames_think()
         self.armorvalue = floor(self.owner.armorvalue);
         self.SendFlags |= 2;
     }
-    if(self.the_entnum != num_for_edict(self.owner))
-    {
-        self.the_entnum = num_for_edict(self.owner);
-    }
     self.nextthink = time;
 }