Xonotic
strafehud.qc File Reference
+ Include dependency graph for strafehud.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

string GetLengthUnit (int length_unit)
 
float GetLengthUnitFactor (int length_unit)
 
void HUD_Panel_DrawStrafeHUD (float offset, float width, vector color, float alpha, int type, int gradientType)
 
void HUD_StrafeHUD ()
 
void HUD_StrafeHUD_Export (int fh)
 
void StrafeHUD_drawGradient (vector color1, vector color2, vector size, float original_width, float offset, float alpha, float gradientOffset, int gradientType)
 
vector StrafeHUD_mixColors (vector color1, vector color2, float ratio)
 

Variables

noref string autocvar_hud_panel_strafehud_bg = "0"
 
noref string autocvar_hud_panel_strafehud_bg_alpha = "0.7"
 
noref string autocvar_hud_panel_strafehud_bg_border = ""
 
noref string autocvar_hud_panel_strafehud_bg_color = ""
 
noref string autocvar_hud_panel_strafehud_bg_color_team = ""
 
noref string autocvar_hud_panel_strafehud_bg_padding = ""
 
noref string autocvar_hud_panel_strafehud_pos = "0.320000 0.570000"
 
noref string autocvar_hud_panel_strafehud_size = "0.360000 0.020000"
 
float demo_angle = -37
 
float demo_direction = 1
 
float demo_time = 0
 
int direction
 
bool fwd = true
 
float hidden_width
 
float startspeed = -1
 
float starttime = 0
 
bool state_fwd = true
 
bool state_fwd_prev = true
 
float state_fwd_time = 0
 
bool state_onground = false
 
float state_onground_time = 0
 
bool state_strafekeys = false
 
float state_strafekeys_time = 0
 
bool turn = false
 
float turnangle
 

Function Documentation

◆ GetLengthUnit()

string GetLengthUnit ( int  length_unit)

Definition at line 873 of file strafehud.qc.

References strcat().

Referenced by HUD_StrafeHUD().

874 {
875  switch(length_unit)
876  {
877  // translator-friendly strings without the initial space
878  default:
879  case 1: return strcat(" ", _("qu"));
880  case 2: return strcat(" ", _("m"));
881  case 3: return strcat(" ", _("km"));
882  case 4: return strcat(" ", _("mi"));
883  case 5: return strcat(" ", _("nmi"));
884  }
885 }
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLengthUnitFactor()

float GetLengthUnitFactor ( int  length_unit)

Definition at line 860 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

861 {
862  switch(length_unit)
863  {
864  default:
865  case 1: return 1.0;
866  case 2: return 0.0254;
867  case 3: return 0.0254 * 0.001;
868  case 4: return 0.0254 * 0.001 * 0.6213711922;
869  case 5: return 0.0254 * 0.001 * 0.5399568035;
870  }
871 }
+ Here is the caller graph for this function:

◆ HUD_Panel_DrawStrafeHUD()

void HUD_Panel_DrawStrafeHUD ( float  offset,
float  width,
vector  color,
float  alpha,
int  type,
int  gradientType 
)

Definition at line 749 of file strafehud.qc.

References autocvar_hud_panel_strafehud_bar_neutral_color, direction, drawfill(), DRAWFLAG_NORMAL, eX, fabs(), hidden_width, HUD_Panel_DrawProgressBar(), max(), min(), panel_pos, panel_size, size, StrafeHUD_drawGradient(), and vector().

Referenced by HUD_StrafeHUD().

750 {
751  float mirror_offset, mirror_width;
753  vector mirror_size = panel_size;
754 
755  float original_width = width;
756  float hiddencolor_width;
757 
758  if(alpha <= 0 && type != 2 || width <= 0) return;
759 
760  if(type == 2 && gradientType == 0) type = 0;
761 
762  if(offset < 0)
763  {
764  mirror_width = min(fabs(offset), width);
765  mirror_offset = panel_size.x + hidden_width - fabs(offset);
766  width += offset;
767  offset = 0;
768  }
769  else
770  {
771  mirror_width = min(offset + width - panel_size.x - hidden_width, width);
772  mirror_offset = max(offset - panel_size.x - hidden_width, 0);
773  }
774  if((offset + width) > panel_size.x)
775  {
776  width = panel_size.x - offset;
777  }
778  if(mirror_offset < 0)
779  {
780  mirror_width += mirror_offset;
781  mirror_offset = 0;
782  }
783  if((mirror_offset + mirror_width) > panel_size.x)
784  {
785  mirror_width = panel_size.x - mirror_offset;
786  }
787 
788  if(width < 0) width = 0;
789  if(mirror_width < 0) mirror_width = 0;
790  hiddencolor_width = original_width - width - mirror_width;
791 
792  if(direction < 0) // swap mirror and non-mirror values if direction points left
793  {
794  offset += mirror_offset;
795  mirror_offset = offset - mirror_offset;
796  offset -= mirror_offset;
797 
798  width += mirror_width;
799  mirror_width = width - mirror_width;
800  width -= mirror_width;
801  }
802 
803  size.x = width;
804  mirror_size.x = mirror_width;
805 
806  switch(type)
807  {
808  default:
809  case 0: // no styling (drawfill)
810  if(mirror_size.x > 0 && mirror_size.y > 0) drawfill(panel_pos + eX * mirror_offset, mirror_size, color, alpha, DRAWFLAG_NORMAL);
811  if(size.x > 0 && size.y > 0) drawfill(panel_pos + eX * offset, size, color, alpha, DRAWFLAG_NORMAL);
812  break;
813 
814  case 1: // progress bar style
815  if(mirror_size.x > 0 && mirror_size.y > 0) HUD_Panel_DrawProgressBar(panel_pos + eX * mirror_offset, mirror_size, "progressbar", 1, 0, 0, color, alpha, DRAWFLAG_NORMAL);
816  if(size.x > 0 && size.y > 0) HUD_Panel_DrawProgressBar(panel_pos + eX * offset, size, "progressbar", 1, 0, 0, color, alpha, DRAWFLAG_NORMAL);
817  break;
818 
819  case 2: // gradient style (types: 1 = left, 2 = right, 3 = both)
820  StrafeHUD_drawGradient(color, autocvar_hud_panel_strafehud_bar_neutral_color, mirror_size, original_width, mirror_offset, alpha, width + (mirror_offset == 0 ? hiddencolor_width : 0), gradientType);
821  StrafeHUD_drawGradient(color, autocvar_hud_panel_strafehud_bar_neutral_color, size, original_width, offset, alpha, (offset == 0 ? hiddencolor_width : 0), gradientType);
822  }
823 }
vector color
float alpha
Definition: items.qc:14
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
Definition: hud.qc:270
vector panel_size
Definition: hud.qh:160
int direction
Definition: strafehud.qc:24
vector size
Definition: csprogsdefs.qc:114
const float DRAWFLAG_NORMAL
Definition: csprogsdefs.qc:317
vector panel_pos
Definition: hud.qh:159
void StrafeHUD_drawGradient(vector color1, vector color2, vector size, float original_width, float offset, float alpha, float gradientOffset, int gradientType)
Definition: strafehud.qc:836
float hidden_width
Definition: strafehud.qc:23
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
vector autocvar_hud_panel_strafehud_bar_neutral_color
Definition: strafehud.qh:12
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_StrafeHUD()

