#include <lib/warpzone/common.qh>
float autocvar_cl_viewmodel_alpha = 1;
+float autocvar_cl_viewmodel_alpha_while_invisible;
bool autocvar_cl_bobmodel;
float autocvar_cl_bobmodel_speed;
void viewmodel_draw(entity this)
{
int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
- float a = ((autocvar_cl_viewmodel_alpha) ? bound(-1, autocvar_cl_viewmodel_alpha, this.m_alpha) : this.m_alpha);
+ float a;
+ if (this.m_alpha == 1) // check visibility
+ a = bound(-1, autocvar_cl_viewmodel_alpha, this.m_alpha);
+ else
+ if (!autocvar_cl_viewmodel_alpha_while_invisible) // check if unset 0
+ a = bound(-1, autocvar_cl_viewmodel_alpha, this.m_alpha);
+ else
+ a = bound(-1, autocvar_cl_viewmodel_alpha_while_invisible, 1);
int wepskin = this.m_skin;
bool invehicle = player_localentnum > maxclients;
if (invehicle) a = -1;
seta cl_movement_errorcompensation 1 "try to compensate for prediction errors and reduce perceived lag"
seta cl_movement_intermissionrunning 0 "keep velocity after the match ends, players may appear to continue running while stationary"
-seta cl_viewmodel_alpha 1 "Maximum opacity of the view model, use a value between 0 and 1"
+seta cl_viewmodel_alpha 1 "Maximum opacity of the viewmodel, use a value between 0 and 1"
+seta cl_viewmodel_alpha_while_invisible 0 "Overrides the opacity of the viewmodel if invisible; -1 forces invisibility, 0 disables this override, and any value between 0 and 1 enables it with the value as opacity"
set debugdraw 0
set debugdraw_filter ""