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 /sp/src/game/server/sdk/sdk_brushentity.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 'sp/src/game/server/sdk/sdk_brushentity.cpp')
| -rw-r--r-- | sp/src/game/server/sdk/sdk_brushentity.cpp | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/sp/src/game/server/sdk/sdk_brushentity.cpp b/sp/src/game/server/sdk/sdk_brushentity.cpp index 74408ee3..1e90c99d 100644 --- a/sp/src/game/server/sdk/sdk_brushentity.cpp +++ b/sp/src/game/server/sdk/sdk_brushentity.cpp @@ -1,79 +1,79 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose: Simple brush entity that moves when touched
-//
-//=============================================================================//
-
-#include "cbase.h"
-
-class CMyBrushEntity : public CBaseToggle
-{
-public:
- DECLARE_CLASS( CMyBrushEntity, CBaseToggle );
- DECLARE_DATADESC();
-
- void Spawn( void );
- bool CreateVPhysics( void );
-
- void BrushTouch( CBaseEntity *pOther );
-};
-
-LINK_ENTITY_TO_CLASS( my_brush_entity, CMyBrushEntity );
-
-// Start of our data description for the class
-BEGIN_DATADESC( CMyBrushEntity )
-
- // Declare this function as being a touch function
- DEFINE_ENTITYFUNC( BrushTouch ),
-
-END_DATADESC()
-
-//-----------------------------------------------------------------------------
-// Purpose: Sets up the entity's initial state
-//-----------------------------------------------------------------------------
-void CMyBrushEntity::Spawn( void )
-{
- // We want to capture touches from other entities
- SetTouch( &CMyBrushEntity::BrushTouch );
-
- // We should collide with physics
- SetSolid( SOLID_VPHYSICS );
-
- // We push things out of our way
- SetMoveType( MOVETYPE_PUSH );
-
- // Use our brushmodel
- SetModel( STRING( GetModelName() ) );
-
- // Create our physics hull information
- CreateVPhysics();
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Setup our physics information so we collide properly
-//-----------------------------------------------------------------------------
-bool CMyBrushEntity::CreateVPhysics( void )
-{
- // For collisions with physics objects
- VPhysicsInitShadow( false, false );
-
- return true;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Move away from an entity that touched us
-// Input : *pOther - the entity we touched
-//-----------------------------------------------------------------------------
-void CMyBrushEntity::BrushTouch( CBaseEntity *pOther )
-{
- // Get the collision information
- const trace_t &tr = GetTouchTrace();
-
- // We want to move away from the impact point along our surface
- Vector vecPushDir = tr.plane.normal;
- vecPushDir.Negate();
- vecPushDir.z = 0.0f;
-
- // Move slowly in that direction
- LinearMove( GetAbsOrigin() + ( vecPushDir * 64.0f ), 32.0f );
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Simple brush entity that moves when touched +// +//=============================================================================// + +#include "cbase.h" + +class CMyBrushEntity : public CBaseToggle +{ +public: + DECLARE_CLASS( CMyBrushEntity, CBaseToggle ); + DECLARE_DATADESC(); + + void Spawn( void ); + bool CreateVPhysics( void ); + + void BrushTouch( CBaseEntity *pOther ); +}; + +LINK_ENTITY_TO_CLASS( my_brush_entity, CMyBrushEntity ); + +// Start of our data description for the class +BEGIN_DATADESC( CMyBrushEntity ) + + // Declare this function as being a touch function + DEFINE_ENTITYFUNC( BrushTouch ), + +END_DATADESC() + +//----------------------------------------------------------------------------- +// Purpose: Sets up the entity's initial state +//----------------------------------------------------------------------------- +void CMyBrushEntity::Spawn( void ) +{ + // We want to capture touches from other entities + SetTouch( &CMyBrushEntity::BrushTouch ); + + // We should collide with physics + SetSolid( SOLID_VPHYSICS ); + + // We push things out of our way + SetMoveType( MOVETYPE_PUSH ); + + // Use our brushmodel + SetModel( STRING( GetModelName() ) ); + + // Create our physics hull information + CreateVPhysics(); +} + +//----------------------------------------------------------------------------- +// Purpose: Setup our physics information so we collide properly +//----------------------------------------------------------------------------- +bool CMyBrushEntity::CreateVPhysics( void ) +{ + // For collisions with physics objects + VPhysicsInitShadow( false, false ); + + return true; +} + +//----------------------------------------------------------------------------- +// Purpose: Move away from an entity that touched us +// Input : *pOther - the entity we touched +//----------------------------------------------------------------------------- +void CMyBrushEntity::BrushTouch( CBaseEntity *pOther ) +{ + // Get the collision information + const trace_t &tr = GetTouchTrace(); + + // We want to move away from the impact point along our surface + Vector vecPushDir = tr.plane.normal; + vecPushDir.Negate(); + vecPushDir.z = 0.0f; + + // Move slowly in that direction + LinearMove( GetAbsOrigin() + ( vecPushDir * 64.0f ), 32.0f ); +} |