]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'fruitiex/better_shownames' into terencehill/newpanelhud
authorFruitieX <fruitiex@gmail.com>
Mon, 11 Apr 2011 13:38:02 +0000 (16:38 +0300)
committerFruitieX <fruitiex@gmail.com>
Mon, 11 Apr 2011 13:38:02 +0000 (16:38 +0300)
Conflicts:
_hud_descriptions.cfg
defaultXonotic.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_xhair_minimal.cfg
hud_nexuiz.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/common/constants.qh
qcsrc/common/util.qh
qcsrc/menu/xonotic/mainwindow.c

18 files changed:
_hud_descriptions.cfg
defaultXonotic.cfg
hud_luminos.cfg
hud_luminos_old.cfg
hud_luminos_xhair_minimal.cfg
hud_nexuiz.cfg
qcsrc/client/Defs.qc
qcsrc/client/Main.qc
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/common/constants.qh
qcsrc/common/util.qh
qcsrc/menu/classes.c
qcsrc/menu/xonotic/mainwindow.c
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/t_teleporters.qc

index e4c669663324bca895414a5e8e954451199aaa02..09c35e37bb42f9bdb6b80efa9263467a99cb6934 100644 (file)
@@ -220,6 +220,7 @@ seta hud_panel_infomessages_bg_border "" "if set to something else than \"\" = o
 seta hud_panel_infomessages_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
 seta hud_panel_infomessages_flip "" "1 = align the items to the right"
 
+<<<<<<< HEAD
 seta hud_panel_physics "" "enable/disable this panel, 1 = show if not observing, 2 = show always"
 seta hud_panel_physics_pos "" "position of this base of the panel"
 seta hud_panel_physics_size "" "size of this panel"
@@ -234,3 +235,14 @@ seta hud_panel_physics_flip "" "flip speed/acceleration positions"
 seta hud_panel_physics_progressbar "" "enable progressbar in panel (2 = only for speed; 3 = only for acceleration)"
 seta hud_panel_physics_acceleration_progressbar_mode "" "0 = progressbar increases from the center to the right if the acceleration is positive, to the left if it's negative; 1 = progressbar increases from the border in the same direction for both positive and negative accelerations"
 seta hud_panel_physics_text "" "show text in panel (2 = only for speed; 3 = only for acceleration)"
+=======
+seta hud_panel_shownames "" "enable/disable this panel, 1 = teammates only, 2 = everyone"
+seta hud_panel_shownames_pos "" "position of this base of the panel"
+seta hud_panel_shownames_size "" "size of this panel"
+seta hud_panel_shownames_bg "" "if set to something else than \"\" = override default background"
+seta hud_panel_shownames_bg_color "" "if set to something else than \"\" = override default panel background color"
+seta hud_panel_shownames_bg_color_team "" "override panel color with team color in team based games"
+seta hud_panel_shownames_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
+seta hud_panel_shownames_bg_border "" "if set to something else than \"\" = override default size of border around the background"
+seta hud_panel_shownames_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+>>>>>>> fruitiex/better_shownames
index f0016dfcda27035c0dc0f14413dc8e05e4084672..ffd3148250e96f37b2b8f08879aef1f042c314bf 100644 (file)
@@ -1453,6 +1453,8 @@ seta hud_panel_physics_topspeed_time 4 "how many seconds the top speed takes to
 seta hud_panel_physics_acceleration_max 1.5 "acceleration progressbar gets completely filled up by this value (in g)"
 seta hud_panel_physics_acceleration_vertical 0 "include the acceleration on the Z-axis"
 
+seta hud_panel_shownames_sustain 0.5 "seconds that shownames will sustain after not aiming at a player anymore"
+
 seta hud_showbinds 1   "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both"
 seta hud_showbinds_limit 2     "maximum number of bound keys to show for a command. 0 for unlimited"
 
index 836641e9e730d3e004e4923360242f2874bc0521..de45c860930a06e6d3342157f549e8c82aee8f4f 100644 (file)
@@ -23,7 +23,7 @@ seta hud_progressbar_speed_color "1 0.75 0"
 seta hud_progressbar_acceleration_color "0.5 0.75 1"
 seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 
