From: MirceaKitsune Date: Thu, 17 May 2012 11:18:41 +0000 (+0300) Subject: Partial attempt at porting the stomach board list to the new system. This commit... X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=c63a3db871dfcc1e99b888d122a5b56bb8be280f;p=voretournament%2Fvoretournament.git Partial attempt at porting the stomach board list to the new system. This commit currently breaks the whole list, until I feel like figuring out the complex maths to cvar the list position and keep items in correct proportions --- diff --git a/data/hudVT.cfg b/data/hudVT.cfg index d0b107ae..7072a139 100644 --- a/data/hudVT.cfg +++ b/data/hudVT.cfg @@ -21,4 +21,8 @@ set hud_item_ammo_noload_text_scale 16 set hud_item_ammo_load_text_position "0.015 -0.935 0" set hud_item_ammo_load_text_scale 12 set hud_item_clip_load_text_position "0.03 -0.89 0" -set hud_item_clip_load_text_scale 16 \ No newline at end of file +set hud_item_clip_load_text_scale 16 + +set hud_item_preylist_position "0 0 0" +set hud_item_preylist_scale "0.25 0.25 0" +set hud_item_preylist_items 9 \ No newline at end of file diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index 2b01044c..e81da42c 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -950,7 +950,7 @@ void Sbar_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_num } float fieldcounter; -void Sbar_PrintStomachboardItem(vector pos, entity pl) +void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions) { // lists all players in the stomach @@ -961,12 +961,16 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter) { + vector pos, sz; field = -fieldcounter; str = Sbar_GetStomachField(pl, field); // row highlighting if(field == ST_HIGHLIGHT) { + pos = position; + sz = dimensions; + if(getstati(STAT_VORE_EATEN)) { if(teamplay && (GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(player_localentnum - 1) || GetPlayerColor(getstati(STAT_VORE_EATEN) - 1) == GetPlayerColor(spectatee_status - 1))) // same team @@ -976,36 +980,43 @@ void Sbar_PrintStomachboardItem(vector pos, entity pl) } else hl_color = stov(cvar_string("sbar_stomachboard_color1")); - drawfill(pos - '0 0 0', '193 11 0', hl_color, cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL); + drawfill(pos, sz, hl_color, cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL); } if(field == ST_NAME) { + pos_x = position_x / 9; + sz_x = dimensions_x / 9; + 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); + drawpic(pos, "gfx/sb_playercolor_base", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(pos, "gfx/sb_playercolor_shirt", sz, colormapPaletteColor(floor(f / 16), 0), sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(pos, "gfx/sb_playercolor_pants", sz, colormapPaletteColor(mod(f, 16), 1), sbar_alpha_fg, DRAWFLAG_NORMAL); - pos_x += 24; - drawcolorcodedstring(pos, textShortenToWidth(str, 138, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + pos_x = position_x / 4; + sz_x = dimensions_x / 4; + drawcolorcodedstring(pos, textShortenToWidth(str, sz_x, '1 1 0' * sz_y, stringwidth_colors), '1 1 0' * sz_y, sbar_alpha_fg, DRAWFLAG_NORMAL); } if(field == ST_HEALTH) { - pos_x += 138; - if(pl.sv_entnum == player_localentnum - 1 || (spectatee_status && pl.sv_entnum == spectatee_status - 1)) - drawcolorcodedstring(pos, "self", '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); - else - { - drawpic(pos, "gfx/hud/sb_health", '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + pos_x = position_x / 1.05; + sz_x = sz_y = dimensions_y; - pos_x += 9; - drawcolorcodedstring(pos, str, '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); - } + if(pl.sv_entnum == player_localentnum - 1 || (spectatee_status && pl.sv_entnum == spectatee_status - 1)) + drawcolorcodedstring(pos, "self", sz, sbar_alpha_fg, DRAWFLAG_NORMAL); + else + { + drawpic(pos, "gfx/hud/sb_health", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + + pos_x = position_x / 1.05; + sz_x = sz_y = dimensions_y; + drawcolorcodedstring(pos, str, sz, sbar_alpha_fg, DRAWFLAG_NORMAL); + } } } } float fieldcounter2; -void Sbar_PrintStomachboardItemPred(vector pos, entity pl) +void Sbar_PrintStomachboardItemPred(entity pl, vector position, vector dimensions) { // shows the name of our predator @@ -1020,12 +1031,12 @@ void Sbar_PrintStomachboardItemPred(vector pos, entity pl) if(field == STP_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); + drawpic(position, "gfx/sb_playercolor_base", '22 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(position, "gfx/sb_playercolor_shirt", '22 11 0', colormapPaletteColor(floor(f / 16), 0), sbar_alpha_fg, DRAWFLAG_NORMAL); + drawpic(position, "gfx/sb_playercolor_pants", '22 11 0', colormapPaletteColor(mod(f, 16), 1), sbar_alpha_fg, DRAWFLAG_NORMAL); - pos_x += 24; - drawcolorcodedstring(pos, textShortenToWidth(str, 122, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + //pos_x += 24; + drawcolorcodedstring(position, textShortenToWidth(str, 122, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); } } } @@ -3256,7 +3267,7 @@ void Sbar_Draw (void) { if(l <= 8) // limit the stomach board to 9 entries due to the HUD design { - Sbar_PrintStomachboardItem(pos - '-16 124 0', pl); + Sbar_PrintStomachboardItem(pl, stov(cvar_string("hud_item_preylist_position")), stov(cvar_string("hud_item_preylist_scale"))); pos_y += 1.1 * sbar_fontsize_y; l += 1; } @@ -3274,7 +3285,7 @@ void Sbar_Draw (void) } // draw the predator's name - Sbar_PrintStomachboardItemPred(bottomleft - '-76 150 0', pred); +// Sbar_PrintStomachboardItemPred(bottomleft - '-76 150 0', pred); } // draw status, scores, timer, ring and portrait