void HUD_StrafeHUD ( )

Definition at line 52 of file strafehud.qc.

References ANIMIMPLICITSTATE_INAIR, autocvar__hud_configure, autocvar__hud_panel_strafehud_demo, autocvar_hud_panel_strafehud, autocvar_hud_panel_strafehud_angle_accel_color, autocvar_hud_panel_strafehud_angle_alpha, autocvar_hud_panel_strafehud_angle_height, autocvar_hud_panel_strafehud_angle_neutral_color, autocvar_hud_panel_strafehud_angle_overturn_color, autocvar_hud_panel_strafehud_angle_width, autocvar_hud_panel_strafehud_antiflicker_angle, autocvar_hud_panel_strafehud_antiflicker_speed, autocvar_hud_panel_strafehud_bar_accel_alpha, autocvar_hud_panel_strafehud_bar_accel_color, autocvar_hud_panel_strafehud_bar_neutral_alpha, autocvar_hud_panel_strafehud_bar_neutral_color, autocvar_hud_panel_strafehud_bar_overturn_alpha, autocvar_hud_panel_strafehud_bar_overturn_color, autocvar_hud_panel_strafehud_direction_alpha, autocvar_hud_panel_strafehud_direction_color, autocvar_hud_panel_strafehud_direction_length, autocvar_hud_panel_strafehud_direction_width, autocvar_hud_panel_strafehud_dynamichud, autocvar_hud_panel_strafehud_jumpheight_color, autocvar_hud_panel_strafehud_jumpheight_fade, autocvar_hud_panel_strafehud_jumpheight_min, autocvar_hud_panel_strafehud_jumpheight_size, autocvar_hud_panel_strafehud_mode, autocvar_hud_panel_strafehud_range, autocvar_hud_panel_strafehud_slickdetector_alpha, autocvar_hud_panel_strafehud_slickdetector_color, autocvar_hud_panel_strafehud_slickdetector_granularity, autocvar_hud_panel_strafehud_slickdetector_height, autocvar_hud_panel_strafehud_slickdetector_range, autocvar_hud_panel_strafehud_startspeed_color, autocvar_hud_panel_strafehud_startspeed_fade, autocvar_hud_panel_strafehud_startspeed_size, autocvar_hud_panel_strafehud_style, autocvar_hud_panel_strafehud_switch_active_alpha, autocvar_hud_panel_strafehud_switch_active_color, autocvar_hud_panel_strafehud_switch_inactive_alpha, autocvar_hud_panel_strafehud_switch_inactive_color, autocvar_hud_panel_strafehud_switch_minspeed, autocvar_hud_panel_strafehud_switch_width, autocvar_hud_panel_strafehud_timeout_air, autocvar_hud_panel_strafehud_timeout_direction, autocvar_hud_panel_strafehud_timeout_ground, autocvar_hud_panel_strafehud_timeout_turn, autocvar_hud_panel_strafehud_unit, autocvar_hud_panel_strafehud_unit_show, autocvar_v_flipped, bound(), cos(), CSQCModel_server2csqc(), csqcplayer, DEG2RAD, demo_angle, demo_direction, demo_time, direction, draw_beginBoldFont, draw_endBoldFont, drawfill(), DRAWFLAG_NORMAL, drawstring_aspect(), entity(), eX, eY, fabs(), ftos_decimals(), fwd, GetLengthUnit(), GetLengthUnitFactor(), GetSpeedUnit(), GetSpeedUnitFactor(), hidden_width, HUD_Panel_DrawBg, HUD_Panel_DrawProgressBar(), HUD_Panel_DrawStrafeHUD(), HUD_Panel_LoadCvars(), HUD_Scale_Disable(), HUD_Scale_Enable(), IS_DEAD, IS_DUCKED, IS_ONGROUND, IS_ONSLICK, isdemo(), max(), min(), MOVE_WORLDONLY, movement, MUTATOR_CALLHOOK, NULL, panel_bg_padding, panel_fg_alpha, panel_pos, panel_size, PHYS_MAXAIRSPEED, PHYS_MAXAIRSTRAFESPEED, PHYS_MAXSPEED, player_localentnum, pow(), Q3SURFACEFLAG_SLICK, race_checkpoint, race_checkpointtime, RAD2DEG, sin(), spectatee_status, speed, startspeed, starttime, state_fwd, state_fwd_prev, state_fwd_time, state_onground, state_onground_time, state_strafekeys, state_strafekeys_time, StrafeHUD_mixColors(), strcat(), time, trace_dphitq3surfaceflags, turn, turnangle, vec2, vectoangles(), vector(), vlen(), and WATERLEVEL_SWIMMING.

