void HUD_Physics_Init()
{
// find out whether the local csqcmodel entity is valid
- if(spectatee_status > 0 || isdemo())
+ if (spectatee_status > 0 || isdemo())
{
islocal = false;
strafeplayer = CSQCModel_server2csqc(player_localentnum - 1);
strafeplayer = csqcplayer;
}
- if(csqcplayer && strafeplayer)
- csqc_and_strafe_player = true;
- else
- {
- csqc_and_strafe_player = false;
- // Since both huds return (essentially) when this is false, no variables beyond this point need to be computed
- return;
- }
+ csqc_and_strafe_player = (csqcplayer && strafeplayer);
+ if (!csqc_and_strafe_player)
+ return; // Since both huds return (essentially) when this is false, no variables beyond this point need to be computed
predicted = csqcplayer_status == CSQCPLAYERSTATUS_PREDICTED;
keys = STAT(PRESSED_KEYS);
// try to ignore if track_canjump is enabled, doesn't work in spectator mode if spectated player uses +jetpack or cl_movement_track_canjump
jumpheld = false;
- if(islocal)
+ if (islocal)
{
- if((PHYS_INPUT_BUTTON_JUMP(strafeplayer) || PHYS_INPUT_BUTTON_JETPACK(strafeplayer)) && !PHYS_CL_TRACK_CANJUMP(strafeplayer))
+ if ((PHYS_INPUT_BUTTON_JUMP(strafeplayer) || PHYS_INPUT_BUTTON_JETPACK(strafeplayer)) && !PHYS_CL_TRACK_CANJUMP(strafeplayer))
jumpheld = true;
}
else
{
- if((keys & KEY_JUMP) && !PHYS_TRACK_CANJUMP(strafeplayer))
+ if ((keys & KEY_JUMP) && !PHYS_TRACK_CANJUMP(strafeplayer))
jumpheld = true;
}
view_angle = PHYS_INPUT_ANGLES(strafeplayer).y;
airstopaccel = PHYS_AIRSTOPACCELERATE(strafeplayer);
- if(!airstopaccel)
+ if (!airstopaccel)
airstopaccel = 1; // values of 0 are equivalent to 1
- if(onground)
+ if (onground)
{
- if(friction_phys == 0)
- {
+ if (friction_phys == 0)
onslick = true;
- }
else // don't use IS_ONSLICK(), it only works for the local player and only if client prediction is enabled
{
trace_dphitq3surfaceflags = 0;
onground_lasttime = time;
onslick_last = onslick;
}
- else if(jumpheld || swimming)
- {
+ else if (jumpheld || swimming)
onground_lasttime = 0;
- }
strafefriction = onslick ? friction_slick : friction_phys;
alive_player = (!IS_DEAD(strafeplayer) && IS_PLAYER(strafeplayer));
HUD_Panel_DrawBg();
if (panel_bg_padding)
{
- panel_pos += '1 1 0' * panel_bg_padding;
+ panel_pos += '1 1 0' * panel_bg_padding;
panel_size -= '2 2 0' * panel_bg_padding;
}
float panel_ar = panel_size.x / panel_size.y;
vector speed_offset = '0 0 0', accel_offset = '0 0 0';
if (autocvar_hud_panel_physics_force_layout == PHYSICS_LAYOUT_HORIZONTAL
- || (autocvar_hud_panel_physics_force_layout != PHYSICS_LAYOUT_VERTICAL && panel_ar >= 5 && !accel_progressbar_scale))
+ || (autocvar_hud_panel_physics_force_layout != PHYSICS_LAYOUT_VERTICAL && panel_ar >= 5 && !accel_progressbar_scale))
{
panel_size.x *= 0.5;
if (autocvar_hud_panel_physics_flip)
// draw speed
if (!immobile)
- if (autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_BOTH || autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_SPEED)
+ if (autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_BOTH
+ || autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_SPEED)
HUD_Panel_DrawProgressBar(panel_pos + speed_offset, panel_size, "progressbar", speed / max_speed, 0, speed_baralign,
autocvar_hud_progressbar_speed_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
// compute jumpspeed text
float jump_speed_f = 0;
if (autocvar_hud_panel_physics_jumpspeed)
- if (autocvar_hud_panel_physics_text == PHYSICS_TEXT_BOTH || autocvar_hud_panel_physics_text == PHYSICS_TEXT_SPEED)
+ if (autocvar_hud_panel_physics_text == PHYSICS_TEXT_BOTH
+ || autocvar_hud_panel_physics_text == PHYSICS_TEXT_SPEED)
{
text_bits |= BIT(1);
if (autocvar__hud_configure)
// compute and draw topspeed
float top_speed_f = 0;
if (autocvar_hud_panel_physics_topspeed)
- if (autocvar_hud_panel_physics_text == PHYSICS_TEXT_BOTH || autocvar_hud_panel_physics_text == PHYSICS_TEXT_SPEED)
+ if (autocvar_hud_panel_physics_text == PHYSICS_TEXT_BOTH
+ || autocvar_hud_panel_physics_text == PHYSICS_TEXT_SPEED)
{
text_bits |= BIT(0);
if (autocvar__hud_configure)
if (top_speed_f > 0)
{
if (speed < top_speed)
- if (autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_BOTH || autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_SPEED)
+ if (autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_BOTH
+ || autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_SPEED)
{
float peak_offsetX;
vector peak_size = '0 0 0';
}
// draw speed text
- if (autocvar_hud_panel_physics_text == PHYSICS_TEXT_BOTH || autocvar_hud_panel_physics_text == PHYSICS_TEXT_SPEED)
+ if (autocvar_hud_panel_physics_text == PHYSICS_TEXT_BOTH
+ || autocvar_hud_panel_physics_text == PHYSICS_TEXT_SPEED)
{
tmp_size.x = panel_size.x * speed_size;
tmp_size.y = panel_size.y * text_scale;
// draw acceleration
if (accel)
- if (autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_BOTH || autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_ACCEL)
+ if (autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_BOTH
+ || autocvar_hud_panel_physics_progressbar == PHYSICS_PROGRESSBAR_ACCEL)
{
vector progressbar_color;
if (accel < 0)
}
// draw acceleration text
- if (autocvar_hud_panel_physics_text == PHYSICS_TEXT_BOTH || autocvar_hud_panel_physics_text == PHYSICS_TEXT_ACCEL)
+ if (autocvar_hud_panel_physics_text == PHYSICS_TEXT_BOTH
+ || autocvar_hud_panel_physics_text == PHYSICS_TEXT_ACCEL)
{
tmp_size.x = panel_size.x;
tmp_size.y = panel_size.y * text_scale;