aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/hl2/weapon_brickbat.h
blob: ec4d827e17b3efe949b336b406fcd2afdcb229ef (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:		Weapon that throws things from the hand 
//
// $Workfile:     $
// $Date:         $
// $NoKeywords: $
//=============================================================================//

#ifndef	WEAPON_BRICKBAT_H
#define	WEAPON_BRICKBAT_H

#ifdef _WIN32
#pragma once
#endif


#include "basehlcombatweapon.h"

enum BrickbatAmmo_t
{
	BRICKBAT_ROCK = 0,
	BRICKBAT_BOTTLE,
	
	NUM_BRICKBAT_AMMO_TYPES
};

class CGrenade_Brickbat;

class CWeaponBrickbat : public CBaseHLCombatWeapon
{
public:
	DECLARE_CLASS( CWeaponBrickbat, CBaseHLCombatWeapon );

	DECLARE_SERVERCLASS();

public:
	int					m_iCurrentAmmoType;

	void				Precache( void );
	void				Spawn( void );
	bool				Deploy( void );

	virtual const char *GetViewModel( int viewmodelindex =0 );
	virtual const char *GetWorldModel( void );

	void				DrawAmmo( void );

	virtual	int			WeaponRangeAttack1Condition( float flDot, float flDist );
	virtual	bool		WeaponLOSCondition(const Vector &ownerPos, const Vector &targetPos, bool bSetConditions);

	void				SetPickupTouch( void );
	void 				BrickbatTouch( CBaseEntity *pOther );	// default weapon touch
	void				TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr );	
	int					CapabilitiesGet( void ) { return bits_CAP_WEAPON_RANGE_ATTACK1; }

	bool				ObjectInWay( void );

	void				ThrowBrickbat( Vector vecSrc, Vector vecVelocity, float damage);
	void				ItemPostFrame( void );
	void				PrimaryAttack( void );
	void				SecondaryAttack( void );
	void				Throw( void );

	void				Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );

	DECLARE_DATADESC();
	DECLARE_ACTTABLE();

	CWeaponBrickbat(void);

private:
	bool				m_bNeedDraw;
	bool				m_bNeedThrow;
	int					m_iThrowBits;				// Save the current throw bits state
	float				m_fNextThrowCheck;			// When to check throw ability next
	Vector				m_vecTossVelocity;

	int					m_nAmmoCount[NUM_BRICKBAT_AMMO_TYPES];			// How much ammo of each type do I own?
};

#endif	//WEAPON_BRICKBAT_H