]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Viewmodels: fix spectating
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 2 Nov 2015 07:05:11 +0000 (18:05 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 2 Nov 2015 07:05:11 +0000 (18:05 +1100)
qcsrc/common/weapons/all.qc
qcsrc/server/cl_client.qc
qcsrc/server/weapons/weaponsystem.qc

index 854fa93a09816447aa6bf13d1c9b8798803099fb..b408ee15737e44c105fec28e2d16366086d3c096 100644 (file)
@@ -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
 
index 6746627ab55c21fb6b82d3af82c52cec3852ebd0..fdfdedfe732c9490df3fe0572e36b68039b71b58 100644 (file)
@@ -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));
index 189a619e57279fe18711da60fb4028fb2aebd7ab..d35492473111ed05107dc22cf7704833db160858 100644 (file)
@@ -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;