From 0d85d2fe95c31b8a0b5f85b22b4474d07075cdbe Mon Sep 17 00:00:00 2001 From: FruitieX Date: Mon, 3 May 2010 18:03:07 +0300 Subject: [PATCH] minor cleanups and initial work for vote panel/notify panel --- defaultXonotic.cfg | 27 +++++++----- qcsrc/client/hud.qc | 90 ++++++++++++++++++++++++--------------- qcsrc/common/constants.qh | 2 +- 3 files changed, 73 insertions(+), 46 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index c980f7114..ab9e65dc1 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1336,37 +1336,37 @@ seta hud_inventory_pos "0 -60" "position of this panel" seta hud_inventory_size "200 60" "size of this panel" seta hud_inventory_bg 1 "enable/disable the background of this panel" seta hud_inventory_marigin 30 "size of marigin from the background edges" -seta hud_inventory_color "" "optional R G B vector of the inventory background color, otherwise use hud default" +seta hud_inventory_color "" "optional R G B vector of the panel background color, otherwise use hud default" seta hud_powerups 0 "enable/disable this panel" seta hud_powerups_pos "0 -90" "position of this panel" seta hud_powerups_size "240 90" "size of this panel" seta hud_powerups_bg 1 "enable/disable the background of this panel" seta hud_powerups_marigin 30 "size of marigin from the background edges" -seta hud_powerups_color "" "optional R G B vector of the inventory background color, otherwise use hud default" +seta hud_powerups_color "" "optional R G B vector of the panel background color, otherwise use hud default" seta hud_healtharmor 1 "enable/disable this panel" seta hud_healtharmor_pos "207.5 -37" "position of this panel" seta hud_healtharmor_size "230 37" "size of this panel" seta hud_healtharmor_bg 1 "enable/disable the background of this panel" seta hud_healtharmor_marigin 30 "size of marigin from the background edges" -seta hud_healtharmor_color "" "optional R G B vector of the inventory background color, otherwise use hud default" -seta hud_progressbar_health_color "0.6 0 0" "optional R G B vector of the inventory background color, otherwise use hud default" -seta hud_progressbar_armor_color "0 0.6 0" "optional R G B vector of the inventory background color, otherwise use hud default" +seta hud_healtharmor_color "" "optional R G B vector of the panel background color, otherwise use hud default" +seta hud_progressbar_health_color "0.6 0 0" "R G B vector of the progress bar background color" +seta hud_progressbar_armor_color "0 0.6 0" "R G B vector of the progress bar background color" seta hud_notify 0 "enable/disable this panel" seta hud_notify_pos "-300 -37.5" "position of this base of the panel" seta hud_notify_size "200 37.5" "size of this panel with all notifications on" seta hud_notify_bg 1 "enable/disable the background of this panel" seta hud_notify_marigin 30 "size of marigin from the background edges" -seta hud_notify_color "" "optional R G B vector of the inventory background color, otherwise use hud default" +seta hud_notify_color "" "optional R G B vector of the panel background color, otherwise use hud default" seta hud_timer 1 "enable/disable this panel" seta hud_timer_pos "-180 0" "position of this base of the panel" seta hud_timer_size "180 90" "size of this panel" seta hud_timer_bg 1 "enable/disable the background of this panel" seta hud_timer_marigin 30 "size of marigin from the background edges" -seta hud_timer_color "" "optional R G B vector of the inventory background color, otherwise use hud default" +seta hud_timer_color "" "optional R G B vector of the panel background color, otherwise use hud default" seta hud_timer_increment "show elapsed time instead of remaining time" seta hud_radar 1 "enable/disable this panel" @@ -1374,21 +1374,28 @@ seta hud_radar_pos "0 0" "position of this base of the panel" seta hud_radar_size "230 170" "size of this panel" seta hud_radar_bg 1 "enable/disable the background of this panel" seta hud_radar_marigin 30 "size of marigin from the background edges" -seta hud_radar_color "" "optional R G B vector of the inventory background color, otherwise use hud default" +seta hud_radar_color "" "optional R G B vector of the panel background color, otherwise use hud default" seta hud_score 0 "enable/disable this panel" seta hud_score_pos "-300 -37.5" "position of this base of the panel" seta hud_score_size "200 37.5" "size of this panel" seta hud_score_bg 1 "enable/disable the background of this panel" seta hud_score_marigin 30 "size of marigin from the background edges" -seta hud_score_color "" "optional R G B vector of the inventory background color, otherwise use hud default" +seta hud_score_color "" "optional R G B vector of the panel background color, otherwise use hud default" seta hud_racetimer 0 "enable/disable this panel" seta hud_racetimer_pos "-300 -37.5" "position of this base of the panel" seta hud_racetimer_size "200 37.5" "size of this panel" seta hud_racetimer_bg 0 "enable/disable the background of this panel" seta hud_racetimer_marigin 30 "size of marigin from the background edges" -seta hud_racetimer_color "" "optional R G B vector of the inventory background color, otherwise use hud default" +seta hud_racetimer_color "" "optional R G B vector of the panel background color, otherwise use hud default" + +seta hud_vote 0 "enable/disable this panel" +seta hud_vote_pos "-300 -37.5" "position of this base of the panel" +seta hud_vote_size "200 37.5" "size of this panel" +seta hud_vote_bg 0 "enable/disable the background of this panel" +seta hud_vote_marigin 30 "size of marigin from the background edges" +seta hud_vote_color "" "optional R G B vector of the panel background color, otherwise use hud default" // these should now be deprecated. sbar_info_pos 50 diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index bdd732dae..8088d0699 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -549,6 +549,7 @@ string HUD_Panel_GetName(float id) case 6: return "radar"; break; case 7: return "score"; break; case 8: return "racetimer"; break; + case 9: return "vote"; break; default: return ""; } } @@ -1652,27 +1653,22 @@ void HUD_RaceTimer (void) { drawfont = sbar_font; } - - - - - - // Notification area (#4) -// OH MY GOOODDDDDD this thing is colossal :/ -// TODO -float vote_yescount; -float vote_nocount; -float vote_needed; -float vote_highlighted; // currently selected vote +void HUD_Notify (void) +{ + float marigin; -float vote_active; // is there an active vote? -float vote_prev; // previous state of vote_active to check for a change -float vote_alpha; -float vote_change; // "time" when vote_active changed + vector pos, mySize, color; + marigin = HUD_Panel_GetMarigin(4); + pos = HUD_Panel_GetPos(4); + mySize = HUD_Panel_GetSize(4); + color = HUD_Panel_GetColor(4); -/* -{ + if(HUD_Panel_GetBgActive(4)) + draw_BorderPicture(pos - '1 1 0' * marigin, "gfx/hud/border", mySize + '1 1 0' * 2 * marigin, color, hud_alpha_bg, '1 1 0' * (marigin/MARIGIN_MULTIPLIER)); + + string s; + entity tm; if(spectatee_status && !intermission) { drawfont = sbar_bigfont; @@ -1786,7 +1782,34 @@ float vote_change; // "time" when vote_active changed } } } +} + +// Vote window (#9) +float vote_yescount; +float vote_nocount; +float vote_needed; +float vote_highlighted; // currently selected vote + +float vote_active; // is there an active vote? +float vote_prev; // previous state of vote_active to check for a change +float vote_alpha; +float vote_change; // "time" when vote_active changed +void HUD_VoteWindow(void) +{ + float marigin; + + vector pos, mySize, color; + marigin = HUD_Panel_GetMarigin(9); + pos = HUD_Panel_GetPos(9); + mySize = HUD_Panel_GetSize(9); + color = HUD_Panel_GetColor(9); + + if(HUD_Panel_GetBgActive(9)) + draw_BorderPicture(pos - '1 1 0' * marigin, "gfx/hud/border", mySize + '1 1 0' * 2 * marigin, color, hud_alpha_bg, '1 1 0' * (marigin/MARIGIN_MULTIPLIER)); + + string s; + float a; if(vote_active != vote_prev) { vote_change = time; vote_prev = bound(0, vote_active, 1); @@ -1800,36 +1823,34 @@ float vote_change; // "time" when vote_active changed if(vote_alpha) { a = vote_alpha * bound(cvar_or("hud_vote_alreadyvoted_alpha", 0.75), 1 - vote_highlighted, 1); - vector voteorigin = bottomright - '290 135 0'; - vector votesize = '280 70 0'; - drawpic(voteorigin, "gfx/hud/voteprogress_back", votesize, HUD_GetBgColor(), a * hud_alpha_bg, DRAWFLAG_NORMAL); + drawpic(pos, "gfx/hud/voteprogress_back", mySize, HUD_GetBgColor(), a * hud_alpha_bg, DRAWFLAG_NORMAL); s = "A vote has been called for: "; - drawstring(voteorigin + '0.5 0 0' * votesize_x + '0 0.1 0' * votesize_y - eX * stringwidth(s, FALSE, '6 0 0'), s, '12 12 0', '1 1 1', a * hud_alpha_fg, DRAWFLAG_NORMAL); - s = textShortenToWidth(vote_called_vote, votesize_x * 0.96, '10 0 0', stringwidth_colors); - drawcolorcodedstring(voteorigin + '0.52 0 0' * votesize_x + '0 0.3 0' * votesize_y - eX * stringwidth(s, FALSE, '5 0 0'), s, '10 10 0', a * hud_alpha_fg, DRAWFLAG_NORMAL); + drawstring(pos + '0.5 0 0' * mySize_x + '0 0.1 0' * mySize_y - eX * stringwidth(s, FALSE, '6 0 0'), s, '12 12 0', '1 1 1', a * hud_alpha_fg, DRAWFLAG_NORMAL); + s = textShortenToWidth(vote_called_vote, mySize_x * 0.96, '10 0 0', stringwidth_colors); + drawcolorcodedstring(pos + '0.52 0 0' * mySize_x + '0 0.3 0' * mySize_y - eX * stringwidth(s, FALSE, '5 0 0'), s, '10 10 0', a * hud_alpha_fg, DRAWFLAG_NORMAL); // print the yes/no counts s = strcat("Yes: ", ftos(vote_yescount)); - drawstring(voteorigin + '0 0.6 0' * votesize_y + '0.02 0 0' * votesize_x, s, '12 12 0', eY, a * hud_alpha_fg, DRAWFLAG_NORMAL); + drawstring(pos + '0 0.6 0' * mySize_y + '0.02 0 0' * mySize_x, s, '12 12 0', eY, a * hud_alpha_fg, DRAWFLAG_NORMAL); s = strcat("No: ", ftos(vote_nocount)); - drawstring(voteorigin + '0 0.6 0' * votesize_y + '0.98 0 0' * votesize_x - eX * stringwidth(s, FALSE, '12 0 0'), s, '12 12 0', eX, a * hud_alpha_fg, DRAWFLAG_NORMAL); + drawstring(pos + '0 0.6 0' * mySize_y + '0.98 0 0' * mySize_x - eX * stringwidth(s, FALSE, '12 0 0'), s, '12 12 0', eX, a * hud_alpha_fg, DRAWFLAG_NORMAL); // draw the progress bars - drawsetcliparea(voteorigin_x, voteorigin_y, votesize_x * 0.5 * (vote_yescount/vote_needed), votesize_y); - drawpic(voteorigin, "gfx/hud/voteprogress_prog", votesize, eY, a * hud_alpha_fg, DRAWFLAG_NORMAL); + drawsetcliparea(pos_x, pos_y, mySize_x * 0.5 * (vote_yescount/vote_needed), mySize_y); + drawpic(pos, "gfx/hud/voteprogress_prog", mySize, eY, a * hud_alpha_fg, DRAWFLAG_NORMAL); - drawsetcliparea(voteorigin_x + votesize_x - votesize_x * 0.5 * (vote_nocount/vote_needed), voteorigin_y, votesize_x * 0.5, votesize_y); - drawpic(voteorigin, "gfx/hud/voteprogress_prog", votesize, eX, a * hud_alpha_fg, DRAWFLAG_NORMAL); + drawsetcliparea(pos_x + mySize_x - mySize_x * 0.5 * (vote_nocount/vote_needed), pos_y, mySize_x * 0.5, mySize_y); + drawpic(pos, "gfx/hud/voteprogress_prog", mySize, eX, a * hud_alpha_fg, DRAWFLAG_NORMAL); // draw the highlights if(vote_highlighted == 1) { - drawsetcliparea(voteorigin_x, voteorigin_y, votesize_x * 0.5, votesize_y); - drawpic(voteorigin, "gfx/hud/voteprogress_voted", votesize, eY, a * hud_alpha_fg, DRAWFLAG_NORMAL); + drawsetcliparea(pos_x, pos_y, mySize_x * 0.5, mySize_y); + drawpic(pos, "gfx/hud/voteprogress_voted", mySize, eY, a * hud_alpha_fg, DRAWFLAG_NORMAL); } else if(vote_highlighted == 2) { - drawsetcliparea(voteorigin_x + 0.5 * votesize_x, voteorigin_y, votesize_x * 0.5, votesize_y); - drawpic(voteorigin, "gfx/hud/voteprogress_voted", votesize, eX, a * hud_alpha_fg, DRAWFLAG_NORMAL); + drawsetcliparea(pos_x + 0.5 * mySize_x, pos_y, mySize_x * 0.5, mySize_y); + drawpic(pos, "gfx/hud/voteprogress_voted", mySize, eX, a * hud_alpha_fg, DRAWFLAG_NORMAL); } drawresetcliparea(); @@ -1839,7 +1860,6 @@ float vote_change; // "time" when vote_active changed } } -*/ // Awards system float race_status_time; float race_status_prev; diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 6d5655824..d2915ce21 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -506,4 +506,4 @@ float WATERLEVEL_SUBMERGED = 3; float MAX_SHOT_DISTANCE = 32768; // panel hud constants -float panel_cnt = 9; // NOTE: IDs start from 0! +float panel_cnt = 10; // NOTE: IDs start from 0! -- 2.39.2