From abf08e4520e3b6cd12a40f269f4a256cf8496227 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Fri, 5 Aug 2022 16:21:43 +0300 Subject: [PATCH] Fix client tripmine body and weapon bodies passed to EV_WeaponAnimation (#298) --- cl_dll/ev_hldm.cpp | 32 ++++++++++++++++---------------- cl_dll/hl/hl_weapons.cpp | 6 +----- dlls/tripmine.cpp | 5 +++++ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 6eee0328..c0b8b475 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -486,7 +486,7 @@ static void EV_FireGlock_Impl( event_args_t *args ) if( EV_IsLocal( idx ) ) { EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, 0 ); V_PunchAxis( 0, -2.0 ); } @@ -549,7 +549,7 @@ void EV_FireShotGunDouble( event_args_t *args ) { // Add muzzle flash to current weapon model EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE2, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE2, 0 ); V_PunchAxis( 0, -10.0 ); } @@ -603,7 +603,7 @@ void EV_FireShotGunSingle( event_args_t *args ) { // Add muzzle flash to current weapon model EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( SHOTGUN_FIRE, 0 ); V_PunchAxis( 0, -5.0 ); } @@ -660,7 +660,7 @@ void EV_FireMP5( event_args_t *args ) { // Add muzzle flash to current weapon model EV_MuzzleFlash(); - gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_FIRE1 + gEngfuncs.pfnRandomLong( 0, 2 ), 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_FIRE1 + gEngfuncs.pfnRandomLong( 0, 2 ), 0 ); V_PunchAxis( 0, gEngfuncs.pfnRandomFloat( -2, 2 ) ); } @@ -697,7 +697,7 @@ void EV_FireMP52( event_args_t *args ) if( EV_IsLocal( idx ) ) { - gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_LAUNCH, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( MP5_LAUNCH, 0 ); V_PunchAxis( 0, -10 ); } @@ -862,7 +862,7 @@ void EV_FireGauss( event_args_t *args ) if( EV_IsLocal( idx ) ) { V_PunchAxis( 0.0f, -2.0f ); - gEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 2 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 0 ); if( m_fPrimaryFire == false ) g_flApplyVel = flDamage; @@ -1129,13 +1129,13 @@ void EV_Crowbar( event_args_t *args ) switch( (g_iSwing++) % 3 ) { case 0: - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK1MISS, 0 ); break; case 1: - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK2MISS, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK2MISS, 0 ); break; case 2: - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK3MISS, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROWBAR_ATTACK3MISS, 0 ); break; } } @@ -1203,9 +1203,9 @@ void EV_FireCrossbow2( event_args_t *args ) if( EV_IsLocal( idx ) ) { if( args->iparam1 ) - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 0 ); else - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 0 ); } // Store off the old count @@ -1279,9 +1279,9 @@ void EV_FireCrossbow( event_args_t *args ) if( EV_IsLocal( idx ) ) { if( args->iparam1 ) - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE1, 0 ); else - gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 0 ); V_PunchAxis( 0.0f, -2.0f ); } @@ -1321,7 +1321,7 @@ void EV_FireRpg( event_args_t *args ) //Only play the weapon anims if I shot it. if( EV_IsLocal( idx ) ) { - gEngfuncs.pEventAPI->EV_WeaponAnimation( RPG_FIRE2, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( RPG_FIRE2, 0 ); V_PunchAxis( 0, -5.0 ); } @@ -1422,7 +1422,7 @@ void EV_EgonFire( event_args_t *args ) //Only play the weapon anims if I shot it. if( EV_IsLocal( idx ) ) - gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( g_fireAnims1[gEngfuncs.pfnRandomLong( 0, 3 )], 0 ); if( iStartup == 1 && EV_IsLocal( idx ) && !( pBeam || pBeam2 || pFlare ) && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction. { @@ -1564,7 +1564,7 @@ void EV_HornetGunFire( event_args_t *args ) if( EV_IsLocal( idx ) ) { V_PunchAxis( 0, gEngfuncs.pfnRandomLong( 0, 2 ) ); - gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 1 ); + gEngfuncs.pEventAPI->EV_WeaponAnimation( HGUN_SHOOT, 0 ); } switch( gEngfuncs.pfnRandomLong( 0, 2 ) ) diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index f8473eaa..4f119f02 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -907,11 +907,7 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm // over the wire ( fixes some animation glitches ) if( g_runfuncs && ( HUD_GetWeaponAnim() != to->client.weaponanim ) ) { - int body = 2; - - //Pop the model to body 0. - if( pWeapon == &g_Tripmine ) - body = 0; + int body = 0; //Show laser sight/scope combo if( pWeapon == &g_Python && bIsMultiplayer() ) diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index 3a46c6a5..7df4b93d 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -364,7 +364,12 @@ void CTripmine::Spawn() m_iId = WEAPON_TRIPMINE; SET_MODEL( ENT( pev ), "models/v_tripmine.mdl" ); pev->frame = 0; + +#ifdef CLIENT_DLL + pev->body = 0; +#else pev->body = 3; +#endif pev->sequence = TRIPMINE_GROUND; // ResetSequenceInfo(); pev->framerate = 0;