From bab35c76347fecb0d3e719b2876681b6311d5459 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Mar 2020 23:48:57 +1000 Subject: [PATCH] If the weapon's animation was invalid, reset it to idle, also default to the idle animation, fixes weapon playing reload animation for a second when re-spawning --- qcsrc/common/weapons/all.qc | 2 +- qcsrc/server/weapons/weaponsystem.qc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index b8d2428f3..a8d1376d1 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -577,10 +577,10 @@ NET_HANDLE(wframe, bool isNew) vector a = '0 0 0'; switch(fr) { + default: case WFRAME_IDLE: a = wepent.anim_idle; break; case WFRAME_FIRE1: a = wepent.anim_fire1; break; case WFRAME_FIRE2: a = wepent.anim_fire2; break; - default: case WFRAME_RELOAD: a = wepent.anim_reload; break; } a.z *= t; diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 59812425d..5f4f6f833 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -366,6 +366,9 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void( bool restartanim; if (fr == WFRAME_DONTCHANGE) { + // this can happen when the weapon entity is newly spawned, since it has a clear state and no previous weapon frame + if (this.wframe == WFRAME_DONTCHANGE) + this.wframe = WFRAME_IDLE; fr = this.wframe; restartanim = false; } -- 2.39.2