]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixed player name in spectator HUD
authorz411 <z411@omaera.org>
Wed, 4 Nov 2020 05:11:38 +0000 (02:11 -0300)
committerz411 <z411@omaera.org>
Wed, 4 Nov 2020 05:11:38 +0000 (02:11 -0300)
qcsrc/client/hud/panel/score.qc
qcsrc/client/hud/panel/spect.qc

index 2ce8e3c737a064913b055f4702d08c184ca220d4..4dbb69ceee2bf2ca6e07a23d91a2ba11ef644be1 100644 (file)
@@ -203,7 +203,7 @@ void HUD_Score()
        if (!scoreboard_fade_alpha) // the scoreboard too calls Scoreboard_UpdatePlayerTeams
                Scoreboard_UpdatePlayerTeams();
        
-       if(spectatee_status) return;
+       if(spectatee_status && teamplay) return;
 
        HUD_Panel_LoadCvars();
        vector pos, mySize;
index 7990706c9ae07f778707d8de9fe25a24f1ed3e50..92eff46dbab99d7fd15a1abe7b832a8e59ccf7f9 100644 (file)
@@ -18,7 +18,7 @@ void HUD_SpectHUD_drawCurrentName(vector pos)
        if(!current_player) return;
        
        string s = entcs_GetName(current_player);
-       pos.x -= stringwidth(s, false, hud_fontsize * 2) / 2;
+       pos.x -= stringwidth_colors(s, hud_fontsize * 2) / 2;
        drawcolorcodedstring(pos, s, hud_fontsize * 2, panel_fg_alpha, DRAWFLAG_NORMAL);
 }
        
@@ -113,7 +113,7 @@ void HUD_SpectHUD_drawTeamScore(vector pos, entity tm, vector rgb, bool invert)
 
 void HUD_SpectHUD()
 {
-       if(!spectatee_status || !teamplay) return;
+       if(!spectatee_status) return;
        
        vector pos, rgb;
        float ammo_y, timer_width;
@@ -122,13 +122,19 @@ void HUD_SpectHUD()
        // Set main vars
        HUD_Panel_LoadCvars();
        HUD_Scale_Enable();
-       
        hud_fontsize = HUD_GetFontsize("hud_fontsize");
+       
+       // Spectator name
+       ammo_y = stov(cvar_string("hud_panel_ammo_pos")).y * vid_conheight;
+       pos = panel_pos + vec2((vid_conwidth - 1) / 2, (ammo_y - (hud_fontsize.y * 2)));
+       HUD_SpectHUD_drawCurrentName(pos);
+       
+       if(!teamplay) return;
+       
+       // Set vars
        teamscore_fontsize = hud_fontsize * 3;
        teamname_fontsize = hud_fontsize * 2;
-       
        teamscore_size = vec2(teamscore_fontsize.x * 1.5, teamscore_fontsize.y * 1.25);
-       ammo_y = stov(cvar_string("hud_panel_ammo_pos")).y * vid_conheight;
        timer_width = stov(cvar_string("hud_panel_timer_size")).x * vid_conwidth;
        
        // Team 1
@@ -150,8 +156,4 @@ void HUD_SpectHUD()
        
        pos = panel_pos + vec2(vid_conwidth - 1, (vid_conheight - 1) / 4 + hud_fontsize.y);
        HUD_SpectHUD_drawTeamPlayers(pos, tm, rgb, true);
-       
-       // Spectator name
-       pos = panel_pos + vec2((vid_conwidth - 1) / 2, (ammo_y - (hud_fontsize.y * 2)));
-       HUD_SpectHUD_drawCurrentName(pos);
 }