aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/server/weight_button.cpp
diff options
context:
space:
mode:
authorJørgen P. Tjernø <[email protected]>2013-12-02 19:31:46 -0800
committerJørgen P. Tjernø <[email protected]>2013-12-02 19:46:31 -0800
commitf56bb35301836e56582a575a75864392a0177875 (patch)
treede61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/server/weight_button.cpp
parentMark some more files as text. (diff)
downloadsource-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz
source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/server/weight_button.cpp')
-rw-r--r--mp/src/game/server/weight_button.cpp204
1 files changed, 102 insertions, 102 deletions
diff --git a/mp/src/game/server/weight_button.cpp b/mp/src/game/server/weight_button.cpp
index 583d3c62..fc3f103e 100644
--- a/mp/src/game/server/weight_button.cpp
+++ b/mp/src/game/server/weight_button.cpp
@@ -1,102 +1,102 @@
-
-//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose: 'Button' which activates after a specified amount of weight is touching it.
-//
-//=============================================================================//
-
-#include "cbase.h"
-
-class CWeightButton : public CBaseEntity
-{
-public:
-
- DECLARE_DATADESC();
- DECLARE_CLASS( CWeightButton, CBaseEntity );
-
- void Spawn( void );
- bool CreateVPhysics( void );
-
- COutputEvent m_OnPressed; // After threshold weight has been reached
- COutputEvent m_OnReleased; // After weight has been removed to go below weight threshold
-
- float m_fStressToActivate; // Amount of weight required to activate
- bool m_bHasBeenPressed; // Once the button has been pressed, fire one
- // output until the weight is reduced below the threshold
-
- void TriggerThink ( void );
-
-};
-
-LINK_ENTITY_TO_CLASS( func_weight_button, CWeightButton );
-
-BEGIN_DATADESC( CWeightButton )
-
- DEFINE_KEYFIELD( m_fStressToActivate, FIELD_FLOAT, "WeightToActivate" ),
- DEFINE_FIELD( m_bHasBeenPressed, FIELD_BOOLEAN ),
-
- DEFINE_OUTPUT( m_OnPressed, "OnPressed" ),
- DEFINE_OUTPUT( m_OnReleased, "OnReleased" ),
-
- DEFINE_THINKFUNC( TriggerThink ),
-
-END_DATADESC()
-
-
-void CWeightButton::Spawn()
-{
- BaseClass::Spawn();
-
- // Convert movedir from angles to a vector
- SetMoveType( MOVETYPE_VPHYSICS );
- SetSolid( SOLID_VPHYSICS );
- SetModel( STRING( GetModelName() ) );
- CreateVPhysics();
- SetThink( &CWeightButton::TriggerThink );
- SetNextThink( gpGlobals->curtime + TICK_INTERVAL );
- m_bHasBeenPressed = false;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Create VPhysics collision for this entity
-//-----------------------------------------------------------------------------
-bool CWeightButton::CreateVPhysics()
-{
- VPhysicsInitShadow( false, false );
- return true;
-}
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Every second, check total stress and fire an output if we have reached
-// our threshold. If the stress is relieved below our threshold, fire a different output.
-//-----------------------------------------------------------------------------
-void CWeightButton::TriggerThink( void )
-{
- vphysics_objectstress_t vpobj_StressOut;
- IPhysicsObject* pMyPhysics = VPhysicsGetObject();
-
- if ( !pMyPhysics )
- {
- SetNextThink( TICK_NEVER_THINK );
- return;
- }
-
- float fStress = CalculateObjectStress( pMyPhysics, this, &vpobj_StressOut );
-
-// fStress = vpobj_StressOut.receivedStress;
-
- if ( fStress > m_fStressToActivate && !m_bHasBeenPressed )
- {
- m_OnPressed.FireOutput( this, this );
- m_bHasBeenPressed = true;
- }
- else if ( fStress < m_fStressToActivate && m_bHasBeenPressed )
- {
- m_OnReleased.FireOutput( this, this );
- m_bHasBeenPressed = false;
- }
-
- // think every tick
- SetNextThink( gpGlobals->curtime + TICK_INTERVAL );
-}
+
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: 'Button' which activates after a specified amount of weight is touching it.
+//
+//=============================================================================//
+
+#include "cbase.h"
+
+class CWeightButton : public CBaseEntity
+{
+public:
+
+ DECLARE_DATADESC();
+ DECLARE_CLASS( CWeightButton, CBaseEntity );
+
+ void Spawn( void );
+ bool CreateVPhysics( void );
+
+ COutputEvent m_OnPressed; // After threshold weight has been reached
+ COutputEvent m_OnReleased; // After weight has been removed to go below weight threshold
+
+ float m_fStressToActivate; // Amount of weight required to activate
+ bool m_bHasBeenPressed; // Once the button has been pressed, fire one
+ // output until the weight is reduced below the threshold
+
+ void TriggerThink ( void );
+
+};
+
+LINK_ENTITY_TO_CLASS( func_weight_button, CWeightButton );
+
+BEGIN_DATADESC( CWeightButton )
+
+ DEFINE_KEYFIELD( m_fStressToActivate, FIELD_FLOAT, "WeightToActivate" ),
+ DEFINE_FIELD( m_bHasBeenPressed, FIELD_BOOLEAN ),
+
+ DEFINE_OUTPUT( m_OnPressed, "OnPressed" ),
+ DEFINE_OUTPUT( m_OnReleased, "OnReleased" ),
+
+ DEFINE_THINKFUNC( TriggerThink ),
+
+END_DATADESC()
+
+
+void CWeightButton::Spawn()
+{
+ BaseClass::Spawn();
+
+ // Convert movedir from angles to a vector
+ SetMoveType( MOVETYPE_VPHYSICS );
+ SetSolid( SOLID_VPHYSICS );
+ SetModel( STRING( GetModelName() ) );
+ CreateVPhysics();
+ SetThink( &CWeightButton::TriggerThink );
+ SetNextThink( gpGlobals->curtime + TICK_INTERVAL );
+ m_bHasBeenPressed = false;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Create VPhysics collision for this entity
+//-----------------------------------------------------------------------------
+bool CWeightButton::CreateVPhysics()
+{
+ VPhysicsInitShadow( false, false );
+ return true;
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Every second, check total stress and fire an output if we have reached
+// our threshold. If the stress is relieved below our threshold, fire a different output.
+//-----------------------------------------------------------------------------
+void CWeightButton::TriggerThink( void )
+{
+ vphysics_objectstress_t vpobj_StressOut;
+ IPhysicsObject* pMyPhysics = VPhysicsGetObject();
+
+ if ( !pMyPhysics )
+ {
+ SetNextThink( TICK_NEVER_THINK );
+ return;
+ }
+
+ float fStress = CalculateObjectStress( pMyPhysics, this, &vpobj_StressOut );
+
+// fStress = vpobj_StressOut.receivedStress;
+
+ if ( fStress > m_fStressToActivate && !m_bHasBeenPressed )
+ {
+ m_OnPressed.FireOutput( this, this );
+ m_bHasBeenPressed = true;
+ }
+ else if ( fStress < m_fStressToActivate && m_bHasBeenPressed )
+ {
+ m_OnReleased.FireOutput( this, this );
+ m_bHasBeenPressed = false;
+ }
+
+ // think every tick
+ SetNextThink( gpGlobals->curtime + TICK_INTERVAL );
+}