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/pathcorner.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/pathcorner.cpp')
| -rw-r--r-- | sp/src/game/server/pathcorner.cpp | 284 |
1 files changed, 142 insertions, 142 deletions
diff --git a/sp/src/game/server/pathcorner.cpp b/sp/src/game/server/pathcorner.cpp index a1ddbadc..977ce8ba 100644 --- a/sp/src/game/server/pathcorner.cpp +++ b/sp/src/game/server/pathcorner.cpp @@ -1,142 +1,142 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose: Used to create a path that can be followed by NPCs and trains.
-//
-//=============================================================================//
-
-#include "cbase.h"
-#include "trains.h"
-#include "entitylist.h"
-#include "ndebugoverlay.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-class CPathCorner : public CPointEntity
-{
- DECLARE_CLASS( CPathCorner, CPointEntity );
-public:
-
- void Spawn( );
- float GetDelay( void ) { return m_flWait; }
- int DrawDebugTextOverlays(void);
- void DrawDebugGeometryOverlays(void);
-
- // Input handlers
- void InputSetNextPathCorner( inputdata_t &inputdata );
- void InputInPass( inputdata_t &inputdata );
-
- DECLARE_DATADESC();
-
-private:
- float m_flWait;
- COutputEvent m_OnPass;
-};
-
-LINK_ENTITY_TO_CLASS( path_corner, CPathCorner );
-
-
-class CPathCornerCrash : public CPathCorner
-{
- DECLARE_CLASS( CPathCornerCrash, CPathCorner );
-};
-
-LINK_ENTITY_TO_CLASS( path_corner_crash, CPathCornerCrash );
-
-
-BEGIN_DATADESC( CPathCorner )
-
- DEFINE_KEYFIELD( m_flWait, FIELD_FLOAT, "wait" ),
-
- // Inputs
- DEFINE_INPUTFUNC( FIELD_STRING, "SetNextPathCorner", InputSetNextPathCorner),
-
- // Internal inputs - not exposed in the FGD
- DEFINE_INPUTFUNC( FIELD_VOID, "InPass", InputInPass ),
-
- // Outputs
- DEFINE_OUTPUT( m_OnPass, "OnPass"),
-
-END_DATADESC()
-
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CPathCorner::Spawn( void )
-{
- ASSERTSZ(GetEntityName() != NULL_STRING, "path_corner without a targetname");
-}
-
-
-//------------------------------------------------------------------------------
-// Purpose: Sets the next path corner by name.
-// Input : String ID name of next path corner.
-//-----------------------------------------------------------------------------
-void CPathCorner::InputSetNextPathCorner( inputdata_t &inputdata )
-{
- m_target = inputdata.value.StringID();
-}
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Fired by path followers as they pass the path corner.
-//-----------------------------------------------------------------------------
-void CPathCorner::InputInPass( inputdata_t &inputdata )
-{
- m_OnPass.FireOutput( inputdata.pActivator, inputdata.pCaller, 0);
-}
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Draw any debug text overlays
-// Output : Current text offset from the top
-//-----------------------------------------------------------------------------
-int CPathCorner::DrawDebugTextOverlays(void)
-{
- int text_offset = BaseClass::DrawDebugTextOverlays();
-
- if (m_debugOverlays & OVERLAY_TEXT_BIT)
- {
- // --------------
- // Print Target
- // --------------
- char tempstr[255];
- if (m_target!=NULL_STRING)
- {
- Q_snprintf(tempstr,sizeof(tempstr),"Target: %s",STRING(m_target));
- }
- else
- {
- Q_strncpy(tempstr,"Target: - ",sizeof(tempstr));
- }
- EntityText(text_offset,tempstr,0);
- text_offset++;
- }
- return text_offset;
-}
-
-
-//-----------------------------------------------------------------------------
-// Purpose: Override base class to add display of paths
-//-----------------------------------------------------------------------------
-void CPathCorner::DrawDebugGeometryOverlays(void)
-{
- // ----------------------------------------------
- // Draw line to next target is bbox is selected
- // ----------------------------------------------
- if (m_debugOverlays & (OVERLAY_BBOX_BIT|OVERLAY_ABSBOX_BIT))
- {
- NDebugOverlay::Box(GetAbsOrigin(), Vector(-10,-10,-10), Vector(10,10,10), 255, 100, 100, 0 ,0);
-
- if (m_target != NULL_STRING)
- {
- CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, m_target );
- if (pTarget)
- {
- NDebugOverlay::Line(GetAbsOrigin(),pTarget->GetAbsOrigin(),255,100,100,true,0.0);
- }
- }
- }
- BaseClass::DrawDebugGeometryOverlays();
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Used to create a path that can be followed by NPCs and trains. +// +//=============================================================================// + +#include "cbase.h" +#include "trains.h" +#include "entitylist.h" +#include "ndebugoverlay.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class CPathCorner : public CPointEntity +{ + DECLARE_CLASS( CPathCorner, CPointEntity ); +public: + + void Spawn( ); + float GetDelay( void ) { return m_flWait; } + int DrawDebugTextOverlays(void); + void DrawDebugGeometryOverlays(void); + + // Input handlers + void InputSetNextPathCorner( inputdata_t &inputdata ); + void InputInPass( inputdata_t &inputdata ); + + DECLARE_DATADESC(); + +private: + float m_flWait; + COutputEvent m_OnPass; +}; + +LINK_ENTITY_TO_CLASS( path_corner, CPathCorner ); + + +class CPathCornerCrash : public CPathCorner +{ + DECLARE_CLASS( CPathCornerCrash, CPathCorner ); +}; + +LINK_ENTITY_TO_CLASS( path_corner_crash, CPathCornerCrash ); + + +BEGIN_DATADESC( CPathCorner ) + + DEFINE_KEYFIELD( m_flWait, FIELD_FLOAT, "wait" ), + + // Inputs + DEFINE_INPUTFUNC( FIELD_STRING, "SetNextPathCorner", InputSetNextPathCorner), + + // Internal inputs - not exposed in the FGD + DEFINE_INPUTFUNC( FIELD_VOID, "InPass", InputInPass ), + + // Outputs + DEFINE_OUTPUT( m_OnPass, "OnPass"), + +END_DATADESC() + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CPathCorner::Spawn( void ) +{ + ASSERTSZ(GetEntityName() != NULL_STRING, "path_corner without a targetname"); +} + + +//------------------------------------------------------------------------------ +// Purpose: Sets the next path corner by name. +// Input : String ID name of next path corner. +//----------------------------------------------------------------------------- +void CPathCorner::InputSetNextPathCorner( inputdata_t &inputdata ) +{ + m_target = inputdata.value.StringID(); +} + + +//----------------------------------------------------------------------------- +// Purpose: Fired by path followers as they pass the path corner. +//----------------------------------------------------------------------------- +void CPathCorner::InputInPass( inputdata_t &inputdata ) +{ + m_OnPass.FireOutput( inputdata.pActivator, inputdata.pCaller, 0); +} + + +//----------------------------------------------------------------------------- +// Purpose: Draw any debug text overlays +// Output : Current text offset from the top +//----------------------------------------------------------------------------- +int CPathCorner::DrawDebugTextOverlays(void) +{ + int text_offset = BaseClass::DrawDebugTextOverlays(); + + if (m_debugOverlays & OVERLAY_TEXT_BIT) + { + // -------------- + // Print Target + // -------------- + char tempstr[255]; + if (m_target!=NULL_STRING) + { + Q_snprintf(tempstr,sizeof(tempstr),"Target: %s",STRING(m_target)); + } + else + { + Q_strncpy(tempstr,"Target: - ",sizeof(tempstr)); + } + EntityText(text_offset,tempstr,0); + text_offset++; + } + return text_offset; +} + + +//----------------------------------------------------------------------------- +// Purpose: Override base class to add display of paths +//----------------------------------------------------------------------------- +void CPathCorner::DrawDebugGeometryOverlays(void) +{ + // ---------------------------------------------- + // Draw line to next target is bbox is selected + // ---------------------------------------------- + if (m_debugOverlays & (OVERLAY_BBOX_BIT|OVERLAY_ABSBOX_BIT)) + { + NDebugOverlay::Box(GetAbsOrigin(), Vector(-10,-10,-10), Vector(10,10,10), 255, 100, 100, 0 ,0); + + if (m_target != NULL_STRING) + { + CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, m_target ); + if (pTarget) + { + NDebugOverlay::Line(GetAbsOrigin(),pTarget->GetAbsOrigin(),255,100,100,true,0.0); + } + } + } + BaseClass::DrawDebugGeometryOverlays(); +} |