If the weapon's animation was invalid, reset it to idle, also default to the idle...
authorMario <mario.mario@y7mail.com>
Thu, 26 Mar 2020 13:48:57 +0000 (23:48 +1000)
committerMario <mario.mario@y7mail.com>
Thu, 26 Mar 2020 13:48:57 +0000 (23:48 +1000)
qcsrc/common/weapons/all.qc
qcsrc/server/weapons/weaponsystem.qc

index b8d2428f3ff24ac9c30d6d1b26930bd2012a7b42..a8d1376d1d86b60781be17f990ff41f835f88996 100644 (file)
@@ -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;
index 59812425d674cbe83100c535b2e40b02a1d8dac7..5f4f6f8332deb1d0b4d171c31a839922b4267bd3 100644 (file)
@@ -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;
        }