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/ragdoll_manager.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/ragdoll_manager.cpp')
| -rw-r--r-- | mp/src/game/server/ragdoll_manager.cpp | 348 |
1 files changed, 174 insertions, 174 deletions
diff --git a/mp/src/game/server/ragdoll_manager.cpp b/mp/src/game/server/ragdoll_manager.cpp index 361f476d..74ab8e96 100644 --- a/mp/src/game/server/ragdoll_manager.cpp +++ b/mp/src/game/server/ragdoll_manager.cpp @@ -1,174 +1,174 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#include "cbase.h"
-#include "baseentity.h"
-#include "sendproxy.h"
-#include "ragdoll_shared.h"
-#include "ai_basenpc.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-class CRagdollManager : public CBaseEntity
-{
-public:
- DECLARE_CLASS( CRagdollManager, CBaseEntity );
- DECLARE_SERVERCLASS();
- DECLARE_DATADESC();
-
- CRagdollManager();
-
- virtual void Activate();
- virtual int UpdateTransmitState();
-
- void InputSetMaxRagdollCount(inputdata_t &data);
- void InputSetMaxRagdollCountDX8(inputdata_t &data);
-
- int DrawDebugTextOverlays(void);
-
-public:
-
- void UpdateCurrentMaxRagDollCount();
-
- CNetworkVar( int, m_iCurrentMaxRagdollCount );
-
- int m_iDXLevel;
- int m_iMaxRagdollCount;
- int m_iMaxRagdollCountDX8;
-
- bool m_bSaveImportant;
-};
-
-
-IMPLEMENT_SERVERCLASS_ST_NOBASE( CRagdollManager, DT_RagdollManager )
- SendPropInt( SENDINFO( m_iCurrentMaxRagdollCount ), 6 ),
-END_SEND_TABLE()
-
-LINK_ENTITY_TO_CLASS( game_ragdoll_manager, CRagdollManager );
-
-BEGIN_DATADESC( CRagdollManager )
-
- //DEFINE_FIELD( m_iDXLevel, FIELD_INTEGER ),
-
- DEFINE_FIELD( m_iCurrentMaxRagdollCount, FIELD_INTEGER ),
- DEFINE_KEYFIELD( m_iMaxRagdollCount, FIELD_INTEGER, "MaxRagdollCount" ),
- DEFINE_KEYFIELD( m_iMaxRagdollCountDX8, FIELD_INTEGER, "MaxRagdollCountDX8" ),
-
- DEFINE_KEYFIELD( m_bSaveImportant, FIELD_BOOLEAN, "SaveImportant" ),
-
- DEFINE_INPUTFUNC( FIELD_INTEGER, "SetMaxRagdollCount", InputSetMaxRagdollCount ),
- DEFINE_INPUTFUNC( FIELD_INTEGER, "SetMaxRagdollCountDX8", InputSetMaxRagdollCountDX8 ),
-
-END_DATADESC()
-
-//-----------------------------------------------------------------------------
-// Constructor
-//-----------------------------------------------------------------------------
-CRagdollManager::CRagdollManager( void )
-{
- m_iMaxRagdollCount = -1;
- m_iMaxRagdollCountDX8 = -1;
- m_iCurrentMaxRagdollCount = -1;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Input : *pInfo -
-// Output : int
-//-----------------------------------------------------------------------------
-int CRagdollManager::UpdateTransmitState()
-{
- return SetTransmitState( FL_EDICT_ALWAYS );
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CRagdollManager::Activate()
-{
- BaseClass::Activate();
-
- // Cache off the DX level for use later.
- ConVarRef mat_dxlevel( "mat_dxlevel" );
- m_iDXLevel = mat_dxlevel.GetInt();
-
- UpdateCurrentMaxRagDollCount();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void CRagdollManager::UpdateCurrentMaxRagDollCount()
-{
- if ( ( m_iDXLevel < 90 ) && ( m_iMaxRagdollCountDX8 >= 0 ) )
- {
- m_iCurrentMaxRagdollCount = m_iMaxRagdollCountDX8;
- }
- else
- {
- m_iCurrentMaxRagdollCount = m_iMaxRagdollCount;
- }
-
- s_RagdollLRU.SetMaxRagdollCount( m_iCurrentMaxRagdollCount );
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void CRagdollManager::InputSetMaxRagdollCount(inputdata_t &inputdata)
-{
- m_iMaxRagdollCount = inputdata.value.Int();
- UpdateCurrentMaxRagDollCount();
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void CRagdollManager::InputSetMaxRagdollCountDX8(inputdata_t &inputdata)
-{
- m_iMaxRagdollCountDX8 = inputdata.value.Int();
- UpdateCurrentMaxRagDollCount();
-}
-
-bool RagdollManager_SaveImportant( CAI_BaseNPC *pNPC )
-{
-#ifdef HL2_DLL
- CRagdollManager *pEnt = (CRagdollManager *)gEntList.FindEntityByClassname( NULL, "game_ragdoll_manager" );
-
- if ( pEnt == NULL )
- return false;
-
- if ( pEnt->m_bSaveImportant )
- {
- if ( pNPC->Classify() == CLASS_PLAYER_ALLY || pNPC->Classify() == CLASS_PLAYER_ALLY_VITAL )
- {
- return true;
- }
- }
-#endif
-
- return false;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Draw any debug text overlays
-// Output : Current text offset from the top
-//-----------------------------------------------------------------------------
-int CRagdollManager::DrawDebugTextOverlays( void )
-{
- int text_offset = BaseClass::DrawDebugTextOverlays();
-
- if (m_debugOverlays & OVERLAY_TEXT_BIT)
- {
- char tempstr[512];
-
- // print max ragdoll count
- Q_snprintf(tempstr,sizeof(tempstr),"max ragdoll count: %d", m_iCurrentMaxRagdollCount.Get());
- EntityText(text_offset,tempstr,0);
- text_offset++;
- }
- return text_offset;
-}
-
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" +#include "baseentity.h" +#include "sendproxy.h" +#include "ragdoll_shared.h" +#include "ai_basenpc.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class CRagdollManager : public CBaseEntity +{ +public: + DECLARE_CLASS( CRagdollManager, CBaseEntity ); + DECLARE_SERVERCLASS(); + DECLARE_DATADESC(); + + CRagdollManager(); + + virtual void Activate(); + virtual int UpdateTransmitState(); + + void InputSetMaxRagdollCount(inputdata_t &data); + void InputSetMaxRagdollCountDX8(inputdata_t &data); + + int DrawDebugTextOverlays(void); + +public: + + void UpdateCurrentMaxRagDollCount(); + + CNetworkVar( int, m_iCurrentMaxRagdollCount ); + + int m_iDXLevel; + int m_iMaxRagdollCount; + int m_iMaxRagdollCountDX8; + + bool m_bSaveImportant; +}; + + +IMPLEMENT_SERVERCLASS_ST_NOBASE( CRagdollManager, DT_RagdollManager ) + SendPropInt( SENDINFO( m_iCurrentMaxRagdollCount ), 6 ), +END_SEND_TABLE() + +LINK_ENTITY_TO_CLASS( game_ragdoll_manager, CRagdollManager ); + +BEGIN_DATADESC( CRagdollManager ) + + //DEFINE_FIELD( m_iDXLevel, FIELD_INTEGER ), + + DEFINE_FIELD( m_iCurrentMaxRagdollCount, FIELD_INTEGER ), + DEFINE_KEYFIELD( m_iMaxRagdollCount, FIELD_INTEGER, "MaxRagdollCount" ), + DEFINE_KEYFIELD( m_iMaxRagdollCountDX8, FIELD_INTEGER, "MaxRagdollCountDX8" ), + + DEFINE_KEYFIELD( m_bSaveImportant, FIELD_BOOLEAN, "SaveImportant" ), + + DEFINE_INPUTFUNC( FIELD_INTEGER, "SetMaxRagdollCount", InputSetMaxRagdollCount ), + DEFINE_INPUTFUNC( FIELD_INTEGER, "SetMaxRagdollCountDX8", InputSetMaxRagdollCountDX8 ), + +END_DATADESC() + +//----------------------------------------------------------------------------- +// Constructor +//----------------------------------------------------------------------------- +CRagdollManager::CRagdollManager( void ) +{ + m_iMaxRagdollCount = -1; + m_iMaxRagdollCountDX8 = -1; + m_iCurrentMaxRagdollCount = -1; +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : *pInfo - +// Output : int +//----------------------------------------------------------------------------- +int CRagdollManager::UpdateTransmitState() +{ + return SetTransmitState( FL_EDICT_ALWAYS ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CRagdollManager::Activate() +{ + BaseClass::Activate(); + + // Cache off the DX level for use later. + ConVarRef mat_dxlevel( "mat_dxlevel" ); + m_iDXLevel = mat_dxlevel.GetInt(); + + UpdateCurrentMaxRagDollCount(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void CRagdollManager::UpdateCurrentMaxRagDollCount() +{ + if ( ( m_iDXLevel < 90 ) && ( m_iMaxRagdollCountDX8 >= 0 ) ) + { + m_iCurrentMaxRagdollCount = m_iMaxRagdollCountDX8; + } + else + { + m_iCurrentMaxRagdollCount = m_iMaxRagdollCount; + } + + s_RagdollLRU.SetMaxRagdollCount( m_iCurrentMaxRagdollCount ); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void CRagdollManager::InputSetMaxRagdollCount(inputdata_t &inputdata) +{ + m_iMaxRagdollCount = inputdata.value.Int(); + UpdateCurrentMaxRagDollCount(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void CRagdollManager::InputSetMaxRagdollCountDX8(inputdata_t &inputdata) +{ + m_iMaxRagdollCountDX8 = inputdata.value.Int(); + UpdateCurrentMaxRagDollCount(); +} + +bool RagdollManager_SaveImportant( CAI_BaseNPC *pNPC ) +{ +#ifdef HL2_DLL + CRagdollManager *pEnt = (CRagdollManager *)gEntList.FindEntityByClassname( NULL, "game_ragdoll_manager" ); + + if ( pEnt == NULL ) + return false; + + if ( pEnt->m_bSaveImportant ) + { + if ( pNPC->Classify() == CLASS_PLAYER_ALLY || pNPC->Classify() == CLASS_PLAYER_ALLY_VITAL ) + { + return true; + } + } +#endif + + return false; +} + +//----------------------------------------------------------------------------- +// Purpose: Draw any debug text overlays +// Output : Current text offset from the top +//----------------------------------------------------------------------------- +int CRagdollManager::DrawDebugTextOverlays( void ) +{ + int text_offset = BaseClass::DrawDebugTextOverlays(); + + if (m_debugOverlays & OVERLAY_TEXT_BIT) + { + char tempstr[512]; + + // print max ragdoll count + Q_snprintf(tempstr,sizeof(tempstr),"max ragdoll count: %d", m_iCurrentMaxRagdollCount.Get()); + EntityText(text_offset,tempstr,0); + text_offset++; + } + return text_offset; +} + |