}
// shift hud if operating in view angle centered mode
- float shift_angle = 0;
+ float shiftangle = 0;
if(mode == STRAFEHUD_MODE_VIEW_CENTERED)
{
- shift_angle = -angle;
- bestangle += shift_angle;
- changeangle += shift_angle;
- opposite_bestangle += shift_angle;
- opposite_changeangle += shift_angle;
+ shiftangle = -angle;
+ bestangle += shiftangle;
+ changeangle += shiftangle;
+ opposite_bestangle += shiftangle;
+ opposite_changeangle += shiftangle;
}
- StrafeHUD_DrawStrafeMeter(
- speed, bestspeed, frictionspeed, shift_angle, wishangle, changeangle, bestangle,
- absolute_bestangle, absolute_prebestangle, opposite_bestangle, opposite_changeangle,
- moving, opposite_direction, direction, hudangle);
+ StrafeHUD_DrawStrafeMeter(shiftangle, wishangle, absolute_bestangle, absolute_prebestangle, moving, hudangle);
float text_offset_top;
float text_offset_bottom;
#include <client/draw.qh>
void StrafeHUD_DrawStrafeMeter(
- float speed, float bestspeed, float frictionspeed, float shift_angle, float wishangle,
- float changeangle, float bestangle, float absolute_bestangle,
- float absolute_prebestangle, float opposite_bestangle,
- float opposite_changeangle, bool moving, bool opposite_direction,
- int direction, float hudangle)
+ float shiftangle, float wishangle, float absolute_bestangle,
+ float absolute_prebestangle, bool moving, float hudangle)
{
// the neutral zone fills the whole strafe bar
if(!moving)
neutral_offsetangle = 360 - current_startangle;
// calculate how far off-center the strafe zones currently are
- shift_angle += neutral_offsetangle / 2 - wishangle;
+ shiftangle += neutral_offsetangle / 2 - wishangle;
// shift strafe zones into correct place
- neutral_startangle += shift_angle;
- accelzone_left_startangle += shift_angle;
- accelzone_right_startangle += shift_angle;
- preaccelzone_left_startangle += shift_angle;
- preaccelzone_right_startangle += shift_angle;
- overturn_startangle += shift_angle;
+ neutral_startangle += shiftangle;
+ accelzone_left_startangle += shiftangle;
+ accelzone_right_startangle += shiftangle;
+ preaccelzone_left_startangle += shiftangle;
+ preaccelzone_right_startangle += shiftangle;
+ overturn_startangle += shiftangle;
// draw left acceleration zone
StrafeHUD_drawStrafeHUD(
// bound to HUD area
angle = bound(-hudangle / 2, angle, hudangle / 2);
- angle = StrafeHUD_projectAngle(angle, hudangle, false);
float offset = StrafeHUD_angleToOffset(angle, hudangle);
+ offset = StrafeHUD_projectOffset(offset, hudangle, false);
StrafeHUD_DrawAngleIndicatorLine(line_size, offset, num_dashes, color, alpha);
void StrafeHUD_DrawAngleIndicatorLine(vector, float, int, vector, float);
void StrafeHUD_DrawAngleIndicatorArrow(float, float, vector, vector, float, bool);
void StrafeHUD_DrawDirectionIndicator(int, bool, bool);
-void StrafeHUD_DrawStrafeMeter(
- float, float, float, float, float, float, float,
- float, float, float, float, bool, bool, int, float);
+void StrafeHUD_DrawStrafeMeter(float, float, float, float, bool, float);
return ratio;
}
-float StrafeHUD_projectAngle(float angle, float range, bool reverse)
-{
- if(autocvar_hud_panel_strafehud_projection == STRAFEHUD_PROJECTION_LINEAR)
- return angle;
-
- float ratio = (angle % 360) / (range / 2);
- ratio = StrafeHUD_project(ratio, range, reverse);
- angle = ratio * (range / 2);
- return angle;
-}
-
float StrafeHUD_projectOffset(float offset, float range, bool reverse)
{
if(autocvar_hud_panel_strafehud_projection == STRAFEHUD_PROJECTION_LINEAR)
{
float dt_client = input_timelength;
- if(dt_client > .05) // server splits frames longer than 50 ms into two moves
+ if(dt_client > .05) // server splits frames longer than 50 ms into two moves (DarkPlaces behaviour)
dt_client /= 2; // does not ensure frames are smaller than 50 ms, just splits large frames in half, matches server behaviour
// calculate average frametime
float GetLengthUnitFactor(int);
string GetLengthUnit(int);
float StrafeHUD_project(float, float, bool);
-float StrafeHUD_projectAngle(float, float, bool);
float StrafeHUD_projectOffset(float, float, bool);
float StrafeHUD_projectWidth(float, float, float);
float StrafeHUD_angleToWidth(float, float);