Update weapon skin with CSQC
authorMario <mario@smbclan.net>
Tue, 27 Aug 2019 04:16:37 +0000 (14:16 +1000)
committerMario <mario@smbclan.net>
Tue, 27 Aug 2019 04:16:37 +0000 (14:16 +1000)
qcsrc/client/view.qc
qcsrc/common/wepent.qc
qcsrc/common/wepent.qh
qcsrc/server/weapons/weaponsystem.qc

index 7385b4c..744c547 100644 (file)
@@ -291,6 +291,7 @@ void viewmodel_draw(entity this)
                return;
        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;
        Weapon wep = this.activeweapon;
@@ -304,6 +305,7 @@ void viewmodel_draw(entity this)
        {
                e.drawmask = mask;
                e.alpha = a;
+               e.skin = wepskin;
                e.colormap = 256 + c;  // colormap == 0 is black, c == 0 is white
                e.glowmod = g;
                e.csqcmodel_effects = fx;
index 9193c4e..38ef3bd 100644 (file)
@@ -74,6 +74,10 @@ MACRO_END
        { WriteShort(chan, this.clip_size); }, \
        { (viewmodels[this.m_wepent_slot]).clip_size = ReadShort(); }) \
     \
+    PROP(false, skin, WEPENT_SET_NORMAL, \
+       { WriteShort(chan, this.skin); }, \
+       { (viewmodels[this.m_wepent_slot]).m_skin = ReadShort(); }) \
+    \
        /**/
 
 #ifdef SVQC
index 556f581..6d7128c 100644 (file)
@@ -37,6 +37,8 @@ REGISTER_NET_TEMP(CLIENT_WEPENT)
 
        .float m_alpha;
 
+       .int m_skin;
+
        // only for Porto
        .bool angles_held_status;
        .vector angles_held;
index b758811..19ba40a 100644 (file)
@@ -163,6 +163,7 @@ void CL_ExteriorWeaponentity_Think(entity this)
     Weapon wep = this.owner.(weaponentity).m_weapon;
        if (wep) this.glowmod = weaponentity_glowmod(wep, this.owner, this.owner.clientcolors, this.owner.(weaponentity));
        this.colormap = this.owner.colormap;
+       this.skin = w_ent.skin;
 
        CSQCMODEL_AUTOUPDATE(this);
 }