Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 25 additions & 28 deletions sp/src/game/server/episodic/grenade_hopwire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,31 @@ bool CGravityVortexController::CanConsumeEntity( CBaseEntity *pEnt )
}
#endif

bool VectorLessFunc( const Vector &lhs, const Vector &rhs )
{
return lhs.LengthSqr() < rhs.LengthSqr();
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
CGravityVortexController::CGravityVortexController( void ) : m_flEndTime( 0.0f ), m_flRadius( 256 ), m_flStrength( 256 ), m_flMass( 0.0f ),
m_flNodeRadius( 256.0f ), m_flConsumeRadius( 48.0f )
{
#ifdef EZ2
SetDefLessFunc( m_ModelMass );
SetDefLessFunc( m_ClassMass );
m_ModelMass.EnsureCapacity( 128 );
m_ClassMass.EnsureCapacity( 128 );

m_HullMap.SetLessFunc( VectorLessFunc );
m_HullMap.EnsureCapacity( 32 );

SetDefLessFunc( m_SpawnList );
m_SpawnList.EnsureCapacity( 16 );
#endif
}

//-----------------------------------------------------------------------------
// Purpose: Returns the amount of mass consumed by the vortex
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1060,29 +1085,12 @@ void CGravityVortexController::CreateDenseBall( void )
}
}
#ifdef EZ2
bool VectorLessFunc( const Vector &lhs, const Vector &rhs )
{
return lhs.LengthSqr() < rhs.LengthSqr();
}

//-----------------------------------------------------------------------------
// Purpose:
// Input : &restore -
//-----------------------------------------------------------------------------
int CGravityVortexController::Restore( IRestore &restore )
{
// This needs to be done before the game is restored
SetDefLessFunc( m_ModelMass );
SetDefLessFunc( m_ClassMass );
m_ModelMass.EnsureCapacity( 128 );
m_ClassMass.EnsureCapacity( 128 );

m_HullMap.SetLessFunc( VectorLessFunc );
m_HullMap.EnsureCapacity( 32 );

SetDefLessFunc( m_SpawnList );
m_SpawnList.EnsureCapacity( 16 );

return BaseClass::Restore( restore );
}

Expand Down Expand Up @@ -2109,17 +2117,6 @@ void CGravityVortexController::StartPull( const Vector &origin, float radius, fl
// Play a danger sound throughout the duration of the vortex so that NPCs run away
CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin(), radius, duration, this );

SetDefLessFunc( m_ModelMass );
SetDefLessFunc( m_ClassMass );
m_ModelMass.EnsureCapacity( 64 );
m_ClassMass.EnsureCapacity( 64 );

m_HullMap.SetLessFunc( VectorLessFunc );
m_HullMap.EnsureCapacity( 32 );

SetDefLessFunc( m_SpawnList );
m_SpawnList.EnsureCapacity( 16 );

m_flStartTime = gpGlobals->curtime;
#endif

Expand Down
3 changes: 1 addition & 2 deletions sp/src/game/server/episodic/grenade_hopwire.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class CGravityVortexController : public CBaseEntity, public CDisplacerSink

public:

CGravityVortexController( void ) : m_flEndTime( 0.0f ), m_flRadius( 256 ), m_flStrength( 256 ), m_flMass( 0.0f ),
m_flNodeRadius( 256.0f ), m_flConsumeRadius( 48.0f ) {}
CGravityVortexController( void );
float GetConsumedMass( void ) const;

#ifdef EZ2
Expand Down
Loading