]> git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Make timer customizable too
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 2 Feb 2013 21:39:08 +0000 (23:39 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 2 Feb 2013 21:39:08 +0000 (23:39 +0200)
data/defaultVT.cfg
data/hudVT.cfg
data/qcsrc/client/hud.qc

index a105b6782297742f9671fcf3e0ce62606f8a6909..0439d806c09b8294088a6b1ad62d20effe493ffe 100644 (file)
@@ -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"\r
 seta sbar_stomachboard_highlight_alpha 0.25 "alpha of the stomach board highlight"\r
 seta sbar_timer_increment 0 "1 = show elapsed time on the timer"\r
-seta sbar_timer_scale 1 "scale multiplier of the timer"\r
 seta sbar_ring1 1 "enables the first HUD ring"\r
 seta sbar_ring1_scale 110 "scale of the first HUD ring"\r
 seta sbar_ring1_text_scale 12 "scale of the text on the first HUD ring"\r
index b4d0408879a7713c3c99942bcef85296bd4bca72..81d869b1f484f97fed0553e0281b98e2bcb047d1 100644 (file)
@@ -1,9 +1,14 @@
 // Only some HUD components can be customized here at the time.\r
-// Components left to do: Timer, Portrait, Sbar ring, "HUD disabled" warnings, some race timers, some spectator messages,.\r
+// Components left to do: Portrait, Sbar ring, "HUD disabled" warnings, some race timers, some spectator messages,.\r
 \r
 set hud_panel_status_background_position "0 -0.85 0"\r
 set hud_panel_status_background_scale "0.2 0.15 0"\r
 \r
+set hud_item_timer_text_position "0.875 0.96 0"\r
+set hud_item_timer_text_scale 16\r
+set hud_item_timer_icon_position "0.975 0.96 0"\r
+set hud_item_timer_icon_scale "0.025 0.035 0"\r
+\r
 set hud_item_score_race_primary_text_position "0 0.95 0"\r
 set hud_item_score_race_primary_text_scale 30\r
 set hud_item_score_race_secondary_text_position "-0.225 0.95 0"\r
index 1a3b65a9bd9bfad2824f1381240ff45b5ef407e8..9b2d56e257465205f11a459fa0e1ccabde41b2d9 100644 (file)
@@ -2208,13 +2208,13 @@ void Sbar_Timer()
        topright_x = vid_conwidth;\r
        \r
        float scale;\r
-       scale = cvar_or("sbar_timer_scale", 1);\r
+       scale = 1; // temporary\r
        timelimit = getstatf(STAT_TIMELIMIT);\r
 \r
        if(gametype == GAME_RPG && !timelimit) // don't draw the timer in rpg if there's no time limit\r
                return;\r
 \r
-       Sbar_DrawRaceStatus((topright_x - 100) * '1 0 0' + '0 30 0' * scale);\r
+       Sbar_DrawRaceStatus('0 20 0');\r
        \r
        timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time);\r
        timeleft = ceil(timeleft);\r
@@ -2237,23 +2237,13 @@ void Sbar_Timer()
                        minutes = floor(elapsedTime / 60);\r
                        seconds = elapsedTime - minutes*60;\r
                }\r
-               if (minutes < 10)\r
-                       bgpos_x = topright_x - (54 + 17 + 12) * scale;\r
-               else if (minutes < 100) // nudge the timer background left if more digits are drawn\r
-                       bgpos_x = topright_x - (62 + 17 + 12) * scale;\r
-               else\r
-                       bgpos_x = topright_x - (70 + 17 + 12) * scale;\r
+               bgpos_x = topright_x - (70 + 17 + 12) * scale;\r
                bgpos_y = 0;\r
                bgpos_z = 0;\r
        } else {\r
                minutes = minutesLeft;\r
                seconds = secondsLeft;\r
-               if (minutes < 10) // nudge the timer background left if more digits are drawn\r
-                       bgpos_x = topright_x - (54 + 17 + 12) * scale;\r
-               else if (minutes < 100)\r
-                       bgpos_x = topright_x - (62 + 17 + 12) * scale;\r
-               else\r
-                       bgpos_x = topright_x - (70 + 17 + 12) * scale;\r
+               bgpos_x = topright_x - (70 + 17 + 12) * scale;\r
                bgpos_y = 0;\r
                bgpos_z = 0;\r
        }\r
@@ -2268,7 +2258,8 @@ void Sbar_Timer()
                }\r
        }\r
 \r
-       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);\r
+       Sbar_DrawPic("gfx/hud/sb_time", stov(cvar_string("hud_item_timer_icon_position")), stov(cvar_string("hud_item_timer_icon_scale")), FALSE);\r
+\r
        finaltime = strcat(ftos(minutes), ":");\r
        if(seconds < 10)\r
                finaltime = strcat(finaltime, "0", ftos(seconds));\r
@@ -2277,7 +2268,7 @@ void Sbar_Timer()
 \r
        pos = topright - ('24 -2 0' + '3 0 0' - '0 2 0');\r
        pos -= '1 0 0' * stringwidth(finaltime, FALSE, 18 * scale * '1 1 0');\r
-       drawstring(pos, finaltime, 18 * scale * '1 1 0', timer_color, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+       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);\r
 }\r
 \r
 void Sbar_Ring()\r