- //compute and draw top speed
- if (autocvar_hud_panel_physics_topspeed)
- if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 2)
- {
- if (autocvar__hud_configure)
- {
- top_speed = floor( max_speed * 0.75 + 0.5 );
- f = 1;
- }
- else
- {
- if (speed >= top_speed)
- {
- top_speed = speed;
- top_speed_time = time;
- }
- 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 peak
- if(speed < top_speed)
- if(autocvar_hud_panel_physics_progressbar == 1 || autocvar_hud_panel_physics_progressbar == 2)
- {
- float peak_offsetX;
- vector peak_size = '0 0 0';
- if (speed_baralign == 0)
- peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x;
- else if (speed_baralign == 1)
- peak_offsetX = (1 - min(top_speed, max_speed)/max_speed) * panel_size.x;
- else // if (speed_baralign == 2)
- peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x * 0.5;
- 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_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x - peak_offsetX + peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
- }
- else
- drawfill(panel_pos + speed_offset + eX * (peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ // compute and draw top speed
+ if (autocvar_hud_panel_physics_topspeed) {
+ if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 2) {
+ if (autocvar__hud_configure) {
+ top_speed = floor(max_speed * 0.75 + 0.5);
+ f = 1;
+ } else {
+ if (speed >= top_speed) {
+ top_speed = speed;
+ top_speed_time = time;
+ }
+ 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;
+ }