From: Mario Date: Tue, 27 Aug 2019 04:16:37 +0000 (+1000) Subject: Update weapon skin with CSQC X-Git-Tag: xonotic-v0.8.5~1365 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3b4ecdd4afd99573627e610610dc3908f1003c0b;p=xonotic%2Fxonotic-data.pk3dir.git Update weapon skin with CSQC --- 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); }