1 /* $Id: game.h,v 1.9 2004-08-28 23:17:45 schaffner Exp $ */
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
17 * Constants & prototypes which pertain to the game only
29 //#include "segment.h"
32 extern ubyte Scanline_double;
36 typedef struct cockpit_span_line {
43 extern cockpit_span_line win_cockpit_mask[480];
48 extern fix FrameTime; // time in seconds since last frame
49 extern fix RealFrameTime; // time in seconds since last frame
50 extern fix GameTime; // time in game (sum of FrameTime)
51 extern int FrameCount; // how many frames rendered
52 extern fix Next_laser_fire_time; // Time at which player can next fire his selected laser.
53 extern fix Last_laser_fired_time;
54 extern fix Next_missile_fire_time; // Time at which player can next fire his selected missile.
55 extern fix Laser_delay_time; // Delay between laser fires.
56 extern int Cheats_enabled;
58 extern int Missile_view_enabled;
60 extern object *Missile_viewer;
68 extern int Cockpit_3d_view[2]; // left & right
69 extern int Coop_view_player[2]; // left & right
70 extern int Marker_viewer_num[2]; // left & right
72 // constants for ft_preference
75 #define FP_FORWARD 2 // this is the default
78 #define FP_FIRST_TIME 5
80 extern int ft_preference;
82 // The following bits define the game modes.
83 #define GM_EDITOR 1 // You came into the game from the editor
84 #define GM_SERIAL 2 // You are in serial mode
85 #define GM_NETWORK 4 // You are in network mode
86 #define GM_MULTI_ROBOTS 8 // You are in a multiplayer mode with robots.
87 #define GM_MULTI_COOP 16 // You are in a multiplayer mode and can't hurt other players.
88 #define GM_MODEM 32 // You are in a modem (serial) game
90 #define GM_UNKNOWN 64 // You are not in any mode, kind of dangerous...
91 #define GM_GAME_OVER 128 // Game has been finished
93 #define GM_TEAM 256 // Team mode for network play
94 #define GM_CAPTURE 512 // Capture the flag mode for D2
95 #define GM_HOARD 1024 // New hoard mode for D2 Christmas
97 #define GM_NORMAL 0 // You are in normal play mode, no multiplayer stuff
98 #define GM_MULTI 38 // You are in some type of multiplayer game
101 // Deathmatch mode on a network is GM_NETWORK
102 // Deathmatch mode via modem with robots is GM_MODEM | GM_MULTI_ROBOTS
103 // Cooperative mode via serial link is GM_SERIAL | GM_MULTI_COOP
105 #define NDL 5 // Number of difficulty levels.
106 #define NUM_DETAIL_LEVELS 6
108 extern int Game_mode;
109 //added 3/24/99 by Owen Evans
110 extern u_int32_t Game_screen_mode;
113 extern int Game_paused;
114 extern int gauge_message_on;
116 #ifndef NDEBUG // if debugging, these are variables
118 extern int Slew_on; // in slew or sim mode?
119 extern int Game_double_buffer; // double buffering?
122 #else // if not debugging, these are constants
124 #define Slew_on 0 // no slewing in real game
125 #define Game_double_buffer 1 // always double buffer in real game
131 #define Scanline_double 0 // PC doesn't do scanline doubling
135 extern ubyte Scanline_double; // but the Macintosh does
141 #define SUSP_NONE 0 // Everything moving normally
142 #define SUSP_ROBOTS 1 // Robot AI doesn't move
143 #define SUSP_WEAPONS 2 // Lasers, etc. don't move
145 extern int Game_suspended; // if non-zero, nothing moves but player
148 void init_game(void);
150 void close_game(void);
151 void init_cockpit(void);
152 void calc_frame_time(void);
154 int do_flythrough(object *obj,int first_time);
156 extern jmp_buf LeaveGame; // Do a long jump to this when game is over.
157 extern int Difficulty_level; // Difficulty level in 0..NDL-1, 0 = easiest, NDL-1 = hardest
158 extern int Detail_level; // Detail level in 0..NUM_DETAIL_LEVELS-1, 0 = boringest, NUM_DETAIL_LEVELS = coolest
159 extern int Global_laser_firing_count;
160 extern int Global_missile_firing_count;
161 extern int Render_depth;
162 extern fix Auto_fire_fusion_cannon_time, Fusion_charge;
164 extern int PaletteRedAdd, PaletteGreenAdd, PaletteBlueAdd;
166 #define MAX_PALETTE_ADD 30
168 extern void PALETTE_FLASH_ADD(int dr, int dg, int db);
170 //sets the rgb values for palette flash
171 #define PALETTE_FLASH_SET(_r,_g,_b) PaletteRedAdd=(_r), PaletteGreenAdd=(_g), PaletteBlueAdd=(_b)
173 extern int draw_gauges_on;
175 extern void init_game_screen(void);
177 extern void game_flush_inputs(); // clear all inputs
179 extern int Playing_game; // True if playing game
180 extern int Auto_flythrough; // if set, start flythough automatically
181 extern int Mark_count; // number of debugging marks set
182 extern char faded_in;
184 extern void stop_time(void);
185 extern void start_time(void);
186 extern void reset_time(void); // called when starting level
188 // If automap_flag == 1, then call automap routine to write message.
189 extern void save_screen_shot(int automap_flag);
192 extern grs_canvas * get_current_game_screen();
195 //valid modes for cockpit
196 #define CM_FULL_COCKPIT 0 // normal screen with cockput
197 #define CM_REAR_VIEW 1 // looking back with bitmap
198 #define CM_STATUS_BAR 2 // small status bar, w/ reticle
199 #define CM_FULL_SCREEN 3 // full screen, no cockpit (w/ reticle)
200 #define CM_LETTERBOX 4 // half-height window (for cutscenes)
202 extern int Cockpit_mode; // what sort of cockpit or window is up?
203 extern int Game_window_w, // width and height of player's game window
206 extern int Rear_view; // if true, looking back.
207 extern fix Rear_view_leave_time;// how long until we decide key is down
210 void fly_init(object *obj);
212 // selects a given cockpit (or lack of one).
213 void select_cockpit(int mode);
215 // force cockpit redraw next time. call this if you've trashed the screen
216 void reset_cockpit(void); // called if you've trashed the screen
218 // functions to save, clear, and resture palette flash effects
219 void palette_save(void);
220 void reset_palette_add(void);
221 void palette_restore(void);
223 // put up the help message
226 // show a message in a nice little box
227 void show_boxed_message(char *msg);
229 // erases message drawn with show_boxed_message()
230 void clear_boxed_message();
232 // turns off rear view & rear view cockpit
233 void reset_rear_view(void);
235 extern int Game_turbo_mode;
237 // returns ptr to escort robot, or NULL
238 object *find_escort();
240 extern void apply_modified_palette(void);
242 //Flickering light system
244 short segnum, sidenum;
245 unsigned long mask; // determines flicker pattern
246 fix timer; // time until next change
247 fix delay; // time between changes
250 #define MAX_FLICKERING_LIGHTS 100
252 extern flickering_light Flickering_lights[MAX_FLICKERING_LIGHTS];
253 extern int Num_flickering_lights;
255 // returns ptr to flickering light structure, or NULL if can't find
256 flickering_light *find_flicker(int segnum, int sidenum);
258 // turn flickering off (because light has been turned off)
259 void disable_flicker(int segnum, int sidenum);
261 // turn flickering off (because light has been turned on)
262 void enable_flicker(int segnum, int sidenum);
264 // returns 1 if ok, 0 if error
265 int add_flicker(int segnum, int sidenum, fix delay, unsigned long mask);
267 int gr_toggle_fullscreen_game(void);
270 * reads a flickering_light structure from a CFILE
272 void flickering_light_read(flickering_light *fl, CFILE *fp);