Expressions in A_Jump's offset

Moderator: GZDoom Developers

Post Reply
User avatar
torridgristle
Posts: 684
Joined: Fri Aug 23, 2013 9:34 am

Expressions in A_Jump's offset

Post by torridgristle »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Expressions in A_Jump's offset

Post by Graf Zahl »

No, no expansion of deprecated features. When custom state labels were introduced, all further work on jump by offsets was stopped.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Expressions in A_Jump's offset

Post by Xaser »

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?
Gez
 
 
Posts: 17834
Joined: Fri Jul 06, 2007 3:22 pm

Re: Expressions in A_Jump's offset

Post by Gez »

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?
With a beautiful and elegant approach, like this one:
Spoiler:
Imagine if instead we had code like this:
Spoiler:
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Expressions in A_Jump's offset

Post by Xaser »

What?
Gez
 
 
Posts: 17834
Joined: Fri Jul 06, 2007 3:22 pm

Re: Expressions in A_Jump's offset

Post by Gez »

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.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Expressions in A_Jump's offset

Post by Xaser »

Spoiler:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Expressions in A_Jump's offset

Post by Graf Zahl »

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.
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Re: Expressions in A_Jump's offset

Post by D2JK »

Crap. I was just attempting a similar thing:

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
I suppose there isn't any smart way to do this at the moment?
User avatar
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

Post by NeuralStunner »

Not really. Though I'm unsure whether what you're trying to do there is smart in the first place. :P
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Expressions in A_Jump's offset

Post by edward850 »

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. :P
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Re: Expressions in A_Jump's offset

Post by D2JK »

Well, in this particular case I could work around the limitation, if only there was a way to combine action functions:

Code: Select all

 ANIM AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPP 1 A_DoStuff     // Includes the "Stuff" state posted above, minus the A_SetArg (not needed here)
 Stop
A bit like A_Metal effectively combines A_PlaySound and A_Chase, for example.

I guess it's scripting time again...
User avatar
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

Post by NeuralStunner »

D2JK wrote:Well, in this particular case I could work around the limitation, if only there was a way to combine action functions
There sort of is, depending on which functions you want to use.
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Re: Expressions in A_Jump's offset

Post by D2JK »

That's interesting, I'll give it a try. Thanks!
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”