GAME.H 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. /*
  14. * $Source: f:/miner/source/main/rcs/game.h $
  15. * $Revision: 2.1 $
  16. * $Author: john $
  17. * $Date: 1995/03/06 15:23:22 $
  18. *
  19. * Constants & prototypes which pertain to the game only
  20. *
  21. * $Log: game.h $
  22. * Revision 2.1 1995/03/06 15:23:22 john
  23. * New screen techniques.
  24. *
  25. * Revision 2.0 1995/02/27 11:28:21 john
  26. * New version 2.0, which has no anonymous unions, builds with
  27. * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  28. *
  29. * Revision 1.79 1995/02/13 10:37:17 john
  30. * Saved Buggin' cheat mode to save file.
  31. *
  32. * Revision 1.78 1995/02/01 16:34:12 john
  33. * Linted.
  34. *
  35. * Revision 1.77 1995/01/29 21:37:14 mike
  36. * initialize variables on game load so you don't drain your energy when you fire.
  37. *
  38. * Revision 1.76 1995/01/26 22:11:36 mike
  39. * Purple chromo-blaster (ie, fusion cannon) spruce up (chromification)
  40. *
  41. * Revision 1.75 1995/01/26 16:45:31 mike
  42. * Add autofire fusion cannon stuff.
  43. *
  44. * Revision 1.74 1994/12/11 23:18:06 john
  45. * Added -nomusic.
  46. * Added RealFrameTime.
  47. * Put in a pause when sound initialization error.
  48. * Made controlcen countdown and framerate use RealFrameTime.
  49. *
  50. * Revision 1.73 1994/12/09 00:41:24 mike
  51. * fix hang in automap print screen
  52. *
  53. * Revision 1.72 1994/12/04 13:47:00 mike
  54. * enhance custom detail level support.
  55. *
  56. * Revision 1.71 1994/12/02 15:05:44 matt
  57. * Added new "official" cheats
  58. *
  59. * Revision 1.70 1994/11/28 18:14:09 rob
  60. * Added game_mode flag for team games.
  61. *
  62. * Revision 1.69 1994/11/15 16:51:13 matt
  63. * Made rear view only switch to rear cockpit if cockpit on in front view
  64. *
  65. * Revision 1.68 1994/11/04 16:26:10 john
  66. * Fixed bug with letterbox mode game after you finish a game.
  67. *
  68. * Revision 1.67 1994/11/02 11:59:48 john
  69. * Moved menu out of game into inferno main loop.
  70. *
  71. * Revision 1.66 1994/10/26 23:02:19 matt
  72. * Made palette flash saturate negative values
  73. *
  74. * Revision 1.65 1994/10/26 15:21:05 mike
  75. * Detail level stuff. Make Render_depth public.
  76. *
  77. * Revision 1.64 1994/10/19 00:13:01 matt
  78. * Added prototypes
  79. *
  80. * Revision 1.63 1994/10/09 14:54:39 matt
  81. * Made player cockpit state & window size save/restore with saved games & automap
  82. *
  83. * Revision 1.62 1994/10/08 19:56:32 matt
  84. * Added prototype
  85. *
  86. * Revision 1.61 1994/10/07 22:19:32 mike
  87. * Increase number of difficulty levels from 4 to 5.
  88. *
  89. * Revision 1.60 1994/10/06 14:14:11 matt
  90. * Added new function to reset time (to prevent big FrameTime) at start of level
  91. *
  92. * Revision 1.59 1994/10/05 17:08:43 matt
  93. * Changed order of cockpit bitmaps, since there's no longer a full-screen cockpit
  94. *
  95. * Revision 1.58 1994/10/03 23:44:13 matt
  96. * Save & restore palette effect around menus & pause message
  97. *
  98. * Revision 1.57 1994/09/29 17:42:12 matt
  99. * Cleaned up game_mode a little
  100. *
  101. * Revision 1.56 1994/09/28 23:12:01 matt
  102. * Macroized palette flash system
  103. *
  104. * Revision 1.55 1994/09/24 16:56:13 rob
  105. * Added new fields for the Game_mode bitvector for modem play.
  106. *
  107. * Revision 1.54 1994/09/24 14:16:20 mike
  108. * Added new game mode constants.
  109. *
  110. * Revision 1.53 1994/09/22 19:00:57 mike
  111. * Move NDL from robot.h to here.
  112. *
  113. * Revision 1.52 1994/09/22 10:46:51 mike
  114. * Add difficulty levels.
  115. *
  116. * Revision 1.51 1994/09/17 01:39:52 matt
  117. * Added status bar/sizable window mode, and in the process revamped the
  118. * whole cockpit mode system.
  119. *
  120. * Revision 1.50 1994/09/15 21:23:10 matt
  121. * Changed system to keep track of whether & what cockpit is up
  122. *
  123. * Revision 1.49 1994/09/15 16:11:33 john
  124. * Added support for VFX1 head tracking. Fixed bug with memory over-
  125. * write when using stereo mode.
  126. *
  127. * Revision 1.48 1994/09/13 16:40:10 mike
  128. * Prototype Global_missile_firing_count.
  129. *
  130. * Revision 1.47 1994/09/13 11:19:05 mike
  131. * Add Next_missile_fire_time.
  132. *
  133. * Revision 1.46 1994/09/12 09:52:50 john
  134. * Made global flush function that flushes keyboard,mouse, and joystick.
  135. *
  136. * Revision 1.45 1994/09/03 15:24:14 mike
  137. * Make global Global_laser_firing_count.
  138. *
  139. * Revision 1.44 1994/08/31 19:26:57 mike
  140. * Prototypes for Next_laser_fire_time, Laser_delay_time.
  141. *
  142. * Revision 1.43 1994/08/18 10:47:22 john
  143. * Cleaned up game sequencing and player death stuff
  144. * in preparation for making the player explode into
  145. * pieces when dead.
  146. *
  147. * Revision 1.42 1994/08/11 18:03:53 matt
  148. * Added prototype
  149. *
  150. * Revision 1.41 1994/06/29 20:41:38 matt
  151. * Added new pause mode; cleaned up countdown & game startup code
  152. *
  153. * Revision 1.40 1994/06/24 17:03:49 john
  154. * Added VFX support. Also took all game sequencing stuff like
  155. * EndGame out and put it into gameseq.c
  156. *
  157. * Revision 1.39 1994/06/20 15:01:08 yuan
  158. * Added death when mine blows up...
  159. * Continues onto next level.
  160. *
  161. * Revision 1.38 1994/06/17 18:07:20 matt
  162. * Moved some vars out of ifdef
  163. *
  164. * Revision 1.37 1994/06/15 11:09:22 yuan
  165. * Moved gauge_message to mono screen for now.
  166. *
  167. * Revision 1.36 1994/05/30 20:22:11 yuan
  168. * New triggers.
  169. *
  170. * Revision 1.35 1994/05/27 10:32:48 yuan
  171. * New dialog boxes (Walls and Triggers) added.
  172. *
  173. *
  174. * Revision 1.34 1994/05/20 11:56:45 matt
  175. * Cleaned up find_vector_intersection() interface
  176. * Killed check_point_in_seg(), check_player_seg(), check_object_seg()
  177. *
  178. * Revision 1.33 1994/05/19 21:45:21 matt
  179. * Removed unused prototypes
  180. *
  181. * Revision 1.32 1994/05/19 18:53:17 yuan
  182. * Changing player structure...
  183. *
  184. * Revision 1.31 1994/05/16 16:38:35 yuan
  185. * Fixed palette add so it doesn't show up in the menu.
  186. *
  187. * Revision 1.30 1994/05/16 09:28:17 matt
  188. * Renamed init_player() to be init_player_stats(), added new funtion
  189. * init_player_object()
  190. *
  191. * Revision 1.29 1994/05/14 17:14:57 matt
  192. * Got rid of externs in source (non-header) files
  193. *
  194. */
  195. #ifndef _GAME_H
  196. #define _GAME_H
  197. #include <setjmp.h>
  198. #include "vecmat.h"
  199. #include "object.h"
  200. //#include "segment.h"
  201. //from mglobal.c
  202. extern fix FrameTime; //time in seconds since last frame
  203. extern fix RealFrameTime; //time in seconds since last frame
  204. extern fix GameTime; //time in game (sum of FrameTime)
  205. extern int FrameCount; //how many frames rendered
  206. extern fix Next_laser_fire_time; // Time at which player can next fire his selected laser.
  207. extern fix Last_laser_fired_time;
  208. extern fix Next_missile_fire_time; // Time at which player can next fire his selected missile.
  209. extern fix Laser_delay_time; // Delay between laser fires.
  210. extern int Cheats_enabled;
  211. //constants for ft_preference
  212. #define FP_RIGHT 0
  213. #define FP_UP 1
  214. #define FP_FORWARD 2 //this is the default
  215. #define FP_LEFT 3
  216. #define FP_DOWN 4
  217. #define FP_FIRST_TIME 5
  218. extern int ft_preference;
  219. // The following bits define the game modes.
  220. #define GM_EDITOR 1 // You came into the game from the editor
  221. #define GM_SERIAL 2 // You are in serial mode
  222. #define GM_NETWORK 4 // You are in network mode
  223. #define GM_MULTI_ROBOTS 8 // You are in a multiplayer mode with robots.
  224. #define GM_MULTI_COOP 16 // You are in a multiplayer mode and can't hurt other players.
  225. #define GM_MODEM 32 // You are in a modem (serial) game
  226. #define GM_UNKNOWN 64 // You are not in any mode, kind of dangerous...
  227. #define GM_GAME_OVER 128 // Game has been finished
  228. #define GM_TEAM 256 // Team mode for network play
  229. #define GM_NORMAL 0 // You are in normal play mode, no multiplayer stuff
  230. #define GM_MULTI 38 // You are in some type of multiplayer game
  231. // Examples:
  232. // Deathmatch mode on a network is GM_NETWORK
  233. // Deathmatch mode via modem with robots is GM_MODEM | GM_MULTI_ROBOTS
  234. // Cooperative mode via serial link is GM_SERIAL | GM_MULTI_COOP
  235. #define NDL 5 // Number of difficulty levels.
  236. #define NUM_DETAIL_LEVELS 6
  237. extern int Game_mode;
  238. extern int Game_paused;
  239. extern int gauge_message_on;
  240. #ifndef NDEBUG //if debugging, these are variables
  241. extern int Slew_on; //in slew or sim mode?
  242. extern int Game_double_buffer; //double buffering?
  243. #else //if not debugging, these are constants
  244. #define Slew_on 0 //no slewing in real game
  245. #define Game_double_buffer 1 //always double buffer in real game
  246. #endif
  247. //Suspend flags
  248. #define SUSP_NONE 0 //Everything moving normally
  249. #define SUSP_ROBOTS 1 //Robot AI doesn't move
  250. #define SUSP_WEAPONS 2 //Lasers, etc. don't move
  251. extern int Game_suspended; //if non-zero, nothing moves but player
  252. //from game.c
  253. void init_game(void);
  254. void game(void);
  255. void close_game(void);
  256. void calc_frame_time(void);
  257. do_flythrough(object *obj,int first_time);
  258. extern jmp_buf LeaveGame; // Do a long jump to this when game is over.
  259. extern int Difficulty_level; // Difficulty level in 0..NDL-1, 0 = easiest, NDL-1 = hardest
  260. extern int Detail_level; // Detail level in 0..NUM_DETAIL_LEVELS-1, 0 = boringest, NUM_DETAIL_LEVELS = coolest
  261. extern int Global_laser_firing_count;
  262. extern int Global_missile_firing_count;
  263. extern int Render_depth;
  264. extern fix Auto_fire_fusion_cannon_time, Fusion_charge;
  265. extern int PaletteRedAdd, PaletteGreenAdd, PaletteBlueAdd;
  266. #define MAX_PALETTE_ADD 30
  267. //adds to rgb values for palette flash
  268. #define PALETTE_FLASH_ADD(_dr,_dg,_db) \
  269. do { \
  270. if ((PaletteRedAdd+=(_dr)) > MAX_PALETTE_ADD) \
  271. PaletteRedAdd = MAX_PALETTE_ADD; \
  272. if ((PaletteGreenAdd+=(_dg)) > MAX_PALETTE_ADD) \
  273. PaletteGreenAdd = MAX_PALETTE_ADD; \
  274. if ((PaletteBlueAdd+=(_db)) > MAX_PALETTE_ADD) \
  275. PaletteBlueAdd = MAX_PALETTE_ADD; \
  276. if (PaletteRedAdd < -MAX_PALETTE_ADD) \
  277. PaletteRedAdd = -MAX_PALETTE_ADD; \
  278. if (PaletteGreenAdd < -MAX_PALETTE_ADD) \
  279. PaletteGreenAdd = -MAX_PALETTE_ADD; \
  280. if (PaletteBlueAdd < -MAX_PALETTE_ADD) \
  281. PaletteBlueAdd = -MAX_PALETTE_ADD; \
  282. } while (0)
  283. //sets the rgb values for palette flash
  284. #define PALETTE_FLASH_SET(_r,_g,_b) PaletteRedAdd=(_r), PaletteGreenAdd=(_g), PaletteBlueAdd=(_b)
  285. extern int draw_gauges_on;
  286. extern void init_game_screen(void);
  287. extern void game_flush_inputs(); // clear all inputs
  288. extern int Playing_game; // True if playing game
  289. extern int Auto_flythrough; //if set, start flythough automatically
  290. extern int Mark_count; // number of debugging marks set
  291. extern char faded_in;
  292. extern void stop_time(void);
  293. extern void start_time(void);
  294. extern void reset_time(void); //called when starting level
  295. // If automap_flag == 1, then call automap routine to write message.
  296. extern void save_screen_shot(int automap_flag);
  297. extern grs_canvas * get_current_game_screen();
  298. //valid modes for cockpit
  299. #define CM_FULL_COCKPIT 0 //normal screen with cockput
  300. #define CM_REAR_VIEW 1 //looking back with bitmap
  301. #define CM_STATUS_BAR 2 //small status bar, w/ reticle
  302. #define CM_FULL_SCREEN 3 //full screen, no cockpit (w/ reticle)
  303. #define CM_LETTERBOX 4 //half-height window (for cutscenes)
  304. extern int Cockpit_mode; //what sort of cockpit or window is up?
  305. extern int Game_window_w, //width and height of player's game window
  306. Game_window_h;
  307. extern int Rear_view; //if true, looking back.
  308. //selects a given cockpit (or lack of one).
  309. void select_cockpit(int mode);
  310. //force cockpit redraw next time. call this if you've trashed the screen
  311. void reset_cockpit(void); //called if you've trashed the screen
  312. //functions to save, clear, and resture palette flash effects
  313. void palette_save(void);
  314. void reset_palette_add(void);
  315. void palette_restore(void);
  316. //put up the help message
  317. void do_show_help();
  318. //show a message in a nice little box
  319. show_boxed_message(char *msg);
  320. //erases message drawn with show_boxed_message()
  321. clear_boxed_message();
  322. //turns off rear view & rear view cockpit
  323. void reset_rear_view(void);
  324. extern int Game_turbo_mode;
  325. #define VR_NONE 0 //viewing the game screen
  326. #define VR_AREA_DET 1 //viewing with the stereo area determined method
  327. #define VR_INTERLACED 2 //viewing with the stereo interlaced method
  328. extern ubyte VR_use_paging;
  329. extern ubyte VR_current_page;
  330. extern ubyte VR_switch_eyes;
  331. extern fix VR_eye_width;
  332. extern int VR_screen_mode;
  333. extern int VR_render_width;
  334. extern int VR_render_height;
  335. extern int VR_render_mode;
  336. extern int VR_compatible_menus;
  337. extern grs_canvas *VR_offscreen_buffer; // The offscreen data buffer
  338. extern grs_canvas VR_render_buffer[2]; // Two offscreen buffers for left/right eyes.
  339. extern grs_canvas VR_render_sub_buffer[2]; // Two sub buffers for left/right eyes.
  340. extern grs_canvas VR_screen_pages[2]; // Two pages of VRAM if paging is available
  341. extern grs_canvas VR_screen_sub_pages[2]; // Two sub pages of VRAM if paging is available
  342. void game_init_render_buffers(int screen_mode, int render_max_w, int render_max_h, int use_paging, int render_method, int compatible_menus );
  343. #endif
  344.