Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-automatic weapon fire fix #56

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/game_mod/bg_weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ int PM_Weapon_WeaponTimeAdjust(pmove_t *pm, pml_t *pml)
else
holdingFireBtn = pm->cmd.button_bits.testBit(0) != 0;

if ((*weaponState < WEAPON_OFFHAND_INIT || *weaponState > WEAPON_OFFHAND_END)
if (!IS_WEAPONSTATE_OFFHAND(*weaponState)
&& *weaponState != WEAPON_DROPPING_QUICK
&& *weaponState != WEAPON_RAISING
&& (pausedAfterFiring || holdingGrenadeBtn)
&& holdingFireBtn
&& ps->weapon == pm->cmd.weapon
Expand All @@ -254,7 +256,7 @@ int PM_Weapon_WeaponTimeAdjust(pmove_t *pm, pml_t *pml)
}
else
{
if ((!holdingFireBtn || ps->weapFlags & 0x400) && !BurstFirePending(ps))
if ((!holdingFireBtn || ps->weapFlags & 0x400 || *weaponState == WEAPON_DROPPING_QUICK || *weaponState == WEAPON_RAISING) && !BurstFirePending(ps))
*weaponShotCount = 0;

*weaponTime = 0;
Expand Down
8 changes: 8 additions & 0 deletions components/game_mod/bg_weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ enum weaponstate_t
(x) == WEAPON_CONT_FIRE_LOOP || \
IS_WEAPONSTATE_MELEE(x))

#define IS_WEAPONSTATE_OFFHAND(x) (\
(x) == WEAPON_OFFHAND_INIT || \
(x) == WEAPON_OFFHAND_PREPARE || \
(x) == WEAPON_OFFHAND_HOLD || \
(x) == WEAPON_OFFHAND_START || \
(x) == WEAPON_OFFHAND || \
(x) == WEAPON_OFFHAND_END)

struct usercmd_s
{
int serverTime;
Expand Down