NoDelay can double up function calls

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: NoDelay can double up function calls

Re: NoDelay can double up function calls

by Gez » Wed Feb 25, 2015 5:51 am

randi wrote:Fixed.
Isn't this change leftover debugging?

Re: NoDelay can double up function calls

by randi » Tue Feb 24, 2015 8:40 pm

Re: NoDelay can double up function calls

by FDARI » Mon Feb 16, 2015 9:45 am

Spawning does/did not call the state setting function (with its implicit countdown/next-state operation). It assigned a state directly, to avoid all the side effects.
A duration 0 state cannot normally be maintained, but on spawn it is maintained until the next time states advance naturally.

Foo the Bar as the actor is spawned:

Code: Select all

spawn:
TNT1 A 0 nodelay A_FooBar
Spawn the actor, and wait for the first state tick to Foo the Bar:

Code: Select all

spawn:
TNT1 A 0
TNT1 A 0 A_FooBar
Unless more was changed by the nodelay implementation than I would expect.

Re: NoDelay can double up function calls

by edward850 » Tue Dec 30, 2014 1:29 am

There shouldn't be a functional difference between the two, indeed. I would assume any behaviour where that is not the case would be a bug, as I cannot see anything else it should be doing in the code.

Re: NoDelay can double up function calls

by Matt » Tue Dec 30, 2014 1:27 am

So is there actually supposed to be any functional difference between

Code: Select all

spawn:
TNT1 A 0
TNT1 A 0 A_FooBar
and

Code: Select all

spawn:
TNT1 A 0 nodelay A_FooBar
?

The way that wiki entry is written seems to imply there is not, but in situations where getting things done in the very first tic is crucial (e.g., a projectile spawning where it ought to instantly die) I have noticed that the latter does not actually "force the action function associated to the state to be executed during the actor's first tic" while the former does.

Re: NoDelay can double up function calls

by edward850 » Tue Dec 30, 2014 12:44 am

Actor_states wrote:Forces the action function associated to the state to be executed during the actor's first tic. This is only useful for the first state in an actor's spawn sequence.
Basically, remember the "spawn frame of an actor does not call a function on spawn" rule?

Re: NoDelay can double up function calls

by Matt » Tue Dec 30, 2014 12:41 am

Okay, so if that behaviour is actually a bug, then just what is nodelay supposed to do and why is it called "nodelay" and not "[whatever it is it's supposed to do]"?

Re: NoDelay can double up function calls

by NeuralStunner » Mon Dec 29, 2014 10:06 pm

Graf Zahl wrote:Exploitation would be mostly by accident so that's not quite true.
That would be simple error, not "this is doing something weird and I'm gonna use that". (Exploitation meaning deliberate abuse/misuse.)

Re: NoDelay can double up function calls

by Graf Zahl » Mon Dec 29, 2014 3:25 pm

Exploitation would be mostly by accident so that's not quite true.

Re: NoDelay can double up function calls

by NeuralStunner » Mon Dec 29, 2014 3:05 pm

Graf Zahl wrote:I doubt this has been exploited much.
I don't think it's to harsh to say: Anyone exploiting this deserves to have their mod broken.

Re: NoDelay can double up function calls

by Graf Zahl » Mon Dec 29, 2014 3:03 pm

And even then, it's calling the same function twice which very rarely makes a difference that's noticable.
I doubt this has been exploited much.

Re: NoDelay can double up function calls

by Gez » Mon Dec 29, 2014 3:01 pm

I really doubt it'd break that many mod. I'd wager it wouldn't actually break any. It might even fix some.

Re: NoDelay can double up function calls

by Edward-san » Mon Dec 29, 2014 2:46 pm

Knowing that this, if fixed, would cause some mod breakages (how many mods were released for zdoom 2.7.1, which use 'nodelay'?) ... maybe introduce a new word to use in place of 'nodelay'?

NoDelay can double up function calls

by edward850 » Sun Dec 28, 2014 8:15 pm

Likely an oversight, it appears that a NoDelay state can accidentally cause an actor to run a function twice in the same tic.

Code: Select all

actor foobar
{
   states
   {
   spawn:
      TNT1 A 0 nodelay
      BAL1 A 1 A_ChangeVelocity(1,0,0)
      wait
   }
}
When the actor tics and checks/sets the state in the state->GetNoDelay() block, it'll run both frames in the above actor and set the tics to 1. However, it then goes on to run the normal frame counter, and immediately tics back down to 0 and runs A_ChangeVelocity a second time in the same tic.
Something tells me that's not supposed to happen, and the block should return at the end, rather than continuing to the normal frame counter.

Top