A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Moderator: GZDoom Developers

Post Reply
User avatar
MaxED
Posts: 2246
Joined: Tue Feb 28, 2012 12:55 pm

A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by MaxED »

An optional flag for [wiki]A_Raise[/wiki] and [wiki]A_Lower[/wiki], which tells the engine that a weapon is fully raised/lowered. This will allow to create custom weapon raise/lower animations without using ugly hacks.

Usage example:

Code: Select all

Select:
    MAGR EDCBA 1 //Actual raising animation
    MAG_ A 0 A_Raise(true) //Weapon is ready
    stop

Deselect:
    MAGD ABCDEF 1 //Actual deselect animation
    MAG_ A 0 A_Lower(true) //Weapon is deselected
    stop
How I'm doing it now:

Code: Select all

Select:
    MAG_ AAAAAAAAAAAAAA 0 A_Raise //I had to fiddle with the number of frames, so the actual animation is not affected by A_Raise animation and is actually played
    MAGR EDCBA 1 //Actual raising animation
    loop

Deselect:
    MAGD ABCDEF 1 //Actual deselect animation
    goto DeselectEnd 

DeselectEnd:
    MAG_ A 0 A_Lower 
    loop
User avatar
edward850
Posts: 5890
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by edward850 »

Wait is your new God.

Code: Select all

Select:
    MAG_ A 0 A_Raise //Weapon is ready
    wait

Ready:
    MAGR EDCBA 1 //Actual raising animation
Readyist: // Needed anyway, due to frame offsets
    FOOB B 1 A_WeaponReady
    loop

Deselect:
    MAGD ABCDEF 1 //Actual deselect animation
    MAG_ A 0 A_Lower //Weapon is deselected
    wait
Last edited by edward850 on Thu Feb 26, 2015 6:31 am, edited 1 time in total.
User avatar
MaxED
Posts: 2246
Joined: Tue Feb 28, 2012 12:55 pm

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by MaxED »

Oh well, looks like my way of learning stuff is "make pointless feature requests" yet again :)
User avatar
edward850
Posts: 5890
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by edward850 »

I edited the above to include "Readyist". Because a weapons frames are off screen before the first raise, you need to display the animation at the end. Just use Goto Readyist instead of Ready instead for your fire frames and such.
User avatar
MaxED
Posts: 2246
Joined: Tue Feb 28, 2012 12:55 pm

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by MaxED »

Actually, I've already discovered more elegant solution :)

Code: Select all

Select:
    MAGR EDCBA 1 Offset(0, 32)
    MAG_ A 0 A_Raise
    wait
User avatar
edward850
Posts: 5890
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by edward850 »

... Of course that works. I have no idea why I have never seen that solution before.
D2JK
Posts: 545
Joined: Sat Aug 30, 2014 8:21 am

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by D2JK »

If possible, a new numeric parameter to define the raising/lowering speed would be the best solution, I think. It would use the default speed if omitted (6, if I recall). You could reduce or increase the speed as desired (eg. 3 / 12), or make an instantaneous raise/lower (999).
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by Xaser »

Oh wow, a zero-tic A_Raise/A_Lower loop works? I'd always been under the impression this would cause an infinite loop freeze/crash -- it most certainly does in vanilla, and possibly on older versions of ZDoom too (unless I'd been misremembering the 'nilla behavior as canon this whole time). Good to know it's been changed at some point, even if I'm a zillion years late in saying this. :P
User avatar
edward850
Posts: 5890
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by edward850 »

In Vanilla, it can only lock up in the lower state if the player dies, due to the next state always being the same tic. ZDoom NULLs the weapon if the player is dead (probably the only time that's ever safe to do so) at the end of a deselect, so the state won't remain.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_Raise[(bool instantly)] and A_Lower[(bool instantly)]

Post by NeuralStunner »

edward850 wrote:ZDoom NULLs the weapon if the player is dead (probably the only time that's ever safe to do so) at the end of a deselect, so the state won't remain.
In response to the aforementioned hang, I believe. I ran into it a few times while testing weapons.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”