mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 04:29:34 -04:00
fix Boom weapon autoswitch (from DSDA-Doom) (#633)
* fix Boom weapon autoswitch (from DSDA-Doom) Fixes #578 Did I get this right @kraflab? * fix boolean type typo
This commit is contained in:
parent
bc1728f4bd
commit
7b09a40fe3
16
src/g_game.c
16
src/g_game.c
@ -346,6 +346,9 @@ void G_BuildTiccmd(ticcmd_t* cmd)
|
||||
int newweapon; // phares
|
||||
ticcmd_t *base;
|
||||
|
||||
extern boolean boom_weapon_state_injection;
|
||||
static boolean done_autoswitch = false;
|
||||
|
||||
G_DemoSkipTics();
|
||||
|
||||
base = I_BaseTiccmd(); // empty, or external driver
|
||||
@ -457,9 +460,20 @@ void G_BuildTiccmd(ticcmd_t* cmd)
|
||||
//
|
||||
// killough 3/26/98, 4/2/98: fix autoswitch when no weapons are left
|
||||
|
||||
if (!players[consoleplayer].attackdown)
|
||||
{
|
||||
done_autoswitch = false;
|
||||
}
|
||||
|
||||
if ((!demo_compatibility && players[consoleplayer].attackdown &&
|
||||
!P_CheckAmmo(&players[consoleplayer])) || M_InputGameActive(input_weapontoggle))
|
||||
!P_CheckAmmo(&players[consoleplayer]) &&
|
||||
((boom_weapon_state_injection && !done_autoswitch) || cmd->buttons & BT_ATTACK)) ||
|
||||
M_InputGameActive(input_weapontoggle))
|
||||
{
|
||||
done_autoswitch = true;
|
||||
boom_weapon_state_injection = false;
|
||||
newweapon = P_SwitchWeapon(&players[consoleplayer]); // phares
|
||||
}
|
||||
else
|
||||
{ // phares 02/26/98: Added gamemode checks
|
||||
// [FG] prev/next weapon keys and buttons
|
||||
|
@ -519,6 +519,8 @@ void A_ReFire(player_t *player, pspdef_t *psp)
|
||||
}
|
||||
}
|
||||
|
||||
boolean boom_weapon_state_injection;
|
||||
|
||||
void A_CheckReload(player_t *player, pspdef_t *psp)
|
||||
{
|
||||
if (!P_CheckAmmo(player) && mbf21)
|
||||
@ -528,6 +530,7 @@ void A_CheckReload(player_t *player, pspdef_t *psp)
|
||||
// rewritten. But we must tell Doom that we don't need to complete the
|
||||
// reload frames for the weapon here. G_BuildTiccmd will set ->pendingweapon
|
||||
// for us later on.
|
||||
boom_weapon_state_injection = true;
|
||||
P_SetPsprite(player, ps_weapon, weaponinfo[player->readyweapon].downstate);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user