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

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_Raise[(bool instantly)] and A_Lower[(bool instantly)]

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

by NeuralStunner » Thu Feb 26, 2015 8:57 pm

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.

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

by edward850 » Thu Feb 26, 2015 7:49 am

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.

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

by Xaser » Thu Feb 26, 2015 7:37 am

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

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

by D2JK » Thu Feb 26, 2015 6:59 am

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).

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

by edward850 » Thu Feb 26, 2015 6:38 am

... Of course that works. I have no idea why I have never seen that solution before.

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

by MaxED » Thu Feb 26, 2015 6:36 am

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

Code: Select all

Select:
    MAGR EDCBA 1 Offset(0, 32)
    MAG_ A 0 A_Raise
    wait

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

by edward850 » Thu Feb 26, 2015 6:33 am

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.

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

by MaxED » Thu Feb 26, 2015 6:31 am

Oh well, looks like my way of learning stuff is "make pointless feature requests" yet again :)

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

by edward850 » Thu Feb 26, 2015 6:25 am

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

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

by MaxED » Thu Feb 26, 2015 6:08 am

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

Top