summaryrefslogtreecommitdiff
path: root/game/shared/tf/passtime_game_events.h
blob: d788a57ea2fc6619d9e85d0af925ed17be891cff (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

class IGameEvent;
namespace PasstimeGameEvents
{
	// TODO: this was done following valve's style of having different events 
	// for everything, but these particular events have a lot of overlap and 
	// might be better implemented as a single "ball event" that has an enum 
	// specifying what kind it is. It would cut down on the number of strcmp 
	// calls in the event handling functions. Or maybe we could just not use 
	// 1000s of strcmps for each event dispatch and use a lookup table of some kind.

	//-----------------------------------------------------------------------------
	struct BallGet
	{
		BallGet( IGameEvent *pEvent );
		BallGet( int ownerIndex );
		void Fire();
		
		static const char *const s_eventName;
		static const char *const s_keyOwnerIndex;
		int ownerIndex;
	};
	
	//-----------------------------------------------------------------------------
	struct Score
	{
		Score( IGameEvent *pEvent );
		Score( int scorerIndex, int assisterIndex, int numPoints );
		Score( int scorerIndex_, int numPoints_ );
		void Fire();
		
		static const char *const s_eventName;
		static const char *const s_keyScorerIndex;
		static const char *const s_keyAssisterIndex;
		static const char *const s_keyNumPoints;
		int scorerIndex;
		int assisterIndex;
		int numPoints;
	};

	//-----------------------------------------------------------------------------
	struct BallFree
	{
		BallFree( IGameEvent *pEvent );
		BallFree();
		BallFree( int ownerIndex );
		BallFree( int ownerIndex, int attackerIndex );
		void Fire();

		static const char *const s_eventName;
		static const char *const s_keyOwnerIndex;
		static const char *const s_keyAttackerIndex;
		int ownerIndex;
		int attackerIndex;
	};

	//-----------------------------------------------------------------------------
	struct PassCaught
	{
		PassCaught( IGameEvent *pEvent );
		PassCaught();
		PassCaught( int passerIndex, int catcherIndex, float dist, float duration );
		void Fire();

		static const char *const s_eventName;
		static const char *const s_keyPasserIndex;
		static const char *const s_keyCatcherIndex;
		static const char *const s_keyDist;
		static const char *const s_keyDuration;
		int passerIndex;
		int catcherIndex;
		float dist;
		float duration;
	};

	//-----------------------------------------------------------------------------
	struct BallStolen
	{
		BallStolen( IGameEvent *pEvent );
		BallStolen();
		BallStolen( int victimIndex, int attackerIndex );
		void Fire();

		static const char *const s_eventName;
		static const char *const s_keyVictimIndex;
		static const char *const s_keyAttackerIndex;
		int victimIndex;
		int attackerIndex;
	};

	//-----------------------------------------------------------------------------
	struct BallBlocked
	{
		BallBlocked( IGameEvent *pEvent );
		BallBlocked();
		BallBlocked( int ownerIndex, int blockerIndex );
		void Fire();

		static const char *const s_eventName;
		static const char *const s_keyOwnerIndex;
		static const char *const s_keyBlockerIndex;
		int ownerIndex;
		int blockerIndex;
	};
}

#endif // PASSTIME_GAME_EVENTS_H