From 1b6e0b955486a2ef35603b4b8771e90601979121 Mon Sep 17 00:00:00 2001 From: drjaska Date: Sun, 1 Dec 2024 15:24:15 +0200 Subject: [PATCH] Rework to min and max --- qcsrc/client/view.qc | 12 +++++------- xonotic-client.cfg | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index b07aa5b97..0180f712f 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -41,7 +41,7 @@ #include float autocvar_cl_viewmodel_alpha = 1; -float autocvar_cl_viewmodel_alpha_while_invisible; +float autocvar_cl_viewmodel_alpha_min; bool autocvar_cl_bobmodel; float autocvar_cl_bobmodel_speed; @@ -295,13 +295,11 @@ void viewmodel_draw(entity this) { int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL; float a; - if (this.m_alpha == 1) // check visibility - a = bound(-1, autocvar_cl_viewmodel_alpha, this.m_alpha); + if (autocvar_cl_viewmodel_alpha_min) + a = bound(autocvar_cl_viewmodel_alpha_min, this.m_alpha, autocvar_cl_viewmodel_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); + a = autocvar_cl_viewmodel_alpha; + a = bound(-1, a, 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 4ddd0e2cf..f49685feb 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -806,7 +806,7 @@ seta cl_movement_errorcompensation 1 "try to compensate for prediction errors an 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 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" +seta cl_viewmodel_alpha_min 0 "Minimum opacity of the viewmodel, use a value between 0 and 1" set debugdraw 0 set debugdraw_filter "" -- 2.39.2