From: TimePath Date: Mon, 2 Nov 2015 07:05:11 +0000 (+1100) Subject: Viewmodels: fix spectating X-Git-Tag: xonotic-v0.8.2~1601^2~16 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=93e8a6ec12037127f59cd421d920faf0ec93a413;p=xonotic%2Fxonotic-data.pk3dir.git Viewmodels: fix spectating --- diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 854fa93a0..b408ee157 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -597,7 +597,7 @@ REGISTER_NET_TEMP(wframe, bool isNew) #endif #ifdef SVQC -void wframe_send(entity actor, .entity weaponentity, vector a, bool restartanim) +void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim) { if (!IS_REAL_CLIENT(actor)) return; int channel = MSG_ONE; @@ -607,8 +607,8 @@ void wframe_send(entity actor, .entity weaponentity, vector a, bool restartanim) WriteCoord(channel, a.y); WriteCoord(channel, a.z); WriteByte(channel, restartanim); - WriteByte(channel, actor.(weaponentity).state); - WriteByte(channel, actor.(weaponentity).alpha * 255); + WriteByte(channel, weaponentity.state); + WriteByte(channel, weaponentity.alpha * 255); } #endif diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 6746627ab..fdfdedfe7 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1680,6 +1680,7 @@ void SpectateCopy(entity spectatee) self.switchweapon = spectatee.switchweapon; self.switchingweapon = spectatee.switchingweapon; self.weapon = spectatee.weapon; + self.weapon_nextthink = spectatee.weapon_nextthink; self.vortex_charge = spectatee.vortex_charge; self.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo; self.hagar_load = spectatee.hagar_load; @@ -2342,7 +2343,11 @@ void PlayerPreThink (void) if(frametime) { vector g; - if(self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge)) + if (IS_SPEC(self)) + { + g = self.enemy.weaponentity_glowmod; + } + else if(self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge)) { g.x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit)); g.y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.vortex_charge / WEP_CVAR(vortex, charge_animlimit)); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 189a619e5..d35492473 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -307,7 +307,7 @@ bool weapon_prepareattack(Weapon thiswep, entity actor, .entity weaponentity, bo return false; } -void wframe_send(entity actor, .entity weaponentity, vector a, bool restartanim); +void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim); void weapon_thinkf(entity actor, .entity weaponentity, float fr, float t, void(Weapon thiswep, entity actor, .entity weaponentity, int fire) func) @@ -341,7 +341,9 @@ void weapon_thinkf(entity actor, .entity weaponentity, float fr, float t, void(W else // if (fr == WFRAME_RELOAD) a = actor.(weaponentity).anim_reload; a.z *= g_weaponratefactor; - wframe_send(actor, weaponentity, a, restartanim); + entity e; FOR_EACH_CLIENT(e) if (e == actor || (IS_SPEC(e) && e.enemy == actor)) { + wframe_send(e, actor.(weaponentity), a, restartanim); + } } v_forward = of;