]> icculus.org git repositories - btb/d2x.git/blob - main/bm.h
fix level number position
[btb/d2x.git] / main / bm.h
1 /* $Id: bm.h,v 1.12 2003-10-10 21:04:43 btb Exp $ */
2 /*
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.
13 */
14
15 /*
16  *
17  * Bitmap and Palette loading functions.
18  *
19  * Old Log:
20  * Revision 1.1  1995/05/16  15:54:39  allender
21  * Initial revision
22  *
23  * Revision 2.0  1995/02/27  11:32:59  john
24  * New version 2.0, which has no anonymous unions, builds with
25  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
26  *
27  * Revision 1.60  1994/12/06  13:24:58  matt
28  * Made exit model come out of bitmaps.tbl
29  *
30  * Revision 1.59  1994/11/10  14:02:48  matt
31  * Hacked in support for player ships with different textures
32  *
33  * Revision 1.58  1994/10/27  13:32:17  john
34  * Made TmapList only be in if editor
35  *
36  * Revision 1.57  1994/10/11  12:25:20  matt
37  * Added "hot rocks" that create badass explosion when hit by weapons
38  *
39  * Revision 1.56  1994/09/29  12:38:13  matt
40  * Took out include of digi.h, saving hours of unneeded compiles
41  *
42  * Revision 1.55  1994/09/25  00:39:51  matt
43  * Added the ability to make eclips (monitors, fans) which can be blown up
44  *
45  * Revision 1.54  1994/09/17  01:40:59  matt
46  * Added status bar/sizable window mode, and in the process revamped the
47  * whole cockpit mode system.
48  *
49  * Revision 1.53  1994/09/08  16:20:48  matt
50  * Gave textures the ability to cause damage when scraped
51  *
52  * Revision 1.52  1994/08/30  22:23:43  matt
53  * Added cabability for player ship to have alternate model to use to
54  * create debris.
55  *
56  * Revision 1.51  1994/08/26  15:35:57  matt
57  * Made eclips usable on more than one object at a time
58  *
59  * Revision 1.50  1994/08/23  16:59:51  john
60  * Added 3 cockpuits
61  *
62  * Revision 1.49  1994/08/19  20:09:43  matt
63  * Added end-of-level cut scene with external scene
64  *
65  * Revision 1.48  1994/08/12  22:20:45  matt
66  * Generalized polygon objects (such as control center)
67  *
68  * Revision 1.47  1994/08/09  16:04:21  john
69  * Added network players to editor.
70  *
71  * Revision 1.46  1994/08/09  09:01:31  john
72  * Increase MAX_TEXTURES
73  *
74  * Revision 1.45  1994/07/13  00:14:57  matt
75  * Moved all (or nearly all) of the values that affect player movement to
76  * bitmaps.tbl
77  *
78  * Revision 1.44  1994/06/20  21:33:15  matt
79  * Made bm.h not include sounds.h, to reduce dependencies
80  *
81  * Revision 1.43  1994/06/15  11:55:58  matt
82  * Added 3d model for player
83  *
84  * Revision 1.42  1994/06/13  16:09:11  adam
85  * increased max textures to 600
86  *
87  * Revision 1.41  1994/06/06  15:38:58  john
88  * Made fullscreen view be just another cockpit, but the "hole"
89  * in the cockpit is just bigger.
90  *
91  * Revision 1.40  1994/05/26  21:08:59  matt
92  * Moved robot stuff out of polygon model and into robot_info struct
93  * Made new file, robot.c, to deal with robots
94  *
95  * Revision 1.39  1994/05/18  11:00:05  mike
96  * Add robot_info stuff.
97  *
98  * Revision 1.38  1994/05/17  14:44:56  mike
99  * Get object type and id from ObjType and ObjId.
100  *
101  * Revision 1.37  1994/05/17  12:04:45  mike
102  * Deal with little known fact that polygon object != robot.
103  *
104  * Revision 1.36  1994/05/16  16:17:35  john
105  * Bunch of stuff on my Inferno Task list May16-23
106  *
107  * Revision 1.35  1994/04/27  11:43:42  john
108  * First version of sound! Yay!
109  *
110  * Revision 1.34  1994/04/22  10:53:48  john
111  * Increased MAX_TEXTURES to 500.
112  *
113  * Revision 1.33  1994/04/01  11:15:05  yuan
114  * Added multiple bitmap functionality to all objects...
115  * (hostages, powerups, lasers, etc.)
116  * Hostages and powerups are implemented in the object system,
117  * just need to finish function call to "affect" player.
118  *
119  * Revision 1.32  1994/03/25  17:30:37  yuan
120  * Checking in hostage stuff.
121  *
122  * Revision 1.31  1994/03/17  18:07:28  yuan
123  * Removed switch code... Now we just have Walls, Triggers, and Links...
124  *
125  * Revision 1.30  1994/03/15  17:03:51  yuan
126  * Added Robot/object bitmap capability
127  *
128  * Revision 1.29  1994/03/15  16:32:58  yuan
129  * Cleaned up bm-loading code.
130  * (Fixed structures too)
131  *
132  * Revision 1.28  1994/03/04  17:09:13  yuan
133  * New door stuff.
134  *
135  * Revision 1.27  1994/01/31  14:50:09  yuan
136  * Added Robotex
137  *
138  * Revision 1.26  1994/01/31  12:27:14  yuan
139  * Added demo stuff (menu, etc.)
140  *
141  * Revision 1.25  1994/01/25  17:11:43  john
142  * New texmaped lasers.
143  *
144  * Revision 1.24  1994/01/24  11:48:06  yuan
145  * Lighting stuff
146  *
147  * Revision 1.23  1994/01/22  13:40:15  yuan
148  * Modified the bmd_bitmap structure a bit.
149  * (Saves some memory, and added reflection)
150  *
151  * Revision 1.22  1994/01/11  10:58:38  yuan
152  * Added effects system
153  *
154  * Revision 1.21  1994/01/06  17:13:12  john
155  * Added Video clip functionality
156  *
157  * Revision 1.20  1993/12/21  20:00:15  john
158  * moved selector stuff to grs_bitmap
159  *
160  * Revision 1.19  1993/12/21  19:33:58  john
161  * Added selector to bmd_bitmap.
162  *
163  * Revision 1.18  1993/12/07  12:28:48  john
164  * moved bmd_palette to gr_palette
165  *
166  * Revision 1.17  1993/12/06  18:40:37  matt
167  * Changed object loading & handling
168  *
169  * Revision 1.16  1993/12/05  23:05:03  matt
170  * Added include of gr.h
171  *
172  * Revision 1.15  1993/12/03  17:38:04  yuan
173  * Ooops. meant to say:
174  * Moved MAX variables to bm.c, Arrays left open.
175  *
176  * Revision 1.14  1993/12/03  17:37:26  yuan
177  * Added Asserts.
178  *
179  * Revision 1.13  1993/12/02  17:22:54  yuan
180  * New global var. Num_object_types
181  *
182  * Revision 1.12  1993/12/02  16:34:39  yuan
183  * Added fireball hack stuff.
184  *
185  * Revision 1.11  1993/12/02  15:45:14  yuan
186  * Added a buncha constants, variables, and function prototypes
187  * for the new bitmaps.tbl format.
188  *
189  * Revision 1.10  1993/12/01  11:25:11  yuan
190  * Changed MALLOC'd buffers for filename and type in
191  * the bmd_bitmap structure into arrays... Saves time
192  * at load up.
193  *
194  * Revision 1.9  1993/12/01  00:28:09  yuan
195  * New bitmap system structure.
196  *
197  * Revision 1.8  1993/11/03  11:34:08  john
198  * made it use bitmaps.tbl
199  *
200  * Revision 1.7  1993/10/26  18:11:03  john
201  * made all palette data be statically allocated
202  *
203  * Revision 1.6  1993/10/19  12:17:51  john
204  * *** empty log message ***
205  *
206  * Revision 1.5  1993/10/16  20:02:41  matt
207  * Changed name of backdrop bitmap file
208  *
209  * Revision 1.4  1993/10/12  15:08:52  matt
210  * Added a bunch of new textures
211  *
212  * Revision 1.3  1993/10/12  12:30:41  john
213  * *** empty log message ***
214  *
215  * Revision 1.2  1993/10/12  11:27:58  john
216  * added more bitmaps
217  *
218  * Revision 1.1  1993/09/23  13:09:10  john
219  * Initial revision
220  *
221  *
222  */
223
224 #ifndef _BM_H
225 #define _BM_H
226
227 #include "gr.h"
228 #include "piggy.h"
229
230 #define MAX_TEXTURES    1200
231
232 //tmapinfo flags
233 #define TMI_VOLATILE    1   //this material blows up when hit
234 #define TMI_WATER       2   //this material is water
235 #define TMI_FORCE_FIELD 4   //this is force field - flares don't stick
236 #define TMI_GOAL_BLUE   8   //this is used to remap the blue goal
237 #define TMI_GOAL_RED    16  //this is used to remap the red goal
238 #define TMI_GOAL_HOARD  32  //this is used to remap the goals
239
240 typedef struct {
241         ubyte   flags;     //values defined above
242         ubyte   pad[3];    //keep alignment
243         fix     lighting;  //how much light this casts
244         fix     damage;    //how much damage being against this does (for lava)
245         short   eclip_num; //the eclip that changes this, or -1
246         short   destroyed; //bitmap to show when destroyed, or -1
247         short   slide_u,slide_v;    //slide rates of texture, stored in 8:8 fix
248         #ifdef EDITOR
249         char    filename[13];       //used by editor to remap textures
250         char    pad2[3];
251         #endif
252 } __pack__ tmap_info;
253
254 extern int Num_object_types;
255
256 #define N_COCKPIT_BITMAPS 6
257 extern int Num_cockpits;
258 extern bitmap_index cockpit_bitmap[N_COCKPIT_BITMAPS];
259
260 extern int Num_tmaps;
261 #ifdef EDITOR
262 extern int TmapList[MAX_TEXTURES];
263 #endif
264
265 extern tmap_info TmapInfo[MAX_TEXTURES];
266
267 //for each model, a model number for dying & dead variants, or -1 if none
268 extern int Dying_modelnums[];
269 extern int Dead_modelnums[];
270
271 //the model number of the marker object
272 extern int Marker_model_num;
273
274 // Initializes the palette, bitmap system...
275 int bm_init();
276 void bm_close();
277
278 // Initializes the Texture[] array of bmd_bitmap structures.
279 void init_textures();
280
281 #define OL_ROBOT            1
282 #define OL_HOSTAGE          2
283 #define OL_POWERUP          3
284 #define OL_CONTROL_CENTER   4
285 #define OL_PLAYER           5
286 #define OL_CLUTTER          6   //some sort of misc object
287 #define OL_EXIT             7   //the exit model for external scenes
288 #define OL_WEAPON           8   //a weapon that can be placed
289
290 #define MAX_OBJTYPE         140
291
292 extern int  Num_total_object_types;     // Total number of object types, including robots, hostages, powerups, control centers, faces
293 extern sbyte ObjType[MAX_OBJTYPE];      // Type of an object, such as Robot, eg if ObjType[11] == OL_ROBOT, then object #11 is a robot
294 extern sbyte ObjId[MAX_OBJTYPE];        // ID of a robot, within its class, eg if ObjType[11] == 3, then object #11 is the third robot
295 extern fix  ObjStrength[MAX_OBJTYPE];   // initial strength of each object
296
297 #define MAX_OBJ_BITMAPS     610
298
299 extern bitmap_index ObjBitmaps[MAX_OBJ_BITMAPS];
300 extern ushort ObjBitmapPtrs[MAX_OBJ_BITMAPS];
301 extern int First_multi_bitmap_num;
302
303 // Initializes all bitmaps from BITMAPS.TBL file.
304 int bm_init_use_tbl(void);
305
306 extern void bm_read_all(CFILE * fp);
307
308 int load_exit_models();
309
310 #endif /* _BM_H */