1 #pragma once
2 
3 #include "snoutlib/misc.h"
4 #include "snoutlib/fx.h"
5 
6 #include "boat.h"
7 #include "pboat.h"
8 #include "torpedo.h"
9 #include "missile.h"
10 
11 enum app_modes_t {MODE_MENU,MODE_GAME,MODE_CREDITS,MODE_SCORES};
12 extern app_modes_t g_mode;
13 
14 enum game_modes_t {GM_INGAME,GM_ENDWAVE,GM_STARTWAVE,GM_GAMEOVER,GM_GAMEOVER_HISCORE};
15 
16 class Game
17 {
18   int m_score;
19   int m_difficulty; // 0,1,2
20   int m_wave;
21 
22 	Boat *m_boats[3];
23 
24 	PBoat *m_pboat1;
25 	PBoat *m_pboat2;
26 
27 	vector<Torpedo> m_torpedoes;
28 	vector<Missile*> m_missiles;
29 
30   FX_stack m_effects;
31 
32   float m_missile_radius;
33 
34   int m_torpedoes_to_spawn;
35   float m_last_torpedo_spawned_at;
36   float m_torpedo_spawn_time;
37 
38   game_modes_t m_gamemode;
39   float m_last_gamemode_change;
40 
41   bool mouse_over_menu_button(const vec2 &pos);
42   int torpedo_hit_score(void);
43   void start_wave(void);
44   void draw_HUD(void);
45   void spawn_torpedo(void);
46   void gamemode_specific_stuff(void);
47   void change_gamemode(game_modes_t gamemode);
48   int torpedoes_left(void);
49   int ships_left(void);
50   int ship_left_score(void);
51   int missile_left_score(void);
52 
53   void highscore_entry_key(int key);
54   void highscore_entry_char(int ch);
55 
56   string m_hiscore_name;
57   bool m_ended;
58 public:
59   Game(int difficulty, int wave=1);
60   ~Game();
61 
62   void draw_under(void);
63   void draw_over(void);
64 
65   void add_effect(FX *effect,int draw_order_id=0);
66 
67 	void keyboard_cb(int key,int action);
68   void character_cb(int ch,int action);
69   void mouse_cb(int button,int action);
70 
71   bool ended(void);
72   game_modes_t current_gamemode(void);
73 };
74 
75 extern Game *g_current_game;
76 
77