Skip to content
Merged
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: 2 additions & 0 deletions game/neo/scripts/weapon_aa13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions game/neo/scripts/weapon_jitte.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions game/neo/scripts/weapon_jittescoped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_kyla.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_m41.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_m41l.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_m41s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_milso.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions game/neo/scripts/weapon_mpn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions game/neo/scripts/weapon_mpn_unsilenced.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_mx.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_mx_silenced.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions game/neo/scripts/weapon_pz.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions game/neo/scripts/weapon_srm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions game/neo/scripts/weapon_srm_s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_srs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_tachi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
{
Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_zr68c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_zr68l.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions game/neo/scripts/weapon_zr68s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions src/game/shared/neo/weapons/neo_weapon_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/game/shared/neo/weapons/neo_weapon_parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
28 changes: 27 additions & 1 deletion src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ 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)),
SendPropTime(SENDINFO(m_flLastAttackTime)),
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
Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/game/shared/neo/weapons/weapon_neobasecombatweapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading