diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/server/baseprojectile.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/server/baseprojectile.cpp')
| -rw-r--r-- | mp/src/game/server/baseprojectile.cpp | 272 |
1 files changed, 136 insertions, 136 deletions
diff --git a/mp/src/game/server/baseprojectile.cpp b/mp/src/game/server/baseprojectile.cpp index 6ee7d3ec..30d92fec 100644 --- a/mp/src/game/server/baseprojectile.cpp +++ b/mp/src/game/server/baseprojectile.cpp @@ -1,136 +1,136 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================
-
-#include "cbase.h"
-#include "baseprojectile.h"
-
-BEGIN_DATADESC( CBaseProjectile )
- DEFINE_FIELD( m_flDamage, FIELD_FLOAT ),
- DEFINE_FIELD( m_iDamageType, FIELD_INTEGER ),
- DEFINE_FIELD( m_flDamageScale, FIELD_FLOAT ),
-
- DEFINE_FUNCTION( ProjectileTouch ),
- DEFINE_THINKFUNC( FlyThink ),
-END_DATADESC()
-
-LINK_ENTITY_TO_CLASS( proj_base, CBaseProjectile );
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CBaseProjectile::Spawn( void )
-{
- Precache();
-
- SetModel( STRING( GetModelName() ) );
-
- SetSolid( SOLID_BBOX );
- SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM );
- AddFlag( FL_OBJECT );
-
- UTIL_SetSize( this, -Vector( 1.0f, 1.0f, 1.0f ), Vector( 1.0f, 1.0f, 1.0f ) );
-
- // Setup attributes.
- SetGravity( 0.001f );
- m_takedamage = DAMAGE_NO;
-
- // Setup the touch and think functions.
- SetTouch( &CBaseProjectile::ProjectileTouch );
- SetThink( &CBaseProjectile::FlyThink );
- SetNextThink( gpGlobals->curtime );
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CBaseProjectile::Precache( void )
-{
- BaseClass::Precache();
-
- PrecacheModel( STRING( GetModelName() ) );
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-CBaseProjectile *CBaseProjectile::Create( baseprojectilecreate_t &pCreate )
-{
- CBaseProjectile *pProjectile = static_cast<CBaseProjectile*>( CBaseEntity::CreateNoSpawn( "proj_base", pCreate.vecOrigin, vec3_angle, pCreate.pOwner ) );
- if ( !pProjectile )
- return NULL;
-
- pProjectile->SetModelName( pCreate.iszModel );
- pProjectile->SetDamage( pCreate.flDamage );
- pProjectile->SetDamageType( pCreate.iDamageType );
- pProjectile->SetDamageScale( pCreate.flDamageScale );
- pProjectile->SetAbsVelocity( pCreate.vecVelocity );
-
- // Setup the initial angles.
- QAngle angles;
- VectorAngles( -pCreate.vecVelocity, angles );
- pProjectile->SetAbsAngles( angles );
-
- // Spawn & Activate
- DispatchSpawn( pProjectile );
- pProjectile->Activate();
-
- return pProjectile;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-unsigned int CBaseProjectile::PhysicsSolidMaskForEntity( void ) const
-{
- return BaseClass::PhysicsSolidMaskForEntity() | CONTENTS_HITBOX;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CBaseProjectile::ProjectileTouch( CBaseEntity *pOther )
-{
- // Verify a correct "other."
- Assert( pOther );
- if ( !pOther->IsSolid() || pOther->IsSolidFlagSet( FSOLID_VOLUME_CONTENTS ) )
- return;
-
- // Handle hitting skybox (disappear).
- const trace_t *pTrace = &CBaseEntity::GetTouchTrace();
- trace_t *pNewTrace = const_cast<trace_t*>( pTrace );
-
- if( pTrace->surface.flags & SURF_SKY )
- {
- UTIL_Remove( this );
- return;
- }
-
- CTakeDamageInfo info;
- info.SetAttacker( GetOwnerEntity() );
- info.SetInflictor( this );
- info.SetDamage( GetDamage() );
- info.SetDamageType( GetDamageType() );
- CalculateMeleeDamageForce( &info, GetAbsVelocity(), GetAbsOrigin(), GetDamageScale() );
-
- Vector dir;
- AngleVectors( GetAbsAngles(), &dir );
-
- pOther->DispatchTraceAttack( info, dir, pNewTrace );
- ApplyMultiDamage();
-
- UTIL_Remove( this );
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Orient the projectile along its velocity
-//-----------------------------------------------------------------------------
-void CBaseProjectile::FlyThink( void )
-{
- QAngle angles;
- VectorAngles( -(GetAbsVelocity()), angles );
- SetAbsAngles( angles );
- SetNextThink( gpGlobals->curtime + 0.1f );
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#include "cbase.h" +#include "baseprojectile.h" + +BEGIN_DATADESC( CBaseProjectile ) + DEFINE_FIELD( m_flDamage, FIELD_FLOAT ), + DEFINE_FIELD( m_iDamageType, FIELD_INTEGER ), + DEFINE_FIELD( m_flDamageScale, FIELD_FLOAT ), + + DEFINE_FUNCTION( ProjectileTouch ), + DEFINE_THINKFUNC( FlyThink ), +END_DATADESC() + +LINK_ENTITY_TO_CLASS( proj_base, CBaseProjectile ); + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CBaseProjectile::Spawn( void ) +{ + Precache(); + + SetModel( STRING( GetModelName() ) ); + + SetSolid( SOLID_BBOX ); + SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM ); + AddFlag( FL_OBJECT ); + + UTIL_SetSize( this, -Vector( 1.0f, 1.0f, 1.0f ), Vector( 1.0f, 1.0f, 1.0f ) ); + + // Setup attributes. + SetGravity( 0.001f ); + m_takedamage = DAMAGE_NO; + + // Setup the touch and think functions. + SetTouch( &CBaseProjectile::ProjectileTouch ); + SetThink( &CBaseProjectile::FlyThink ); + SetNextThink( gpGlobals->curtime ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CBaseProjectile::Precache( void ) +{ + BaseClass::Precache(); + + PrecacheModel( STRING( GetModelName() ) ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CBaseProjectile *CBaseProjectile::Create( baseprojectilecreate_t &pCreate ) +{ + CBaseProjectile *pProjectile = static_cast<CBaseProjectile*>( CBaseEntity::CreateNoSpawn( "proj_base", pCreate.vecOrigin, vec3_angle, pCreate.pOwner ) ); + if ( !pProjectile ) + return NULL; + + pProjectile->SetModelName( pCreate.iszModel ); + pProjectile->SetDamage( pCreate.flDamage ); + pProjectile->SetDamageType( pCreate.iDamageType ); + pProjectile->SetDamageScale( pCreate.flDamageScale ); + pProjectile->SetAbsVelocity( pCreate.vecVelocity ); + + // Setup the initial angles. + QAngle angles; + VectorAngles( -pCreate.vecVelocity, angles ); + pProjectile->SetAbsAngles( angles ); + + // Spawn & Activate + DispatchSpawn( pProjectile ); + pProjectile->Activate(); + + return pProjectile; +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +unsigned int CBaseProjectile::PhysicsSolidMaskForEntity( void ) const +{ + return BaseClass::PhysicsSolidMaskForEntity() | CONTENTS_HITBOX; +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CBaseProjectile::ProjectileTouch( CBaseEntity *pOther ) +{ + // Verify a correct "other." + Assert( pOther ); + if ( !pOther->IsSolid() || pOther->IsSolidFlagSet( FSOLID_VOLUME_CONTENTS ) ) + return; + + // Handle hitting skybox (disappear). + const trace_t *pTrace = &CBaseEntity::GetTouchTrace(); + trace_t *pNewTrace = const_cast<trace_t*>( pTrace ); + + if( pTrace->surface.flags & SURF_SKY ) + { + UTIL_Remove( this ); + return; + } + + CTakeDamageInfo info; + info.SetAttacker( GetOwnerEntity() ); + info.SetInflictor( this ); + info.SetDamage( GetDamage() ); + info.SetDamageType( GetDamageType() ); + CalculateMeleeDamageForce( &info, GetAbsVelocity(), GetAbsOrigin(), GetDamageScale() ); + + Vector dir; + AngleVectors( GetAbsAngles(), &dir ); + + pOther->DispatchTraceAttack( info, dir, pNewTrace ); + ApplyMultiDamage(); + + UTIL_Remove( this ); +} + +//----------------------------------------------------------------------------- +// Purpose: Orient the projectile along its velocity +//----------------------------------------------------------------------------- +void CBaseProjectile::FlyThink( void ) +{ + QAngle angles; + VectorAngles( -(GetAbsVelocity()), angles ); + SetAbsAngles( angles ); + SetNextThink( gpGlobals->curtime + 0.1f ); +} |