Skip to content

Commit

Permalink
Fix client tripmine body and weapon bodies passed to EV_WeaponAnimati…
Browse files Browse the repository at this point in the history
…on (#298)
  • Loading branch information
FreeSlave authored Aug 5, 2022
1 parent 70516c9 commit abf08e4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
32 changes: 16 additions & 16 deletions cl_dll/ev_hldm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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 ) );
}
Expand Down Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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.
{
Expand Down Expand Up @@ -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 ) )
Expand Down
6 changes: 1 addition & 5 deletions cl_dll/hl/hl_weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
Expand Down
5 changes: 5 additions & 0 deletions dlls/tripmine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit abf08e4

Please sign in to comment.