diff --git a/game/neo/scripts/weapon_aa13.txt b/game/neo/scripts/weapon_aa13.txt index def63c9983..f8fe920d0a 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" + "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 c450c6f29a..2ab8600053 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 + "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 a7c32e13d1..217946dee2 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 + "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 ab9152032c..8d56a57f53 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 + "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 29acafbfcf..a7727d8038 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 + "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 303ba2c82d..b98a05166c 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 + "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 af971caae6..08ae66d288 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 + "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 8e05550834..5e220ac1f1 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" + "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 c85eb6a752..e61bce9774 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 + "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 8bd6e69fcc..4cc79578cb 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 + "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 1eaabb29e8..2c587ffa45 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 + "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 b8b7c86556..2f80fc7f50 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 + "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 c67473d642..4b9f268184 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 + "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 e697644a27..2d2170338f 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 + "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 8d190812a7..e8fb6146d3 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 + "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 4d7ba65f34..ab9e1de751 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" + "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 21c7909c8b..89d0bf13c1 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" + "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 4ce959e1c1..f11a4f6aef 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 + "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 7a32a52377..aea02e630a 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 + "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 f38e687f26..f5c6574194 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 + "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 5a7dbd3214..bafe4597b6 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_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 c36e610af5..040dc00649 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_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 4d75d319dc..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 @@ -416,7 +420,16 @@ void CNEOBaseCombatWeapon::Equip(CBaseCombatCharacter* pOwner) bool CNEOBaseCombatWeapon::Reload( void ) { - return BaseClass::Reload(); + if (!BaseClass::Reload()) + { + return false; + } + + // 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; #if(0) CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); @@ -452,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) @@ -612,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);