53 {
54  entity strafeplayer;
55  bool islocal;
56 
57  // generic hud routines
59  {
62  (autocvar_hud_panel_strafehud == 3 && !MUTATOR_CALLHOOK(HUD_StrafeHUD_showoptional))) return;
63  }
64 
66 
68  {
70  }
71  else
72  {
74  }
75 
77 
79  {
80  panel_pos += '1 1 0' * panel_bg_padding;
81  panel_size -= '2 2 0' * panel_bg_padding;
82  }
83 
84  // find out whether the local csqcmodel entity is valid
85  if(spectatee_status > 0 || isdemo())
86  {
87  islocal = false;
88  strafeplayer = CSQCModel_server2csqc(player_localentnum - 1);
89  }
90  else
91  {
92  islocal = true;
93  strafeplayer = csqcplayer;
94  }
95 
96  // draw strafehud
97  if(csqcplayer && strafeplayer)
98  {
99  // physics
100  bool onground = islocal ? IS_ONGROUND(strafeplayer) : !(strafeplayer.anim_implicit_state & ANIMIMPLICITSTATE_INAIR);
101  bool strafekeys;
102  bool swimming = strafeplayer.waterlevel >= WATERLEVEL_SWIMMING;
103  bool spectating = entcs_GetSpecState(strafeplayer.sv_entnum) == ENTCS_SPEC_PURE;
104  float speed = !autocvar__hud_configure ? vlen(vec2(csqcplayer.velocity)) : 1337; // use local csqcmodel entity for this even when spectating, flickers too much otherwise
105  float maxspeed_crouch_mod = IS_DUCKED(strafeplayer) && !swimming ? .5 : 1;
106  float maxspeed_water_mod = swimming ? .7 : 1; // very simplified water physics, the hud will not work well (and is not supposed to) while swimming
107  float maxspeed_phys = onground ? PHYS_MAXSPEED(strafeplayer) : PHYS_MAXAIRSPEED(strafeplayer);
108  float maxspeed = !autocvar__hud_configure ? maxspeed_phys * maxspeed_crouch_mod * maxspeed_water_mod : 320;
109  float vel_angle = vectoangles(strafeplayer.velocity).y;
110  float view_angle = PHYS_INPUT_ANGLES(strafeplayer).y + 180;
111  float angle;
112  vector movement = PHYS_INPUT_MOVEVALUES(strafeplayer);
113  int keys = STAT(PRESSED_KEYS);
114  int keys_fwd;
115  float wishangle = 0;
116 
117  // HUD
119  float speed_conversion_factor = GetSpeedUnitFactor(autocvar_hud_panel_strafehud_unit);
120  float length_conversion_factor = GetLengthUnitFactor(autocvar_hud_panel_strafehud_unit);
121  int length_decimals = autocvar_hud_panel_strafehud_unit >= 3 && autocvar_hud_panel_strafehud_unit <= 5 ? 6 : 2; // use more decimals when displaying km or miles
122  float antiflicker_angle = bound(0, autocvar_hud_panel_strafehud_antiflicker_angle, 180);
123  float antiflicker_speed = max(0, autocvar_hud_panel_strafehud_antiflicker_speed);
124  float minspeed;
125  float shift_offset = 0;
126  bool straight_overturn = false;
127  bool immobile = speed <= (swimming ? antiflicker_speed : 0);
128  float hudangle;
129  float neutral_offset;
130  float neutral_width;
132  float currentangle_offset;
133  vector currentangle_size = '0 0 0';
134  float bestangle;
135  float odd_bestangle;
136  bool bestangle_anywhere = false;
137  float bestangle_offset;
138  float switch_bestangle_offset;
139  bool odd_angles = false;
140  float odd_bestangle_offset = 0;
141  float switch_odd_bestangle_offset = 0;
142  float bestangle_width;
143  float accelzone_left_offset;
144  float accelzone_right_offset;
145  float accelzone_width;
146  float overturn_offset;
147  float overturn_width;
148  float slickdetector_height;
149  vector direction_size_vertical = '0 0 0';
150  vector direction_size_horizontal = '0 0 0';
151  float range_minangle;
152 
153  // determine whether the player is pressing forwards or backwards keys
154  if(islocal) // if entity is local player
155  {
156  if(movement.x > 0)
157  {
158  keys_fwd = 1;
159  }
160  else if(movement.x < 0)
161  {
162  keys_fwd = -1;
163  }
164  else
165  {
166  keys_fwd = 0;
167  }
168  }
169  else // alternatively determine direction by querying pressed keys
170  {
171  if((keys & KEY_FORWARD) && !(keys & KEY_BACKWARD))
172  {
173  keys_fwd = 1;
174  }
175  else if(!(keys & KEY_FORWARD) && (keys & KEY_BACKWARD))
176  {
177  keys_fwd = -1;
178  }
179  else
180  {
181  keys_fwd = 0;
182  }
183  }
184 
185  // determine player wishdir
186  if(islocal) // if entity is local player
187  {
188  if(movement.x == 0)
189  {
190  if(movement.y < 0)
191  {
192  wishangle = -90;
193  }
194  else if(movement.y > 0)
195  {
196  wishangle = 90;
197  }
198  else
199  {
200  wishangle = 0;
201  }
202  }
203  else
204  {
205  if(movement.y == 0)
206  {
207  wishangle = 0;
208  }
209  else
210  {
211  wishangle = RAD2DEG * atan2(movement.y, movement.x);
212  // wrap the wish angle if it exceeds ±90°
213  if(fabs(wishangle) > 90)
214  {
215  if(wishangle < 0) wishangle += 180;
216  else wishangle -= 180;
217  wishangle = -wishangle;
218  }
219  }
220  }
221  }
222  else // alternatively calculate wishdir by querying pressed keys
223  {
224  if(keys & KEY_FORWARD || keys & KEY_BACKWARD)
225  {
226  wishangle = 45;
227  }
228  else
229  {
230  wishangle = 90;
231  }
232  if(keys & KEY_LEFT)
233  {
234  wishangle *= -1;
235  }
236  else if(!(keys & KEY_RIGHT))
237  {
238  wishangle = 0; // wraps at 180°
239  }
240  }
241 
242  strafekeys = fabs(wishangle) == 90;
243 
244  // determine minimum required angle to display full strafe range
245  range_minangle = fabs(wishangle) % 90; // maximum range is 90 degree
246  if(range_minangle > 45) // minimum angle range is 45
247  {
248  range_minangle = 45 - fabs(wishangle) % 45;
249  }
250  range_minangle = 90 - range_minangle; // calculate value which is never >90 or <45
251  range_minangle *= 2; // multiply to accommodate for both sides of the hud
252 
254  {
256  {
257  hudangle = 90;
258  }
259  else
260  {
261  hudangle = range_minangle; // use minimum angle required if dynamically setting hud angle
262  }
263  }
264  else
265  {
266  hudangle = bound(0, fabs(autocvar_hud_panel_strafehud_range), 360); // limit HUD range to 360 degrees, higher values don't make sense
267  }
268 
269  // detect air strafe turning
270  if(onground != state_onground)
271  {
273  }
274  state_onground = onground;
275 
276  if(strafekeys != state_strafekeys)
277  {
279  }
280  state_strafekeys = strafekeys;
281 
282  if((keys & KEY_FORWARD) || (keys & KEY_BACKWARD) || swimming || autocvar__hud_configure)
283  {
284  turn = false;
285  }
286  else if(onground)
287  {
288  if((time - state_onground_time) >= autocvar_hud_panel_strafehud_timeout_ground) // timeout for strafe jumping in general
289  {
290  turn = false;
291  }
292  }
293  else // air strafe only
294  {
295  if(strafekeys)
296  {
297  if(((time - state_onground_time) >= autocvar_hud_panel_strafehud_timeout_air) || (keys & KEY_JUMP)) // timeout for slick ramps
298  {
299  turn = true; // CPMA turning
300  turnangle = wishangle;
301  }
302  }
303  else if((time - state_strafekeys_time) >= autocvar_hud_panel_strafehud_timeout_turn) // timeout for jumping with strafe keys only
304  {
305  turn = false;
306  }
307  }
308  if(turn)
309  {
310  maxspeed = PHYS_MAXAIRSTRAFESPEED(strafeplayer); // no modifiers here because they don't affect air strafing
311  wishangle = turnangle;
312  }
313 
315 
316  // get current strafing angle ranging from -180° to +180°
318  {
319  if(speed > 0)
320  {
321  // calculate view angle relative to the players current velocity direction
322  angle = vel_angle - view_angle;
323 
324  // if the angle goes above 180° or below -180° wrap it to the opposite side
325  if (angle > 180) angle -= 360;
326  else if(angle < -180) angle += 360;
327 
328  // shift the strafe angle by 180° for hud calculations
329  if(angle < 0) angle += 180;
330  else angle -= 180;
331 
332  // determine whether the player is strafing forwards or backwards
333  // if the player isn't strafe turning use forwards/backwards keys to determine direction
334  if(!strafekeys)
335  {
336  if(keys_fwd > 0)
337  {
338  state_fwd = true;
339  }
340  else if(keys_fwd < 0)
341  {
342  state_fwd = false;
343  }
344  else
345  {
346  state_fwd = fabs(angle) <= 90;
347  }
348  }
349  // otherwise determine by examining the strafe angle
350  else
351  {
352  if(wishangle < 0) // detect direction using wishangle since the direction is not yet set
353  {
354  state_fwd = angle <= -wishangle;
355  }
356  else
357  {
358  state_fwd = angle >= -wishangle;
359  }
360  }
361 
363  {
365  }
367 
368  if((time - state_fwd_time) >= autocvar_hud_panel_strafehud_timeout_direction || speed < maxspeed || (strafekeys && mode == 0)) // timeout when changing between forwards and backwards movement
369  {
370  fwd = state_fwd;
371  }
372 
373  // shift the strafe angle by 180° when strafing backwards
374  if(!fwd)
375  {
376  if(angle < 0) angle += 180;
377  else angle -= 180;
378  }
379 
380  // don't make the angle indicator switch side too much at ±180° if anti flicker is turned on
381  if(angle > (180 - antiflicker_angle) || angle < (-180 + antiflicker_angle))
382  {
383  straight_overturn = true;
384  }
385  }
386  else
387  {
388  angle = 0;
389  }
390  }
391  else // simulate turning for HUD setup
392  {
393  fwd = true;
395  {
396  demo_time = time;
398  if(fabs(demo_angle) >= 55)
399  {
401  }
402  }
403  angle = demo_angle;
404  wishangle = 45 * (demo_angle > 0 ? 1 : -1);
405  }
406 
407  // invert the wish angle when strafing backwards
408  if(!fwd)
409  {
410  wishangle = -wishangle;
411  }
412 
413  // flip angles if v_flipped is enabled
415  {
416  angle = -angle;
417  wishangle = -wishangle;
418  }
419 
420  // determine whether the player is strafing left or right
421  if(wishangle != 0)
422  {
423  direction = wishangle > 0 ? 1 : -1;
424  }
425  else
426  {
427  direction = (angle > antiflicker_angle && angle < (180 - antiflicker_angle)) ? 1 : (angle < -antiflicker_angle && angle > (-180 + antiflicker_angle)) ? -1 : 0;
428  }
429 
430  // best angle to strafe at
431  bestangle = (speed > maxspeed ? acos(maxspeed / speed) : 0) * RAD2DEG * (direction < 0 ? -1 : 1);
432  odd_bestangle = -bestangle - wishangle;
433  bestangle -= wishangle;
434 
435  // various offsets and size calculations of hud indicator elements
436  // how much is hidden by the current hud angle
437  hidden_width = (360 - hudangle) / hudangle * panel_size.x;
438  // current angle
439  currentangle_size.x = max(panel_size.x * autocvar_hud_panel_strafehud_angle_width, 1);
440  if(mode == 0)
441  {
442  currentangle_offset = angle/hudangle * panel_size.x;
443  }
444  else
445  {
446  currentangle_offset = bound(-hudangle/2, angle, hudangle/2)/hudangle * panel_size.x + panel_size.x/2;
447  }
448  currentangle_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_height, 2), 1);
449  // best strafe acceleration angle
450  bestangle_offset = bestangle/hudangle * panel_size.x + panel_size.x/2;
451  switch_bestangle_offset = -bestangle/hudangle * panel_size.x + panel_size.x/2;
452  bestangle_width = max(panel_size.x * autocvar_hud_panel_strafehud_switch_width, 1);
453 
454  if(((angle > -wishangle && direction < 0) || (angle < -wishangle && direction > 0)) && (direction != 0))
455  {
456  odd_angles = true;
457  odd_bestangle_offset = odd_bestangle/hudangle * panel_size.x + panel_size.x/2;
458  switch_odd_bestangle_offset = (odd_bestangle+bestangle*2)/hudangle * panel_size.x + panel_size.x/2;
459  }
460  // direction indicator
461  direction_size_vertical.x = max(panel_size.y * min(autocvar_hud_panel_strafehud_direction_width, .5), 1);
462  direction_size_vertical.y = panel_size.y;
463  direction_size_horizontal.x = max(panel_size.x * min(autocvar_hud_panel_strafehud_direction_length, .5), direction_size_vertical.x);
464  direction_size_horizontal.y = direction_size_vertical.x;
465  // overturn
466  overturn_width = 180/hudangle * panel_size.x;
467 
468  // the neutral zone fills the whole strafe bar
469  if(immobile)
470  {
471  // draw neutral zone
473  {
475  {
476  default:
477  case 0:
479  break;
480 
481  case 1:
483  }
484  }
485  }
486  else
487  {
488  // calculate various zones of the strafe-o-meter
489  accelzone_width = overturn_offset = (90 - fabs(bestangle + wishangle))/hudangle * panel_size.x;
490  accelzone_right_offset = 0;
491  accelzone_left_offset = overturn_offset + overturn_width;
492  neutral_width = 360/hudangle * panel_size.x - accelzone_width*2 - overturn_width;
493  neutral_offset = direction < 0 ? accelzone_left_offset + accelzone_width : -neutral_width;
494 
495  // remove switch indicator width from offset
496  if(direction < 0)
497  {
498  bestangle_offset -= bestangle_width;
499  switch_odd_bestangle_offset -= bestangle_width;
500  }
501  else
502  {
503  switch_bestangle_offset -= bestangle_width;
504  odd_bestangle_offset -= bestangle_width;
505  }
506 
507  // shift hud if operating in view angle centered mode
508  if(mode == 0)
509  {
510  shift_offset = -currentangle_offset;
511  bestangle_offset += shift_offset;
512  switch_bestangle_offset += shift_offset;
513  odd_bestangle_offset += shift_offset;
514  switch_odd_bestangle_offset += shift_offset;
515  }
516  if(direction < 0) shift_offset += -360/hudangle * panel_size.x;
517  // calculate how far off-center the strafe zones currently are
518  shift_offset += (panel_size.x + neutral_width)/2 - wishangle/hudangle * panel_size.x;
519  // shift strafe zones into correct place
520  neutral_offset += shift_offset;
521  accelzone_left_offset += shift_offset;
522  accelzone_right_offset += shift_offset;
523  overturn_offset += shift_offset;
524 
525  // draw left acceleration zone
527 
528  // draw right acceleration zone
530 
531  // draw overturn zone
533 
534  // draw neutral zone
536 
537  if(direction != 0 && direction_size_vertical.x > 0 && autocvar_hud_panel_strafehud_direction_alpha * panel_fg_alpha > 0)
538  {
539  bool indicator_direction = direction < 0;
540  // invert left/right when strafing backwards or when strafing towards the opposite side indicated by the direction variable
541  // if both conditions are true then it's inverted twice hence not inverted at all
542  if(!fwd != odd_angles)
543  {
544  indicator_direction = !indicator_direction;
545  }
546  // draw the direction indicator caps at the sides of the hud
547  // vertical line
548  if(direction_size_vertical.y > 0) drawfill(panel_pos + eX * (indicator_direction ? -direction_size_vertical.x : panel_size.x), direction_size_vertical, autocvar_hud_panel_strafehud_direction_color, autocvar_hud_panel_strafehud_direction_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
549  // top horizontal line
550  drawfill(panel_pos + eX * (indicator_direction ? -direction_size_vertical.x : panel_size.x - direction_size_horizontal.x + direction_size_vertical.x) - eY * direction_size_horizontal.y, direction_size_horizontal, autocvar_hud_panel_strafehud_direction_color, autocvar_hud_panel_strafehud_direction_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
551  // bottom horizontal line
552  drawfill(panel_pos + eX * (indicator_direction ? -direction_size_vertical.x : panel_size.x - direction_size_horizontal.x + direction_size_vertical.x) + eY * panel_size.y, direction_size_horizontal, autocvar_hud_panel_strafehud_direction_color, autocvar_hud_panel_strafehud_direction_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
553  }
554 
555  if(speed >= minspeed) // only draw indicators if minspeed is reached
556  {
557  // draw best angles for acceleration
558  float offset = !odd_angles ? bestangle_offset : odd_bestangle_offset;
559  float switch_offset = !odd_angles ? switch_bestangle_offset : switch_odd_bestangle_offset;
560  // both indicators are inactive if no direction can be determined
563  // draw the switch indicators
565  HUD_Panel_DrawStrafeHUD(offset, bestangle_width, switch_color, switch_alpha * panel_fg_alpha, 0, 0);
566  }
567  }
568 
569  // experimental: slick detector
570  slickdetector_height = panel_size.y * bound(0, autocvar_hud_panel_strafehud_slickdetector_height, 0.5);
571  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
572  {
573  float slicksteps = 90 / pow(2, bound(0, autocvar_hud_panel_strafehud_slickdetector_granularity, 4));
574  bool slickdetected = false;
575 
576  slickdetected = IS_ONSLICK(strafeplayer); // don't need to traceline if already touching slick
577 
578  // traceline into every direction
580  for(float i = 0; i < 360 && !slickdetected; i += slicksteps)
581  {
582  vector slickoffset;
583  float slickrotate;
586  if(i != 0 && i != 180)
587  {
588  for(float j = 0; j < 180 && !slickdetected; j += slicksteps)
589  {
590  slickoffset.x = sin(j * DEG2RAD) * slickrotate;
591  slickoffset.y = cos(j * DEG2RAD) * slickrotate;
592 
593  traceline(strafeplayer.origin, strafeplayer.origin + slickoffset, MOVE_WORLDONLY, NULL);
594  if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) slickdetected = true;
595  }
596  }
597  else
598  {
599  slickoffset.x = slickoffset.y = 0;
600  traceline(strafeplayer.origin, strafeplayer.origin + slickoffset, MOVE_WORLDONLY, NULL);
601  if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK) slickdetected = true;
602  }
603  }
604 
605  // if a traceline hit a slick surface
606  if(slickdetected)
607  {
608  vector slickdetector_size = panel_size;
609  slickdetector_size.y = slickdetector_height;
610  // top horizontal line
612  // bottom horizontal line
614  }
615  }
616 
618  // show speed when crossing the start trigger
620  {
621  float text_alpha = 0;
622  if(race_checkpoint == 254) // checkpoint 254 is the start trigger
623  {
625  {
627  startspeed = speed;
628  }
629  }
630  if(startspeed >= 0)
631  {
632  text_alpha = cos(((time - starttime) / autocvar_hud_panel_strafehud_startspeed_fade) * 90 * DEG2RAD); // fade non-linear like the physics panel does
634  {
635  startspeed = -1;
636  }
637  }
638  if(startspeed >= 0 && text_alpha > 0 && autocvar_hud_panel_strafehud_startspeed_size > 0)
639  {
640  vector startspeed_size = panel_size;
641  startspeed_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_startspeed_size, 5);
642  string speed_unit = GetSpeedUnit(autocvar_hud_panel_strafehud_unit);
643  drawstring_aspect(panel_pos + eY * panel_size.y, strcat(ftos_decimals(startspeed * speed_conversion_factor, 2), autocvar_hud_panel_strafehud_unit_show ? speed_unit : ""), startspeed_size, autocvar_hud_panel_strafehud_startspeed_color, text_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
644  }
645  }
646  else
647  {
648  starttime = 0;
649  startspeed = -1;
650  }
651 
652  // show height achieved by a single jump
654  {
655  static float height_min = 0, height_max = 0; // ground and peak of jump z coordinates
656  static float jumpheight = 0, jumptime = 0; // displayed value and timestamp for fade out
657 
658  // tries to catch kill and spectate but those are not reliable, should just hook to kill/spectate/teleport and reset jump height there
659  if((strafeplayer.velocity.z <= 0 && height_max >= strafeplayer.origin.z) || IS_ONGROUND(strafeplayer) || swimming || IS_DEAD(strafeplayer) || spectating)
660  {
661  height_min = height_max = strafeplayer.origin.z;
662  }
663  else if(strafeplayer.origin.z > height_max)
664  {
665  height_max = strafeplayer.origin.z;
666  jumpheight = (height_max - height_min) * length_conversion_factor;
667 
669  jumptime = time;
670  }
671 
673  {
674  float text_alpha = cos(((time - jumptime) / autocvar_hud_panel_strafehud_jumpheight_fade) * 90 * DEG2RAD); // fade non-linear like the physics panel does
675  vector jumpheight_size = panel_size;
676  jumpheight_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_jumpheight_size, 5);
677  string length_unit = GetLengthUnit(autocvar_hud_panel_strafehud_unit);
678  drawstring_aspect(panel_pos - eY * jumpheight_size.y, strcat(ftos_decimals(jumpheight, length_decimals), autocvar_hud_panel_strafehud_unit_show ? length_unit : ""), jumpheight_size, autocvar_hud_panel_strafehud_jumpheight_color, text_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
679  }
680  }
682 
683  if(speed < (maxspeed + antiflicker_speed) && !immobile)
684  {
685  bestangle_anywhere = true; // moving forward should suffice to gain speed
686  }
687 
688  // draw the actual strafe angle
689  if(!bestangle_anywhere && !immobile) // player gains speed with strafing
690  {
691  if((direction > 0 && (angle >= bestangle || angle <= -(bestangle + wishangle*2))) ||
692  (direction < 0 && (angle <= bestangle || angle >= -(bestangle + wishangle*2))))
694  }
695 
696  if(fabs(angle + wishangle) > 90) // player is overturning
697  {
699  }
700  else if(bestangle_anywhere) // player gains speed without strafing
701  {
703  }
704 
705  if(mode == 0 || straight_overturn)
706  {
707  currentangle_offset = panel_size.x/2;
708  }
709 
710  if(autocvar_hud_panel_strafehud_style == 2 && !immobile)
711  {
712  float moveangle = angle + wishangle;
713  float strafeangle = (bestangle + wishangle) * (direction < 0 ? -1 : 1);
714  float strafe_ratio = 0;
715  if(fabs(moveangle) > 90)
716  {
717  strafe_ratio = -((fabs(moveangle) - 90) / 90);
718  if(strafe_ratio < -1) strafe_ratio = -2 - strafe_ratio;
719  }
720  else
721  {
722  if(moveangle >= strafeangle)
723  {
724  strafe_ratio = 1 - (moveangle - strafeangle) / (90 - strafeangle);
725  }
726  else if(moveangle <= -strafeangle)
727  {
728  strafe_ratio = 1 - (moveangle + strafeangle) / (-90 + strafeangle);
729  }
730  }
731  if(strafe_ratio < 0)
732  {
734  }
735  else
736  {
738  }
739  }
740 
741  if(currentangle_size.x > 0 && currentangle_size.y > 0 && autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha > 0)
742  {
743  drawfill(panel_pos - eY * ((currentangle_size.y - panel_size.y) / 2) + eX * (currentangle_offset - currentangle_size.x/2), currentangle_size, currentangle_color, autocvar_hud_panel_strafehud_angle_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
744  }
745  }
746 }
float autocvar_hud_panel_strafehud_switch_inactive_alpha
Definition: strafehud.qh:28
float autocvar_hud_panel_strafehud_direction_alpha
Definition: strafehud.qh:31
float autocvar_hud_panel_strafehud_bar_accel_alpha
Definition: strafehud.qh:15
float autocvar_hud_panel_strafehud_switch_minspeed
Definition: strafehud.qh:24
#define draw_endBoldFont()
Definition: draw.qh:5
float panel_fg_alpha
Definition: hud.qh:166
#define PHYS_MAXAIRSPEED(s)
Definition: player.qh:130
ERASEABLE string ftos_decimals(float number, int decimals)
converts a number to a string with the indicated number of decimals
Definition: string.qh:450
float DEG2RAD
Definition: csprogsdefs.qc:961
float autocvar_hud_panel_strafehud_timeout_turn
Definition: strafehud.qh:48
float autocvar_hud_panel_strafehud_slickdetector_alpha
Definition: strafehud.qh:37
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
Definition: hud.qc:270
float speed
Definition: subs.qh:41
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
Definition: draw.qc:102
const vector eY
Definition: vector.qh:45
string GetLengthUnit(int length_unit)
Definition: strafehud.qc:873
entity CSQCModel_server2csqc(int i)
Definition: cl_model.qc:314
float state_onground_time
Definition: strafehud.qc:29
float trace_dphitq3surfaceflags
float autocvar_hud_panel_strafehud_angle_width
Definition: strafehud.qh:20
float autocvar_hud_panel_strafehud_angle_height
Definition: strafehud.qh:19
int autocvar_hud_panel_strafehud_style
Definition: strafehud.qh:9
float race_checkpoint
Definition: racetimer.qh:8
bool autocvar__hud_configure
Definition: hud_config.qh:3
#define IS_DUCKED(s)
Definition: player.qh:206
#define draw_beginBoldFont()
Definition: draw.qh:4
bool fwd
Definition: strafehud.qc:34
float autocvar_hud_panel_strafehud_jumpheight_size
Definition: strafehud.qh:45
vector autocvar_hud_panel_strafehud_switch_inactive_color
Definition: strafehud.qh:27
vector panel_size
Definition: hud.qh:160
int direction
Definition: strafehud.qc:24
vector autocvar_hud_panel_strafehud_slickdetector_color
Definition: strafehud.qh:36
entity() spawn
vector autocvar_hud_panel_strafehud_angle_accel_color
Definition: strafehud.qh:22
vector autocvar_hud_panel_strafehud_startspeed_color
Definition: strafehud.qh:40
#define IS_ONGROUND(s)
Definition: movetypes.qh:16
bool autocvar_hud_panel_strafehud_dynamichud
Definition: strafehud.qh:6
void HUD_Scale_Disable()
Definition: hud.qc:83
float autocvar_hud_panel_strafehud_antiflicker_angle
Definition: strafehud.qh:50
float Q3SURFACEFLAG_SLICK
float autocvar_hud_panel_strafehud_range
Definition: strafehud.qh:8
bool state_strafekeys
Definition: strafehud.qc:30
bool autocvar__hud_panel_strafehud_demo
Definition: strafehud.qh:5
float GetLengthUnitFactor(int length_unit)
Definition: strafehud.qc:860
void HUD_Panel_DrawStrafeHUD(float offset, float width, vector color, float alpha, int type, int gradientType)
Definition: strafehud.qc:749
int anim_implicit_state
Definition: animdecide.qh:116
bool state_fwd
Definition: strafehud.qc:35
float autocvar_hud_panel_strafehud_startspeed_size
Definition: strafehud.qh:41
float autocvar_hud_panel_strafehud_switch_width
Definition: strafehud.qh:29
float autocvar_hud_panel_strafehud_bar_neutral_alpha
Definition: strafehud.qh:13
float demo_angle
Definition: strafehud.qc:25
#define HUD_Panel_DrawBg()
Definition: hud.qh:54
float GetSpeedUnitFactor(int speed_unit)
Definition: main.qc:1063
void HUD_Scale_Enable()
Definition: hud.qc:90
float autocvar_hud_panel_strafehud_jumpheight_fade
Definition: strafehud.qh:42
float autocvar_hud_panel_strafehud_direction_width
Definition: strafehud.qh:32
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
bool state_onground
Definition: strafehud.qc:28
vector autocvar_hud_panel_strafehud_jumpheight_color
Definition: strafehud.qh:44
#define NULL
Definition: post.qh:17
#define IS_ONSLICK(s)
Definition: movetypes.qh:19
float autocvar_hud_panel_strafehud_timeout_direction
Definition: strafehud.qh:49
float autocvar_hud_panel_strafehud_slickdetector_height
Definition: strafehud.qh:38
const float DRAWFLAG_NORMAL
Definition: csprogsdefs.qc:317
bool turn
Definition: strafehud.qc:32
vector panel_pos
Definition: hud.qh:159
float hidden_width
Definition: strafehud.qc:23
#define IS_DEAD(s)
Definition: utils.qh:26
float startspeed
Definition: strafehud.qc:39
bool autocvar_v_flipped
Definition: view.qh:70
float player_localentnum
Definition: csprogsdefs.qc:19
float turnangle
Definition: strafehud.qc:33
float autocvar_hud_panel_strafehud_jumpheight_min
Definition: strafehud.qh:43
vector movement
vector(float skel, float bonenum) _skel_get_boneabs_hidden
int autocvar_hud_panel_strafehud
Definition: strafehud.qh:4
float autocvar_hud_panel_strafehud_slickdetector_range
Definition: strafehud.qh:34
float race_checkpointtime
Definition: racetimer.qh:11
float spectatee_status
Definition: main.qh:166
float RAD2DEG
Definition: csprogsdefs.qc:962
const vector eX
Definition: vector.qh:44
float autocvar_hud_panel_strafehud_timeout_ground
Definition: strafehud.qh:47
vector StrafeHUD_mixColors(vector color1, vector color2, float ratio)
Definition: strafehud.qc:825
const int ANIMIMPLICITSTATE_INAIR
Definition: animdecide.qh:132
float demo_time
Definition: strafehud.qc:27
vector autocvar_hud_panel_strafehud_bar_overturn_color
Definition: strafehud.qh:16
string GetSpeedUnit(int speed_unit)
Definition: main.qc:1076
const int WATERLEVEL_SWIMMING
Definition: movetypes.qh:13
float autocvar_hud_panel_strafehud_direction_length
Definition: strafehud.qh:33
#define MUTATOR_CALLHOOK(id,...)
Definition: base.qh:140
#define PHYS_MAXAIRSTRAFESPEED(s)
Definition: player.qh:131
#define vec2(...)
Definition: vector.qh:90
float autocvar_hud_panel_strafehud_angle_alpha
Definition: strafehud.qh:18
float autocvar_hud_panel_strafehud_switch_active_alpha
Definition: strafehud.qh:26
bool state_fwd_prev
Definition: strafehud.qc:36
float autocvar_hud_panel_strafehud_bar_overturn_alpha
Definition: strafehud.qh:17
vector autocvar_hud_panel_strafehud_angle_neutral_color
Definition: strafehud.qh:21
entity csqcplayer
Definition: cl_player.qh:26
vector autocvar_hud_panel_strafehud_bar_neutral_color
Definition: strafehud.qh:12
float autocvar_hud_panel_strafehud_antiflicker_speed
Definition: strafehud.qh:51
vector autocvar_hud_panel_strafehud_direction_color
Definition: strafehud.qh:30
int autocvar_hud_panel_strafehud_mode
Definition: strafehud.qh:7
float state_strafekeys_time
Definition: strafehud.qc:31
float MOVE_WORLDONLY
float time
Definition: csprogsdefs.qc:16
vector autocvar_hud_panel_strafehud_switch_active_color
Definition: strafehud.qh:25
float starttime
Definition: strafehud.qc:38
#define PHYS_MAXSPEED(s)
Definition: player.qh:132
float state_fwd_time
Definition: strafehud.qc:37
vector autocvar_hud_panel_strafehud_angle_overturn_color
Definition: strafehud.qh:23
bool autocvar_hud_panel_strafehud_unit_show
Definition: strafehud.qh:11
int autocvar_hud_panel_strafehud_unit
Definition: strafehud.qh:10
float autocvar_hud_panel_strafehud_startspeed_fade
Definition: strafehud.qh:39
void HUD_Panel_LoadCvars()
Definition: hud.qc:216
vector autocvar_hud_panel_strafehud_bar_accel_color
Definition: strafehud.qh:14
int autocvar_hud_panel_strafehud_slickdetector_granularity
Definition: strafehud.qh:35
float panel_bg_padding
Definition: hud.qh:171
float demo_direction
Definition: strafehud.qc:26
float autocvar_hud_panel_strafehud_timeout_air
Definition: strafehud.qh:46
+ Here is the call graph for this function:

