From: Mario Date: Fri, 14 Sep 2018 22:21:42 +0000 (+1000) Subject: Allow customising the view model's transparency, also properly fix weapon transparenc... X-Git-Tag: xonotic-v0.8.5~1867 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f4923001ae5cdd8720930dfaf4ea0b4d063c05bb;p=xonotic%2Fxonotic-data.pk3dir.git Allow customising the view model's transparency, also properly fix weapon transparency when entering/exiting vehicles --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index e873f6453..ff9b47cbc 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -48,6 +48,7 @@ #define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT) float autocvar_cl_viewmodel_scale; +float autocvar_cl_viewmodel_alpha; bool autocvar_cl_bobmodel; float autocvar_cl_bobmodel_speed; @@ -297,12 +298,9 @@ void viewmodel_draw(entity this) if(!this.activeweapon || !autocvar_r_drawviewmodel) return; int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL; - float a = this.alpha; - static bool wasinvehicle; + float a = ((autocvar_cl_viewmodel_alpha) ? bound(-1, autocvar_cl_viewmodel_alpha, this.m_alpha) : this.m_alpha); bool invehicle = player_localentnum > maxclients; if (invehicle) a = -1; - else if (wasinvehicle) a = 1; - wasinvehicle = invehicle; Weapon wep = this.activeweapon; int c = entcs_GetClientColors(current_player); vector g = weaponentity_glowmod(wep, NULL, c, this); diff --git a/qcsrc/common/wepent.qc b/qcsrc/common/wepent.qc index 9488c4c2c..6b1797c66 100644 --- a/qcsrc/common/wepent.qc +++ b/qcsrc/common/wepent.qc @@ -20,7 +20,7 @@ MACRO_END \ PROP(false, m_alpha, WEPENT_SET_NORMAL, \ { WriteByte(chan, rint(bound(-1, 254 * this.m_alpha, 254) - -1)); }, \ - { (viewmodels[this.m_wepent_slot]).alpha = (ReadByte() + -1) / 254; }) \ + { (viewmodels[this.m_wepent_slot]).m_alpha = (ReadByte() + -1) / 254; }) \ \ PROP(false, vortex_charge, WEPENT_SET_NORMAL, \ { WriteByte(chan, this.vortex_charge * 255); }, \ diff --git a/qcsrc/common/wepent.qh b/qcsrc/common/wepent.qh index d6db7745b..556f58194 100644 --- a/qcsrc/common/wepent.qh +++ b/qcsrc/common/wepent.qh @@ -35,6 +35,8 @@ REGISTER_NET_TEMP(CLIENT_WEPENT) .Weapon switchingweapon; .Weapon switchweapon; + .float m_alpha; + // only for Porto .bool angles_held_status; .vector angles_held; diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 32f08fc94..af69bbb21 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -722,6 +722,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 0 "Maximum transparency of the view model, set to 0 to disable" + set debugdraw 0 set debugdraw_filter "" set debugdraw_filterout ""