From c75962c2b997f79ae2f24d9c3141f8dd92f0a161 Mon Sep 17 00:00:00 2001 From: FruitieX Date: Wed, 15 Dec 2010 20:15:57 +0200 Subject: [PATCH] properly detect which color to use when drawing team colors in hud, so that it'll be correct when spectating. No idea why I didn't do this before :P --- qcsrc/client/hud.qc | 8 +++++--- qcsrc/client/hud.qh | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 1226c252c..2f3ec3b17 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -5216,6 +5216,8 @@ void HUD_Main (void) } } + current_player = (spectatee_status > 0) ? spectatee_status : player_localentnum; + // draw the dock if(autocvar_hud_dock != "" && autocvar_hud_dock != "0") { @@ -5223,7 +5225,7 @@ void HUD_Main (void) vector color; float hud_dock_color_team = autocvar_hud_dock_color_team; if((teamplay) && hud_dock_color_team) { - f = stof(getplayerkey(player_localentnum - 1, "colors")); + f = stof(getplayerkey(current_player - 1, "colors")); color = colormapPaletteColor(mod(f, 16), 1) * hud_dock_color_team; } else if(autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && hud_dock_color_team) { @@ -5233,11 +5235,11 @@ void HUD_Main (void) { string hud_dock_color = autocvar_hud_dock_color; if(hud_dock_color == "shirt") { - f = stof(getplayerkey(player_localentnum - 1, "colors")); + f = stof(getplayerkey(current_player - 1, "colors")); color = colormapPaletteColor(floor(f / 16), 0); } else if(hud_dock_color == "pants") { - f = stof(getplayerkey(player_localentnum - 1, "colors")); + f = stof(getplayerkey(current_player - 1, "colors")); color = colormapPaletteColor(mod(f, 16), 1); } else diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index bbb57d91f..21e3746b5 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -80,6 +80,8 @@ var string panel_bg_border_str; var float panel_bg_padding; var string panel_bg_padding_str; +float current_player; + // Because calling lots of functions in QC apparently cuts fps in half on many machines: // ---------------------- // MACRO HELL STARTS HERE @@ -125,7 +127,7 @@ if(!autocvar__hud_configure && panel_bg_str == "0") {\ // Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector. #define HUD_Panel_GetColor()\ if((teamplay) && panel_bg_color_team) {\ - panel_bg_color = colormapPaletteColor(mod(stof(getplayerkey(player_localentnum - 1, "colors")), 16), 1) * panel_bg_color_team;\ + panel_bg_color = colormapPaletteColor(mod(stof(getplayerkey(current_player - 1, "colors")), 16), 1) * panel_bg_color_team;\ } else if (autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && panel_bg_color_team) {\ panel_bg_color = '1 0 0' * panel_bg_color_team;\ } else {\ @@ -133,9 +135,9 @@ if((teamplay) && panel_bg_color_team) {\ panel_bg_color = autocvar_hud_panel_bg_color;\ } else {\ if(panel_bg_color_str == "shirt") {\ - panel_bg_color = colormapPaletteColor(floor(stof(getplayerkey(player_localentnum - 1, "colors")) / 16), 0);\ + panel_bg_color = colormapPaletteColor(floor(stof(getplayerkey(current_player - 1, "colors")) / 16), 0);\ } else if(panel_bg_color_str == "pants") {\ - panel_bg_color = colormapPaletteColor(mod(stof(getplayerkey(player_localentnum - 1, "colors")), 16), 1);\ + panel_bg_color = colormapPaletteColor(mod(stof(getplayerkey(current_player - 1, "colors")), 16), 1);\ } else {\ panel_bg_color = stov(panel_bg_color_str);\ }\ -- 2.39.2