◆ HUD_StrafeHUD_Export()

void HUD_StrafeHUD_Export ( int  fh)

Definition at line 18 of file strafehud.qc.

19 {
20  // allow saving cvars that aesthetically change the panel into hud skin files
21 }

◆ StrafeHUD_drawGradient()

void StrafeHUD_drawGradient ( vector  color1,
vector  color2,
vector  size,
float  original_width,
float  offset,
float  alpha,
float  gradientOffset,
int  gradientType 
)

Definition at line 836 of file strafehud.qc.

References autocvar_hud_panel_strafehud_bar_neutral_alpha, bound(), drawfill(), DRAWFLAG_NORMAL, eX, panel_pos, size, StrafeHUD_mixColors(), and vector().

Referenced by HUD_Panel_DrawStrafeHUD().

837 {
838  float color_ratio, alpha1, alpha2;
839  vector gradient_size = size;
840  alpha1 = bound(0, alpha, 1);
842  if((alpha1+alpha2) == 0) return;
843  color_ratio = alpha1/(alpha1+alpha2);
844  for(int i = 0; i < size.x; ++i)
845  {
846  float ratio, alpha_ratio, combine_ratio1, combine_ratio2;
847  gradient_size.x = size.x - i < 1 ? size.x - i : 1;
848  ratio = (i + gradientOffset) / original_width * (gradientType == 3 ? 2 : 1);
849  if(ratio > 1) ratio = 2 - ratio;
850  if(gradientType != 2) ratio = 1 - ratio;
851  alpha_ratio = alpha1 - (alpha1 - alpha2) * ratio;
852  combine_ratio1 = ratio*(1-color_ratio);
853  combine_ratio2 = (1-ratio)*color_ratio;
854  ratio = (combine_ratio1 + combine_ratio2) == 0 ? 1 : combine_ratio1/(combine_ratio1 + combine_ratio2);
855  if(alpha_ratio > 0) drawfill(panel_pos + eX * (offset + i), gradient_size, StrafeHUD_mixColors(color1, color2, ratio), alpha_ratio, DRAWFLAG_NORMAL);
856  }
857 }
float alpha
Definition: items.qc:14
vector size
Definition: csprogsdefs.qc:114
float autocvar_hud_panel_strafehud_bar_neutral_alpha
Definition: strafehud.qh:13
const float DRAWFLAG_NORMAL
Definition: csprogsdefs.qc:317
vector panel_pos
Definition: hud.qh:159
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const vector eX
Definition: vector.qh:44
vector StrafeHUD_mixColors(vector color1, vector color2, float ratio)
Definition: strafehud.qc:825
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StrafeHUD_mixColors()

