Skip to content

Commit

Permalink
Fixed: workaround for bug with bouncing satchels causing high load in…
Browse files Browse the repository at this point in the history
… network channel and leading to choke. Further lowering net load by disabling animation of satchel model (its model has no animation, so nothing is lost). Corrected precache model for a satchel.
  • Loading branch information
LevShisterov committed Dec 24, 2010
1 parent 336bc05 commit 7a627bf
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions dlls/satchel.cpp
Expand Up @@ -42,6 +42,7 @@ enum satchel_radio_e {

class CSatchelCharge : public CGrenade
{
Vector m_lastBounceOrigin; // Used to fix a bug in engine: when object isn't moving, but its speed isn't 0 and on ground isn't set
void Spawn( void );
void Precache( void );
void BounceSound( void );
Expand Down Expand Up @@ -115,15 +116,22 @@ void CSatchelCharge::SatchelSlide( CBaseEntity *pOther )
}
if ( !(pev->flags & FL_ONGROUND) && pev->velocity.Length2D() > 10 )
{
BounceSound();
// Fix for a bug in engine: when object isn't moving, but its speed isn't 0 and on ground isn't set
if ( pev->origin != m_lastBounceOrigin )
{
BounceSound();
}
}
StudioFrameAdvance( );
m_lastBounceOrigin = pev->origin;
// There is no model animation so commented this out to prevent net traffic
//StudioFrameAdvance( );
}


void CSatchelCharge :: SatchelThink( void )
{
StudioFrameAdvance( );
// There is no model animation so commented this out to prevent net traffic
//StudioFrameAdvance( );
pev->nextthink = gpGlobals->time + 0.1;

if (!IsInWorld())
Expand Down Expand Up @@ -151,7 +159,7 @@ void CSatchelCharge :: SatchelThink( void )

void CSatchelCharge :: Precache( void )
{
PRECACHE_MODEL("models/grenade.mdl");
PRECACHE_MODEL("models/w_satchel.mdl");
PRECACHE_SOUND("weapons/g_bounce1.wav");
PRECACHE_SOUND("weapons/g_bounce2.wav");
PRECACHE_SOUND("weapons/g_bounce3.wav");
Expand Down

0 comments on commit 7a627bf

Please sign in to comment.