-seta _hud_panelorder "10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 15 "
+seta _hud_panelorder "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
@@ -233,4 +233,14 @@ 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
index ca8ea38de05476976feaf3a64b31755697d7cd44..1d84465112a737607d2ee63980cb301628fbe74a 100644 (file)
@@ -20,7 +20,7 @@ seta hud_progressbar_armor_color "0 0.6 0"
 seta hud_progressbar_fuel_color "0.6 0.6 0"
 seta hud_progressbar_nexball_color "0.7 0.1 0"
 
-seta _hud_panelorder "10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 "
+seta _hud_panelorder "15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
index 5f769f8f1ce522eaffb221df3b21a5b5da856c2a..55a1149e9226adbe2140ddaae253cf51cdd4fcba 100644 (file)
@@ -23,7 +23,7 @@ seta hud_progressbar_speed_color "1 0.75 0"
 seta hud_progressbar_acceleration_color "0.5 0.75 1"
 seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 
-seta _hud_panelorder "3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 15 "
+seta _hud_panelorder "15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.010000"
index 5f8127f275d7dc585b176eefa4252ccbc7c1717a..87bebc5d035fd5e49d33a74a149e23ffcce4bbc3 100644 (file)
@@ -23,7 +23,7 @@ seta hud_progressbar_speed_color "0.25 0.25 1"
 seta hud_progressbar_acceleration_color "0.25 1 0.25"
 seta hud_progressbar_acceleration_neg_color "1 0.25 0.25"
 
-seta _hud_panelorder "0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 15 "
+seta _hud_panelorder "15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 "
 
 seta hud_configure_grid "1"
 seta hud_configure_grid_xsize "0.01"
index afdd9f31f683a2ddc6cd4e6a64fcc001e04b24dd..aed42e4dd9b85d8ffe5172d3536c1679a27d56a0 100644 (file)
@@ -274,3 +274,8 @@ float nex_charge_movingavg;
 float serverflags;
 
 float uid2name_dialog;
+
+string shownames_netname;
+float shownames_health;
+float shownames_armor;
+float shownames_time;
index aa95e9724a2094598c5db210f518f29f6614a1e2..6de1a872ed487acfd85f756a4bce37be3c709d6d 100644 (file)
@@ -1324,6 +1324,35 @@ void Net_WeaponComplain() {
        weapontime = time; // ping the weapon panel
 }
 
+void Net_ShowNames()
+{
+    string thename;
+    float thehealth, thearmor;
+
+    if(shownames_netname)
+        strunzone(shownames_netname);
+    thename = strzone(ReadString());
+    thehealth = ReadByte();
+    thearmor = ReadByte();
+
+    if(autocvar_hud_panel_shownames == 1 && thehealth > 0) // teammates only
+    {
+        shownames_netname = thename;
+        shownames_health = thehealth;
+        shownames_armor = thearmor;
+
+        shownames_time = time + autocvar_hud_panel_shownames_sustain;
+    }
+    else if(autocvar_hud_panel_shownames == 2)
+    {
+        shownames_netname = thename;
+        shownames_health = thehealth;
+        shownames_armor = thearmor;
+
+        shownames_time = time + autocvar_hud_panel_shownames_sustain;
+    }
+}
+
 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
@@ -1394,6 +1423,10 @@ float CSQC_Parse_TempEntity()
                        Net_WeaponComplain();
                        bHandled = true;
                        break;
+               case TE_CSQC_SHOWNAMES:
+            Net_ShowNames();
+            bHandled = true;
+            break;
                default:
                        // No special logic for this temporary entity; return 0 so the engine can handle it
                        bHandled = false;
index 79dc7237a547317a0d3b1b26e8dafcfaeea180ef..b9ea7b4baf4560bfe6b5ed765a2e1c98e202bfc4 100644 (file)
@@ -242,6 +242,8 @@ float autocvar_hud_panel_radar_scale;
 float autocvar_hud_panel_radar_zoommode;
 float autocvar_hud_panel_score;
 float autocvar_hud_panel_score_rankings;
+float autocvar_hud_panel_shownames;
+float autocvar_hud_panel_shownames_sustain;
 float autocvar_hud_panel_timer;
 float autocvar_hud_panel_timer_increment;
 float autocvar_hud_panel_vote;
index 580637b6502f9da4fc5e514f154dd1a54205aa89..fbde7368c9030f91f6ad1dbead458594dac28755 100644 (file)
@@ -4208,11 +4208,91 @@ void HUD_InfoMessages(void)
        }
 }
 
