r3829 WRF_NOSWITCH behaviour?

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
User avatar
Enjay
 
 
Posts: 26418
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

r3829 WRF_NOSWITCH behaviour?

Post by Enjay »

I'm not sure if this is a bug or not but a discussion in the editing forum leads me to post this just in case.

In short, I am looking to create a weapon that, once selected, cannot be changed away from (unless the weapon is taken using ACS). The WRF_NOSWITCH seemed like it would do the job however, I ran into problems. The behaviour I experienced may well be what is intended but I feel it makes the feature not particularly useful.

I've copied the relevant points of discussion below. FDARI's comment is possibly the most valuable.

Enjay wrote:What is the best way to prevent a player changing away from a particular weapon (can be ACS or DECORATE).

I'm just trying to get a neater way of making a "mounted gun" weapon like the minigun in my Burghead mod. What I did there was count everything the player had in his inventory, then take it all away and give him the minigun. Then when he stopped using the gun, I gave him his inventory back.

It would be much beater to leave his inventory alone and either create a weapon where its decorate means that you cannot change away from it (making the deselect state jump to the ready state has some unwanted side effects) or some ACS prevents you changing away.
Blue Shadow wrote:Would the WRF_NOSWTICH flag for [wiki]A_WeaponReady[/wiki] help?
Enjay wrote:That looks like it would do the trick. It seems to be meant for exactly what I'm trying to do. Thanks.

[edit] Hmm, nope, it doesn't allow what I want. Changing the ready state to:

Code: Select all

   Ready:
      MINI A 1 A_WeaponReady(WRF_NOSWITCH)
      Loop
does mean that you can't switch away from the weapon when you are in the "ready" state. However, if you start firing and then press the button for another weapon while the weapon is still firing, you can switch away. Even worse, if you press the button for another weapon while you are in the ready state, ZDoom seems to remember that you have tried to switch away so that when you start firing (ie enter a state where the weapon can switch away) you change weapons shortly after entering the firing state. [/edit]
FDARI wrote:That may be a bug. It may also be intended behaviour, or perhaps a nigh-unavoidable feature of the design. I would expect and prefer that WRF_NOSWITCH were in effect until a_weaponready was called again.
Emphasis mine.
Guest

Re: r3829 WRF_NOSWITCH behaviour?

Post by Guest »

Just call A_WeaponReady(WRF_NOSWITCH) upon entering every state. That should do the trick.
User avatar
randi
Site Admin
Posts: 7728
Joined: Wed Jul 09, 2003 10:30 pm

Re: r3829 WRF_NOSWITCH behaviour?

Post by randi »

Fixed in r4024.
User avatar
Enjay
 
 
Posts: 26418
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: r3829 WRF_NOSWITCH behaviour?

Post by Enjay »

Thank you very much. I look forward to trying this out over the weekend.

[edit] Works like a charm. :D [/edit]
VicRattlehead
Posts: 77
Joined: Fri Sep 09, 2011 7:47 am

Re: r3829 WRF_NOSWITCH behaviour?

Post by VicRattlehead »

This has caused some mods to stop working properly. I've only tried out Russian Overkill, Terrorists, Psychic, NecroDoom and Diaz v3 and the two lattermost are affected -- weapons freeze when attempting to switch to another.
Gez
 
 
Posts: 17654
Joined: Fri Jul 06, 2007 3:22 pm

Re: r3829 WRF_NOSWITCH behaviour?

Post by Gez »

Guess we'll need to revert WRF_NOSWITCH to its previous behavior and have WRF_KEEPNOSWITCH for the new behavior.
User avatar
Enjay
 
 
Posts: 26418
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: r3829 WRF_NOSWITCH behaviour?

Post by Enjay »

Hmmm, it looks like the original behaviour was used more than I thought it was. Given that the revised behaviour is also very desirable, two flags would indeed make sense. The revised behaviour has allowed me to cut out a huge, clumsy, easily breakable bit of ACS and replace it with a single line in the Weapon's DECORATE.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48043
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: r3829 WRF_NOSWITCH behaviour?

Post by Graf Zahl »

Damn... And I wanted to do a new GZDoom release today. This has to be sorted out first, though, otherwise it makes no sense.
User avatar
Blue Shadow
Posts: 4906
Joined: Sun Nov 14, 2010 12:59 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: r3829 WRF_NOSWITCH behaviour?

Post by Blue Shadow »

Graf Zahl wrote:Damn... And I wanted to do a new GZDoom release today.
You ain't having a luck aren't you, Graf? :P This is the second time that this happens.
User avatar
Kate
... in loving memory ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: r3829 WRF_NOSWITCH behaviour?

Post by Kate »

2 changes could fix this and still keep the current behavior:

1. WRF_NOSWITCH has no business touching the pending weapon. It should remember that I want to switch and do so as soon as possible, even if that isn't right now.
2. Entering the Deselect state should imply disabling switching, since it's caused by switching, meaning it will result in the weapon deadlocking if it doesn't immediately call A_Lower, which is what's happening right now.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US

[r4024] Can't lower certain weapons...

Post by Ed the Bat »

Since the revision in r4024, trying to lower any weapon that has at least two tics in its Deselect state before A_Lower is called will freeze the weapon. Example included below.
You do not have the required permissions to view the files attached to this post.
User avatar
Kate
... in loving memory ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: [r4024] Can't lower certain weapons...

Post by Kate »

That's because this.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US

Re: [r4024] Can't lower certain weapons...

Post by Ed the Bat »

Yes, the thing which happened in r4024. The... ONLY thing which happened.

This breaks a lot of projects, including my own. Any weapon with a fancy lowering animation in its Deselect state is now broken.
User avatar
Enjay
 
 
Posts: 26418
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: r3829 WRF_NOSWITCH behaviour?

Post by Enjay »

I am guessing that this problem may also be related.

If a weapon plays a sound in its deselect state sequence, the sound loops rapidly when the player dies while holding the weapon.

[edit] Easier to use example attached a couple of posts down. [/edit]
example:

Code: Select all

ACTOR TestPistol : Pistol
{
	States
	{
	Deselect:
		PISG A 0 A_PlayWeaponSound("misc/chat")
		PISG A 1 A_Lower
		goto Deselect+1
	}
}
Put the above into a decorate file. Type "give testpistol" at the console to get and switch to the testpistol. [optional: switch to another weapon to confirm that the pistol makes the "misc/chat" sound when lowered]. With the testpistol readied, type "kill" at the console or let an enemy kill you and the sound will play over and over making a helluva noise in the SVN build but doesn't in the official release.

[edit] Actually, the sound seems to be repeating rapidly whenever the weapon is deselected. It's just that when you die, the rapid looping never stops.[/edit]
Last edited by Enjay on Sat Jan 19, 2013 5:08 am, edited 1 time in total.
Gez
 
 
Posts: 17654
Joined: Fri Jul 06, 2007 3:22 pm

Re: r3829 WRF_NOSWITCH behaviour?

Post by Gez »

You could use "Wait" instead of "Goto Deselect+1". (It wouldn't change anything to the behavior, it just looks cleaner I think.)

Return to “Closed Bugs”