From: Dr. Jaska Date: Thu, 2 Jan 2025 23:31:25 +0000 (+0000) Subject: Implement cl_viewmodel_alpha_min cvar X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4640d36571d65e73be32af5803fcc42951eed9ab;p=xonotic%2Fxonotic-data.pk3dir.git Implement cl_viewmodel_alpha_min cvar --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 261fd1b01..84bf0d4f1 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -41,6 +41,7 @@ #include float autocvar_cl_viewmodel_alpha = 1; +float autocvar_cl_viewmodel_alpha_min; bool autocvar_cl_bobmodel; float autocvar_cl_bobmodel_speed; @@ -292,8 +293,12 @@ void viewmodel_animate(entity this) void viewmodel_draw(entity this) { + // alpha calculations + float amax = (autocvar_cl_viewmodel_alpha != 0) ? autocvar_cl_viewmodel_alpha : 1; + float amin = (autocvar_cl_viewmodel_alpha_min != 0) ? autocvar_cl_viewmodel_alpha_min : -1; + float a = (amin >= amax) ? amax : bound(amin, this.m_alpha, amax); + 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); int wepskin = this.m_skin; bool invehicle = player_localentnum > maxclients; if (invehicle) a = -1; diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 58c29f8b9..769d43e80 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -807,7 +807,8 @@ seta cl_forcemyplayercolors 0 "set to the color value (encoding is same as _cl_c 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_min 0 "Minimum opacity of the viewmodel, use a value between 0 and 1" set debugdraw 0 set debugdraw_filter ""