-// Physics panel (#15)
+// 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/200), 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/200), 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)
 //
 vector acc_prevspeed;
 float acc_prevtime, acc_avg, top_speed, top_speed_time;
-
 void HUD_Physics(void)
 {
        if(!autocvar__hud_configure)
@@ -4483,6 +4563,8 @@ 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)
index f46f5873fe84f0fb709b21837ff25af45838cd47..0f9c8bb44c730caab766b2e06621b47a6358a675 100644 (file)
@@ -275,11 +275,15 @@ if(menu_enabled == 2 && hud_configure_active_panel == highlightedPanel) {\
        HUD_Panel_GetMenuPos()\
 } ENDS_WITH_CURLY_BRACE
 
+// FTEQCC I HATE YOU WHY DO YOU MAKE ME DO THIS??? :(
+// max macro length is 1024 characters, I must split it up :(
+
 // Update all common cvars of given panel id
 #define HUD_Panel_UpdateCvarsForId_Part2(id) \
 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) \
@@ -317,7 +321,9 @@ 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) \
 switch(id) { \
        case HUD_PANEL_WEAPONS: HUD_Panel_UpdatePosSize(weapons) break;\
index 295cc664f8b236b963a93f50f7376e8c6e1cd157..13c1bc824461ed93a12e786ba6998d7ac3ab10e0 100644 (file)
@@ -63,6 +63,7 @@ const float TE_CSQC_NOTIFY = 112;
 const float TE_CSQC_WEAPONCOMPLAIN = 113;
 const float TE_CSQC_NEX_SCOPE = 116;
 const float TE_CSQC_MINELAYER_MAXMINES = 117;
+const float TE_CSQC_SHOWNAMES = 118;
 
 const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
 const float RACE_NET_CHECKPOINT_CLEAR = 1;
@@ -633,7 +634,6 @@ float WR_RESETPLAYER    = 10; // (SVQC) does not need to do anything
 float WR_IMPACTEFFECT  = 11; // (CSQC) impact effect
 float WR_SWITCHABLE    = 12; // (CSQC) impact effect
 
-
 float HUD_PANEL_WEAPONS                = 0;
 float HUD_PANEL_AMMO           = 1;
 float HUD_PANEL_POWERUPS       = 2;
@@ -650,7 +650,8 @@ float HUD_PANEL_CHAT                = 12;
 float HUD_PANEL_ENGINEINFO     = 13;
 float HUD_PANEL_INFOMESSAGES   = 14;
 float HUD_PANEL_PHYSICS        = 15;
-float HUD_PANEL_NUM            = 16; // always last panel id + 1, please increment when adding a new panel
+float HUD_PANEL_SHOWNAMES      = 16;
+float HUD_PANEL_NUM            = 17; // always last panel id + 1, please increment when adding a new panel
 
 string HUD_PANELNAME_WEAPONS           = "weapons";
 string HUD_PANELNAME_AMMO              = "ammo";
@@ -668,6 +669,9 @@ string HUD_PANELNAME_CHAT           = "chat";
 string HUD_PANELNAME_ENGINEINFO                = "engineinfo";
 string HUD_PANELNAME_INFOMESSAGES      = "infomessages";
 string HUD_PANELNAME_PHYSICS   = "physics";
+string HUD_PANELNAME_SHOWNAMES         = "shownames";
+
+float HUD_MENU_ENABLE          = 0;
 
 #define SERVERFLAG_ALLOW_FULLBRIGHT 1
 #define SERVERFLAG_TEAMPLAY 2
index 00c65227f869ab126c270ff17256e2bcd8b40ae1..3b6033f6fb50b643b571f3347825037852a14578 100644 (file)
@@ -220,6 +220,7 @@ switch(id) {\
        case HUD_PANEL_ENGINEINFO: panel_name = HUD_PANELNAME_ENGINEINFO; break; \
        case HUD_PANEL_INFOMESSAGES: panel_name = HUD_PANELNAME_INFOMESSAGES; break; \
        case HUD_PANEL_PHYSICS: panel_name = HUD_PANELNAME_PHYSICS; break; \
+       case HUD_PANEL_SHOWNAMES: panel_name = HUD_PANELNAME_SHOWNAMES; break; \
 } ENDS_WITH_CURLY_BRACE
 
 // Get name of specified panel id
@@ -238,8 +239,8 @@ switch(id) { \
        case HUD_PANEL_MODICONS: panel_name = HUD_PANELNAME_MODICONS; break; \
        case HUD_PANEL_PRESSEDKEYS: panel_name = HUD_PANELNAME_PRESSEDKEYS; break; \
        case HUD_PANEL_CHAT: panel_name = HUD_PANELNAME_CHAT; break; \
-}\
-HUD_Panel_GetName_Part2(id)
+    default: HUD_Panel_GetName_Part2(id)\
+}
 
 vector vec2(vector v);
 
