Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Starshatter.h
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: Starshatter.h
7  AUTHOR: John DiCamillo
8 
9 */
10 
11 #ifndef Starshatter_h
12 #define Starshatter_h
13 
14 #include "Types.h"
15 #include "Game.h"
16 #include "Bitmap.h"
17 #include "KeyMap.h"
18 #include "Text.h"
19 
20 // +--------------------------------------------------------------------+
21 
22 class Campaign;
23 class MenuScreen;
24 class CmpnScreen;
25 class PlanScreen;
26 class LoadScreen;
27 class GameScreen;
28 class Ship;
29 class Sim;
30 class FadeView;
31 class CameraDirector;
32 class MultiController;
33 class MouseController;
34 class MusicDirector;
35 class DataLoader;
36 class Font;
37 class TrackIR;
38 class Mission;
39 
40 class NetServer;
41 class NetLobby;
42 
43 // +--------------------------------------------------------------------+
44 
45 class Starshatter : public Game
46 {
47 public:
48  Starshatter();
49  virtual ~Starshatter();
50 
51  virtual bool Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow);
52  virtual bool InitGame();
53  virtual bool ChangeVideo();
54  virtual void GameState();
55  virtual void Exit();
56  virtual bool OnHelp();
57 
58  enum MODE { MENU_MODE, // main menu
59  CLOD_MODE, // loading campaign
60  CMPN_MODE, // operational command for dynamic campaign
61  PREP_MODE, // loading mission info for planning
62  PLAN_MODE, // mission briefing
63  LOAD_MODE, // loading mission into simulator
64  PLAY_MODE, // active simulation
65  EXIT_MODE // shutting down
66  };
67 
70  };
71 
72  int GetGameMode() { return game_mode; }
73  void SetGameMode(int mode);
74  void RequestChangeVideo();
75  void LoadVideoConfig(const char* filename);
76  void SaveVideoConfig(const char* filename);
77  void SetupSplash();
78  void SetupMenuScreen();
79  void SetupCmpnScreen();
80  void SetupPlanScreen();
81  void SetupLoadScreen();
82  void SetupGameScreen();
83  void OpenTacticalReference();
84  void CreateWorld();
85  int KeyDown(int action) const;
86 
87  void PlayerCam(int mode);
88  void ViewSelection();
89 
90  void MapKeys();
91  static void MapKeys(KeyMap* mapping, int nkeys);
92  static void MapKey(int act, int key, int alt=0);
93 
94  void SetTestMode(int t) { test_mode = t; }
95 
96  static Starshatter* GetInstance() { return instance; }
97 
98  int GetScreenWidth();
99  int GetScreenHeight();
100 
101  // graphic options:
102  int LensFlare() { return lens_flare; }
103  int Corona() { return corona; }
104  int Nebula() { return nebula; }
105  int Dust() { return dust; }
106 
107  KeyMap& GetKeyMap() { return keycfg; }
108 
109  int GetLoadProgress() { return load_progress; }
110  const char* GetLoadActivity() { return load_activity; }
111 
112  void InvalidateTextureCache();
113 
114  int GetChatMode() const { return chat_mode; }
115  void SetChatMode(int c);
116  const char* GetChatText() const { return chat_text.data(); }
117 
118  void StopNetGame();
119 
120  int GetLobbyMode();
121  void SetLobbyMode(int mode = NET_LOBBY_CLIENT);
122  void StartLobby();
123  void StopLobby();
124 
125  void ExecCutscene(const char* msn_file, const char* path);
126  void BeginCutscene();
127  void EndCutscene();
128  bool InCutscene() const { return cutscene > 0; }
129  Mission* GetCutsceneMission() const;
130  const char* GetSubtitles() const;
131  void EndMission();
132 
133  void StartOrResumeGame();
134 
135  static bool UseFileSystem();
136 
137 protected:
138  virtual void DoMenuScreenFrame();
139  virtual void DoCmpnScreenFrame();
140  virtual void DoPlanScreenFrame();
141  virtual void DoLoadScreenFrame();
142  virtual void DoGameScreenFrame();
143  virtual void DoMouseFrame();
144 
145  virtual void DoChatMode();
146  virtual void DoGameKeys();
147 
148  virtual bool GameLoop();
149  virtual void UpdateWorld();
150  virtual void InstantiateMission();
151  virtual bool ResizeVideo();
152  virtual void InitMouse();
153 
161 
169 
173 
183 
184  DWORD time_mark;
185  DWORD minutes;
186 
188  double orig_fov;
189 
190  static int keymap[256];
191  static int keyalt[256];
193 
194  bool tactical;
195  bool spinning;
196  int mouse_x;
197  int mouse_y;
198  int mouse_dx;
199  int mouse_dy;
200 
205 
207  int corona;
208  int nebula;
209  int dust;
210 
211  double exit_time;
212 
217 
218  int cutscene;
223 };
224 
225 #endif Starshatter_h