} ENDS_WITH_CURLY_BRACE
//basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
-void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float lenght_ratio, float vertical, float right_align, vector theColor, float theAlpha, float drawflag)
+void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, float vertical, float baralign, vector theColor, float theAlpha, float drawflag)
{
- if(lenght_ratio <= 0 || !theAlpha)
+ if(length_ratio <= 0 || !theAlpha)
return;
- if(lenght_ratio > 1)
- lenght_ratio = 1;
+ if(length_ratio > 1)
+ length_ratio = 1;
vector square;
vector width, height;
pic = "gfx/hud/default/statusbar_vertical";
}
- if (right_align)
- theOrigin_y += (1 - lenght_ratio) * theSize_y;
- theSize_y *= lenght_ratio;
+ if (baralign == 1) // bottom align
+ theOrigin_y += (1 - length_ratio) * theSize_y;
+ else if (baralign == 2) // center align
+ theOrigin_y += 0.5 * (1 - length_ratio) * theSize_y;
+ theSize_y *= length_ratio;
vector bH;
width = eX * theSize_x;
pic = "gfx/hud/default/statusbar";
}
- if (right_align)
- theOrigin_x += (1 - lenght_ratio) * theSize_x;
- theSize_x *= lenght_ratio;
+ if (baralign == 1) // right align
+ theOrigin_x += (1 - length_ratio) * theSize_x;
+ else if (baralign == 2) // center align
+ theOrigin_x += 0.5 * (1 - length_ratio) * theSize_x;
+ theSize_x *= length_ratio;
vector bW;
width = eX * theSize_x;
if(!autocvar_hud_panel_weapons) return;
if(spectatee_status == -1) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_WEAPONS;
+
+ hud_configure_active_panel = HUD_PANEL_WEAPONS;
float timeout = autocvar_hud_panel_weapons_timeout;
float timeout_effect_length, timein_effect_length;
if(!autocvar_hud_panel_ammo) return;
if(spectatee_status == -1) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_AMMO;
+
+ hud_configure_active_panel = HUD_PANEL_AMMO;
HUD_Panel_UpdateCvars(ammo);
vector pos, mySize;
}
else
{
- hud_configure_active_panel = HUD_PANEL_POWERUPS;
-
strength_time = 15;
shield_time = 27;
}
+ hud_configure_active_panel = HUD_PANEL_POWERUPS;
+
HUD_Panel_UpdateCvars(powerups);
vector pos, mySize;
pos = panel_pos;
}
else
{
- hud_configure_active_panel = HUD_PANEL_HEALTHARMOR;
-
health = 150;
armor = 75;
fuel = 20;
}
+ hud_configure_active_panel = HUD_PANEL_HEALTHARMOR;
+
HUD_Panel_UpdateCvars(healtharmor);
vector pos, mySize;
pos = panel_pos;
{
if(!autocvar_hud_panel_notify) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_NOTIFY;
+
+ hud_configure_active_panel = HUD_PANEL_NOTIFY;
HUD_Panel_UpdateCvars(notify);
vector pos, mySize;
{
if(!autocvar_hud_panel_timer) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_TIMER;
+
+ hud_configure_active_panel = HUD_PANEL_TIMER;
HUD_Panel_UpdateCvars(timer);
vector pos, mySize;
if (autocvar_hud_panel_radar == 0) return;
if (autocvar_hud_panel_radar != 2 && !teamplay) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_RADAR;
+
+ hud_configure_active_panel = HUD_PANEL_RADAR;
HUD_Panel_UpdateCvars(radar);
vector pos, mySize;
{
if(!autocvar_hud_panel_score) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_SCORE;
+
+ hud_configure_active_panel = HUD_PANEL_SCORE;
HUD_Panel_UpdateCvars(score);
vector pos, mySize;
if(!(gametype == GAME_RACE || gametype == GAME_CTS)) return;
if(spectatee_status == -1) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_RACETIMER;
+
+ hud_configure_active_panel = HUD_PANEL_RACETIMER;
HUD_Panel_UpdateCvars(racetimer);
vector pos, mySize;
}
else
{
- hud_configure_active_panel = HUD_PANEL_VOTE;
-
vote_yescount = 3;
vote_nocount = 2;
vote_needed = 4;
}
+ hud_configure_active_panel = HUD_PANEL_VOTE;
+
string s;
float a;
if(vote_active != vote_prev) {
void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, float layout, float i)
{
- float dom_pps, dom_pps_ratio;
+ float stat, pps_ratio;
string pic;
vector color;
switch(i)
{
case 0:
- dom_pps = dom_pps_red;
+ stat = getstatf(STAT_DOM_PPS_RED);
pic = "dom_icon_red";
color = '1 0 0';
break;
case 1:
- dom_pps = dom_pps_blue;
+ stat = getstatf(STAT_DOM_PPS_BLUE);
pic = "dom_icon_blue";
color = '0 0 1';
break;
case 2:
- dom_pps = dom_pps_yellow;
+ stat = getstatf(STAT_DOM_PPS_YELLOW);
pic = "dom_icon_yellow";
color = '1 1 0';
break;
case 3:
- dom_pps = dom_pps_pink;
+ stat = getstatf(STAT_DOM_PPS_PINK);
pic = "dom_icon_pink";
color = '1 0 1';
}
- dom_pps_ratio = dom_pps / dom_total_pps;
+ pps_ratio = stat / getstatf(STAT_DOM_TOTAL_PPS);
if(mySize_x/mySize_y > aspect_ratio)
{
if (layout) // show text too
{
//draw the text
- color *= 0.5 + dom_pps_ratio * (1 - 0.5); // half saturated color at min, full saturated at max
+ color *= 0.5 + pps_ratio * (1 - 0.5); // half saturated color at min, full saturated at max
if (layout == 2) // average pps
- drawstring_aspect(myPos + eX * mySize_y, ftos_decimals(dom_pps, 2), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(myPos + eX * mySize_y, ftos_decimals(stat, 2), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
else // percentage of average pps
- drawstring_aspect(myPos + eX * mySize_y, strcat( ftos(floor(dom_pps_ratio*100 + 0.5)), "%" ), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(myPos + eX * mySize_y, strcat( ftos(floor(pps_ratio*100 + 0.5)), "%" ), eX * (2/3) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
}
//draw the icon
drawpic_aspect_skin(myPos, pic, '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- if (dom_pps > 0)
+ if (stat > 0)
{
- drawsetcliparea(myPos_x, myPos_y + mySize_y * (1 - dom_pps_ratio), mySize_y, mySize_y * dom_pps_ratio);
+ drawsetcliparea(myPos_x, myPos_y + mySize_y * (1 - pps_ratio), mySize_y, mySize_y * pps_ratio);
drawpic_aspect_skin(myPos, strcat(pic, "-highlighted"), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawresetcliparea();
}
if(tm.team != COLOR_SPECTATOR)
++teams_count;
- float layout = cvar("hud_panel_modicons_dom_layout");
+ float layout = autocvar_hud_panel_modicons_dom_layout;
float rows, columns, aspect_ratio;
rows = mySize_y/mySize_x;
aspect_ratio = (layout) ? 3 : 1;
if(!autocvar_hud_panel_modicons) return;
if (gametype != GAME_CTF && gametype != GAME_KEYHUNT && gametype != GAME_NEXBALL && gametype != GAME_CTS && gametype != GAME_RACE && gametype != GAME_CA && gametype != GAME_FREEZETAG && gametype != GAME_KEEPAWAY && gametype != GAME_DOMINATION) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_MODICONS;
+
+ hud_configure_active_panel = HUD_PANEL_MODICONS;
HUD_Panel_UpdateCvars(modicons);
vector pos, mySize;
if(!autocvar_hud_panel_pressedkeys) return;
if(spectatee_status <= 0 && autocvar_hud_panel_pressedkeys < 2) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_PRESSEDKEYS;
+ hud_configure_active_panel = HUD_PANEL_PRESSEDKEYS;
HUD_Panel_UpdateCvars(pressedkeys);
vector pos, mySize;
return;
}
}
- else
- hud_configure_active_panel = HUD_PANEL_CHAT;
+
+ hud_configure_active_panel = HUD_PANEL_CHAT;
HUD_Panel_UpdateCvars(chat);
{
if(!autocvar_hud_panel_engineinfo) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_ENGINEINFO;
+
+ hud_configure_active_panel = HUD_PANEL_ENGINEINFO;
HUD_Panel_UpdateCvars(engineinfo);
vector pos, mySize;
{
if(!autocvar_hud_panel_infomessages) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_INFOMESSAGES;
+
+ hud_configure_active_panel = HUD_PANEL_INFOMESSAGES;
HUD_Panel_UpdateCvars(infomessages);
vector pos, mySize;
{
if(!autocvar__hud_configure) return;
}
- else
- hud_configure_active_panel = HUD_PANEL_PHYSICS;
+
+ hud_configure_active_panel = HUD_PANEL_PHYSICS;
HUD_Panel_UpdateCvars(physics);
float speed_baralign, acceleration_baralign;
if (autocvar_hud_panel_physics_baralign == 1)
acceleration_baralign = speed_baralign = 1;
+ else if(autocvar_hud_panel_physics_baralign == 4)
+ acceleration_baralign = speed_baralign = 2;
else if (autocvar_hud_panel_physics_flip)
{
acceleration_baralign = (autocvar_hud_panel_physics_baralign == 2);
top_speed = speed;
top_speed_time = time;
}
- if (top_speed == 0) //hide top speed 0, it would be stupid
- f = 0;
- else
+ if (top_speed != 0)
{
f = max(1, autocvar_hud_panel_physics_topspeed_time);
// divide by f to make it start from 1
f = cos( ((time - top_speed_time) / f) * PI/2 );
}
+ else //hide top speed 0, it would be stupid
+ f = 0;
}
if (f > 0)
{
- //top speed progressbar peek
+ //top speed progressbar peak
if(autocvar_hud_panel_physics_progressbar && speed < top_speed)
{
- float peek_offset_x, peek_size_x;
- if (speed_baralign)
- peek_offset_x = (1 - min(top_speed, max_speed)/max_speed) * panel_size_x;
- else
- peek_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x;
+ float peak_offset_x;
+ vector peak_size
+ if (speed_baralign == 0)
+ peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x;
+ else if (speed_baralign == 1)
+ peak_offset_x = (1 - min(top_speed, max_speed)/max_speed) * panel_size_x;
+ else if (speed_baralign == 2)
+ peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x * 0.5;
//if speed is not 0 the speed progressbar already fetched the color
if (speed == 0)
HUD_Panel_GetProgressBarColor(speed);
- peek_size_x = panel_size_x * 0.01;
- drawfill(panel_pos + speed_offset + eX * (peek_offset_x - peek_size_x), eX * peek_size_x + eY * panel_size_y, progressbar_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ peak_size_x = floor(panel_size_x * 0.01 + 1.5);
+ peak_size_y = panel_size_y;
+ if (speed_baralign == 2) // draw two peaks, on both sides
+ {
+ drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x + peak_offset_x - peak_size_x), peak_size, progressbar_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size_x - peak_offset_x + peak_size_x), peak_size, progressbar_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ }
+ else
+ drawfill(panel_pos + speed_offset + eX * (peak_offset_x - peak_size_x), peak_size, progressbar_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
//top speed
else
top_speed = 0;
}
+ print(ftos(f), "\n");
//draw acceleration
if(acceleration && autocvar_hud_panel_physics_progressbar)