From: Mario Date: Mon, 20 Feb 2017 08:50:55 +0000 (+1000) Subject: Fix weapon attack animations getting cut short by the animtime setting, and allow... X-Git-Tag: xonotic-v0.8.2~189^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F411%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git Fix weapon attack animations getting cut short by the animtime setting, and allow the animations to continue while switching weapons (may have some odd side effects) --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 8b96e6a26..acdb69fdc 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -326,7 +326,7 @@ void viewmodel_draw(entity this) this.viewmodel_angles = this.angles; } anim_update(this); - if (!this.animstate_override && !this.animstate_looping) + if ((!this.animstate_override && !this.animstate_looping) || time > this.animstate_endtime) anim_set(this, this.anim_idle, true, false, false); } float f = 0; // 0..1; 0: fully active diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index c236bb47c..a694112ce 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -566,7 +566,10 @@ NET_HANDLE(wframe, bool isNew) int slot = ReadByte(); bool restartanim = ReadByte(); entity wepent = viewmodels[slot]; - anim_set(wepent, a, !restartanim, restartanim, restartanim); + if(a.x == wepent.anim_idle_x) // we don't need to enforce idle animation + wepent.animstate_looping = false; + else + anim_set(wepent, a, !restartanim, restartanim, restartanim); wepent.state = ReadByte(); wepent.weapon_nextthink = ReadFloat(); switch (wepent.state) diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 3347f2bb1..1605db39d 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -517,7 +517,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity) this.clip_load = this.clip_size = 0; } - weapon_thinkf(actor, weaponentity, WFRAME_IDLE, newwep.switchdelay_raise, w_ready); + weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, newwep.switchdelay_raise, w_ready); break; } case WS_DROP: