From 9fc712da019a1ca646171e912209a993e7c43976 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 25 Dec 2020 09:14:22 +0300 Subject: [PATCH 1/4] Fix checking for gag spawnflag (#143) --- dlls/monsterstate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/monsterstate.cpp b/dlls/monsterstate.cpp index cec29b79..a642873b 100644 --- a/dlls/monsterstate.cpp +++ b/dlls/monsterstate.cpp @@ -66,7 +66,7 @@ void CBaseMonster::RunAI( void ) // IDLE sound permitted in ALERT state is because monsters were silent in ALERT state. Only play IDLE sound in IDLE state // once we have sounds for that state. - if( ( m_MonsterState == MONSTERSTATE_IDLE || m_MonsterState == MONSTERSTATE_ALERT ) && RANDOM_LONG( 0, 99 ) == 0 && !( pev->flags & SF_MONSTER_GAG ) ) + if( ( m_MonsterState == MONSTERSTATE_IDLE || m_MonsterState == MONSTERSTATE_ALERT ) && RANDOM_LONG( 0, 99 ) == 0 && !( pev->spawnflags & SF_MONSTER_GAG ) ) { IdleSound(); } From 0e251e6f095514b3b27a0d99b2217dab09d6b612 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 10 Feb 2021 20:21:45 +0300 Subject: [PATCH 2/4] Fix attack times --- dlls/weapons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index ec98e0ca..1795c191 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -596,7 +596,7 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted ) } else { - return ( attack_time <= 0.0f ) ? TRUE : FALSE; + return ( (static_cast(::floor(attack_time * 1000.0f)) * 1000.0f) <= 0.0f) ? TRUE : FALSE; } } From 0a29ec49c8183ebb8da22a6d2ef395eae9c3dffe Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 10 Feb 2021 20:25:30 +0300 Subject: [PATCH 3/4] Gauss color depends on its charge --- cl_dll/ev_hldm.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 53c6cbcf..f5e512ea 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -948,13 +948,13 @@ void EV_FireGauss( event_args_t *args ) 0.1f, m_fPrimaryFire ? 1.0f : 2.5f, 0.0f, - m_fPrimaryFire ? 128.0f : flDamage, + (m_fPrimaryFire ? 128.0f : flDamage) / 255.0f, 0, 0, 0, - m_fPrimaryFire ? 255 : 255, - m_fPrimaryFire ? 128 : 255, - m_fPrimaryFire ? 0 : 255 + (m_fPrimaryFire ? 255 : 255) / 255.0f, + (m_fPrimaryFire ? 128 : 255) / 255.0f, + (m_fPrimaryFire ? 0 : 255) / 255.0f ); } else @@ -965,13 +965,13 @@ void EV_FireGauss( event_args_t *args ) 0.1f, m_fPrimaryFire ? 1.0f : 2.5f, 0.0f, - m_fPrimaryFire ? 128.0f : flDamage, + (m_fPrimaryFire ? 128.0f : flDamage) / 255.0f, 0, 0, 0, - m_fPrimaryFire ? 255 : 255, - m_fPrimaryFire ? 128 : 255, - m_fPrimaryFire ? 0 : 255 + (m_fPrimaryFire ? 255 : 255) / 255.0f, + (m_fPrimaryFire ? 128 : 255) / 255.0f, + (m_fPrimaryFire ? 0 : 255) / 255.0f ); } From 06f046430defa219eae8c6c7b096276195056850 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 10 Feb 2021 20:30:01 +0300 Subject: [PATCH 4/4] Fix occasional double playing of reload animations --- cl_dll/hl/hl_weapons.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index f305f321..754fd594 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -325,9 +325,13 @@ void CBasePlayerWeapon::ItemPostFrame( void ) { if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= 0.0f ) ) { -#if 0 // FIXME, need ammo on client to make this work right +#if 1 // complete the reload. - int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ); + ItemInfo itemInfo; + memset( &itemInfo, 0, sizeof( itemInfo ) ); + GetItemInfo( &itemInfo ); + + int j = Q_min( itemInfo.iMaxClip - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ); // Add them to the clip m_iClip += j;