Skip to content
Closed
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
22 changes: 22 additions & 0 deletions src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,22 @@ void CNEOBaseCombatWeapon::DryFire()
m_flNextPrimaryAttack = gpGlobals->curtime + GetFastestDryRefireTime(); // SequenceDuration();
}

// An empty weapon idles on its empty sequence where the model has one, such as a pistol with its slide held back
bool CNEOBaseCombatWeapon::SendWeaponAnim(int iActivity)
{
if (iActivity == ACT_VM_IDLE && UsesClipsForAmmo1() && m_iClip1 <= 0 && HasEmptyIdle())
{
iActivity = ACT_VM_IDLE_EMPTY;
}

return BaseClass::SendWeaponAnim(iActivity);
}

bool CNEOBaseCombatWeapon::HasEmptyIdle()
{
return SelectWeightedSequence(ACT_VM_IDLE_EMPTY) != ACTIVITY_NOT_AVAILABLE;
}

void CNEOBaseCombatWeapon::PrimaryAttack(void)
{
if (ShootingIsPrevented())
Expand Down Expand Up @@ -1064,6 +1080,12 @@ void CNEOBaseCombatWeapon::PrimaryAttack(void)
m_iPrimaryAmmoCount -= info.m_iShots;
}

// the last round's shot goes straight on to the empty idle when it ends
if (UsesClipsForAmmo1() && m_iClip1 <= 0 && HasEmptyIdle())
{
SetWeaponIdleTime(gpGlobals->curtime + SequenceDuration());
}

info.m_flDistance = MAX_TRACE_LENGTH;
info.m_iAmmoType = m_iPrimaryAmmoType;
info.m_iTracerFreq = UsesTracers() ? 1 : 0;
Expand Down
2 changes: 2 additions & 0 deletions src/game/shared/neo/weapons/weapon_neobasecombatweapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class CNEOBaseCombatWeapon : public CBaseHL2MPCombatWeapon
#endif

virtual void DryFire(void);
virtual bool SendWeaponAnim(int iActivity) override;

virtual Activity GetPrimaryAttackActivity(void) override;
#ifdef CLIENT_DLL
Expand Down Expand Up @@ -292,6 +293,7 @@ class CNEOBaseCombatWeapon : public CBaseHL2MPCombatWeapon

private:
CNEOBaseCombatWeapon(const CNEOBaseCombatWeapon &other);
bool HasEmptyIdle();

};

Expand Down
Loading