index 61f5a4877d27bbf506a949372e6520d4239b40cc..80aae373c91636a82e2971b947657ff386a36a55 100644 (file)
 #include "xonotic/dialog_hudpanel_chat.c"
 #include "xonotic/dialog_hudpanel_engineinfo.c"
 #include "xonotic/dialog_hudpanel_infomessages.c"
+#include "xonotic/dialog_hudpanel_shownames.c"
 #include "xonotic/dialog_hudpanel_weapons.c"
 #include "xonotic/dialog_hudpanel_physics.c"
 #include "xonotic/slider_picmip.c"
index feec5a9b92595baa6cbbdc808ae926a3ea3a2793..1d7d50d87c95df9646b69417cad317e3c363f25d 100644 (file)
@@ -118,6 +118,10 @@ void MainWindow_configureMainWindow(entity me)
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 
+       i = spawnXonoticHUDShownamesDialog();
+       i.configureDialog(i);
+       me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
        me.advancedDialog = i = spawnXonoticAdvancedDialog();
        i.configureDialog(i);
        me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
index 3426c4ce56d6782db7a94a2274d23033376eea2b..84d090acc21e9eadc29d86e391612682f67770b6 100644 (file)
@@ -604,8 +604,6 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                {
                        // become fully visible
                        self.alpha = 1;
-                       // clear selected player display
-                       ClearSelectedPlayer();
                        // throw a weapon
                        SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon);
                }
@@ -734,64 +732,29 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        }
 }
 
