aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/shared/baseprojectile.h
blob: 9f16f8283c9574729b41ba9871d2ab77d12fafc4 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef BASEPROJECTILE_H
#define BASEPROJECTILE_H
#ifdef _WIN32
#pragma once
#endif

#include "cbase.h"

#ifdef GAME_DLL
#include "baseanimating.h"
#else
#include "c_baseanimating.h"
#endif

#ifdef CLIENT_DLL
#define CBaseProjectile C_BaseProjectile
#endif // CLIENT_DLL

//=============================================================================
//
// Base Projectile.
//
//=============================================================================
#ifdef CLIENT_DLL
class CBaseProjectile : public CBaseAnimating
#else // CLIENT_DLL
DECLARE_AUTO_LIST( IBaseProjectileAutoList );
class CBaseProjectile : public CBaseAnimating, public IBaseProjectileAutoList
#endif // !CLIENT_DLL
{
public:
	DECLARE_CLASS( CBaseProjectile, CBaseAnimating );
	DECLARE_NETWORKCLASS();

	CBaseProjectile();

	virtual void Spawn();

#ifdef GAME_DLL
	virtual int GetBaseProjectileType() const { return -1; } // no base
	virtual int GetProjectileType() const { return -1; } // no type
	virtual int GetDestroyableHitCount( void ) const { return m_iDestroyableHitCount; }
	void IncrementDestroyableHitCount( void ) { ++m_iDestroyableHitCount; }

	virtual bool CanCollideWithTeammates() const { return m_bCanCollideWithTeammates; }
	virtual float GetCollideWithTeammatesDelay() const { return 0.25f; }
#endif // GAME_DLL

	virtual bool IsDestroyable( void ) { return false; }
	virtual void Destroy( bool bBlinkOut = true, bool bBreakRocket = false ) {}
	virtual void SetLauncher( CBaseEntity *pLauncher );
	CBaseEntity *GetOriginalLauncher() const { return m_hOriginalLauncher; }

protected:
#ifdef GAME_DLL
	void CollideWithTeammatesThink();

	int m_iDestroyableHitCount;
#endif // GAME_DLL

private:

#ifdef GAME_DLL
	void	ResetCollideWithTeammates();

	bool					m_bCanCollideWithTeammates;
#endif // GAME_DLL

	CNetworkHandle( CBaseEntity, m_hOriginalLauncher );
};

#endif // BASEPROJECTILE_H