diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/tf/tf_revive.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/shared/tf/tf_revive.h')
| -rw-r--r-- | game/shared/tf/tf_revive.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/game/shared/tf/tf_revive.h b/game/shared/tf/tf_revive.h new file mode 100644 index 0000000..c7d80bd --- /dev/null +++ b/game/shared/tf/tf_revive.h @@ -0,0 +1,93 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// The copyright to the contents herein is the property of Valve, L.L.C. +// The contents may be used and/or copied only with the written permission of +// Valve, L.L.C., or in accordance with the terms and conditions stipulated in +// the agreement/contract under which the contents have been supplied. +// +// Purpose: Revive +// +// $Workfile: $ +// $Date: $ +// $NoKeywords: $ +//============================================================================= + +#ifndef TF_REVIVE_H +#define TF_REVIVE_H + +#ifdef _WIN32 +#pragma once +#endif + +#ifdef CLIENT_DLL +#include "c_tf_player.h" +#else +#include "tf_player.h" +#endif + +#ifdef CLIENT_DLL +#define CTFReviveMarker C_TFReviveMarker +#endif + +//----------------------------------------------------------------------------- +// +//----------------------------------------------------------------------------- +class CTFReviveMarker : public CBaseAnimating +{ + DECLARE_DATADESC(); + DECLARE_NETWORKCLASS(); + DECLARE_CLASS( CTFReviveMarker, CBaseAnimating ); + +public: + CTFReviveMarker(); + + virtual void Precache() OVERRIDE; + virtual void Spawn( void ) OVERRIDE; + virtual bool ShouldCollide( int collisionGroup, int contentsMask ) const OVERRIDE; + virtual bool IsCombatItem( void ) const { return true; } + +#ifdef GAME_DLL + static CTFReviveMarker *Create( CTFPlayer *pOwner ); + virtual int UpdateTransmitState( void ) OVERRIDE; + virtual int ShouldTransmit( const CCheckTransmitInfo *pInfo ) OVERRIDE; + void ReviveThink( void ); +#else + virtual void OnDataChanged( DataUpdateType_t updateType ) OVERRIDE; + virtual int GetHealth( void ) const OVERRIDE { return m_iHealth; } + virtual int GetMaxHealth( void ) const OVERRIDE { return m_iMaxHealth; } + virtual bool IsVisibleToTargetID( void ) const OVERRIDE { return true; } +#endif // GAME_DLL + + void SetOwner( CTFPlayer *pPlayer ); + void SetReviver( CTFPlayer *pPlayer ) { m_pReviver = pPlayer; } + CTFPlayer *GetOwner( void ) const { return m_hOwner; } + CTFPlayer *GetReviver( void ) const { return m_pReviver; } +#ifdef GAME_DLL + void AddMarkerHealth( float flAmount ); + bool IsReviveInProgress( void ); + // Fully healed. Ask player if they'd like to be revived at their marker. + bool ReviveOwner( void ); + void PromptOwner( void ); + bool HasOwnerBeenPrompted( void ) { return m_bOwnerPromptedToRevive; } + void SetOwnerHasBeenPrompted( bool bValue ) { m_bOwnerPromptedToRevive = bValue; } +#endif // GAME_DLL + +private: + CNetworkHandle( CTFPlayer, m_hOwner ); + CTFPlayer *m_pReviver; + CNetworkVar( uint16, m_nRevives ); +#ifdef GAME_DLL + IMPLEMENT_NETWORK_VAR_FOR_DERIVED( m_iHealth ); + IMPLEMENT_NETWORK_VAR_FOR_DERIVED( m_iMaxHealth ); + float m_flHealAccumulator; + bool m_bOwnerPromptedToRevive; + float m_flLastHealTime; + bool m_bOnGround; +#else + int m_iHealth; + int m_iMaxHealth; + bool m_bCalledForMedic; +#endif // CLIENT_DLL +}; + +#endif // TF_REVIVE_H |