1 #ifndef INC_AI_H
2 #define INC_AI_H
3 
4 #include <SDL/SDL_stdinc.h>
5 
6 class GameState;
7 class Invader;
8 class HPInvader;
9 struct RelPolarCoord;
10 
11 class AI
12 {
13     protected:
14 	GameState* gameState;
15 
16 	// Some utility functions for dealing with the state (which has
17 	// befriended us)
18 	HPInvader* closestEnemy();
19 	void updateSeen();
20 	RelPolarCoord predictPos(Invader* inv, float time);
21 
22     public:
23 	static const Uint8 K_LEFT = 1<<0;
24 	static const Uint8 K_RIGHT = 1<<1;
25 	static const Uint8 K_DEAIM = 1<<2;
26 	static const Uint8 K_DEZOOM = 1<<3;
27 	static const Uint8 K_SHOOT1 = 1<<4;
28 	static const Uint8 K_SHOOT2 = 1<<5;
29 	static const Uint8 K_SHOOT3 = 1<<6;
30 	static const Uint8 K_POD = 1<<7;
31 	Uint8 keys;
32 
33 	virtual void update(int time) =0;
34 
AI(GameState * gameState)35 	AI(GameState* gameState) : gameState(gameState), keys(0) {}
36 
~AI()37 	virtual ~AI() {}
38 };
39 
40 class AIData
41 {
42     public:
43 	bool seen;
AIData()44 	AIData() : seen(false) {}
45 };
46 
47 class BasicAI : public AI
48 {
49     private:
50 	int seed;
51 	void newSeed();
52 	int getShotWeight(int hp, int armour) const;
53     public:
54 	void update(int time);
55 
56 	BasicAI(GameState* gameState);
57 };
58 
59 
60 #endif /* INC_AI_H */
61