X-Git-Url: https://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=blobdiff_plain;f=data%2Fqcsrc%2Fclient%2Fhud.qc;h=7ad5b9d86a5a3ae0297d8f071698271b6ed0aac9;hp=16251aad7c5b253c6e7a98db74d23ddf0513e0cf;hb=7de4a86f3f1bc8f16ed3c356ae8612c8d3462fad;hpb=37c59c987e7c9dbd39745331cb3833ea583d8555 diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index 16251aad..7ad5b9d8 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -959,6 +959,14 @@ void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions) vector hl_color; field_number = 3; // the number of components each row has + // center defined position on the x axis + position_x -= dimensions_x / 2; + + // limit the font size to the maximum of the HUD + vector font_sz; + font_sz_x = bound(0, sbar_fontsize_x, dimensions_y); + font_sz_y = bound(0, sbar_fontsize_y, dimensions_y); + for(fieldcounter = 1; fieldcounter <= field_number; ++fieldcounter) { vector pos, sz; @@ -984,32 +992,32 @@ void Sbar_PrintStomachboardItem(entity pl, vector position, vector dimensions) } if(field == ST_NAME) { - pos_x = position_x / 9; - sz_x = dimensions_x / 9; + pos_x = position_x + dimensions_x * cvar("hud_item_preylist_colors_location"); + sz_x = dimensions_x * cvar("hud_item_preylist_colors_length"); f = stof(getplayerkey(pl.sv_entnum, "colors")); 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 = 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); + pos_x = position_x + dimensions_x * cvar("hud_item_preylist_name_location"); + sz_x = dimensions_x * cvar("hud_item_preylist_name_length"); + drawcolorcodedstring(pos, textShortenToWidth(str, sz_x, font_sz, stringwidth_colors), font_sz, sbar_alpha_fg, DRAWFLAG_NORMAL); } if(field == ST_HEALTH) { - pos_x = position_x / 1.05; - sz_x = sz_y = dimensions_y; + pos_x = position_x + dimensions_x * cvar("hud_item_preylist_health_icon_location"); + sz_x = dimensions_x * cvar("hud_item_preylist_health_icon_length"); if(pl.sv_entnum == player_localentnum - 1 || (spectatee_status && pl.sv_entnum == spectatee_status - 1)) - drawcolorcodedstring(pos, "self", sz, sbar_alpha_fg, DRAWFLAG_NORMAL); + drawcolorcodedstring(pos, textShortenToWidth("self", sz_x, font_sz, stringwidth_colors), font_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); + pos_x = position_x + dimensions_x * cvar("hud_item_preylist_health_text_location"); + sz_x = dimensions_x * cvar("hud_item_preylist_health_text_length"); + drawcolorcodedstring(pos, textShortenToWidth(str, sz_x, font_sz, stringwidth_colors), font_sz, sbar_alpha_fg, DRAWFLAG_NORMAL); } } } @@ -1565,7 +1573,6 @@ void Sbar_DrawScoreboard() // print information about respawn status float respawn_time = getstatf(STAT_RESPAWN_TIME); - dprint(strcat(ftos(respawn_time), " --------\n")); if(respawn_time) { if(respawn_time < 0) @@ -3269,8 +3276,9 @@ void Sbar_Draw (void) entity pl, pred; float f, l; - pos = bottomleft; hud_total_prey = 0; + pos = stov(cvar_string("hud_item_preylist_position")); + vector sz = stov(cvar_string("hud_item_preylist_scale")); for(pl = players.sort_next; pl; pl = pl.sort_next) { if(pl.team == COLOR_SPECTATOR) @@ -3288,10 +3296,12 @@ void Sbar_Draw (void) if(f) { - if(l <= 8) // limit the stomach board to 9 entries due to the HUD design + if(l < cvar("hud_item_preylist_entries")) // limit the stomach board to the given number of entries { - Sbar_PrintStomachboardItem(pl, stov(cvar_string("hud_item_preylist_position")), stov(cvar_string("hud_item_preylist_scale"))); - pos_y += 1.1 * sbar_fontsize_y; + Sbar_PrintStomachboardItem(pl, pos, sz); + + // advance y position for each entry + pos_y += sz_y * cvar("hud_item_preylist_spacing"); l += 1; } ++hud_total_prey;