I'm trying to make a shotgun that can reload, using ZScript. Reloading is divided into 3 states, like this:
Code: Select all
Reload:
SHTG AAAAAAAAAAAA 1 A_Lower;
// Fallthrough
Reload.LoadShell:
SHTG A 35
{
A_PlaySound("misc/w_pkup", CHAN_WEAPON);
A_Reload(1);
}
SHTG A 0 A_JumpIfReloaded("Reload.Finish");
Loop;
Reload.Finish:
SHTG AAAAAAAAAA 1 A_Raise;
SHTG BC 5;
SHTG D 4 A_PlaySound("misc/w_pkup", CHAN_WEAPON);
SHTG CB 5;
SHTG A 1 A_Raise;
Wait;
As you can see, I've defined 2 action functions (A_Reload & A_JumpIfReloaded). Hopefully, it's pretty obvious what they do. What I want is for the player to be able to interrupt the reload, by pressing the reload key again. I can do this by checking input in A_JumpIfReloaded, but that only works if the player happens to be holding the key down when the function is called. Is there any way to detect if the player presses the key between function calls?