]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow customising the view model's transparency, also properly fix weapon transparenc...
authorMario <zacjardine@y7mail.com>
Fri, 14 Sep 2018 22:21:42 +0000 (08:21 +1000)
committerMario <zacjardine@y7mail.com>
Fri, 14 Sep 2018 22:21:42 +0000 (08:21 +1000)
qcsrc/client/view.qc
qcsrc/common/wepent.qc
qcsrc/common/wepent.qh
xonotic-client.cfg

index e873f64535bd40ca74bb8126e882c92f7085fe64..ff9b47cbcdaa97fb2c7d735bc96167d09b02298b 100644 (file)
@@ -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);
index 9488c4c2c6bc0927a3ba8b30eebeb96baf9a2ccc..6b1797c664e9b38fa36f7eee6d6526d2eea4cd5c 100644 (file)
@@ -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); }, \
index d6db7745b9fe1cc5e1ebc8f0f0edcfca78382214..556f58194f5ed5298d52f0aad3f4e6ca3f046e2a 100644 (file)
@@ -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;
index 32f08fc948bbdf7852ab7ba17f18fca721cd5522..af69bbb2145677c5b05116f215f9ec6c9f44d787 100644 (file)
@@ -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 ""