From: drjaska Date: Mon, 9 Dec 2024 15:55:37 +0000 (+0200) Subject: ternary golf X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fdrjaska%2Fviewmodel_alpha;p=xonotic%2Fxonotic-data.pk3dir.git ternary golf --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index c6ac393cf..84bf0d4f1 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -294,15 +294,9 @@ void viewmodel_animate(entity this) void viewmodel_draw(entity this) { // alpha calculations - float a = this.m_alpha; - float a_max = min(autocvar_cl_viewmodel_alpha, 1); - float a_min = -1; - if (autocvar_cl_viewmodel_alpha_min) - a_min = max(autocvar_cl_viewmodel_alpha_min, -1); - if (a_min >= a_max) - a = a_max; - else - a = bound(a_min, a, a_max); + 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; int wepskin = this.m_skin;