From 12a2aeb3c14cdd52fa954eadd8f4111e296796e3 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 18 Jul 2022 22:31:56 +0300 Subject: [PATCH 1/3] Add WEAPONS_ANIMATION_TIMES_FIX macros for fixing some weapons animation times --- CMakeLists.txt | 6 ++++++ dlls/crowbar.cpp | 4 ++++ dlls/rpg.cpp | 5 ++++- dlls/satchel.cpp | 17 ++++++++++++++--- dlls/squeakgrenade.cpp | 9 ++++++++- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d75ade3..86d0a981 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ option(CROWBAR_FIX_RAPID_CROWBAR "Enable rapid crowbar fix" OFF) option(GAUSS_OVERCHARGE_FIX "Enable gauss overcharge fix" OFF) option(TRIPMINE_BEAM_DUPLICATION_FIX "Enable fix of tripmine beam duplication on level transition" OFF) option(HANDGRENADE_DEPLOY_FIX "Enable handgrenade deploy animation fix after finishing a throw" OFF) +option(WEAPONS_ANIMATION_TIMES_FIX "Enable animation times fix for some weapons" OFF) option(OEM_BUILD "Enable OEM Build" OFF) option(HLDEMO_BUILD "Enable Demo Build" OFF) @@ -148,6 +149,11 @@ if(HANDGRENADE_DEPLOY_FIX) add_definitions(-DHANDGRENADE_DEPLOY_FIX) endif() +if(WEAPONS_ANIMATION_TIMES_FIX) + message(STATUS "Weapons animation times fix enabled") + add_definitions(-DWEAPONS_ANIMATION_TIMES_FIX) +endif() + if(OEM_BUILD) message(STATUS "OEM build enabled") add_definitions(-DOEM_BUILD) diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index f1b2393b..667ebd7e 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -366,7 +366,11 @@ void CCrowbar::WeaponIdle( void ) if( flRand > 0.5f ) { iAnim = CROWBAR_IDLE; +#if WEAPONS_ANIMATION_TIMES_FIX + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 25.0f; +#else m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 30.0f; +#endif } else { diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index 65f1bd49..c81e6246 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -518,8 +518,11 @@ void CRpg::WeaponIdle( void ) iAnim = RPG_FIDGET_UL; else iAnim = RPG_FIDGET; - +#if WEAPONS_ANIMATION_TIMES_FIX + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 6.1f; +#else m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f; +#endif } SendWeaponAnim( iAnim ); diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index 528a3ba8..625a88d1 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -293,14 +293,25 @@ BOOL CSatchel::CanDeploy( void ) BOOL CSatchel::Deploy() { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f; +#if !WEAPONS_ANIMATION_TIMES_FIX m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f ); +#endif + + BOOL result; if( m_chargeReady ) - return DefaultDeploy( "models/v_satchel_radio.mdl", "models/p_satchel_radio.mdl", SATCHEL_RADIO_DRAW, "hive" ); + result = DefaultDeploy( "models/v_satchel_radio.mdl", "models/p_satchel_radio.mdl", SATCHEL_RADIO_DRAW, "hive" ); else - return DefaultDeploy( "models/v_satchel.mdl", "models/p_satchel.mdl", SATCHEL_DRAW, "trip" ); + result = DefaultDeploy( "models/v_satchel.mdl", "models/p_satchel.mdl", SATCHEL_DRAW, "trip" ); - return TRUE; +#if WEAPONS_ANIMATION_TIMES_FIX + if ( result ) + { + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; + } +#endif + + return result; } void CSatchel::Holster( int skiplocal /* = 0 */ ) diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index 4bf2e3df..f332a5a8 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -465,7 +465,14 @@ BOOL CSqueak::Deploy() m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; - return DefaultDeploy( "models/v_squeak.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" ); + const BOOL result = DefaultDeploy( "models/v_squeak.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" ); +#if WEAPONS_ANIMATION_TIMES_FIX + if ( result ) + { + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.7f; + } +#endif + return result; } void CSqueak::Holster( int skiplocal /* = 0 */ ) From 058626fc18d76fa1e33685c22a15993b68ef79a3 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 19 Jul 2022 12:29:32 +0300 Subject: [PATCH 2/3] Remove redundant assignment to m_flTimeWeaponIdle in CSatchel::Deploy --- dlls/satchel.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index 625a88d1..38ebec08 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -293,10 +293,6 @@ BOOL CSatchel::CanDeploy( void ) BOOL CSatchel::Deploy() { m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f; -#if !WEAPONS_ANIMATION_TIMES_FIX - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f ); -#endif - BOOL result; if( m_chargeReady ) @@ -310,7 +306,6 @@ BOOL CSatchel::Deploy() m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; } #endif - return result; } From 74f3ec7f61055e00b2f7602a8be849f4ce2aca0e Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 19 Jul 2022 12:32:51 +0300 Subject: [PATCH 3/3] Fix crowbar idle animation time regardless of WEAPONS_ANIMATION_TIMES_FIX macro --- dlls/crowbar.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index 667ebd7e..5342e7c2 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -366,11 +366,7 @@ void CCrowbar::WeaponIdle( void ) if( flRand > 0.5f ) { iAnim = CROWBAR_IDLE; -#if WEAPONS_ANIMATION_TIMES_FIX m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 25.0f; -#else - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 30.0f; -#endif } else {