vector StrafeHUD_mixColors ( vector  color1,
vector  color2,
float  ratio 
)

Definition at line 825 of file strafehud.qc.

References vector().

Referenced by HUD_StrafeHUD(), and StrafeHUD_drawGradient().

826 {
827  vector mixedColor;
828  if(ratio <= 0) return color1;
829  if(ratio >= 1) return color2;
830  mixedColor.x = color1.x + (color2.x - color1.x) * ratio;
831  mixedColor.y = color1.y + (color2.y - color1.y) * ratio;
832  mixedColor.z = color1.z + (color2.z - color1.z) * ratio;
833  return mixedColor;
834 }
vector(float skel, float bonenum) _skel_get_boneabs_hidden
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ autocvar_hud_panel_strafehud_bg

noref string autocvar_hud_panel_strafehud_bg = "0"

Definition at line 45 of file strafehud.qc.

◆ autocvar_hud_panel_strafehud_bg_alpha

noref string autocvar_hud_panel_strafehud_bg_alpha = "0.7"

Definition at line 48 of file strafehud.qc.

◆ autocvar_hud_panel_strafehud_bg_border

noref string autocvar_hud_panel_strafehud_bg_border = ""

Definition at line 49 of file strafehud.qc.

◆ autocvar_hud_panel_strafehud_bg_color

noref string autocvar_hud_panel_strafehud_bg_color = ""

Definition at line 46 of file strafehud.qc.

◆ autocvar_hud_panel_strafehud_bg_color_team

noref string autocvar_hud_panel_strafehud_bg_color_team = ""

Definition at line 47 of file strafehud.qc.

◆ autocvar_hud_panel_strafehud_bg_padding

noref string autocvar_hud_panel_strafehud_bg_padding = ""

Definition at line 50 of file strafehud.qc.

◆ autocvar_hud_panel_strafehud_pos

noref string autocvar_hud_panel_strafehud_pos = "0.320000 0.570000"

Definition at line 43 of file strafehud.qc.

◆ autocvar_hud_panel_strafehud_size

noref string autocvar_hud_panel_strafehud_size = "0.360000 0.020000"

Definition at line 44 of file strafehud.qc.

◆ demo_angle

float demo_angle = -37

Definition at line 25 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ demo_direction

float demo_direction = 1

Definition at line 26 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ demo_time

float demo_time = 0

Definition at line 27 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ direction

◆ fwd

bool fwd = true

Definition at line 34 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ hidden_width

float hidden_width

Definition at line 23 of file strafehud.qc.

Referenced by HUD_Panel_DrawStrafeHUD(), and HUD_StrafeHUD().

◆ startspeed

float startspeed = -1

Definition at line 39 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ starttime

◆ state_fwd

bool state_fwd = true

Definition at line 35 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ state_fwd_prev

bool state_fwd_prev = true

Definition at line 36 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ state_fwd_time

float state_fwd_time = 0

Definition at line 37 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ state_onground

bool state_onground = false

Definition at line 28 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ state_onground_time

float state_onground_time = 0

Definition at line 29 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ state_strafekeys

bool state_strafekeys = false

Definition at line 30 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ state_strafekeys_time

float state_strafekeys_time = 0

Definition at line 31 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ turn

bool turn = false

Definition at line 32 of file strafehud.qc.

Referenced by HUD_StrafeHUD().

◆ turnangle

float turnangle

Definition at line 33 of file strafehud.qc.

Referenced by HUD_StrafeHUD().