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/hl2/Func_Monitor.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/hl2/Func_Monitor.cpp')
| -rw-r--r-- | mp/src/game/server/hl2/Func_Monitor.cpp | 218 |
1 files changed, 109 insertions, 109 deletions
diff --git a/mp/src/game/server/hl2/Func_Monitor.cpp b/mp/src/game/server/hl2/Func_Monitor.cpp index fe664d0a..ef3cce32 100644 --- a/mp/src/game/server/hl2/Func_Monitor.cpp +++ b/mp/src/game/server/hl2/Func_Monitor.cpp @@ -1,109 +1,109 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================//
-
-#include "cbase.h"
-#include "point_camera.h"
-#include "modelentities.h"
-#include "info_camera_link.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-class CFuncMonitor : public CFuncBrush
-{
- DECLARE_DATADESC();
- DECLARE_CLASS( CFuncMonitor, CFuncBrush );
- DECLARE_SERVERCLASS();
-
-public:
- virtual void Activate();
- virtual void UpdateOnRemove();
-
-private:
- void InputSetCamera(inputdata_t &inputdata);
- void SetCameraByName(const char *szName);
- void ReleaseCameraLink();
-
- EHANDLE m_hInfoCameraLink;
-};
-
-// automatically hooks in the system's callbacks
-BEGIN_DATADESC( CFuncMonitor )
-
- DEFINE_FIELD( m_hInfoCameraLink, FIELD_EHANDLE ),
-
- // Outputs
- DEFINE_INPUTFUNC( FIELD_STRING, "SetCamera", InputSetCamera ),
-
-END_DATADESC()
-
-
-LINK_ENTITY_TO_CLASS( func_monitor, CFuncMonitor );
-
-
-IMPLEMENT_SERVERCLASS_ST( CFuncMonitor, DT_FuncMonitor )
-END_SEND_TABLE()
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Called after all entities have spawned and after a load game.
-//-----------------------------------------------------------------------------
-void CFuncMonitor::Activate()
-{
- BaseClass::Activate();
- SetCameraByName(STRING(m_target));
-}
-
-void CFuncMonitor::UpdateOnRemove()
-{
- ReleaseCameraLink();
- BaseClass::UpdateOnRemove();
-}
-
-
-//-----------------------------------------------------------------------------
-// Frees the camera.
-//-----------------------------------------------------------------------------
-void CFuncMonitor::ReleaseCameraLink()
-{
- if ( m_hInfoCameraLink )
- {
- UTIL_Remove( m_hInfoCameraLink );
- m_hInfoCameraLink = NULL;
-
- // Keep the target up-to-date for save/load
- m_target = NULL_STRING;
- }
-}
-
-
-//-----------------------------------------------------------------------------
-// Sets camera
-//-----------------------------------------------------------------------------
-void CFuncMonitor::SetCameraByName(const char *szName)
-{
- ReleaseCameraLink();
- CBaseEntity *pBaseEnt = gEntList.FindEntityByName( NULL, szName );
- if( pBaseEnt )
- {
- CPointCamera *pCamera = dynamic_cast<CPointCamera *>( pBaseEnt );
- if( pCamera )
- {
- // Keep the target up-to-date for save/load
- m_target = MAKE_STRING( szName );
- m_hInfoCameraLink = CreateInfoCameraLink( this, pCamera );
- }
- }
-}
-
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CFuncMonitor::InputSetCamera(inputdata_t &inputdata)
-{
- SetCameraByName( inputdata.value.String() );
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#include "cbase.h" +#include "point_camera.h" +#include "modelentities.h" +#include "info_camera_link.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class CFuncMonitor : public CFuncBrush +{ + DECLARE_DATADESC(); + DECLARE_CLASS( CFuncMonitor, CFuncBrush ); + DECLARE_SERVERCLASS(); + +public: + virtual void Activate(); + virtual void UpdateOnRemove(); + +private: + void InputSetCamera(inputdata_t &inputdata); + void SetCameraByName(const char *szName); + void ReleaseCameraLink(); + + EHANDLE m_hInfoCameraLink; +}; + +// automatically hooks in the system's callbacks +BEGIN_DATADESC( CFuncMonitor ) + + DEFINE_FIELD( m_hInfoCameraLink, FIELD_EHANDLE ), + + // Outputs + DEFINE_INPUTFUNC( FIELD_STRING, "SetCamera", InputSetCamera ), + +END_DATADESC() + + +LINK_ENTITY_TO_CLASS( func_monitor, CFuncMonitor ); + + +IMPLEMENT_SERVERCLASS_ST( CFuncMonitor, DT_FuncMonitor ) +END_SEND_TABLE() + + +//----------------------------------------------------------------------------- +// Purpose: Called after all entities have spawned and after a load game. +//----------------------------------------------------------------------------- +void CFuncMonitor::Activate() +{ + BaseClass::Activate(); + SetCameraByName(STRING(m_target)); +} + +void CFuncMonitor::UpdateOnRemove() +{ + ReleaseCameraLink(); + BaseClass::UpdateOnRemove(); +} + + +//----------------------------------------------------------------------------- +// Frees the camera. +//----------------------------------------------------------------------------- +void CFuncMonitor::ReleaseCameraLink() +{ + if ( m_hInfoCameraLink ) + { + UTIL_Remove( m_hInfoCameraLink ); + m_hInfoCameraLink = NULL; + + // Keep the target up-to-date for save/load + m_target = NULL_STRING; + } +} + + +//----------------------------------------------------------------------------- +// Sets camera +//----------------------------------------------------------------------------- +void CFuncMonitor::SetCameraByName(const char *szName) +{ + ReleaseCameraLink(); + CBaseEntity *pBaseEnt = gEntList.FindEntityByName( NULL, szName ); + if( pBaseEnt ) + { + CPointCamera *pCamera = dynamic_cast<CPointCamera *>( pBaseEnt ); + if( pCamera ) + { + // Keep the target up-to-date for save/load + m_target = MAKE_STRING( szName ); + m_hInfoCameraLink = CreateInfoCameraLink( this, pCamera ); + } + } +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CFuncMonitor::InputSetCamera(inputdata_t &inputdata) +{ + SetCameraByName( inputdata.value.String() ); +} |