]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement cl_viewmodel_alpha_min cvar
authorDr. Jaska <drjaska83@gmail.com>
Thu, 2 Jan 2025 23:31:25 +0000 (23:31 +0000)
committerDr. Jaska <drjaska83@gmail.com>
Thu, 2 Jan 2025 23:31:25 +0000 (23:31 +0000)
qcsrc/client/view.qc
xonotic-client.cfg

index 261fd1b01149392e106e1b2e56b5bb15b6b1e5a2..84bf0d4f11fbc29c7c3fe64df35ce6d0736a94de 100644 (file)
@@ -41,6 +41,7 @@
 #include <lib/warpzone/common.qh>
 
 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;
index 58c29f8b93c3b1c27a5ac0455d43e3e12512c03d..769d43e80ec0eaf0a9905a792e04409104a0c2ce 100644 (file)
@@ -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 ""