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

Dryfire behaviour parity and zr68l sprinting viewmodel fix #878

Open
wants to merge 1 commit into
base: master
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
2 changes: 1 addition & 1 deletion mp/src/game/shared/basecombatweapon_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ bool CBaseCombatWeapon::ReloadOrSwitchWeapons( void )
if ( UsesClipsForAmmo1() && !AutoFiresFullClip() &&
(m_iClip1 == 0) &&
(GetWeaponFlags() & ITEM_FLAG_NOAUTORELOAD) == false &&
m_flNextPrimaryAttack < gpGlobals->curtime &&
m_flNextPrimaryAttack < gpGlobals->curtime &&
m_flNextSecondaryAttack < gpGlobals->curtime )
{
// if we're successfully reloading, we're done
Expand Down
34 changes: 27 additions & 7 deletions mp/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,9 @@ void CNEOBaseCombatWeapon::ProcessAnimationEvents()
m_flNextSecondaryAttack = m_flNextPrimaryAttack;
};

if (!m_bLowered && !m_bInReload && !m_bRoundBeingChambered &&
// NEO JANK (Adam) Why do we have to bombard the zr68l viewmodel with SendWeaponAnim(ACT_VM_IDLE_LOWERED) during sprint to make it act normally? Breakpoint in SendWeaponAnim isn't triggered by anything else after this animation is sent while sprinting
const bool loweredCheck = GetNeoWepBits() & NEO_WEP_ZR68_L ? true : !m_bLowered;
if (loweredCheck && !m_bInReload && !m_bRoundBeingChambered &&
(pOwner->IsSprinting() || pOwner->GetMoveType() == MOVETYPE_LADDER))
{
m_bLowered = true;
Expand Down Expand Up @@ -589,17 +591,31 @@ void CNEOBaseCombatWeapon::ItemPostFrame(void)
}
}

if (!bFired && (pOwner->m_afButtonPressed & IN_ATTACK))
{
if (!IsMeleeWeapon() &&
((UsesClipsForAmmo1() && m_iClip1 <= 0) || (!UsesClipsForAmmo1() && m_iPrimaryAmmoCount <= 0)))
{
DryFire();
m_flLastAttackTime = gpGlobals->curtime - 3.f;
}
else if (pOwner->GetWaterLevel() == 3 && m_bFiresUnderwater == false)
{
// This weapon doesn't fire underwater
WeaponSound(EMPTY);
m_flNextPrimaryAttack = gpGlobals->curtime + 0.2;
m_flLastAttackTime = gpGlobals->curtime - 3.f;
return;
}
}

if (!bFired && (pOwner->m_nButtons & IN_ATTACK) && (m_flNextPrimaryAttack <= gpGlobals->curtime))
{
// Clip empty? Or out of ammo on a no-clip weapon?
if (!IsMeleeWeapon() &&
((UsesClipsForAmmo1() && m_iClip1 <= 0) || (!UsesClipsForAmmo1() && m_iPrimaryAmmoCount <= 0)))
{
if (m_bRoundChambered) // bolt action rifles can have this value set to false, prevents empty clicking when holding the attack button when looking through scope to prevent bolting/reloading
{
HandleFireOnEmpty();
}
else
if (!(GetNeoWepBits() & NEO_WEP_SRS))
{
DryFire();
}
Expand Down Expand Up @@ -654,10 +670,14 @@ void CNEOBaseCombatWeapon::ItemPostFrame(void)
if (!(((pOwner->m_nButtons & IN_ATTACK) && !(pOwner->IsSprinting())) || (pOwner->m_nButtons & IN_ATTACK2) || (CanReload() && pOwner->m_nButtons & IN_RELOAD)))
{
// no fire buttons down or reloading
if (!ReloadOrSwitchWeapons() && (m_bInReload == false))
if (m_flTimeWeaponIdle <= gpGlobals->curtime)
{
WeaponIdle();
}
if (m_flLastAttackTime + 3.f < gpGlobals->curtime)
{
ReloadOrSwitchWeapons();
}
}
}

Expand Down