blob: c7d80bde1f0031cdf5a011cb4e5353afd125e6b0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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
|