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/basegrenade_concussion.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/basegrenade_concussion.cpp')
| -rw-r--r-- | mp/src/game/server/basegrenade_concussion.cpp | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/mp/src/game/server/basegrenade_concussion.cpp b/mp/src/game/server/basegrenade_concussion.cpp index 3fc3a2f6..2954416e 100644 --- a/mp/src/game/server/basegrenade_concussion.cpp +++ b/mp/src/game/server/basegrenade_concussion.cpp @@ -1,131 +1,131 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-#include "cbase.h"
-#include "baseentity.h"
-#include "basegrenade_shared.h"
-#include "soundent.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-class CBaseGrenadeConcussion : public CBaseGrenade
-{
- DECLARE_DATADESC();
-
-public:
- DECLARE_CLASS( CBaseGrenadeConcussion, CBaseGrenade );
-
- void Spawn( void );
- void Precache( void );
- void FallThink(void);
- void ExplodeConcussion( CBaseEntity *pOther );
-
-protected:
- static int m_nTrailSprite;
-};
-
-int CBaseGrenadeConcussion::m_nTrailSprite = 0;
-
-LINK_ENTITY_TO_CLASS( npc_concussiongrenade, CBaseGrenadeConcussion );
-
-BEGIN_DATADESC( CBaseGrenadeConcussion )
-
- DEFINE_THINKFUNC( FallThink ),
- DEFINE_ENTITYFUNC( ExplodeConcussion ),
-
-END_DATADESC()
-
-
-void CBaseGrenadeConcussion::FallThink(void)
-{
- if (!IsInWorld())
- {
- Remove( );
- return;
- }
- CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin() + GetAbsVelocity() * 0.5, GetAbsVelocity().Length( ), 0.2 );
-
- SetNextThink( gpGlobals->curtime + random->RandomFloat(0.05, 0.1) );
-
- if (GetWaterLevel() != 0)
- {
- SetAbsVelocity( GetAbsVelocity() * 0.5 );
- }
-
- Vector pos = GetAbsOrigin() + Vector(random->RandomFloat(-4, 4), random->RandomFloat(-4, 4), random->RandomFloat(-4, 4));
-
- CPVSFilter filter( GetAbsOrigin() );
-
- te->Sprite( filter, 0.0,
- &pos,
- m_nTrailSprite,
- random->RandomFloat(0.5, 0.8),
- 200 );
-}
-
-
-//
-// Contact grenade, explode when it touches something
-//
-void CBaseGrenadeConcussion::ExplodeConcussion( CBaseEntity *pOther )
-{
- trace_t tr;
- Vector vecSpot;// trace starts here!
-
- Vector velDir = GetAbsVelocity();
- VectorNormalize( velDir );
- vecSpot = GetAbsOrigin() - velDir * 32;
- UTIL_TraceLine( vecSpot, vecSpot + velDir * 64, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr );
-
- Explode( &tr, DMG_BLAST );
-}
-
-
-void CBaseGrenadeConcussion::Spawn( void )
-{
- // point sized, solid, bouncing
- SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
- SetSolid( SOLID_BBOX );
- SetCollisionGroup( COLLISION_GROUP_PROJECTILE );
- SetModel( "models/weapons/w_grenade.mdl" ); // BUG: wrong model
-
- UTIL_SetSize(this, vec3_origin, vec3_origin);
-
- // contact grenades arc lower
- SetGravity( UTIL_ScaleForGravity( 400 ) ); // use a lower gravity for grenades to make them easier to see
- QAngle angles;
- VectorAngles(GetAbsVelocity(), angles );
- SetLocalAngles( angles );
-
- m_nRenderFX = kRenderFxGlowShell;
- SetRenderColor( 200, 200, 20, 255 );
-
- // make NPCs afaid of it while in the air
- SetThink( &CBaseGrenadeConcussion::FallThink );
- SetNextThink( gpGlobals->curtime );
-
- // Tumble in air
- QAngle vecAngVel( random->RandomFloat ( -100, -500 ), 0, 0 );
- SetLocalAngularVelocity( vecAngVel );
-
- // Explode on contact
- SetTouch( &CBaseGrenadeConcussion::ExplodeConcussion );
-
- m_flDamage = 80;
-
- // Allow player to blow this puppy up in the air
- m_takedamage = DAMAGE_YES;
-}
-
-
-void CBaseGrenadeConcussion::Precache( void )
-{
- BaseClass::Precache( );
-
- PrecacheModel("models/weapons/w_grenade.mdl");
- m_nTrailSprite = PrecacheModel("sprites/twinkle01.vmt");
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "baseentity.h" +#include "basegrenade_shared.h" +#include "soundent.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class CBaseGrenadeConcussion : public CBaseGrenade +{ + DECLARE_DATADESC(); + +public: + DECLARE_CLASS( CBaseGrenadeConcussion, CBaseGrenade ); + + void Spawn( void ); + void Precache( void ); + void FallThink(void); + void ExplodeConcussion( CBaseEntity *pOther ); + +protected: + static int m_nTrailSprite; +}; + +int CBaseGrenadeConcussion::m_nTrailSprite = 0; + +LINK_ENTITY_TO_CLASS( npc_concussiongrenade, CBaseGrenadeConcussion ); + +BEGIN_DATADESC( CBaseGrenadeConcussion ) + + DEFINE_THINKFUNC( FallThink ), + DEFINE_ENTITYFUNC( ExplodeConcussion ), + +END_DATADESC() + + +void CBaseGrenadeConcussion::FallThink(void) +{ + if (!IsInWorld()) + { + Remove( ); + return; + } + CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin() + GetAbsVelocity() * 0.5, GetAbsVelocity().Length( ), 0.2 ); + + SetNextThink( gpGlobals->curtime + random->RandomFloat(0.05, 0.1) ); + + if (GetWaterLevel() != 0) + { + SetAbsVelocity( GetAbsVelocity() * 0.5 ); + } + + Vector pos = GetAbsOrigin() + Vector(random->RandomFloat(-4, 4), random->RandomFloat(-4, 4), random->RandomFloat(-4, 4)); + + CPVSFilter filter( GetAbsOrigin() ); + + te->Sprite( filter, 0.0, + &pos, + m_nTrailSprite, + random->RandomFloat(0.5, 0.8), + 200 ); +} + + +// +// Contact grenade, explode when it touches something +// +void CBaseGrenadeConcussion::ExplodeConcussion( CBaseEntity *pOther ) +{ + trace_t tr; + Vector vecSpot;// trace starts here! + + Vector velDir = GetAbsVelocity(); + VectorNormalize( velDir ); + vecSpot = GetAbsOrigin() - velDir * 32; + UTIL_TraceLine( vecSpot, vecSpot + velDir * 64, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr ); + + Explode( &tr, DMG_BLAST ); +} + + +void CBaseGrenadeConcussion::Spawn( void ) +{ + // point sized, solid, bouncing + SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); + SetSolid( SOLID_BBOX ); + SetCollisionGroup( COLLISION_GROUP_PROJECTILE ); + SetModel( "models/weapons/w_grenade.mdl" ); // BUG: wrong model + + UTIL_SetSize(this, vec3_origin, vec3_origin); + + // contact grenades arc lower + SetGravity( UTIL_ScaleForGravity( 400 ) ); // use a lower gravity for grenades to make them easier to see + QAngle angles; + VectorAngles(GetAbsVelocity(), angles ); + SetLocalAngles( angles ); + + m_nRenderFX = kRenderFxGlowShell; + SetRenderColor( 200, 200, 20, 255 ); + + // make NPCs afaid of it while in the air + SetThink( &CBaseGrenadeConcussion::FallThink ); + SetNextThink( gpGlobals->curtime ); + + // Tumble in air + QAngle vecAngVel( random->RandomFloat ( -100, -500 ), 0, 0 ); + SetLocalAngularVelocity( vecAngVel ); + + // Explode on contact + SetTouch( &CBaseGrenadeConcussion::ExplodeConcussion ); + + m_flDamage = 80; + + // Allow player to blow this puppy up in the air + m_takedamage = DAMAGE_YES; +} + + +void CBaseGrenadeConcussion::Precache( void ) +{ + BaseClass::Precache( ); + + PrecacheModel("models/weapons/w_grenade.mdl"); + m_nTrailSprite = PrecacheModel("sprites/twinkle01.vmt"); +} |