From: terencehill Date: Sat, 1 Aug 2015 15:16:35 +0000 (+0200) Subject: Fix HUD color when spectating a player in a vehicle and a bug in the score panel... X-Git-Tag: xonotic-v0.8.1~33^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d520f99562ad73e125fc0a026ef21cce7b441e01;p=xonotic%2Fxonotic-data.pk3dir.git Fix HUD color when spectating a player in a vehicle and a bug in the score panel when you're in a vehicle by making use of current_player --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 45f2391a4..a3acb8332 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -2316,7 +2316,7 @@ void HUD_Score(void) vector distribution_color; entity tm, pl, me; - me = playerslots[player_localentnum - 1]; + me = playerslots[current_player]; if((scores_flags[ps_primary] & SFL_TIME) && !teamplay) { // race/cts record display on HUD string timer, distrtimer; @@ -3782,7 +3782,7 @@ void HUD_InfoMessages(void) if(spectatee_status == -1) s = _("^1Observing"); else - s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(player_localentnum - 1)); + s = sprintf(_("^1Spectating: ^7%s"), GetPlayerName(current_player)); drawInfoMessage(s); if(spectatee_status == -1) @@ -4630,8 +4630,6 @@ void HUD_Main (void) hud_skin_prev = strzone(autocvar_hud_skin); } - current_player = player_localentnum; - // draw the dock if(autocvar_hud_dock != "" && autocvar_hud_dock != "0") { @@ -4651,11 +4649,11 @@ void HUD_Main (void) { string hud_dock_color = autocvar_hud_dock_color; if(hud_dock_color == "shirt") { - f = stof(getplayerkeyvalue(current_player - 1, "colors")); + f = stof(getplayerkeyvalue(current_player, "colors")); color = colormapPaletteColor(floor(f / 16), 0); } else if(hud_dock_color == "pants") { - f = stof(getplayerkeyvalue(current_player - 1, "colors")); + f = stof(getplayerkeyvalue(current_player, "colors")); color = colormapPaletteColor(f % 16, 1); } else diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 3b61cb453..5bc2ca4a7 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -227,9 +227,9 @@ HUD_PANELS(HUD_PANEL) panel_bg_color = autocvar_hud_panel_bg_color; \ } else { \ if (panel_bg_color_str == "shirt") { \ - panel_bg_color = colormapPaletteColor(floor(stof(getplayerkeyvalue(current_player - 1, "colors")) / 16), 0);\ + panel_bg_color = colormapPaletteColor(floor(stof(getplayerkeyvalue(current_player, "colors")) / 16), 0); \ } else if (panel_bg_color_str == "pants") { \ - panel_bg_color = colormapPaletteColor(stof(getplayerkeyvalue(current_player - 1, "colors")) % 16, 1);\ + panel_bg_color = colormapPaletteColor(stof(getplayerkeyvalue(current_player, "colors")) % 16, 1); \ } else { \ panel_bg_color = stov(panel_bg_color_str); \ } \ diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index ffdde41a9..35793364f 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1054,7 +1054,11 @@ void CSQC_UpdateView(float w, float h) CSQCPlayer_SetCamera(); - myteam = GetPlayerColor(player_localentnum - 1); + if(player_localentnum <= maxclients) // is it a client? + current_player = player_localentnum - 1; + else // then player_localentnum is the vehicle I'm driving + current_player = player_localnum; + myteam = GetPlayerColor(current_player); if(myteam != prev_myteam) {