From 16dac575c25d9b34d86a2d2877944506c5c44735 Mon Sep 17 00:00:00 2001 From: Alan Shen Date: Wed, 14 Oct 2026 23:50:00 -0600 Subject: [PATCH 1/2] Finish reloads at the last reload click A reload credited the magazine only when the whole reload animation ended, 0.2 to 0.7 s after the last click of the reload sound. Switching weapons in that window dropped the reload, though the gun sounded done. Each gun script now names its ReloadReadyTime: the last loud click of its reload sound, rounded up to the animation frame. Where the charging handle is home later (Jitte, SRM, MPN, AA13, PZ), the script comment names that time as the alternative value. The reload completes there and the rest of the animation plays on. Guns without the key (Supa7) keep the animation length. --- game/neo/scripts/weapon_aa13.txt | 2 ++ game/neo/scripts/weapon_jitte.txt | 2 ++ game/neo/scripts/weapon_jittescoped.txt | 2 ++ game/neo/scripts/weapon_kyla.txt | 1 + game/neo/scripts/weapon_m41.txt | 1 + game/neo/scripts/weapon_m41l.txt | 1 + game/neo/scripts/weapon_m41s.txt | 1 + game/neo/scripts/weapon_milso.txt | 1 + game/neo/scripts/weapon_mpn.txt | 2 ++ game/neo/scripts/weapon_mpn_unsilenced.txt | 2 ++ game/neo/scripts/weapon_mx.txt | 1 + game/neo/scripts/weapon_mx_silenced.txt | 1 + game/neo/scripts/weapon_pz.txt | 2 ++ game/neo/scripts/weapon_srm.txt | 2 ++ game/neo/scripts/weapon_srm_s.txt | 2 ++ game/neo/scripts/weapon_srs.txt | 1 + game/neo/scripts/weapon_tachi.txt | 1 + game/neo/scripts/weapon_zr68c.txt | 1 + game/neo/scripts/weapon_zr68l.txt | 1 + game/neo/scripts/weapon_zr68s.txt | 1 + .../shared/neo/weapons/neo_weapon_parse.cpp | 1 + src/game/shared/neo/weapons/neo_weapon_parse.h | 1 + .../neo/weapons/weapon_neobasecombatweapon.cpp | 17 ++++++++++++++++- 23 files changed, 46 insertions(+), 1 deletion(-) diff --git a/game/neo/scripts/weapon_aa13.txt b/game/neo/scripts/weapon_aa13.txt index def63c9983..72faf2faca 100644 --- a/game/neo/scripts/weapon_aa13.txt +++ b/game/neo/scripts/weapon_aa13.txt @@ -6,6 +6,8 @@ WeaponData "Damage" "25" "Bullets" "5" "CycleTime" "0.333" + "ReloadReadyTime" "4.200" // reload is done at the last reload click, the animation plays on to its end; + // the charging handle is home at 4.333, the alternative value // Weapon data is loaded by both the Game and Client DLLs. "printname" "AA13" diff --git a/game/neo/scripts/weapon_jitte.txt b/game/neo/scripts/weapon_jitte.txt index c450c6f29a..ff6676127f 100644 --- a/game/neo/scripts/weapon_jitte.txt +++ b/game/neo/scripts/weapon_jitte.txt @@ -13,6 +13,8 @@ WeaponData "Damage" "15" "Penetration" "12.0" "CycleTime" "0.090909" // time between shots + "ReloadReadyTime" "2.633" // reload is done at the last reload click, the animation plays on to its end; + // the charging handle is home at 2.900, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_jittescoped.txt b/game/neo/scripts/weapon_jittescoped.txt index a7c32e13d1..a84887e09a 100644 --- a/game/neo/scripts/weapon_jittescoped.txt +++ b/game/neo/scripts/weapon_jittescoped.txt @@ -13,6 +13,8 @@ WeaponData "Damage" "15" "Penetration" "20.0" "CycleTime" "0.090909" // time between shots + "ReloadReadyTime" "2.633" // reload is done at the last reload click, the animation plays on to its end; + // the charging handle is home at 2.900, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_kyla.txt b/game/neo/scripts/weapon_kyla.txt index ab9152032c..c668090a11 100644 --- a/game/neo/scripts/weapon_kyla.txt +++ b/game/neo/scripts/weapon_kyla.txt @@ -13,6 +13,7 @@ WeaponData "Damage" "45" //"11" "Penetration" "10.0" "CycleTime" "0.363636" // time between shoots + "ReloadReadyTime" "1.767" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.6" diff --git a/game/neo/scripts/weapon_m41.txt b/game/neo/scripts/weapon_m41.txt index 29acafbfcf..071e254a1c 100644 --- a/game/neo/scripts/weapon_m41.txt +++ b/game/neo/scripts/weapon_m41.txt @@ -15,6 +15,7 @@ WeaponData "Damage" "29" "Penetration" "32.0" "CycleTime" "0.166666" // time between shots + "ReloadReadyTime" "3.367" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_m41l.txt b/game/neo/scripts/weapon_m41l.txt index 303ba2c82d..56a48fa531 100644 --- a/game/neo/scripts/weapon_m41l.txt +++ b/game/neo/scripts/weapon_m41l.txt @@ -15,6 +15,7 @@ WeaponData "Damage" "45" "Penetration" "32.0" "CycleTime" "0.5" // time between shots + "ReloadReadyTime" "3.367" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.25" diff --git a/game/neo/scripts/weapon_m41s.txt b/game/neo/scripts/weapon_m41s.txt index af971caae6..fda35bb328 100644 --- a/game/neo/scripts/weapon_m41s.txt +++ b/game/neo/scripts/weapon_m41s.txt @@ -15,6 +15,7 @@ WeaponData "Damage" "26" "Penetration" "20.0" "CycleTime" "0.166666" // time between shots + "ReloadReadyTime" "3.367" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_milso.txt b/game/neo/scripts/weapon_milso.txt index 8e05550834..7fad6a3130 100644 --- a/game/neo/scripts/weapon_milso.txt +++ b/game/neo/scripts/weapon_milso.txt @@ -13,6 +13,7 @@ WeaponData "Damage" "17" "Penetration" "12.0" "CycleTime" "0.212121" + "ReloadReadyTime" "1.633" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_mpn.txt b/game/neo/scripts/weapon_mpn.txt index c85eb6a752..20bd77b8e9 100644 --- a/game/neo/scripts/weapon_mpn.txt +++ b/game/neo/scripts/weapon_mpn.txt @@ -13,6 +13,8 @@ WeaponData "Damage" "12" "Penetration" "12.0" "CycleTime" "0.075757" // time between shots + "ReloadReadyTime" "2.700" // reload is done at the last reload click, the animation plays on to its end; + // the charging handle is home at 2.800, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_mpn_unsilenced.txt b/game/neo/scripts/weapon_mpn_unsilenced.txt index 8bd6e69fcc..fcc71f1ebf 100644 --- a/game/neo/scripts/weapon_mpn_unsilenced.txt +++ b/game/neo/scripts/weapon_mpn_unsilenced.txt @@ -13,6 +13,8 @@ WeaponData "Damage" "12" "Penetration" "12.0" "CycleTime" "0.075757" // time between shots + "ReloadReadyTime" "2.700" // reload is done at the last reload click, the animation plays on to its end; + // the charging handle is home at 2.800, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_mx.txt b/game/neo/scripts/weapon_mx.txt index 1eaabb29e8..2589f69fe7 100644 --- a/game/neo/scripts/weapon_mx.txt +++ b/game/neo/scripts/weapon_mx.txt @@ -15,6 +15,7 @@ WeaponData "Damage" "28" "Penetration" "38.0" "CycleTime" "0.106060" // time between shots + "ReloadReadyTime" "2.500" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.3" diff --git a/game/neo/scripts/weapon_mx_silenced.txt b/game/neo/scripts/weapon_mx_silenced.txt index b8b7c86556..ea661d8b14 100644 --- a/game/neo/scripts/weapon_mx_silenced.txt +++ b/game/neo/scripts/weapon_mx_silenced.txt @@ -13,6 +13,7 @@ WeaponData "Damage" "23" "Penetration" "18.0" "CycleTime" "0.106060" // time between shots + "ReloadReadyTime" "2.500" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.3" diff --git a/game/neo/scripts/weapon_pz.txt b/game/neo/scripts/weapon_pz.txt index c67473d642..72bac4dd3d 100644 --- a/game/neo/scripts/weapon_pz.txt +++ b/game/neo/scripts/weapon_pz.txt @@ -15,6 +15,8 @@ WeaponData "Damage" "20" "Penetration" "28.0" "CycleTime" "0.090909" // time between shots + "ReloadReadyTime" "5.133" // reload is done at the last reload click, the animation plays on to its end; + // the charging handle is home at 5.367, the alternative value "TPMuzzleFlashScale" "0.3" diff --git a/game/neo/scripts/weapon_srm.txt b/game/neo/scripts/weapon_srm.txt index e697644a27..c38f49ce6a 100644 --- a/game/neo/scripts/weapon_srm.txt +++ b/game/neo/scripts/weapon_srm.txt @@ -13,6 +13,8 @@ WeaponData "Damage" "12" "Penetration" "20.0" "CycleTime" "0.060606" // time between shots + "ReloadReadyTime" "2.833" // reload is done at the last reload click, the animation plays on to its end; + // the charging handle is home at 2.900, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_srm_s.txt b/game/neo/scripts/weapon_srm_s.txt index 8d190812a7..2555d18694 100644 --- a/game/neo/scripts/weapon_srm_s.txt +++ b/game/neo/scripts/weapon_srm_s.txt @@ -13,6 +13,8 @@ WeaponData "Damage" "12" "Penetration" "10.0" "CycleTime" "0.090909" // time between shots + "ReloadReadyTime" "2.833" // reload is done at the last reload click, the animation plays on to its end; + // the charging handle is home at 2.900, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_srs.txt b/game/neo/scripts/weapon_srs.txt index 4d7ba65f34..edfc3f5dc6 100644 --- a/game/neo/scripts/weapon_srs.txt +++ b/game/neo/scripts/weapon_srs.txt @@ -15,6 +15,7 @@ WeaponData "Damage" "100" "Penetration" "65.0" "CycleTime" "1.4" + "ReloadReadyTime" "3.067" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.25" diff --git a/game/neo/scripts/weapon_tachi.txt b/game/neo/scripts/weapon_tachi.txt index 21c7909c8b..d409d0f4a4 100644 --- a/game/neo/scripts/weapon_tachi.txt +++ b/game/neo/scripts/weapon_tachi.txt @@ -32,6 +32,7 @@ WeaponData "Damage" "17" "Penetration" "19.0" "CycleTime" "0.121212" + "ReloadReadyTime" "1.700" // reload is done here, the animation plays on to its end "ViewModelOffset" { diff --git a/game/neo/scripts/weapon_zr68c.txt b/game/neo/scripts/weapon_zr68c.txt index 4ce959e1c1..3c4945526a 100644 --- a/game/neo/scripts/weapon_zr68c.txt +++ b/game/neo/scripts/weapon_zr68c.txt @@ -15,6 +15,7 @@ WeaponData "Damage" "17" "Penetration" "28.0" "CycleTime" "0.090909" // time between shots + "ReloadReadyTime" "2.267" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_zr68l.txt b/game/neo/scripts/weapon_zr68l.txt index 7a32a52377..ce27a1f96e 100644 --- a/game/neo/scripts/weapon_zr68l.txt +++ b/game/neo/scripts/weapon_zr68l.txt @@ -15,6 +15,7 @@ WeaponData "Damage" "37" "Penetration" "32.0" "CycleTime" "0.5" // time between shots + "ReloadReadyTime" "2.533" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_zr68s.txt b/game/neo/scripts/weapon_zr68s.txt index f38e687f26..6d8127dd26 100644 --- a/game/neo/scripts/weapon_zr68s.txt +++ b/game/neo/scripts/weapon_zr68s.txt @@ -17,6 +17,7 @@ WeaponData "Damage" "22" "Penetration" "18.0" "CycleTime" "0.106060" // time between shots + "ReloadReadyTime" "2.267" // reload is done here, the animation plays on to its end "TPMuzzleFlashScale" "0.5" diff --git a/src/game/shared/neo/weapons/neo_weapon_parse.cpp b/src/game/shared/neo/weapons/neo_weapon_parse.cpp index 5a7dbd3214..8bad569c25 100644 --- a/src/game/shared/neo/weapons/neo_weapon_parse.cpp +++ b/src/game/shared/neo/weapons/neo_weapon_parse.cpp @@ -38,6 +38,7 @@ void CNEOWeaponInfo::Parse( KeyValues *pKeyValuesData, const char *szWeaponName m_iPlayerDamage = pKeyValuesData->GetInt( "Damage", 42 ); // Douglas Adams 1952 - 2001 m_iBullets = pKeyValuesData->GetInt( "Bullets", 1 ); m_flCycleTime = pKeyValuesData->GetFloat( "CycleTime", 0.15 ); + m_flReloadReadyTime = pKeyValuesData->GetFloat( "ReloadReadyTime", 0.0f ); const char *notFoundStr = "notfound"; Q_strncpy(szViewModel2, pKeyValuesData->GetString("team2viewmodel", notFoundStr), MAX_WEAPON_STRING); diff --git a/src/game/shared/neo/weapons/neo_weapon_parse.h b/src/game/shared/neo/weapons/neo_weapon_parse.h index c36e610af5..5ef4b51c80 100644 --- a/src/game/shared/neo/weapons/neo_weapon_parse.h +++ b/src/game/shared/neo/weapons/neo_weapon_parse.h @@ -24,6 +24,7 @@ class CNEOWeaponInfo : public CHL2MPSWeaponInfo int m_iBullets; float m_flCycleTime; + float m_flReloadReadyTime; char szViewModel2[MAX_WEAPON_STRING]; // Team 2 (NSF) wep vm char szBulletCharacter[MAX_BULLET_CHARACTER];// character used to display ammunition in current clip char szDeathIcon[MAX_BULLET_CHARACTER]; diff --git a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp index 4d75d319dc..841544fe84 100644 --- a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp +++ b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp @@ -416,7 +416,22 @@ void CNEOBaseCombatWeapon::Equip(CBaseCombatCharacter* pOwner) bool CNEOBaseCombatWeapon::Reload( void ) { - return BaseClass::Reload(); + if (!BaseClass::Reload()) + { + return false; + } + + // The magazine is loaded at the gun's last reload click, + // and the rest of the reload animation plays on as before + const float flReadyTime = GetNEOWpnData().m_flReloadReadyTime; + if (flReadyTime > 0.0f) + { + const float flReady = gpGlobals->curtime + flReadyTime; + GetOwner()->SetNextAttack(flReady); + m_flNextPrimaryAttack = m_flNextSecondaryAttack = flReady; + } + + return true; #if(0) CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); From 41c9dca7ab54b197efa7633a65aa3203fc3712a1 Mon Sep 17 00:00:00 2001 From: Alan Shen Date: Wed, 14 Oct 2026 23:55:00 -0600 Subject: [PATCH 2/2] Keep the fire time, load the magazine at the click Keep the end of the reload animation as the time the gun can fire again, as before this branch, and only load the magazine early: the owner stays busy until the animation ends, and the weapon loads the magazine from ItemBusyFrame once the reload's ready time has passed. A switch after the last click keeps the ammo; firing, aiming and the sprint lower still wait for the animation to end. The script key is now ReloadReadyBeforeEnd, the time from the last reload click to the end of the reload animation, and the ready time is that much before the end of the reload sequence actually played, clamped to the reload start. The ready time is networked and predicted so the client loads the magazine on the same frame. --- game/neo/scripts/weapon_aa13.txt | 4 +-- game/neo/scripts/weapon_jitte.txt | 4 +-- game/neo/scripts/weapon_jittescoped.txt | 4 +-- game/neo/scripts/weapon_kyla.txt | 2 +- game/neo/scripts/weapon_m41.txt | 2 +- game/neo/scripts/weapon_m41l.txt | 2 +- game/neo/scripts/weapon_m41s.txt | 2 +- game/neo/scripts/weapon_milso.txt | 2 +- game/neo/scripts/weapon_mpn.txt | 4 +-- game/neo/scripts/weapon_mpn_unsilenced.txt | 4 +-- game/neo/scripts/weapon_mx.txt | 2 +- game/neo/scripts/weapon_mx_silenced.txt | 2 +- game/neo/scripts/weapon_pz.txt | 4 +-- game/neo/scripts/weapon_srm.txt | 4 +-- game/neo/scripts/weapon_srm_s.txt | 4 +-- game/neo/scripts/weapon_srs.txt | 2 +- game/neo/scripts/weapon_tachi.txt | 2 +- game/neo/scripts/weapon_zr68c.txt | 2 +- game/neo/scripts/weapon_zr68l.txt | 2 +- game/neo/scripts/weapon_zr68s.txt | 2 +- .../shared/neo/weapons/neo_weapon_parse.cpp | 2 +- .../shared/neo/weapons/neo_weapon_parse.h | 2 +- .../weapons/weapon_neobasecombatweapon.cpp | 29 +++++++++++++------ .../neo/weapons/weapon_neobasecombatweapon.h | 3 ++ 24 files changed, 53 insertions(+), 39 deletions(-) diff --git a/game/neo/scripts/weapon_aa13.txt b/game/neo/scripts/weapon_aa13.txt index 72faf2faca..f8fe920d0a 100644 --- a/game/neo/scripts/weapon_aa13.txt +++ b/game/neo/scripts/weapon_aa13.txt @@ -6,8 +6,8 @@ WeaponData "Damage" "25" "Bullets" "5" "CycleTime" "0.333" - "ReloadReadyTime" "4.200" // reload is done at the last reload click, the animation plays on to its end; - // the charging handle is home at 4.333, the alternative value + "ReloadReadyBeforeEnd" "0.467" // the reload is done at the last reload click, this long before its animation ends + // the charging handle is home 0.333 before the end, the alternative value // Weapon data is loaded by both the Game and Client DLLs. "printname" "AA13" diff --git a/game/neo/scripts/weapon_jitte.txt b/game/neo/scripts/weapon_jitte.txt index ff6676127f..2ab8600053 100644 --- a/game/neo/scripts/weapon_jitte.txt +++ b/game/neo/scripts/weapon_jitte.txt @@ -13,8 +13,8 @@ WeaponData "Damage" "15" "Penetration" "12.0" "CycleTime" "0.090909" // time between shots - "ReloadReadyTime" "2.633" // reload is done at the last reload click, the animation plays on to its end; - // the charging handle is home at 2.900, the alternative value + "ReloadReadyBeforeEnd" "0.667" // the reload is done at the last reload click, this long before its animation ends + // the charging handle is home 0.400 before the end, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_jittescoped.txt b/game/neo/scripts/weapon_jittescoped.txt index a84887e09a..217946dee2 100644 --- a/game/neo/scripts/weapon_jittescoped.txt +++ b/game/neo/scripts/weapon_jittescoped.txt @@ -13,8 +13,8 @@ WeaponData "Damage" "15" "Penetration" "20.0" "CycleTime" "0.090909" // time between shots - "ReloadReadyTime" "2.633" // reload is done at the last reload click, the animation plays on to its end; - // the charging handle is home at 2.900, the alternative value + "ReloadReadyBeforeEnd" "0.667" // the reload is done at the last reload click, this long before its animation ends + // the charging handle is home 0.400 before the end, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_kyla.txt b/game/neo/scripts/weapon_kyla.txt index c668090a11..8d56a57f53 100644 --- a/game/neo/scripts/weapon_kyla.txt +++ b/game/neo/scripts/weapon_kyla.txt @@ -13,7 +13,7 @@ WeaponData "Damage" "45" //"11" "Penetration" "10.0" "CycleTime" "0.363636" // time between shoots - "ReloadReadyTime" "1.767" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.600" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.6" diff --git a/game/neo/scripts/weapon_m41.txt b/game/neo/scripts/weapon_m41.txt index 071e254a1c..a7727d8038 100644 --- a/game/neo/scripts/weapon_m41.txt +++ b/game/neo/scripts/weapon_m41.txt @@ -15,7 +15,7 @@ WeaponData "Damage" "29" "Penetration" "32.0" "CycleTime" "0.166666" // time between shots - "ReloadReadyTime" "3.367" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.333" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_m41l.txt b/game/neo/scripts/weapon_m41l.txt index 56a48fa531..b98a05166c 100644 --- a/game/neo/scripts/weapon_m41l.txt +++ b/game/neo/scripts/weapon_m41l.txt @@ -15,7 +15,7 @@ WeaponData "Damage" "45" "Penetration" "32.0" "CycleTime" "0.5" // time between shots - "ReloadReadyTime" "3.367" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.333" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.25" diff --git a/game/neo/scripts/weapon_m41s.txt b/game/neo/scripts/weapon_m41s.txt index fda35bb328..08ae66d288 100644 --- a/game/neo/scripts/weapon_m41s.txt +++ b/game/neo/scripts/weapon_m41s.txt @@ -15,7 +15,7 @@ WeaponData "Damage" "26" "Penetration" "20.0" "CycleTime" "0.166666" // time between shots - "ReloadReadyTime" "3.367" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.333" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_milso.txt b/game/neo/scripts/weapon_milso.txt index 7fad6a3130..5e220ac1f1 100644 --- a/game/neo/scripts/weapon_milso.txt +++ b/game/neo/scripts/weapon_milso.txt @@ -13,7 +13,7 @@ WeaponData "Damage" "17" "Penetration" "12.0" "CycleTime" "0.212121" - "ReloadReadyTime" "1.633" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.467" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_mpn.txt b/game/neo/scripts/weapon_mpn.txt index 20bd77b8e9..e61bce9774 100644 --- a/game/neo/scripts/weapon_mpn.txt +++ b/game/neo/scripts/weapon_mpn.txt @@ -13,8 +13,8 @@ WeaponData "Damage" "12" "Penetration" "12.0" "CycleTime" "0.075757" // time between shots - "ReloadReadyTime" "2.700" // reload is done at the last reload click, the animation plays on to its end; - // the charging handle is home at 2.800, the alternative value + "ReloadReadyBeforeEnd" "0.500" // the reload is done at the last reload click, this long before its animation ends + // the charging handle is home 0.400 before the end, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_mpn_unsilenced.txt b/game/neo/scripts/weapon_mpn_unsilenced.txt index fcc71f1ebf..4cc79578cb 100644 --- a/game/neo/scripts/weapon_mpn_unsilenced.txt +++ b/game/neo/scripts/weapon_mpn_unsilenced.txt @@ -13,8 +13,8 @@ WeaponData "Damage" "12" "Penetration" "12.0" "CycleTime" "0.075757" // time between shots - "ReloadReadyTime" "2.700" // reload is done at the last reload click, the animation plays on to its end; - // the charging handle is home at 2.800, the alternative value + "ReloadReadyBeforeEnd" "0.500" // the reload is done at the last reload click, this long before its animation ends + // the charging handle is home 0.400 before the end, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_mx.txt b/game/neo/scripts/weapon_mx.txt index 2589f69fe7..2c587ffa45 100644 --- a/game/neo/scripts/weapon_mx.txt +++ b/game/neo/scripts/weapon_mx.txt @@ -15,7 +15,7 @@ WeaponData "Damage" "28" "Penetration" "38.0" "CycleTime" "0.106060" // time between shots - "ReloadReadyTime" "2.500" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.367" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.3" diff --git a/game/neo/scripts/weapon_mx_silenced.txt b/game/neo/scripts/weapon_mx_silenced.txt index ea661d8b14..2f80fc7f50 100644 --- a/game/neo/scripts/weapon_mx_silenced.txt +++ b/game/neo/scripts/weapon_mx_silenced.txt @@ -13,7 +13,7 @@ WeaponData "Damage" "23" "Penetration" "18.0" "CycleTime" "0.106060" // time between shots - "ReloadReadyTime" "2.500" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.367" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.3" diff --git a/game/neo/scripts/weapon_pz.txt b/game/neo/scripts/weapon_pz.txt index 72bac4dd3d..4b9f268184 100644 --- a/game/neo/scripts/weapon_pz.txt +++ b/game/neo/scripts/weapon_pz.txt @@ -15,8 +15,8 @@ WeaponData "Damage" "20" "Penetration" "28.0" "CycleTime" "0.090909" // time between shots - "ReloadReadyTime" "5.133" // reload is done at the last reload click, the animation plays on to its end; - // the charging handle is home at 5.367, the alternative value + "ReloadReadyBeforeEnd" "0.633" // the reload is done at the last reload click, this long before its animation ends + // the charging handle is home 0.400 before the end, the alternative value "TPMuzzleFlashScale" "0.3" diff --git a/game/neo/scripts/weapon_srm.txt b/game/neo/scripts/weapon_srm.txt index c38f49ce6a..2d2170338f 100644 --- a/game/neo/scripts/weapon_srm.txt +++ b/game/neo/scripts/weapon_srm.txt @@ -13,8 +13,8 @@ WeaponData "Damage" "12" "Penetration" "20.0" "CycleTime" "0.060606" // time between shots - "ReloadReadyTime" "2.833" // reload is done at the last reload click, the animation plays on to its end; - // the charging handle is home at 2.900, the alternative value + "ReloadReadyBeforeEnd" "0.233" // the reload is done at the last reload click, this long before its animation ends + // the charging handle is home 0.167 before the end, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_srm_s.txt b/game/neo/scripts/weapon_srm_s.txt index 2555d18694..e8fb6146d3 100644 --- a/game/neo/scripts/weapon_srm_s.txt +++ b/game/neo/scripts/weapon_srm_s.txt @@ -13,8 +13,8 @@ WeaponData "Damage" "12" "Penetration" "10.0" "CycleTime" "0.090909" // time between shots - "ReloadReadyTime" "2.833" // reload is done at the last reload click, the animation plays on to its end; - // the charging handle is home at 2.900, the alternative value + "ReloadReadyBeforeEnd" "0.233" // the reload is done at the last reload click, this long before its animation ends + // the charging handle is home 0.167 before the end, the alternative value "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_srs.txt b/game/neo/scripts/weapon_srs.txt index edfc3f5dc6..ab9e1de751 100644 --- a/game/neo/scripts/weapon_srs.txt +++ b/game/neo/scripts/weapon_srs.txt @@ -15,7 +15,7 @@ WeaponData "Damage" "100" "Penetration" "65.0" "CycleTime" "1.4" - "ReloadReadyTime" "3.067" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.633" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.25" diff --git a/game/neo/scripts/weapon_tachi.txt b/game/neo/scripts/weapon_tachi.txt index d409d0f4a4..89d0bf13c1 100644 --- a/game/neo/scripts/weapon_tachi.txt +++ b/game/neo/scripts/weapon_tachi.txt @@ -32,7 +32,7 @@ WeaponData "Damage" "17" "Penetration" "19.0" "CycleTime" "0.121212" - "ReloadReadyTime" "1.700" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.400" // the reload is done at the last reload click, this long before its animation ends "ViewModelOffset" { diff --git a/game/neo/scripts/weapon_zr68c.txt b/game/neo/scripts/weapon_zr68c.txt index 3c4945526a..f11a4f6aef 100644 --- a/game/neo/scripts/weapon_zr68c.txt +++ b/game/neo/scripts/weapon_zr68c.txt @@ -15,7 +15,7 @@ WeaponData "Damage" "17" "Penetration" "28.0" "CycleTime" "0.090909" // time between shots - "ReloadReadyTime" "2.267" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.433" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_zr68l.txt b/game/neo/scripts/weapon_zr68l.txt index ce27a1f96e..aea02e630a 100644 --- a/game/neo/scripts/weapon_zr68l.txt +++ b/game/neo/scripts/weapon_zr68l.txt @@ -15,7 +15,7 @@ WeaponData "Damage" "37" "Penetration" "32.0" "CycleTime" "0.5" // time between shots - "ReloadReadyTime" "2.533" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.167" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.5" diff --git a/game/neo/scripts/weapon_zr68s.txt b/game/neo/scripts/weapon_zr68s.txt index 6d8127dd26..f5c6574194 100644 --- a/game/neo/scripts/weapon_zr68s.txt +++ b/game/neo/scripts/weapon_zr68s.txt @@ -17,7 +17,7 @@ WeaponData "Damage" "22" "Penetration" "18.0" "CycleTime" "0.106060" // time between shots - "ReloadReadyTime" "2.267" // reload is done here, the animation plays on to its end + "ReloadReadyBeforeEnd" "0.433" // the reload is done at the last reload click, this long before its animation ends "TPMuzzleFlashScale" "0.5" diff --git a/src/game/shared/neo/weapons/neo_weapon_parse.cpp b/src/game/shared/neo/weapons/neo_weapon_parse.cpp index 8bad569c25..bafe4597b6 100644 --- a/src/game/shared/neo/weapons/neo_weapon_parse.cpp +++ b/src/game/shared/neo/weapons/neo_weapon_parse.cpp @@ -38,7 +38,7 @@ void CNEOWeaponInfo::Parse( KeyValues *pKeyValuesData, const char *szWeaponName m_iPlayerDamage = pKeyValuesData->GetInt( "Damage", 42 ); // Douglas Adams 1952 - 2001 m_iBullets = pKeyValuesData->GetInt( "Bullets", 1 ); m_flCycleTime = pKeyValuesData->GetFloat( "CycleTime", 0.15 ); - m_flReloadReadyTime = pKeyValuesData->GetFloat( "ReloadReadyTime", 0.0f ); + m_flReloadReadyBeforeEnd = pKeyValuesData->GetFloat( "ReloadReadyBeforeEnd", 0.0f ); const char *notFoundStr = "notfound"; Q_strncpy(szViewModel2, pKeyValuesData->GetString("team2viewmodel", notFoundStr), MAX_WEAPON_STRING); diff --git a/src/game/shared/neo/weapons/neo_weapon_parse.h b/src/game/shared/neo/weapons/neo_weapon_parse.h index 5ef4b51c80..040dc00649 100644 --- a/src/game/shared/neo/weapons/neo_weapon_parse.h +++ b/src/game/shared/neo/weapons/neo_weapon_parse.h @@ -24,7 +24,7 @@ class CNEOWeaponInfo : public CHL2MPSWeaponInfo int m_iBullets; float m_flCycleTime; - float m_flReloadReadyTime; + float m_flReloadReadyBeforeEnd; char szViewModel2[MAX_WEAPON_STRING]; // Team 2 (NSF) wep vm char szBulletCharacter[MAX_BULLET_CHARACTER];// character used to display ammunition in current clip char szDeathIcon[MAX_BULLET_CHARACTER]; diff --git a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp index 841544fe84..c40f1f9041 100644 --- a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp +++ b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp @@ -41,6 +41,7 @@ BEGIN_NETWORK_TABLE( CNEOBaseCombatWeapon, DT_NEOBaseCombatWeapon ) RecvPropFloat(RECVINFO(m_flAccuracyPenalty)), RecvPropInt(RECVINFO(m_nNumShotsFired)), RecvPropBool(RECVINFO(m_bTriggerReset)), + RecvPropTime(RECVINFO(m_flReloadReadyTime)), RecvPropInt(RECVINFO(m_spawnflags)), #else SendPropTime(SENDINFO(m_flSoonestAttack)), @@ -48,6 +49,7 @@ BEGIN_NETWORK_TABLE( CNEOBaseCombatWeapon, DT_NEOBaseCombatWeapon ) SendPropFloat(SENDINFO(m_flAccuracyPenalty)), SendPropInt(SENDINFO(m_nNumShotsFired)), SendPropBool(SENDINFO(m_bTriggerReset)), + SendPropTime(SENDINFO(m_flReloadReadyTime)), SendPropInt(SENDINFO(m_spawnflags)), SendPropExclude("DT_BaseAnimating", "m_nSequence"), #endif @@ -60,6 +62,7 @@ BEGIN_PREDICTION_DATA(CNEOBaseCombatWeapon) DEFINE_PRED_FIELD(m_flAccuracyPenalty, FIELD_FLOAT, FTYPEDESC_INSENDTABLE), DEFINE_PRED_FIELD(m_nNumShotsFired, FIELD_INTEGER, FTYPEDESC_INSENDTABLE), DEFINE_PRED_FIELD(m_bTriggerReset, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE), + DEFINE_PRED_FIELD(m_flReloadReadyTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE), END_PREDICTION_DATA() #endif @@ -72,6 +75,7 @@ BEGIN_DATADESC( CNEOBaseCombatWeapon ) DEFINE_FIELD(m_flAccuracyPenalty, FIELD_FLOAT), DEFINE_FIELD(m_nNumShotsFired, FIELD_INTEGER), DEFINE_FIELD(m_bTriggerReset, FIELD_BOOLEAN), + DEFINE_FIELD(m_flReloadReadyTime, FIELD_TIME), END_DATADESC() #endif @@ -421,15 +425,9 @@ bool CNEOBaseCombatWeapon::Reload( void ) return false; } - // The magazine is loaded at the gun's last reload click, - // and the rest of the reload animation plays on as before - const float flReadyTime = GetNEOWpnData().m_flReloadReadyTime; - if (flReadyTime > 0.0f) - { - const float flReady = gpGlobals->curtime + flReadyTime; - GetOwner()->SetNextAttack(flReady); - m_flNextPrimaryAttack = m_flNextSecondaryAttack = flReady; - } + // The magazine loads at the gun's last reload click, which the script gives as a time before the reload animation ends; + // the animation and the wait to fire still run to the end + m_flReloadReadyTime = Max(gpGlobals->curtime, m_flNextPrimaryAttack - GetNEOWpnData().m_flReloadReadyBeforeEnd); return true; @@ -467,6 +465,13 @@ bool CNEOBaseCombatWeapon::Reload( void ) //----------------------------------------------------------------------------- void CNEOBaseCombatWeapon::FinishReload(void) { + // The magazine was already loaded at the reload's ready time + if (m_flReloadReadyTime == 0.0f) + { + return; + } + m_flReloadReadyTime = 0.0f; + CBaseCombatCharacter* pOwner = GetOwner(); if (pOwner) @@ -627,6 +632,12 @@ void CNEOBaseCombatWeapon::ItemBusyFrame(void) { BaseClass::ItemBusyFrame(); UpdateInaccuracy(); + + // The owner stays busy until the reload animation ends, but the magazine loads at the reload's ready time + if (m_bInReload && m_flReloadReadyTime > 0.0f && gpGlobals->curtime >= m_flReloadReadyTime) + { + FinishReload(); + } } void CNEOBaseCombatWeapon::ItemHolsterFrame(void) diff --git a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.h b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.h index b8a0afbefa..1e8caa7a0b 100644 --- a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.h +++ b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.h @@ -290,6 +290,9 @@ class CNEOBaseCombatWeapon : public CBaseHL2MPCombatWeapon CNetworkVar(int, m_nNumShotsFired); CNetworkVar(bool, m_bTriggerReset); + // When the reload in progress loads the magazine, 0 once it is loaded + CNetworkVar(float, m_flReloadReadyTime); + private: CNEOBaseCombatWeapon(const CNEOBaseCombatWeapon &other);