A_GunFlash processes two ticks at once (circumstances)

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: A_GunFlash processes two ticks at once (circumstances)

Re: A_GunFlash processes two ticks at once (circumstances)

by StrikerMan780 » Wed Apr 06, 2016 12:04 pm

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

Re: A_GunFlash processes two ticks at once (circumstances)

by Graf Zahl » Sun Apr 03, 2016 2:25 pm

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

Re: A_GunFlash processes two ticks at once (circumstances)

by randi » Sat Mar 31, 2012 8:49 pm

Okay, then.

A_GunFlash processes two ticks at once (circumstances)

by FDARI » Wed Jan 04, 2012 3:59 pm

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

Top