From b0a0c62af1d5f4099bfde5975e06c779c11b403c Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 9 Apr 2017 13:04:32 +0300 Subject: [PATCH] Fixed state selection for weapon secondary fire https://mantis.zdoom.org/view.php?id=552 --- wadsrc/static/zscript/inventory/weapons.txt | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/wadsrc/static/zscript/inventory/weapons.txt b/wadsrc/static/zscript/inventory/weapons.txt index 03b34b947..f837bf4e5 100644 --- a/wadsrc/static/zscript/inventory/weapons.txt +++ b/wadsrc/static/zscript/inventory/weapons.txt @@ -130,18 +130,26 @@ class Weapon : StateProvider native { player.mo.PlayAttacking2 (); } + + Weapon weapon = player.ReadyWeapon; + state flashstate = null; + if (flashlabel == null) { - if (player.ReadyWeapon.bAltFire) + if (weapon.bAltFire) { - flashlabel = 'AltFlash'; + flashstate = weapon.FindState('AltFlash'); } - if (flashlabel == null) + if (flashstate == null) { - flashlabel = 'Flash'; + flashstate = weapon.FindState('Flash'); } } - player.SetPsprite(PSP_FLASH, player.ReadyWeapon.FindState(flashlabel)); + else + { + flashstate = weapon.FindState(flashlabel); + } + player.SetPsprite(PSP_FLASH, flashstate); } //--------------------------------------------------------------------------- @@ -738,4 +746,4 @@ class WeaponGiver : Weapon struct WeaponSlots native { native bool, int, int LocateWeapon(class weap); -} \ No newline at end of file +}