WEAPON_SHOTGUN its reload sequence can now be interrupted by either primary or secondary fire

This commit is contained in:
Marco Cawthorne 2021-05-10 13:39:32 +02:00
parent 061ea05c05
commit 67191ac794
1 changed files with 18 additions and 2 deletions

View File

@ -160,17 +160,25 @@ void
w_shotgun_primary(void)
{
player pl = (player)self;
if (pl.w_attack_next) {
w_shotgun_release();
return;
}
if (pl.mode_tempstate > SHOTTY_IDLE) {
/* interrupt reloading if no longer empty */
if (pl.mode_tempstate == SHOTTY_RELOAD && pl.shotgun_mag >= 1) {
pl.mode_tempstate = SHOTTY_RELOAD_END;
w_shotgun_release();
return;
} else if (pl.mode_tempstate > SHOTTY_IDLE) {
w_shotgun_release();
return;
}
/* Ammo check */
if (pl.shotgun_mag <= 0) {
w_shotgun_release();
return;
}
@ -208,17 +216,25 @@ void
w_shotgun_secondary(void)
{
player pl = (player)self;
if (pl.w_attack_next) {
w_shotgun_release();
return;
}
if (pl.mode_tempstate > SHOTTY_IDLE) {
/* interrupt reloading if no longer empty */
if (pl.mode_tempstate == SHOTTY_RELOAD && pl.shotgun_mag >= 2) {
pl.mode_tempstate = SHOTTY_RELOAD_END;
w_shotgun_release();
return;
} else if (pl.mode_tempstate > SHOTTY_IDLE) {
w_shotgun_release();
return;
}
/* Ammo check */
if (pl.shotgun_mag <= 1) {
w_shotgun_release();
return;
}