From 16e52b805a48d1b0a23823c01e50bc8fbf341469 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 4 Sep 2010 15:28:58 +0300 Subject: [PATCH] Use another function to print the predator name. We can undo the 0 health hiding too. Also remove some useless code. --- data/qcsrc/client/sbar.qc | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 46b88233..c03ac713 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -949,16 +949,9 @@ void Sbar_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_num float fieldcounter; void Sbar_PrintStomachboardItem(vector pos, entity pl) { - vector tmp, rgb; - rgb = GetTeamRGB(pl.team); string str; float f, field; - // Layout: - tmp_x = sbwidth; - tmp_y = sbar_fontsize_y * 1.25; - tmp_z = 0; - for(fieldcounter = 1; fieldcounter <= 2; ++fieldcounter) { field = -fieldcounter; @@ -978,7 +971,7 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) } if(field == ST_HEALTH) - if(g_vore_showpreyhealth && stof(str)) { // only if player health is not 0 + if(g_vore_showpreyhealth) { pos_x += 138; if(pl.sv_entnum == player_localentnum - 1 || (spectatee_status && pl.sv_entnum == spectatee_status - 1)) drawcolorcodedstring(pos, " me", '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); @@ -993,6 +986,31 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) } } +void Sbar_PrintStomachboardItemPred(vector pos, entity pl) +{ + string str; + float f, field; + + for(fieldcounter = 1; fieldcounter <= 2; ++fieldcounter) + { + field = -fieldcounter; + if(field == SP_SEPARATOR) + break; + + str = Sbar_GetStomachField(pl, field); + + if(field == ST_NAME) { + f = stof(getplayerkey(pl.sv_entnum, "colors")); + drawpic(pos, "gfx/sb_playercolor_base", '22 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(pos, "gfx/sb_playercolor_shirt", '22 11 0', colormapPaletteColor(floor(f / 16), 0), sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(pos, "gfx/sb_playercolor_pants", '22 11 0', colormapPaletteColor(mod(f, 16), 1), sbar_alpha_fg, DRAWFLAG_NORMAL); + + pos_x += 24; + drawcolorcodedstring(pos, str, '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + } +} + /* * Sbar_Scoreboard_MakeTable * @@ -2933,7 +2951,7 @@ void Sbar_Draw (void) if(getstati(STAT_STOMACH_EATEN)) if(pl.sv_entnum == getstati(STAT_STOMACH_EATEN) - 1) - Sbar_PrintStomachboardItem(pos - '-76 156 0', pl); + Sbar_PrintStomachboardItemPred(pos - '-76 156 0', pl); } if (cvar("viewsize") <= 100 && vid_conwidth <= 1600) { -- 2.39.2