1 /* $Id: laser.h,v 1.3 2003-10-10 00:30:28 btb 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 * Definitions for the laser code.
20 * Revision 1.1 1995/05/16 15:58:43 allender
23 * Revision 2.0 1995/02/27 11:32:27 john
24 * New version 2.0, which has no anonymous unions, builds with
25 * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
27 * Revision 1.50 1995/02/01 21:03:44 john
30 * Revision 1.49 1995/02/01 16:34:11 john
33 * Revision 1.48 1995/01/31 16:16:16 mike
34 * Separate smart blobs for robot and player.
36 * Revision 1.47 1995/01/27 17:02:55 mike
37 * Add LASER_ID -- why wasn't this added in June?
39 * Revision 1.46 1995/01/25 10:53:27 mike
40 * make badass damage go through grates.
42 * Revision 1.45 1994/12/12 17:17:32 mike
43 * make boss cloak/teleport when get hit, make quad laser 3/4 as powerful.
45 * Revision 1.44 1994/12/04 16:17:23 mike
46 * spruce up homing missile behavior.
48 * Revision 1.43 1994/12/03 12:48:30 mike
49 * make homing missile tracking not frame rate dependent (more-or-less)
51 * Revision 1.42 1994/10/12 08:04:54 mike
52 * Clean up proximity/homing mess.
54 * Revision 1.41 1994/10/09 20:07:04 rob
55 * Change prototype for do_laser_firing
57 * Revision 1.40 1994/10/09 00:15:48 mike
58 * Add constants for super mech missile, regular mech missile, silent spreadfire.
60 * Revision 1.39 1994/10/08 19:52:09 rob
61 * Added new weapon fire flags.
63 * Revision 1.38 1994/10/07 15:31:12 mike
64 * Prototypes for new laser functions which don't necessarily make sound.
66 * Revision 1.37 1994/10/05 17:08:29 matt
67 * Fixed a couple of small bugs, and made homing missiles alternate sides
69 * Revision 1.36 1994/09/28 14:28:55 rob
70 * Added firing of missiles on networks/serial.
72 * Revision 1.35 1994/09/24 14:17:02 mike
73 * Prototype do_laser_firing.
75 * Revision 1.34 1994/09/23 11:36:49 mike
76 * Prototype Laser_create_new_easy.
78 * Revision 1.33 1994/09/20 11:55:01 mike
81 * Revision 1.32 1994/09/20 11:48:34 mike
82 * Change spreadfire laser to use new bitmap. (Define SPREADFIRE_ID)
84 * Revision 1.31 1994/09/15 16:31:28 mike
85 * Prototype object_to_object_visibility.
87 * Revision 1.30 1994/09/10 17:31:40 mike
88 * Add thrust to weapons.
90 * Revision 1.29 1994/09/08 14:49:44 mike
91 * Bunch of IDs for new weapon types.
93 * Revision 1.28 1994/09/07 19:16:40 mike
96 * Revision 1.27 1994/09/07 15:59:47 mike
97 * Kill FLARE_MAX_TIME (now defined in bitmaps.tbl), add PROXIMITY_ID (shame!), prototype do_laser_firing, do_missile_firing.
99 * Revision 1.26 1994/09/03 15:22:41 mike
100 * Kill Projectile_player_fire prototype.
102 * Revision 1.25 1994/09/02 16:39:00 mike
103 * IDs for primary weapons.
105 * Revision 1.24 1994/09/02 11:55:54 mike
106 * Define some illegal constants.
108 * Revision 1.23 1994/08/25 18:12:06 matt
109 * Made player's weapons and flares fire from the positions on the 3d model.
110 * Also added support for quad lasers.
112 * Revision 1.22 1994/08/19 15:22:28 mike
113 * Define constant for MAX_LASER_LEVEL.
115 * Revision 1.21 1994/08/13 12:20:47 john
116 * Made the networking uise the Players array.
118 * Revision 1.20 1994/08/10 10:44:05 john
119 * Made net players fire..
121 * Revision 1.19 1994/06/27 18:30:57 mike
124 * Revision 1.18 1994/06/09 15:32:37 mike
127 * Revision 1.17 1994/05/19 09:09:00 mike
128 * Move a bunch of laser variables to bm.h, I think.
129 * Also, added Robot_laser_speed, instead of hard-coding Laser_speed/4.
131 * Revision 1.16 1994/05/14 17:16:20 matt
132 * Got rid of externs in source (non-header) files
134 * Revision 1.15 1994/05/13 20:27:39 john
135 * Version II of John's new object code.
137 * Revision 1.14 1994/04/20 15:06:47 john
138 * Neatend laser code and fixed some laser bugs.
140 * Revision 1.13 1994/04/01 13:35:15 matt
141 * Cleaned up laser code a bit; moved some code here object.c to laser.c
143 * Revision 1.12 1994/04/01 11:14:24 yuan
144 * Added multiple bitmap functionality to all objects...
145 * (hostages, powerups, lasers, etc.)
146 * Hostages and powerups are implemented in the object system,
147 * just need to finish function call to "affect" player.
149 * Revision 1.11 1994/03/31 09:10:09 matt
150 * Added #define to turn crosshair off
152 * Revision 1.10 1994/02/17 11:33:15 matt
153 * Changes in object system
155 * Revision 1.9 1994/01/06 11:56:01 john
156 * Made lasers be lines, not purple blobs
158 * Revision 1.8 1994/01/05 10:53:35 john
159 * New object code by John.
161 * Revision 1.7 1993/12/08 14:21:36 john
162 * Added ExplodeObject
164 * Revision 1.6 1993/12/08 11:28:54 john
165 * Made lasers look like bolts.
167 * Revision 1.5 1993/12/01 13:12:40 john
168 * made lasers frame-rate independant
170 * Revision 1.4 1993/11/30 19:00:42 john
171 * lasers working kinda
173 * Revision 1.3 1993/11/29 19:44:53 john
174 * *** empty log message ***
176 * Revision 1.2 1993/11/29 17:44:55 john
177 * *** empty log message ***
179 * Revision 1.1 1993/11/29 17:19:19 john
188 #define LASER_ID 0 //0..3 are lasers
189 #define CONCUSSION_ID 8
190 #define FLARE_ID 9 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
191 #define VULCAN_ID 11 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
192 #define SPREADFIRE_ID 12 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
193 #define PLASMA_ID 13 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
194 #define FUSION_ID 14 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
196 #define PROXIMITY_ID 16
200 #define PLAYER_SMART_HOMING_ID 19
201 #define SUPER_MECH_MISS 21
202 #define REGULAR_MECH_MISS 22
203 #define SILENT_SPREADFIRE_ID 23
204 #define ROBOT_SMART_HOMING_ID 29
205 #define EARTHSHAKER_MEGA_ID 54
207 #define SUPER_LASER_ID 30 // 30,31 are super lasers (level 5,6)
209 #define GAUSS_ID 32 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
210 #define HELIX_ID 33 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
211 #define PHOENIX_ID 34 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
212 #define OMEGA_ID 35 // NOTE: This MUST correspond to the ID generated at bitmaps.tbl read time.
215 #define GUIDEDMISS_ID 37
216 #define SUPERPROX_ID 38
217 #define MERCURY_ID 39
218 #define EARTHSHAKER_ID 40
220 #define SMART_MINE_HOMING_ID 47
221 #define ROBOT_SMART_MINE_HOMING_ID 49
222 #define ROBOT_SUPERPROX_ID 53
223 #define ROBOT_EARTHSHAKER_ID 58
225 #define PMINE_ID 51 //the mine that the designers can place
227 #define OMEGA_MULTI_LIFELEFT (F1_0/6)
229 // These are new defines for the value of 'flags' passed to do_laser_firing.
230 // The purpose is to collect other flags like QUAD_LASER and Spreadfire_toggle
231 // into a single 8-bit quantity so it can be easily used in network mode.
234 #define LASER_SPREADFIRE_TOGGLED 2
235 #define LASER_HELIX_FLAG0 4 // helix uses 3 bits for angle
236 #define LASER_HELIX_FLAG1 8 // helix uses 3 bits for angle
237 #define LASER_HELIX_FLAG2 16 // helix uses 3 bits for angle
239 #define LASER_HELIX_SHIFT 2 // how far to shift count to put in flags
240 #define LASER_HELIX_MASK 7 // must match number of bits in flags
242 #define MAX_LASER_LEVEL 3 // Note, laser levels are numbered from 0.
243 #define MAX_SUPER_LASER_LEVEL 5 // Note, laser levels are numbered from 0.
245 #define MAX_LASER_BITMAPS 6
247 // For muzzle firing casting light.
248 #define MUZZLE_QUEUE_MAX 8
250 // Constants governing homing missile behavior.
251 // MIN_TRACKABLE_DOT gets inversely scaled by FrameTime and stuffed in
253 #define MIN_TRACKABLE_DOT (7*F1_0/8)
254 #define MAX_TRACKABLE_DIST (F1_0*250)
255 #define HOMING_MISSILE_STRAIGHT_TIME (F1_0/8) // Changed as per request of John, Adam, Yuan, but mostly John
257 extern fix Min_trackable_dot; // MIN_TRACKABLE_DOT inversely scaled by FrameTime
259 extern object *Guided_missile[];
260 extern int Guided_missile_sig[];
262 void Laser_render(object *obj);
263 void Laser_player_fire(object * obj, int type, int gun_num, int make_sound, int harmless_flag);
264 void Laser_player_fire_spread(object *obj, int laser_type, int gun_num, fix spreadr, fix spreadu, int make_sound, int harmless);
265 void Laser_do_weapon_sequence(object *obj);
266 void Flare_create(object *obj);
267 int laser_are_related(int o1, int o2);
269 extern int do_laser_firing_player(void);
270 extern void do_missile_firing(int do_autoselect);
271 extern void net_missile_firing(int player, int weapon, int flags);
273 int Laser_create_new(vms_vector * direction, vms_vector * position, int segnum, int parent, int type, int make_sound);
275 // Fires a laser-type weapon (a Primary weapon)
276 // Fires from object objnum, weapon type weapon_id.
277 // Assumes that it is firing from a player object, so it knows which
279 // Returns the number of shots actually fired, which will typically be
280 // 1, but could be higher for low frame rates when rapidfire weapons,
281 // such as vulcan or plasma are fired.
282 extern int do_laser_firing(int objnum, int weapon_id, int level, int flags, int nfires);
284 // Easier to call than Laser_create_new because it determines the
285 // segment containing the firing point and deals with it being stuck
286 // in an object or through a wall.
287 // Fires a laser of type "weapon_type" from an object (parent) in the
288 // direction "direction" from the position "position"
289 // Returns object number of laser fired or -1 if not possible to fire
291 int Laser_create_new_easy(vms_vector * direction, vms_vector * position, int parent, int weapon_type, int make_sound);
293 // creates a weapon object
294 int create_weapon_object(int weapon_type,int segnum,vms_vector *position);
296 // give up control of the guided missile
297 void release_guided_missile(int player_num);
299 extern void create_smart_children(object *objp, int count);
300 extern int object_to_object_visibility(object *obj1, object *obj2, int trans_type);
302 extern int Muzzle_queue_index;
304 typedef struct muzzle_info {
310 extern muzzle_info Muzzle_data[MUZZLE_QUEUE_MAX];
312 // Omega cannon stuff.
313 #define MAX_OMEGA_CHARGE (F1_0) // Maximum charge level for omega cannonw
314 extern fix Omega_charge;
315 // NOTE: OMEGA_CHARGE_SCALE moved to laser.c to avoid long rebuilds if changed
317 #endif /* _LASER_H */