From fa30511387ed0d48aab4390559b47ff9c35c2614 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sun, 3 Feb 2013 00:18:12 +0200 Subject: [PATCH] Adapt Strength & Invincible HUD elements to the new system --- data/hudVT.cfg | 12 +++++++++++- data/qcsrc/client/hud.qc | 39 +++++++++++++++------------------------ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/data/hudVT.cfg b/data/hudVT.cfg index b4e9a4b6..ce3b606a 100644 --- a/data/hudVT.cfg +++ b/data/hudVT.cfg @@ -1,5 +1,5 @@ // Only some HUD components can be customized here at the time. -// Components left to do: Strength / Shield 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" @@ -23,6 +23,16 @@ set hud_item_score_nonteam_primary_text_scale 34 set hud_item_score_nonteam_secondary_text_position "-0.2 0.965 0" set hud_item_score_nonteam_secondary_text_scale 16 +set hud_item_strength_icon_position "-0.35 -0.95 0" +set hud_item_strength_icon_scale "0.025 0.035 0" +set hud_item_strength_text_position "-0.3 -0.95 0" +set hud_item_strength_text_scale 18 + +set hud_item_invincible_icon_position "-0.35 -0.875 0" +set hud_item_invincible_icon_scale "0.025 0.035 0" +set hud_item_invincible_text_position "-0.3 -0.875 0" +set hud_item_invincible_text_scale 18 + set hud_item_weapon_position "0 -0.85 0" set hud_item_weapon_scale "0.2 0.15 0" diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index 01bd95a8..5e9b0717 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -2325,13 +2325,6 @@ void Sbar_Ring() } void CSQC_Strength_Timer() { - vector pos; - vector bottomright; - - bottomright_x = vid_conwidth; - bottomright_y = vid_conheight; - bottomright_z = 0; - float stat_items, dt; stat_items = getstati(STAT_ITEMS); /* @@ -2343,59 +2336,57 @@ void CSQC_Strength_Timer() { if (getstati(STAT_HEALTH) <= 0) return; - vector picsize; - float strength_time, invincibility_time, countdown_fontsize; - - picsize = '22 22 0'; - countdown_fontsize = 18; - - pos = bottomright - '34 48 0'; + vector pos, sz; + float strength_time, invincibility_time; //strength strength_time = getstatf(STAT_STRENGTH_FINISHED); - invincibility_time = getstatf(STAT_INVINCIBLE_FINISHED); - if (strength_time) { dt = strength_time - time; + pos = Sbar_ConvertToScreen_PicPosition(stov(cvar_string("hud_item_strength_icon_position")), stov(cvar_string("hud_item_strength_icon_scale"))); + sz = Sbar_ConvertToScreen_PicScale(stov(cvar_string("hud_item_strength_icon_scale"))); if(dt > 0) { if(dt < 5) { - drawpic_expanding_two(pos, "gfx/hud/sb_str", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE, + drawpic_expanding_two(pos, "gfx/hud/sb_str", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE, bound(0, (ceil(dt) - dt) / 0.5, 1)); } else { - drawpic(pos, "gfx/hud/sb_str", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); + drawpic(pos, "gfx/hud/sb_str", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } - Sbar_DrawXNum(pos - '30 -2 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(stov(cvar_string("hud_item_strength_text_position")), ceil(dt), 2, 0, cvar("hud_item_strength_text_scale"), '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } else if(dt > -1) { - drawpic_expanding(pos, "gfx/hud/sb_str", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE, + drawpic_expanding(pos, "gfx/hud/sb_str", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE, bound(0, -dt / 0.5, 1)); } } //invincibility + invincibility_time = getstatf(STAT_INVINCIBLE_FINISHED); if (invincibility_time) { dt = invincibility_time - time; + pos = Sbar_ConvertToScreen_PicPosition(stov(cvar_string("hud_item_invincible_icon_position")), stov(cvar_string("hud_item_invincible_icon_scale"))); + sz = Sbar_ConvertToScreen_PicScale(stov(cvar_string("hud_item_invincible_icon_scale"))); if(dt > 0) { if(dt < 5) { - drawpic_expanding_two(pos - '0 -22 0', "gfx/hud/sb_invinc", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE, + drawpic_expanding_two(pos, "gfx/hud/sb_invinc", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE, bound(0, (ceil(dt) - dt) / 0.5, 1)); } else { - drawpic(pos - '0 -22 0', "gfx/hud/sb_invinc", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); + drawpic(pos, "gfx/hud/sb_invinc", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); } - Sbar_DrawXNum(pos - '30 -24 0', ceil(dt), 2, 0, countdown_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(stov(cvar_string("hud_item_invincible_text_position")), ceil(dt), 2, 0, cvar("hud_item_invincible_text_scale"), '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); } else if(dt > -1) { - drawpic_expanding(pos - '0 -22 0', "gfx/hud/sb_invinc", picsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE, + drawpic_expanding(pos, "gfx/hud/sb_invinc", sz, '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE, bound(0, -dt / 0.5, 1)); } } -- 2.39.2