From 3b4ecdd4afd99573627e610610dc3908f1003c0b Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 27 Aug 2019 14:16:37 +1000 Subject: [PATCH] Update weapon skin with CSQC --- qcsrc/client/view.qc | 2 ++ qcsrc/common/wepent.qc | 4 ++++ qcsrc/common/wepent.qh | 2 ++ qcsrc/server/weapons/weaponsystem.qc | 1 + 4 files changed, 9 insertions(+) diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 7385b4c3a..744c54792 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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; diff --git a/qcsrc/common/wepent.qc b/qcsrc/common/wepent.qc index 9193c4ef1..38ef3bd1f 100644 --- a/qcsrc/common/wepent.qc +++ b/qcsrc/common/wepent.qc @@ -73,6 +73,10 @@ MACRO_END PROP(false, clip_size, WEPENT_SET_NORMAL, \ { 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(); }) \ \ /**/ diff --git a/qcsrc/common/wepent.qh b/qcsrc/common/wepent.qh index 556f58194..6d7128c33 100644 --- a/qcsrc/common/wepent.qh +++ b/qcsrc/common/wepent.qh @@ -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; diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index b75881127..19ba40aa0 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -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); } -- 2.39.2