Debian Codegraph @

Descent3/game.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/game.h $
21 * $Revision: 55 $
22 * $Date: 9/14/01 4:47p $
23 * $Author: Matt $
24 *
25 * Game management
26 *
27 * $Log: /DescentIII/Main/game.h $
28 *
29 * 55 9/14/01 4:47p Matt
30 * Cleaned up problems when screen bit depth set to 32.
31 *
32 * 54 10/14/99 1:08p Chris
33 * Added another custom bounce force field texture slot
34 *
35 * 53 10/13/99 2:19p Chris
36 * Added the ability to disable wind for powerups on a level
37 *
38 * 52 10/13/99 10:41a Chris
39 * Added 'special forcefields' that have custom bounce factors
40 *
41 * 51 10/08/99 4:29p Chris
42 * Added the forcefield and glass breaking override options
43 *
44 * 50 4/15/99 1:38a Jeff
45 * changes for linux compile
46 *
47 * 49 4/14/99 10:33p Jeff
48 * fixed missing extern
49 *
50 * 48 3/19/99 12:54p Jeff
51 * base support for requesting the number of teams for a multiplayer game
52 *
53 * 47 2/21/99 12:28p Matt
54 * Added terrain sound system
55 *
56 * 46 2/16/99 12:00p Samir
57 * added new video resolution swtich test.
58 *
59 * 45 2/10/99 2:41p Chris
60 * Added debug info
61 *
62 * 44 2/09/99 9:59a Chris
63 * Massive BOA update :) Terrain happy now. Vis happy now. Sound happy
64 * now.
65 *
66 * 43 2/08/99 7:50p Jeff
67 * made StartFrame/EndFrame stack based...no longer have to worry about
68 * preserving current frame settings to restore
69 *
70 * 42 2/08/99 12:04a Jeff
71 * added a function to get the current StartFrame parameters (from last
72 * call to StartFrame)
73 *
74 * 39 1/10/99 10:23p Jeff
75 * added initial start/end boss intro function
76 *
77 * 38 10/22/98 2:58p Chris
78 * Difficulty levels are in beta
79 *
80 * 37 10/15/98 8:55a Matt
81 * Took out Endlevel() declaration, since no one should be calling this
82 * function except the gamesequence code.
83 *
84 * 36 10/14/98 7:30p Matt
85 * Changed StartEndlevelSeqence to take a time parameter for how long to
86 * delay before ending the level.
87 *
88 * 35 10/14/98 12:44a Matt
89 * Cleaned up endlevel sequence system (though it still doesn't work --
90 * ChrisP is going to look at the path-following).
91 *
92 * 34 10/05/98 11:06a Chris
93 * Level goals version .9
94 *
95 * 33 9/01/98 4:11p Samir
96 * moved screenshot code from gameloop to game.cpp
97 *
98 * 32 6/22/98 12:00p Chris
99 * Working on sound system to make it in a nice shape.
100 *
101 * 31 4/14/98 9:18p Samir
102 * redid post level results.
103 *
104 * 30 3/19/98 9:19p Samir
105 * removed dependency of hud.h on game.h.
106 *
107 * 29 3/17/98 2:37p Samir
108 * reorg of hud/gauge/cockpit dependencies.
109 *
110 * 28 3/13/98 6:55p Craig
111 *
112 * 27 3/11/98 4:58p Chris
113 * Changed Show_game_sphere to 3 types
114 *
115 * 26 3/10/98 5:15p Chris
116 * DEL+B shows the bounding-sphere of an object
117 *
118 * 25 2/14/98 10:48p Jason
119 * got preferred rendering working
120 *
121 * 24 2/13/98 10:57a Samir
122 * Changed some gamescript initialization.
123 *
124 * 23 2/12/98 5:08p Matt
125 * Reset cockpit mode when starting a level. Unfortunately, this involved
126 * some semi-major mucking with game sequencing.
127 *
128 * 22 2/12/98 4:46p Matt
129 * Added needed include
130 *
131 * 21 2/12/98 4:28p Matt
132 * Added function to start endlevel in-game "cutscene"
133 *
134 * 20 2/11/98 4:35p Samir
135 * SetGameMode fully implented takes a script.
136 *
137 * 19 2/10/98 11:28a Samir
138 * Added gamemode info support
139 *
140 * 18 2/09/98 3:20p Matt
141 * Added missile camera system
142 *
143 * 17 2/08/98 5:01p Samir
144 * New game sequencing changes.
145 *
146 * 16 2/02/98 7:35p Samir
147 * Call QuickPlayGame to play game using quick mission system.
148 *
149 * 15 1/21/98 1:11p Jason
150 * incremental checkin for multiplayer
151 *
152 * 14 1/13/98 4:27p Samir
153 * Fixed clear screen strangeness.
154 *
155 * 13 1/05/98 10:51a Samir
156 * Changed number of parameters in StartFrame
157 *
158 * 12 12/29/97 5:46p Samir
159 * Added new frame start and end functions.
160 *
161 * 11 11/10/97 12:35p Samir
162 * Added SM_CINEMATIC screen mode, and make sure we don't reinit renderer
163 * for hardware rendering between two screen modes that use hardware.
164 *
165 * 10 10/28/97 6:36p Samir
166 * Moved SetCockpitMode to gauges.cpp
167 *
168 * 9 10/28/97 12:46p Samir
169 * Moved SetCockpitMode to new gauges.cpp
170 *
171 * 8 10/16/97 2:32p Samir
172 * Fixed up some timing problems.
173 *
174 * 7 10/10/97 3:56p Samir
175 * Added a cockpit mode selection function.
176 *
177 * 6 10/02/97 12:36p Samir
178 * Redid game sequencing flow.
179 *
180 * $NoKeywords: $
181 */
182
183 #ifndef _GAME_H
184 #define _GAME_H
185
186 #include "pserror.h"
187 #include "renderer.h"
188 #include "object.h"
189
190 // return 0 if we wan't to return to the menu, or return 1 if everything
191 // is okay. starts a new game based off the current mission.
192 void PlayGame(void);
193
194 // meant for 'instant' action (usually run from editor, but...)
195 void QuickPlayGame();
196
197 float GetFPS();
198
199 // Stop the Frame_time clock
200 void StopTime(void);
201
202 // Restart the Frame_time clock
203 void StartTime(void);
204
205 // Compute how long last frame took
206 void CalcFrameTime(void);
207
208 // Initialize frame timer
209 void InitFrameTime(void);
210
211 // Sets screen mode
212 const int SM_NULL = 0, SM_GAME = 1, SM_MENU = 2, SM_CINEMATIC = 3;
213
214 void SetScreenMode(int sm, bool force_res_change = false);
215 int GetScreenMode();
216
217 // ALWAYS CALL THESE TO START AND END RENDERING
218 void StartFrame(bool clear = true);
219 void StartFrame(int x, int y, int x2, int y2, bool clear = true, bool push_on_stack = true);
220 void EndFrame();
221
222 // retrives the settings of the last call to StartFrame
223 // returns false if it's not currently in between a StartFrame/EndFrame block
224 bool GetFrameParameters(int *x1, int *y1, int *x2, int *y2);
225
226 // call this to set the game mode
227 void SetGameMode(int mode);
228
229 // How long (in seconds) the last frame took
230 extern float Frametime;
231
232 // How long (in seconds) since the game started
233 extern float Gametime;
234
235 // set this to clear the screen X number of times.
236 extern int Clear_screen;
237
238 // How many frames have been renered.
239 // NOTE: this is a count of 3d frames, not game frames
240 extern int FrameCount;
241
242 // Vars for game 3D window
243 extern int Game_window_x, Game_window_y, Game_window_w, Game_window_h;
244 extern int Max_window_w, Max_window_h;
245
246 extern int Game_mode;
247 extern int Difficulty_level;
248
249 extern int sound_override_force_field;
250 extern int sound_override_glass_breaking;
251
252 #define MAX_FORCE_FIELD_BOUNCE_TEXTURES 3
253 extern int force_field_bounce_texture[MAX_FORCE_FIELD_BOUNCE_TEXTURES];
254 extern float force_field_bounce_multiplier[MAX_FORCE_FIELD_BOUNCE_TEXTURES];
255
256 extern bool Level_powerups_ignore_wind;
257
258 extern bool IsCheater;
259
260 #ifdef _DEBUG
261 extern int Game_show_sphere;
262 extern int Game_show_portal_vis_pnts;
263 extern int Game_update_attach;
264 extern int Game_do_walking_sim;
265 extern int Game_do_vis_sim;
266 extern int Game_do_flying_sim;
267 extern int Game_do_ai_movement;
268 extern int Game_do_ai_vis;
269 #endif
270
271 extern bool UseHardware;
272 extern renderer_type PreferredRenderer;
273 // State variables for our renderer
274 extern rendering_state Render_state;
275 extern renderer_preferred_state Render_preferred_state;
276 extern int Render_preferred_bitdepth;
277
278 #define GM_SINGLE 1 // Single player game.
279 // #define GM_SERIAL 2 // You are in serial mode (Jason
280 // doesn't like this.)
281 #define GM_NETWORK 4 // You are in network mode
282 #define GM_MODEM 32 // You are in a modem (serial) game
283
284 #define GM_GAME_OVER 128 // Game has been finished
285
286 #define GM_NONE 0 // You are not in any mode, kind of dangerous...
287 #define GM_NORMAL 1 // You are in normal play mode, no multiplayer stuff
288 #define GM_MULTI (GM_NETWORK + GM_MODEM) // You are in some type of multiplayer game
289
290 /*
291 struct trigger;
292 struct tD3XThread;
293 struct tD3XProgram;
294 */
295
296 struct gamemode {
297 char scriptname[64];
298 int requested_num_teams;
299 /*
300 tD3XProgram *d3xmod;
301 tD3XThread *d3xthread;
302 int objmehandle;
303 int objithandle;
304 trigger *trigme;
305 trigger *trigit;
306 */
307 };
308
309 // Structure for a terrain sound "band"
310 struct terrain_sound_band {
311 int sound_index; // the sound to play
312 uint8_t low_alt, high_alt; // top & bottom of range of sound
313 float low_volume, high_volume; // volume at top & bottom of range
314 };
315
316 // How many terrain sound bands we have
317 #define NUM_TERRAIN_SOUND_BANDS 5
318
319 // The terrain sound bands for the current level
320 extern terrain_sound_band Terrain_sound_bands[];
321
322 // Clear out all the terrain sound bands
323 void ClearTerrainSound();
324
325 // Starts the sound on the terrain
326 void StartTerrainSound();
327
328 // Missile camera. If disabled, this is -1. Otherwise, it's a window number (see SmallViews.h).
329 extern int Missile_camera_window;
330
331 // contains all relevent information for gamemode pertaining to d3x system.
332 extern gamemode Gamemode_info;
333
334 // Starts the game-engine "cutscene"
335 // Puts the player in AI mode, sets the view to an external camera, switches to letterbox, & puts the player on a path
336 // Parameters: camera - the camera for the view
337 // pathnum - the path the player should follow
338 // time - if > 0.0, how long the sequence plays before the level ends
339 void StartEndlevelSequence(object *camera, int pathnum, float time);
340
341 inline void ResetGamemode() {
342 Gamemode_info.scriptname[0] = 0;
343 Gamemode_info.requested_num_teams = 1;
344 /*
345 Gamemode_info.objmehandle = 0;
346 Gamemode_info.objithandle = 0;
347 Gamemode_info.trigme = 0;
348 Gamemode_info.trigit = 0;
349 */
350 }
351
352 void SetGamemodeScript(const char *scrfilename, int num_requested_teams = -1);
353
354 // Does a screenshot and tells the bitmap lib to save out the picture as a tga
355 void DoScreenshot();
356
357 #endif