seta hud_panel_strafehud_direction_alpha "1" "opacity of the direction caps which indicate the direction the player is currently strafing towards"
seta hud_panel_strafehud_direction_width "0.25" "stroke width of the direction caps which indicate the direction the player is currently strafing towards (relative to the panel height)"
seta hud_panel_strafehud_direction_length "0.02" "length of the horizontal component of the direction caps which indicate the direction the player is currently strafing towards (relative to the panel width)"
+seta hud_panel_strafehud_slickdetector_range "0" "range of the slick detector in qu, \"0\" to disable"
+seta hud_panel_strafehud_slickdetector_granularity "2" "value from 0 to 4 which defines how exact the search for slick should be, higher values may yield better results but require more computation"
+seta hud_panel_strafehud_slickdetector_color "0 1 1" "color of the slick detector indicator"
+seta hud_panel_strafehud_slickdetector_alpha "0.5" "opacity of the slick detector indicator"
+seta hud_panel_strafehud_slickdetector_height "0.125" "height of the slick detector indicator (relative to the panel height)"
seta hud_panel_strafehud_timeout_air "0.1" "time after take off before changing to air strafe physics when not jumping (visually more consistent hud while on slick downwards ramps)"
seta hud_panel_strafehud_timeout_ground "0.03333333" "time after landing before changing to non-air strafe physics (visually more consistent hud while strafe turning when touching the floor after every hop)"
seta hud_panel_strafehud_timeout_turn "0.1" "time after releasing the strafe keys before changing mode (visually more consistent hud while switching between left/right strafe turning)"
float autocvar_hud_panel_strafehud_direction_alpha = 1;
float autocvar_hud_panel_strafehud_direction_width = 0.25;
float autocvar_hud_panel_strafehud_direction_length = 0.02;
+float autocvar_hud_panel_strafehud_slickdetector_range = 0;
+int autocvar_hud_panel_strafehud_slickdetector_granularity = 2;
+vector autocvar_hud_panel_strafehud_slickdetector_color = '0 1 1';
+float autocvar_hud_panel_strafehud_slickdetector_alpha = 0.5;
+float autocvar_hud_panel_strafehud_slickdetector_height = 0.125;
float autocvar_hud_panel_strafehud_timeout_air = 0.1;
float autocvar_hud_panel_strafehud_timeout_ground = 0.03333333;
float autocvar_hud_panel_strafehud_timeout_turn = 0.1;
float accelzone_width;
float overturn_offset;
float overturn_width;
+ float slickdetector_height;
vector direction_size_vertical = '0 0 0';
vector direction_size_horizontal = '0 0 0';
float range_minangle;
}
}
+ slickdetector_height = panel_size.y * bound(0, autocvar_hud_panel_strafehud_slickdetector_height, 0.5);
+ if(autocvar_hud_panel_strafehud_slickdetector_range > 0 && autocvar_hud_panel_strafehud_slickdetector_alpha > 0 && slickdetector_height > 0 && panel_size.x > 0) // dunno if slick detection works in spectate
+ {
+ float slicksteps = 90 / pow(2, bound(0, autocvar_hud_panel_strafehud_slickdetector_granularity, 4));
+ vector slickoffset;
+ bool slickdetected = false;
+
+ slickdetected = IS_ONSLICK(strafeplayer); // don't need to traceline if already touching slick
+
+ // traceline into every direction
+ trace_dphitq3surfaceflags = 0;
+ for(float i = 0; i < 360 && !slickdetected; i += slicksteps)
+ {
+ float slickrotate;
+ slickoffset.z = -cos(i * DEG2RAD) * autocvar_hud_panel_strafehud_slickdetector_range;
+ slickrotate = sin(i * DEG2RAD) * autocvar_hud_panel_strafehud_slickdetector_range;
+ if(i != 0 && i != 180)
+ {
+ for(float j = 0; j < 180 && !slickdetected; j += slicksteps)
+ {
+ slickoffset.x = sin(j * DEG2RAD) * slickrotate;
+ slickoffset.y = cos(j * DEG2RAD) * slickrotate;
+
+ traceline(strafeplayer.origin, strafeplayer.origin + slickoffset, MOVE_WORLDONLY, NULL);
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) slickdetected = true;
+ }
+ }
+ else
+ {
+ slickoffset.x = slickoffset.y = 0;
+ traceline(strafeplayer.origin, strafeplayer.origin + slickoffset, MOVE_WORLDONLY, NULL);
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) slickdetected = true;
+ }
+ }
+
+ // if one traceline hit a slick surface
+ if(slickdetected)
+ {
+ vector slickdetector_size = panel_size;
+ slickdetector_size.y = slickdetector_height;
+ // top horizontal line
+ drawfill(panel_pos - eY * slickdetector_size.y, slickdetector_size, autocvar_hud_panel_strafehud_slickdetector_color, autocvar_hud_panel_strafehud_slickdetector_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ // bottom horizontal line
+ drawfill(panel_pos + eY * panel_size.y, slickdetector_size, autocvar_hud_panel_strafehud_slickdetector_color, autocvar_hud_panel_strafehud_slickdetector_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+ }
+ }
+
if(speed < (maxspeed + antiflicker_speed) && !immobile)
{
bestangle_anywhere = true; // moving forward should suffice to gain speed