From: MirceaKitsune Date: Sat, 2 Feb 2013 12:07:14 +0000 (+0200) Subject: Adapt predator entry to customizable HUD. Also stup using sbar_fontsize for the HUD... X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=commitdiff_plain;h=2273a8398a99a29bc698826111571c00b06059ce Adapt predator entry to customizable HUD. Also stup using sbar_fontsize for the HUD, we don't do that any more at least --- diff --git a/data/hudVT.cfg b/data/hudVT.cfg index a5f6b166..0e0e1b02 100644 --- a/data/hudVT.cfg +++ b/data/hudVT.cfg @@ -23,6 +23,13 @@ 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 +set hud_item_predator_position "140 450 0" +set hud_item_predator_scale "130 10 0" +set hud_item_predator_colors_location 0 +set hud_item_predator_colors_length 0.15 +set hud_item_predator_name_location 0.15 +set hud_item_predator_name_length 0.85 + set hud_item_preylist_spacing 1.25 set hud_item_preylist_entries 9 set hud_item_preylist_position "110 475 0" diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index 7ad5b9d8..b91c6a26 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -962,10 +962,9 @@ void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions) // center defined position on the x axis position_x -= dimensions_x / 2; - // limit the font size to the maximum of the HUD + // set font size to the height of each entry vector font_sz; - font_sz_x = bound(0, sbar_fontsize_x, dimensions_y); - font_sz_y = bound(0, sbar_fontsize_y, dimensions_y); + font_sz_x = font_sz_y = dimensions_y; for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter) { @@ -1030,21 +1029,51 @@ void Sbar_PrintStomachboardItemPred(entity pl, vector position, vector dimension string str; float f, field, field_number; - field_number = 1; // the number of components each row has + vector hl_color; + field_number = 2; // the number of components each row has + + // center defined position on the x axis + position_x -= dimensions_x / 2; + + // set font size to the height of each entry + vector font_sz; + font_sz_x = font_sz_y = dimensions_y; for(fieldcounter2 = 1; fieldcounter2 <= field_number; ++fieldcounter2) { + vector pos, sz; field = -fieldcounter2; str = Sbar_GetStomachFieldPred(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 + hl_color = stov(cvar_string("sbar_stomachboard_color2")); + else + hl_color = stov(cvar_string("sbar_stomachboard_color3")); + } + else + hl_color = stov(cvar_string("sbar_stomachboard_color1")); + drawfill(pos, sz, hl_color, cvar("sbar_stomachboard_highlight_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL); + } + if(field == STP_NAME) { + pos_x = position_x + dimensions_x * cvar("hud_item_predator_colors_location"); + sz_x = dimensions_x * cvar("hud_item_predator_colors_length"); f = stof(getplayerkey(pl.sv_entnum, "colors")); - 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); + 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(position, textShortenToWidth(str, 122, '11 11 0', stringwidth_colors), '11 11 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + pos_x = position_x + dimensions_x * cvar("hud_item_predator_name_location"); + sz_x = dimensions_x * cvar("hud_item_predator_name_length"); + drawcolorcodedstring(pos, textShortenToWidth(str, sz_x, font_sz, stringwidth_colors), font_sz, sbar_alpha_fg, DRAWFLAG_NORMAL); } } } @@ -3318,7 +3347,7 @@ void Sbar_Draw (void) } // draw the predator's name -// Sbar_PrintStomachboardItemPred(bottomleft - '-76 150 0', pred); + Sbar_PrintStomachboardItemPred(pred, stov(cvar_string("hud_item_predator_position")), stov(cvar_string("hud_item_predator_scale"))); } // draw status, scores, timer, ring and portrait diff --git a/data/qcsrc/client/main.qh b/data/qcsrc/client/main.qh index a868ae40..e16c1088 100644 --- a/data/qcsrc/client/main.qh +++ b/data/qcsrc/client/main.qh @@ -80,6 +80,7 @@ const float COLOR_SPECTATOR = 1337; #define ST_NAME -2 #define ST_HEALTH -3 +#define STP_HIGHLIGHT -2 #define STP_NAME -1 float sbar_field[MAX_SBAR_FIELDS + 1];