Expressions in A_Jump's offset
Moderator: GZDoom Developers
- torridgristle
- Posts: 684
- Joined: Fri Aug 23, 2013 9:34 am
Expressions in A_Jump's offset
A_Jump should be able to use expressions for the number of frames to jump, like A_Jump(256,CallACS("GetAmmoCount",1)) or A_Jump(256,CallACS("GetAmmoCount",1)*5)
This would be useful for situations where you've got ammo displays on weapons and you can predict how many frames to jump for a display, like the weapon that I can't finish without 400 A_JumpIfInventory frames. There are probably other uses for it that'd be useful but this is all I can think of.
This would be useful for situations where you've got ammo displays on weapons and you can predict how many frames to jump for a display, like the weapon that I can't finish without 400 A_JumpIfInventory frames. There are probably other uses for it that'd be useful but this is all I can think of.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Expressions in A_Jump's offset
No, no expansion of deprecated features. When custom state labels were introduced, all further work on jump by offsets was stopped.
Re: Expressions in A_Jump's offset
That doesn't make sense -- there are cases where state labels can't do what is needed. How would you suggest the OP fix his problem using state labels?
Re: Expressions in A_Jump's offset
With a beautiful and elegant approach, like this one:Xaser wrote:That doesn't make sense -- there are cases where state labels can't do what is needed. How would you suggest the OP fix his problem using state labels?
Spoiler:Imagine if instead we had code like this:
Spoiler:
Re: Expressions in A_Jump's offset
Well...
Spoiler:The one reason I can see to disallow such things is the potential for instability when invalid values are generated. But this also exists with some existing codepointers anyway (notably Strife stuff) and should be handled by sanity checks in the codepointers.
Re: Expressions in A_Jump's offset
Spoiler:
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Expressions in A_Jump's offset
Gez wrote:Well...Spoiler:The one reason I can see to disallow such things is the potential for instability when invalid values are generated.
That's precisely the problem here. It's a ready made recipe for disaster that requires a lot of care because invalid values may slip in far quicker than people may think. Static jump offserts can be checked at compile time but once variables (i.e. expressions) come into play all current sanity checks would get thrown out of the window.
Re: Expressions in A_Jump's offset
Crap. I was just attempting a similar thing:
I suppose there isn't any smart way to do this at the moment?
Code: Select all
Spawn:
TNT1 AA 0 A_SetArg(0, 1) // Fall through
Animation:
TNT1 A 0 A_Jump(256, args[0])
ANIM AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPP 1 A_Jump(256, "Stuff")
TNT1 A 0
Stop
Stuff:
TNT1 A 0 A_ScaleVelocity(.95)
TNT1 A 0 A_FadeOut(.2 / 64)
TNT1 A 0 A_SetScale(ScaleX + .1)
TNT1 A 0 A_ChangeVelocity (velx,vely , (velz+2)/2, CVF_REPLACE)
TNT1 A 0 A_SetArg(0, args[0] + 1)
Goto Animation
- NeuralStunner
-
- Posts: 12325
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Expressions in A_Jump's offset
Not really. Though I'm unsure whether what you're trying to do there is smart in the first place.
Re: Expressions in A_Jump's offset
Indeed. What you've encountered is the logical limitations of frame based actor control. It seems restrive, but then what do you expect from something originally designed in 1993 for something vastly more primitive. There's bound to be a brick wall.
Re: Expressions in A_Jump's offset
Well, in this particular case I could work around the limitation, if only there was a way to combine action functions:
A bit like A_Metal effectively combines A_PlaySound and A_Chase, for example.
I guess it's scripting time again...
Code: Select all
ANIM AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPP 1 A_DoStuff // Includes the "Stuff" state posted above, minus the A_SetArg (not needed here)
Stop
I guess it's scripting time again...
- NeuralStunner
-
- Posts: 12325
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Expressions in A_Jump's offset
There sort of is, depending on which functions you want to use.D2JK wrote:Well, in this particular case I could work around the limitation, if only there was a way to combine action functions
Re: Expressions in A_Jump's offset
That's interesting, I'll give it a try. Thanks!