From: Mario Date: Thu, 26 Mar 2020 13:48:57 +0000 (+1000) Subject: If the weapon's animation was invalid, reset it to idle, also default to the idle... X-Git-Tag: xonotic-v0.8.5~1144^2~3^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bab35c76347fecb0d3e719b2876681b6311d5459;p=xonotic%2Fxonotic-data.pk3dir.git 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 --- 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; }