A_GunFlash processes two ticks at once (circumstances)

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.
Post Reply
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

A_GunFlash processes two ticks at once (circumstances)

Post by FDARI »

If A_GunFlash was called from a weapon during iteration in P_MovePsprites (advancing all the overlays) it will process once when called, and once when the iterator reaches it, making it process two times within a single tick. The attached zip-file is a functional wad containing a weapon (FLASHWEAPON) you can give yourself to see some A_Log messages revealing the flow.

Weapon/flash flow on the tick when A_GunFlash is called.

(movepsprite-setpsprite) Weapon shows a log message (A_Log)
(movepsprite-setpsprite) Weapon launches a flash
(movepsprite-A_GunFlash-setpsprite) Flash shows a log message
(movepsprite-A_GunFlash-setpsprite) Flash encounters a > 0 duration and ends processing
(movepsprite) Weapon encounters a > 0 duration and ends processing
(movepsprite-setpsprite) Flash resumes processing and shows a log message (A_Log)
(movepsprite) Flash ends

The above does not occur if A_GunFlash is triggered by BT_ATTACK during regular input processing, because that input test is performed after all psprites have been moved. This means that the weapon will first process whatever state it is on, and then process fire/altfire, leaving it in a feasible state, having processed only a single tick of fire. Because we're past the iteration, the iterator does not act on any flash states that have been set and processed during the first tick of the firing state.

A_ReFire triggers an input-based firing state during the processing phase in which it was encountered (typically/always weapon processing).
Spoiler: tick scenarios
Attachments
A_GunFlash.bug.zdoom.zip
Diff with tested fix. It is not the only way, but the quickest solution I had to just the problem at hand.
(1.19 KiB) Downloaded 60 times
A_GunFlash_bug.zip
zip contains one decorate.txt, and is launchable.
(813 Bytes) Downloaded 49 times
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: A_GunFlash processes two ticks at once (circumstances)

Post by randi »

Okay, then.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_GunFlash processes two ticks at once (circumstances)

Post by Graf Zahl »

I'm just bumping this to say that this kind of 'fix' is always causing more problems than it solves, especially when nobody bothers to investigate the consequences.

See here:

http://forum.zdoom.org/viewtopic.php?f=2&t=50308
User avatar
StrikerMan780
Posts: 486
Joined: Tue Nov 29, 2005 2:15 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: A_GunFlash processes two ticks at once (circumstances)

Post by StrikerMan780 »

I dunno, being able to define 1-tic flashes without it fucking up royally is nice.
Post Reply

Return to “Closed Bugs [GZDoom]”