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/EnvHudHint.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/EnvHudHint.cpp')
| -rw-r--r-- | mp/src/game/server/EnvHudHint.cpp | 284 |
1 files changed, 142 insertions, 142 deletions
diff --git a/mp/src/game/server/EnvHudHint.cpp b/mp/src/game/server/EnvHudHint.cpp index efee1ec1..858fc7b9 100644 --- a/mp/src/game/server/EnvHudHint.cpp +++ b/mp/src/game/server/EnvHudHint.cpp @@ -1,142 +1,142 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose: Implements visual effects entities: sprites, beams, bubbles, etc.
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#include "cbase.h"
-#include "engine/IEngineSound.h"
-#include "baseentity.h"
-#include "entityoutput.h"
-#include "recipientfilter.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-#define SF_HUDHINT_ALLPLAYERS 0x0001
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-class CEnvHudHint : public CPointEntity
-{
-public:
- DECLARE_CLASS( CEnvHudHint, CPointEntity );
-
- void Spawn( void );
- void Precache( void );
-
-private:
- inline bool AllPlayers( void ) { return (m_spawnflags & SF_HUDHINT_ALLPLAYERS) != 0; }
-
- void InputShowHudHint( inputdata_t &inputdata );
- void InputHideHudHint( inputdata_t &inputdata );
- string_t m_iszMessage;
- DECLARE_DATADESC();
-};
-
-LINK_ENTITY_TO_CLASS( env_hudhint, CEnvHudHint );
-
-BEGIN_DATADESC( CEnvHudHint )
-
- DEFINE_KEYFIELD( m_iszMessage, FIELD_STRING, "message" ),
- DEFINE_INPUTFUNC( FIELD_VOID, "ShowHudHint", InputShowHudHint ),
- DEFINE_INPUTFUNC( FIELD_VOID, "HideHudHint", InputHideHudHint ),
-
-END_DATADESC()
-
-
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CEnvHudHint::Spawn( void )
-{
- Precache();
-
- SetSolid( SOLID_NONE );
- SetMoveType( MOVETYPE_NONE );
-}
-
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CEnvHudHint::Precache( void )
-{
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Input handler for showing the message and/or playing the sound.
-//-----------------------------------------------------------------------------
-void CEnvHudHint::InputShowHudHint( inputdata_t &inputdata )
-{
- if ( AllPlayers() )
- {
- CReliableBroadcastRecipientFilter user;
- UserMessageBegin( user, "KeyHintText" );
- WRITE_BYTE( 1 ); // one message
- WRITE_STRING( STRING(m_iszMessage) );
- MessageEnd();
- }
- else
- {
- CBaseEntity *pPlayer = NULL;
- if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() )
- {
- pPlayer = inputdata.pActivator;
- }
- else
- {
- pPlayer = UTIL_GetLocalPlayer();
- }
-
- if ( !pPlayer || !pPlayer->IsNetClient() )
- return;
-
- CSingleUserRecipientFilter user( (CBasePlayer *)pPlayer );
- user.MakeReliable();
- UserMessageBegin( user, "KeyHintText" );
- WRITE_BYTE( 1 ); // one message
- WRITE_STRING( STRING(m_iszMessage) );
- MessageEnd();
- }
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void CEnvHudHint::InputHideHudHint( inputdata_t &inputdata )
-{
- if ( AllPlayers() )
- {
- CReliableBroadcastRecipientFilter user;
- UserMessageBegin( user, "KeyHintText" );
- WRITE_BYTE( 1 ); // one message
- WRITE_STRING( STRING(NULL_STRING) );
- MessageEnd();
- }
- else
- {
- CBaseEntity *pPlayer = NULL;
-
- if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() )
- {
- pPlayer = inputdata.pActivator;
- }
- else
- {
- pPlayer = UTIL_GetLocalPlayer();
- }
-
- if ( !pPlayer || !pPlayer->IsNetClient() )
- return;
-
- CSingleUserRecipientFilter user( (CBasePlayer *)pPlayer );
- user.MakeReliable();
- UserMessageBegin( user, "KeyHintText" );
- WRITE_BYTE( 1 ); // one message
- WRITE_STRING( STRING(NULL_STRING) );
- MessageEnd();
- }
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Implements visual effects entities: sprites, beams, bubbles, etc. +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" +#include "engine/IEngineSound.h" +#include "baseentity.h" +#include "entityoutput.h" +#include "recipientfilter.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +#define SF_HUDHINT_ALLPLAYERS 0x0001 + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +class CEnvHudHint : public CPointEntity +{ +public: + DECLARE_CLASS( CEnvHudHint, CPointEntity ); + + void Spawn( void ); + void Precache( void ); + +private: + inline bool AllPlayers( void ) { return (m_spawnflags & SF_HUDHINT_ALLPLAYERS) != 0; } + + void InputShowHudHint( inputdata_t &inputdata ); + void InputHideHudHint( inputdata_t &inputdata ); + string_t m_iszMessage; + DECLARE_DATADESC(); +}; + +LINK_ENTITY_TO_CLASS( env_hudhint, CEnvHudHint ); + +BEGIN_DATADESC( CEnvHudHint ) + + DEFINE_KEYFIELD( m_iszMessage, FIELD_STRING, "message" ), + DEFINE_INPUTFUNC( FIELD_VOID, "ShowHudHint", InputShowHudHint ), + DEFINE_INPUTFUNC( FIELD_VOID, "HideHudHint", InputHideHudHint ), + +END_DATADESC() + + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CEnvHudHint::Spawn( void ) +{ + Precache(); + + SetSolid( SOLID_NONE ); + SetMoveType( MOVETYPE_NONE ); +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CEnvHudHint::Precache( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: Input handler for showing the message and/or playing the sound. +//----------------------------------------------------------------------------- +void CEnvHudHint::InputShowHudHint( inputdata_t &inputdata ) +{ + if ( AllPlayers() ) + { + CReliableBroadcastRecipientFilter user; + UserMessageBegin( user, "KeyHintText" ); + WRITE_BYTE( 1 ); // one message + WRITE_STRING( STRING(m_iszMessage) ); + MessageEnd(); + } + else + { + CBaseEntity *pPlayer = NULL; + if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() ) + { + pPlayer = inputdata.pActivator; + } + else + { + pPlayer = UTIL_GetLocalPlayer(); + } + + if ( !pPlayer || !pPlayer->IsNetClient() ) + return; + + CSingleUserRecipientFilter user( (CBasePlayer *)pPlayer ); + user.MakeReliable(); + UserMessageBegin( user, "KeyHintText" ); + WRITE_BYTE( 1 ); // one message + WRITE_STRING( STRING(m_iszMessage) ); + MessageEnd(); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void CEnvHudHint::InputHideHudHint( inputdata_t &inputdata ) +{ + if ( AllPlayers() ) + { + CReliableBroadcastRecipientFilter user; + UserMessageBegin( user, "KeyHintText" ); + WRITE_BYTE( 1 ); // one message + WRITE_STRING( STRING(NULL_STRING) ); + MessageEnd(); + } + else + { + CBaseEntity *pPlayer = NULL; + + if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() ) + { + pPlayer = inputdata.pActivator; + } + else + { + pPlayer = UTIL_GetLocalPlayer(); + } + + if ( !pPlayer || !pPlayer->IsNetClient() ) + return; + + CSingleUserRecipientFilter user( (CBasePlayer *)pPlayer ); + user.MakeReliable(); + UserMessageBegin( user, "KeyHintText" ); + WRITE_BYTE( 1 ); // one message + WRITE_STRING( STRING(NULL_STRING) ); + MessageEnd(); + } +} |