aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/baseprojectile.h
blob: 51bd04f7e1996f167f035e5740a44480550ecd77 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

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

// Creation.
struct baseprojectilecreate_t
{
	Vector vecOrigin;
	Vector vecVelocity;
	CBaseEntity *pOwner;
	string_t iszModel;
	float flDamage;
	int iDamageType;
	float flDamageScale;
};

//=============================================================================
//
// Generic projectile
//
class CBaseProjectile : public CBaseAnimating
{
	DECLARE_CLASS( CBaseProjectile, CBaseAnimating );
public:
	DECLARE_DATADESC();

	void	Spawn( void );
	void	Precache( void );

	static CBaseProjectile *Create( baseprojectilecreate_t &pCreate );

	void			SetDamage( float flDamage ) { m_flDamage = flDamage; }
	void			SetDamageScale( float &flScale ) { m_flDamageScale = flScale; }
	void			SetDamageType( int iType ) { m_iDamageType = iType; }

private:
	// Damage
	virtual float	GetDamage() { return m_flDamage; }
	virtual float	GetDamageScale( void ) { return m_flDamageScale; }
	virtual int		GetDamageType( void ) { return m_iDamageType; }

	unsigned int	PhysicsSolidMaskForEntity( void ) const;

	virtual void	ProjectileTouch( CBaseEntity *pOther );
	void			FlyThink( void );

protected:
	float			m_flDamage;
	int				m_iDamageType;
	float			m_flDamageScale;
};

#endif // BASEPROJECTILE_H