From: MirceaKitsune Date: Sat, 2 Feb 2013 21:39:08 +0000 (+0200) Subject: Make timer customizable too X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2a338574d9bfd99db22a715e92b9535e793a1dcd;p=voretournament%2Fvoretournament.git Make timer customizable too --- diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index a105b678..0439d806 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1263,7 +1263,6 @@ seta sbar_stomachboard_status_alpha 0.75 "alpha of the stomach board status" seta sbar_stomachboard_status_fade 1 "color fading speed of the stomach board status" seta sbar_stomachboard_highlight_alpha 0.25 "alpha of the stomach board highlight" seta sbar_timer_increment 0 "1 = show elapsed time on the timer" -seta sbar_timer_scale 1 "scale multiplier of the timer" seta sbar_ring1 1 "enables the first HUD ring" seta sbar_ring1_scale 110 "scale of the first HUD ring" seta sbar_ring1_text_scale 12 "scale of the text on the first HUD ring" diff --git a/data/hudVT.cfg b/data/hudVT.cfg index b4d04088..81d869b1 100644 --- a/data/hudVT.cfg +++ b/data/hudVT.cfg @@ -1,9 +1,14 @@ // Only some HUD components can be customized here at the time. -// Components left to do: Timer, Portrait, Sbar ring, "HUD disabled" warnings, some race timers, some spectator messages,. +// Components left to do: Portrait, Sbar ring, "HUD disabled" warnings, some race timers, some spectator messages,. set hud_panel_status_background_position "0 -0.85 0" set hud_panel_status_background_scale "0.2 0.15 0" +set hud_item_timer_text_position "0.875 0.96 0" +set hud_item_timer_text_scale 16 +set hud_item_timer_icon_position "0.975 0.96 0" +set hud_item_timer_icon_scale "0.025 0.035 0" + set hud_item_score_race_primary_text_position "0 0.95 0" set hud_item_score_race_primary_text_scale 30 set hud_item_score_race_secondary_text_position "-0.225 0.95 0" diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index 1a3b65a9..9b2d56e2 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -2208,13 +2208,13 @@ void Sbar_Timer() topright_x = vid_conwidth; float scale; - scale = cvar_or("sbar_timer_scale", 1); + scale = 1; // temporary timelimit = getstatf(STAT_TIMELIMIT); if(gametype == GAME_RPG && !timelimit) // don't draw the timer in rpg if there's no time limit return; - Sbar_DrawRaceStatus((topright_x - 100) * '1 0 0' + '0 30 0' * scale); + Sbar_DrawRaceStatus('0 20 0'); timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time); timeleft = ceil(timeleft); @@ -2237,23 +2237,13 @@ void Sbar_Timer() minutes = floor(elapsedTime / 60); seconds = elapsedTime - minutes*60; } - if (minutes < 10) - bgpos_x = topright_x - (54 + 17 + 12) * scale; - else if (minutes < 100) // nudge the timer background left if more digits are drawn - bgpos_x = topright_x - (62 + 17 + 12) * scale; - else - bgpos_x = topright_x - (70 + 17 + 12) * scale; + bgpos_x = topright_x - (70 + 17 + 12) * scale; bgpos_y = 0; bgpos_z = 0; } else { minutes = minutesLeft; seconds = secondsLeft; - if (minutes < 10) // nudge the timer background left if more digits are drawn - bgpos_x = topright_x - (54 + 17 + 12) * scale; - else if (minutes < 100) - bgpos_x = topright_x - (62 + 17 + 12) * scale; - else - bgpos_x = topright_x - (70 + 17 + 12) * scale; + bgpos_x = topright_x - (70 + 17 + 12) * scale; bgpos_y = 0; bgpos_z = 0; } @@ -2268,7 +2258,8 @@ void Sbar_Timer() } } - drawpic(topright - ('19 0 0' + '3 0 0' - '0 2 0'), "gfx/hud/sb_time", '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawPic("gfx/hud/sb_time", stov(cvar_string("hud_item_timer_icon_position")), stov(cvar_string("hud_item_timer_icon_scale")), FALSE); + finaltime = strcat(ftos(minutes), ":"); if(seconds < 10) finaltime = strcat(finaltime, "0", ftos(seconds)); @@ -2277,7 +2268,7 @@ void Sbar_Timer() pos = topright - ('24 -2 0' + '3 0 0' - '0 2 0'); pos -= '1 0 0' * stringwidth(finaltime, FALSE, 18 * scale * '1 1 0'); - drawstring(pos, finaltime, 18 * scale * '1 1 0', timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL); + drawstring(Sbar_ConvertToScreen_TextPosition(finaltime, stov(cvar_string("hud_item_timer_text_position")), cvar("hud_item_timer_text_scale")), finaltime, '1 1 0' * cvar("hud_item_timer_text_scale"), timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL); } void Sbar_Ring()