-float UpdateSelectedPlayer_countvalue(float v)
+void net_shownames(entity selected, float teammate)
 {
-       return max(0, (v - 1.0) / 0.5);
-}
-
-// returns: -2 if no hit, otherwise cos of the angle
-// uses the global v_angle
-float UpdateSelectedPlayer_canSee(entity p, float mincosangle, float maxdist)
-{
-       vector so, d;
-       float c;
-
-       if(p == self)
-               return -2;
-
-       if(p.deadflag)
-               return -2;
-
-       so = self.origin + self.view_ofs;
-       d = p.origin - so;
-
-       // misaimed?
-       if(dist_point_line(d, '0 0 0', v_forward) > maxdist)
-               return -2;
-
-       // now find the cos of the angle...
-       c = normalize(d) * v_forward;
-
-       if(c <= mincosangle)
-               return -2;
-
-       // not visible in any way? forget it
-       if(!checkpvs(so, p))
-               return -2;
-
-       traceline(so, p.origin, MOVE_NOMONSTERS, self);
-       if(trace_fraction < 1)
-               return -2;
-
-       return c;
-}
-
-void ClearSelectedPlayer()
-{
-       if(self.selected_player)
-       {
-               centerprint_expire(self, CENTERPRIO_POINT);
-               self.selected_player = world;
-               self.selected_player_display_needs_update = FALSE;
-       }
+    float teammate_health, teammate_armor;
+    if(teammate)
+    {
+        teammate_health = selected.health;
+        teammate_armor = selected.armorvalue;
+    }
+
+    msg_entity = self;
+       WRITESPECTATABLE_MSG_ONE({
+               WriteByte(MSG_ONE, SVC_TEMPENTITY);
+               WriteByte(MSG_ONE, TE_CSQC_SHOWNAMES);
+               WriteString(MSG_ONE, playername(selected));
+        WriteByte(MSG_ONE, teammate_health);
+        WriteByte(MSG_ONE, teammate_armor);
+        });
 }
 
 void UpdateSelectedPlayer()
 {
-       entity selected;
-       float selected_score;
-       selected = world;
-       selected_score = 0.95; // 18 degrees
+    entity selected;
+    selected = world;
 
        if(!autocvar_sv_allow_shownames)
                return;
@@ -802,84 +765,27 @@ void UpdateSelectedPlayer()
        if(self.cvar_cl_shownames == 0)
                return;
 
-       if(self.cvar_cl_shownames == 1 && !teams_matter)
-               return;
-
        makevectors(self.v_angle); // sets v_forward
 
-       // 1. cursor trace is always right
-       WarpZone_crosshair_trace(self);
-       if(trace_ent && trace_ent.classname == "player" && !trace_ent.deadflag)
-       {
-               selected = trace_ent;
-       }
-       else
-       {
-               // 2. if we don't have a cursor trace, find the player which is least
-               //    mis-aimed at
-               entity p;
-               FOR_EACH_PLAYER(p)
-               {
-                       float c;
-                       c = UpdateSelectedPlayer_canSee(p, selected_score, 100); // 100 = 2.5 meters
-                       if(c >= -1)
-                       {
-                               selected = p;
-                               selected_score = c;
-                       }
-               }
-       }
+       // cursor trace
+       if(self.selected_player_display_timeout < time)
+    {
+        WarpZone_crosshair_trace(self);
+        if(trace_ent && trace_ent.classname == "player" && !trace_ent.deadflag)
+        {
+            selected = trace_ent;
+            self.last_selected_player = selected;
+            self.selected_player_display_timeout = time + 0.1; // update at 0.1s intervals
+        }
+    }
 
        if(selected)
        {
-               self.selected_player_display_timeout = time + self.cvar_scr_centertime;
-       }
-       else
-       {
-               if(time < self.selected_player_display_timeout)
-                       if(UpdateSelectedPlayer_canSee(self.selected_player, 0.7, 200) >= -1) // 5 meters, 45 degrees
-                               selected = self.selected_player;
-       }
-
-       if(selected)
-       {
-               if(selected == self.selected_player)
-               {
-                       float save;
-                       save = UpdateSelectedPlayer_countvalue(self.selected_player_count);
-                       self.selected_player_count = self.selected_player_count + frametime;
-                       if(save != UpdateSelectedPlayer_countvalue(self.selected_player_count))
-                       {
-                               string namestr, healthstr;
-                               namestr = playername(selected);
-                               if(teams_matter)
-                               {
-                                       healthstr = ftos(floor(selected.health));
-                                       if(self.team == selected.team)
-                                       {
-                                               namestr = strcat(namestr, " (", healthstr, "%)");
-                                               self.selected_player_display_needs_update = TRUE;
-                                       }
-                               }
-                               centerprint_atprio(self, CENTERPRIO_POINT, namestr);
-                       }
-               }
-               else
-               {
-                       ClearSelectedPlayer();
-                       self.selected_player = selected;
-                       self.selected_player_time = time;
-                       self.selected_player_count = 0;
-                       self.selected_player_display_needs_update = FALSE;
-               }
-       }
-       else
-       {
-               ClearSelectedPlayer();
-       }
-
-       if(self.selected_player)
-               self.last_selected_player = self.selected_player;
+        if(teams_matter && self.team == selected.team)
+                net_shownames(selected, 1);
+        else
+            net_shownames(selected, 0);
+    }
 }
 
 .float muted; // to be used by prvm_edictset server playernumber muted 1
index d7179fafebb703f9c8b2d38ebd426d25cb2a3014..47f4a4aea3c6038b6c4e2aeea582e2c8c35d3bb0 100644 (file)
@@ -363,12 +363,7 @@ float W_WeaponBit(float wpn);
 string W_Name(float weaponid);
 
 void UpdateSelectedPlayer();
-void ClearSelectedPlayer();
-.entity selected_player;
 .entity last_selected_player;
-.float selected_player_time; // when this player has been selected
-.float selected_player_count; // how long this player has been directly pointed to
-.float selected_player_display_needs_update; // are regular updates necessary? (health)
 .float selected_player_display_timeout; // when the selection will time out
 
 void FixIntermissionClient(entity e);
index 93ced82670b1a36fb15c42a8236419621d52513a..2e64eadd77f6517e29b5ea873067082962c8ecab 100644 (file)
@@ -77,7 +77,6 @@ void spawn_tdeath(vector v0, entity e, vector v)
 #define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH)
 void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
 {
-       entity oldself;
        entity telefragger;
        vector from;
 
@@ -136,14 +135,6 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
                }
 
                player.lastteleporttime = time;
-
-               // stop player name display
-               {
-                       oldself = self;
-                       self = player;
-                       ClearSelectedPlayer();
-                       self = oldself;
-               }
        }
 }