home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / game.h < prev    next >
Text File  |  1998-06-08  |  14KB  |  403 lines

  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.  
  196. #ifndef _GAME_H
  197. #define _GAME_H
  198.  
  199. #include <setjmp.h>
  200.  
  201. #include "vecmat.h"
  202. #include "object.h"
  203.  
  204. //#include "segment.h"
  205.  
  206. //from mglobal.c
  207. extern fix FrameTime;                    //time in seconds since last frame
  208. extern fix RealFrameTime;                    //time in seconds since last frame
  209. extern fix GameTime;                        //time in game (sum of FrameTime)
  210. extern int FrameCount;                    //how many frames rendered
  211. extern fix    Next_laser_fire_time;    //    Time at which player can next fire his selected laser.
  212. extern fix    Last_laser_fired_time;
  213. extern fix    Next_missile_fire_time;    //    Time at which player can next fire his selected missile.
  214. extern fix    Laser_delay_time;            //    Delay between laser fires.
  215. extern int Cheats_enabled;
  216.  
  217. //constants for ft_preference
  218. #define FP_RIGHT        0
  219. #define FP_UP            1
  220. #define FP_FORWARD    2        //this is the default
  221. #define FP_LEFT        3
  222. #define FP_DOWN        4
  223. #define FP_FIRST_TIME    5
  224.  
  225. extern int ft_preference;
  226.  
  227. //    The following bits define the game modes.
  228. #define GM_EDITOR                        1            //    You came into the game from the editor
  229. #define GM_SERIAL                        2            // You are in serial mode
  230. #define GM_NETWORK                    4            // You are in network mode
  231. #define GM_MULTI_ROBOTS                8            //    You are in a multiplayer mode with robots.
  232. #define GM_MULTI_COOP                16            //    You are in a multiplayer mode and can't hurt other players.
  233. #define GM_MODEM                        32       // You are in a modem (serial) game
  234.  
  235. #define GM_UNKNOWN                    64            //    You are not in any mode, kind of dangerous...
  236. #define GM_GAME_OVER                    128        //    Game has been finished
  237.  
  238. #define GM_TEAM                        256        // Team mode for network play
  239.  
  240. #define GM_NORMAL                        0            //    You are in normal play mode, no multiplayer stuff
  241. #define GM_MULTI                        38            //    You are in some type of multiplayer game
  242.  
  243. //    Examples:
  244. //    Deathmatch mode on a network is GM_NETWORK
  245. //    Deathmatch mode via modem with robots is GM_MODEM | GM_MULTI_ROBOTS
  246. // Cooperative mode via serial link is GM_SERIAL | GM_MULTI_COOP
  247.  
  248. #define    NDL    5        //    Number of difficulty levels.
  249. #define    NUM_DETAIL_LEVELS    6
  250.  
  251. extern int Game_mode;
  252.  
  253. extern int Game_paused;
  254. extern int gauge_message_on;
  255.  
  256. #ifndef NDEBUG        //if debugging, these are variables
  257.  
  258. extern int Slew_on;                            //in slew or sim mode?
  259. extern int Game_double_buffer;            //double buffering?
  260.  
  261.  
  262. #else                    //if not debugging, these are constants
  263.  
  264. #define Slew_on                 0        //no slewing in real game
  265. #define Game_double_buffer    1        //always double buffer in real game
  266.  
  267.  
  268. #endif
  269.  
  270. //Suspend flags
  271.  
  272. #define SUSP_NONE            0            //Everything moving normally 
  273. #define SUSP_ROBOTS        1            //Robot AI doesn't move
  274. #define SUSP_WEAPONS        2            //Lasers, etc. don't move        
  275.  
  276. extern int Game_suspended;            //if non-zero, nothing moves but player
  277.  
  278. //from game.c
  279.  
  280. void init_game(void);
  281. void game(void);
  282. void close_game(void);
  283.  
  284. void calc_frame_time(void);
  285.  
  286. do_flythrough(object *obj,int first_time);
  287.  
  288. extern jmp_buf LeaveGame;                    // Do a long jump to this when game is over.
  289. extern int    Difficulty_level;                //    Difficulty level in 0..NDL-1, 0 = easiest, NDL-1 = hardest
  290. extern int    Detail_level;                    //    Detail level in 0..NUM_DETAIL_LEVELS-1, 0 = boringest, NUM_DETAIL_LEVELS = coolest
  291. extern int    Global_laser_firing_count;
  292. extern int    Global_missile_firing_count;
  293. extern int    Render_depth;
  294. extern fix    Auto_fire_fusion_cannon_time, Fusion_charge;
  295.  
  296. extern int PaletteRedAdd, PaletteGreenAdd, PaletteBlueAdd;
  297.  
  298. #define    MAX_PALETTE_ADD    30
  299.  
  300. //adds to rgb values for palette flash
  301. #define PALETTE_FLASH_ADD(_dr,_dg,_db)                         \
  302.     do {                                                                    \
  303.         if ((PaletteRedAdd+=(_dr)) > MAX_PALETTE_ADD)        \
  304.             PaletteRedAdd = MAX_PALETTE_ADD;                        \
  305.         if ((PaletteGreenAdd+=(_dg)) > MAX_PALETTE_ADD)        \
  306.             PaletteGreenAdd = MAX_PALETTE_ADD;                    \
  307.         if ((PaletteBlueAdd+=(_db)) > MAX_PALETTE_ADD)        \
  308.             PaletteBlueAdd = MAX_PALETTE_ADD;                    \
  309.         if (PaletteRedAdd < -MAX_PALETTE_ADD)                    \
  310.             PaletteRedAdd = -MAX_PALETTE_ADD;                    \
  311.         if (PaletteGreenAdd < -MAX_PALETTE_ADD)                \
  312.             PaletteGreenAdd = -MAX_PALETTE_ADD;                    \
  313.         if (PaletteBlueAdd < -MAX_PALETTE_ADD)                    \
  314.             PaletteBlueAdd = -MAX_PALETTE_ADD;                    \
  315.     } while (0)
  316.  
  317. //sets the rgb values for palette flash
  318. #define PALETTE_FLASH_SET(_r,_g,_b) PaletteRedAdd=(_r), PaletteGreenAdd=(_g), PaletteBlueAdd=(_b)
  319.  
  320. extern int draw_gauges_on;
  321.  
  322. extern void init_game_screen(void);
  323.  
  324. extern void game_flush_inputs();        // clear all inputs
  325.  
  326. extern int Playing_game;        // True if playing game
  327. extern int Auto_flythrough;    //if set, start flythough automatically
  328. extern int Mark_count;            // number of debugging marks set
  329. extern char faded_in;
  330.  
  331. extern void stop_time(void);
  332. extern void start_time(void);
  333. extern void reset_time(void);        //called when starting level
  334.  
  335. //    If automap_flag == 1, then call automap routine to write message.
  336. extern void save_screen_shot(int automap_flag);
  337.  
  338. extern grs_canvas * get_current_game_screen();
  339.  
  340. //valid modes for cockpit
  341. #define CM_FULL_COCKPIT     0    //normal screen with cockput
  342. #define CM_REAR_VIEW            1    //looking back with bitmap
  343. #define CM_STATUS_BAR        2    //small status bar, w/ reticle
  344. #define CM_FULL_SCREEN        3    //full screen, no cockpit (w/ reticle)
  345. #define CM_LETTERBOX            4    //half-height window (for cutscenes)
  346.  
  347. extern int Cockpit_mode;        //what sort of cockpit or window is up?
  348. extern int Game_window_w,        //width and height of player's game window
  349.               Game_window_h;
  350.  
  351. extern int Rear_view;            //if true, looking back.
  352.  
  353. //selects a given cockpit (or lack of one).
  354. void select_cockpit(int mode);
  355.  
  356. //force cockpit redraw next time. call this if you've trashed the screen
  357. void reset_cockpit(void);        //called if you've trashed the screen
  358.  
  359. //functions to save, clear, and resture palette flash effects
  360. void palette_save(void);
  361. void reset_palette_add(void);
  362. void palette_restore(void);
  363.  
  364. //put up the help message
  365. void do_show_help();
  366.  
  367. //show a message in a nice little box
  368. show_boxed_message(char *msg);
  369.  
  370. //erases message drawn with show_boxed_message()
  371. clear_boxed_message();
  372.  
  373. //turns off rear view & rear view cockpit
  374. void reset_rear_view(void);
  375.  
  376. extern int Game_turbo_mode;
  377.  
  378. #define VR_NONE            0    //viewing the game screen
  379. #define VR_AREA_DET        1    //viewing with the stereo area determined method
  380. #define VR_INTERLACED    2    //viewing with the stereo interlaced method
  381.  
  382. extern ubyte        VR_use_paging;
  383. extern ubyte        VR_current_page;
  384. extern ubyte        VR_switch_eyes;
  385. extern fix            VR_eye_width;
  386. extern int            VR_screen_mode;
  387. extern int            VR_render_width;
  388. extern int            VR_render_height;
  389. extern int            VR_render_mode;
  390. extern int            VR_compatible_menus;
  391. extern grs_canvas *VR_offscreen_buffer;        // The offscreen data buffer
  392. extern grs_canvas    VR_render_buffer[2];                    //  Two offscreen buffers for left/right eyes.
  393. extern grs_canvas    VR_render_sub_buffer[2];            //  Two sub buffers for left/right eyes.
  394. extern grs_canvas    VR_screen_pages[2];                    //  Two pages of VRAM if paging is available
  395. extern grs_canvas    VR_screen_sub_pages[2];                //  Two sub pages of VRAM if paging is available
  396.  
  397. 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 );
  398.  
  399.  
  400. #endif
  401.  
  402. 
  403.