[HL25] Backport crowbar full swing fix

This commit also reverts fe8a54065c to
prevent potential conflicts. Seems to be identical to vanilla behavior.
This commit is contained in:
Joël Troch 2024-08-28 10:27:39 +02:00
parent 9ae57ad71e
commit a542e4a00a
5 changed files with 15 additions and 13 deletions

View file

@ -835,9 +835,9 @@ void HUD_WeaponsPostThink(local_state_s* from, local_state_s* to, usercmd_t* cmd
pto->m_fNextAimBonus = -1.0; pto->m_fNextAimBonus = -1.0;
} }
if (pto->m_flNextPrimaryAttack < -1.1) if (pto->m_flNextPrimaryAttack < -1.0)
{ {
pto->m_flNextPrimaryAttack = -1.1; pto->m_flNextPrimaryAttack = -1.0;
} }
if (pto->m_flNextSecondaryAttack < -0.001) if (pto->m_flNextSecondaryAttack < -0.001)

View file

@ -1772,12 +1772,12 @@ int GetWeaponData(struct edict_s* player, struct weapon_data_s* info)
item->m_iId = II.iId; item->m_iId = II.iId;
item->m_iClip = gun->m_iClip; item->m_iClip = gun->m_iClip;
item->m_flTimeWeaponIdle = V_max(gun->m_flTimeWeaponIdle, -0.001); item->m_flTimeWeaponIdle = V_max(gun->m_flTimeWeaponIdle, -0.001f);
item->m_flNextPrimaryAttack = V_max(gun->m_flNextPrimaryAttack, -0.001); item->m_flNextPrimaryAttack = V_max(gun->m_flNextPrimaryAttack, -0.001f);
item->m_flNextSecondaryAttack = V_max(gun->m_flNextSecondaryAttack, -0.001); item->m_flNextSecondaryAttack = V_max(gun->m_flNextSecondaryAttack, -0.001f);
item->m_fInReload = static_cast<int>(gun->m_fInReload); item->m_fInReload = static_cast<int>(gun->m_fInReload);
item->m_fInSpecialReload = gun->m_fInSpecialReload; item->m_fInSpecialReload = gun->m_fInSpecialReload;
item->fuser1 = V_max(gun->pev->fuser1, -0.001); item->fuser1 = V_max(gun->pev->fuser1, -0.001f);
item->fuser2 = gun->m_flStartThrow; item->fuser2 = gun->m_flStartThrow;
item->fuser3 = gun->m_flReleaseThrow; item->fuser3 = gun->m_flReleaseThrow;
item->iuser1 = gun->m_chargeReady; item->iuser1 = gun->m_chargeReady;
@ -1786,7 +1786,7 @@ int GetWeaponData(struct edict_s* player, struct weapon_data_s* info)
gun->GetWeaponData(*item); gun->GetWeaponData(*item);
// item->m_flPumpTime = V_max( gun->m_flPumpTime, -0.001 ); // item->m_flPumpTime = V_max( gun->m_flPumpTime, -0.001f );
} }
} }
pPlayerItem = pPlayerItem->m_pNext; pPlayerItem = pPlayerItem->m_pNext;

View file

@ -222,7 +222,9 @@ bool CCrowbar::Swing(bool fFirst)
ClearMultiDamage(); ClearMultiDamage();
if ((m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase()) || g_pGameRules->IsMultiplayer()) // JoshA: Changed from < -> <= to fix the full swing logic since client weapon prediction.
// -1.0f + 1.0f = 0.0f. UTIL_WeaponTimeBase is always 0 with client weapon prediction (0 time base vs curtime base)
if ((m_flNextPrimaryAttack + 1.0f <= UTIL_WeaponTimeBase()) || g_pGameRules->IsMultiplayer())
{ {
// first swing does full damage // first swing does full damage
pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB); pEntity->TraceAttack(m_pPlayer->pev, gSkillData.plrDmgCrowbar, gpGlobals->v_forward, &tr, DMG_CLUB);

View file

@ -2621,17 +2621,17 @@ pt_end:
if (gun && gun->UseDecrement()) if (gun && gun->UseDecrement())
{ {
gun->m_flNextPrimaryAttack = V_max(gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.1); gun->m_flNextPrimaryAttack = V_max(gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0f);
gun->m_flNextSecondaryAttack = V_max(gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001); gun->m_flNextSecondaryAttack = V_max(gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001f);
if (gun->m_flTimeWeaponIdle != 1000) if (gun->m_flTimeWeaponIdle != 1000)
{ {
gun->m_flTimeWeaponIdle = V_max(gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001); gun->m_flTimeWeaponIdle = V_max(gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001f);
} }
if (gun->pev->fuser1 != 1000) if (gun->pev->fuser1 != 1000)
{ {
gun->pev->fuser1 = V_max(gun->pev->fuser1 - gpGlobals->frametime, -0.001); gun->pev->fuser1 = V_max(gun->pev->fuser1 - gpGlobals->frametime, -0.001f);
} }
gun->DecrementTimers(); gun->DecrementTimers();

View file

@ -1013,7 +1013,7 @@ void CBasePlayerWeapon::DoRetireWeapon()
//========================================================================= //=========================================================================
float CBasePlayerWeapon::GetNextAttackDelay(float delay) float CBasePlayerWeapon::GetNextAttackDelay(float delay)
{ {
if (m_flLastFireTime == 0 || m_flNextPrimaryAttack <= -1.1) if (m_flLastFireTime == 0 || m_flNextPrimaryAttack == -1)
{ {
// At this point, we are assuming that the client has stopped firing // At this point, we are assuming that the client has stopped firing
// and we are going to reset our book keeping variables. // and we are going to reset our book keeping variables.