]> icculus.org git repositories - divverent/darkplaces.git/blob - quakedef.h
Major speedup to model loading, using lightnormalindex table now.
[divverent/darkplaces.git] / quakedef.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19 */
20 // quakedef.h -- primary header for client
21
22 //#define       GLTEST                  // experimental stuff
23
24 #define QUAKE_GAME                      // as opposed to utilities
25
26 #define DP_VERSION                      1.05
27 #define VERSION                         1.09
28 #define GLQUAKE_VERSION         1.00
29 #define D3DQUAKE_VERSION        0.01
30 #define WINQUAKE_VERSION        0.996
31 #define LINUX_VERSION           1.30
32 #define X11_VERSION                     1.10
33
34 //define        PARANOID                        // speed sapping error checking
35
36 #define GAMENAME        "id1"
37
38 #include <math.h>
39 #include <string.h>
40 #include <stdarg.h>
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <setjmp.h>
44
45 #define id386   0
46
47
48 #if defined(_WIN32) && !defined(WINDED)
49
50 //#if defined(_M_IX86)
51 //#define __i386__      1
52 //#endif
53
54 void    VID_LockBuffer (void);
55 void    VID_UnlockBuffer (void);
56
57 #else
58
59 #define VID_LockBuffer()
60 #define VID_UnlockBuffer()
61
62 #endif
63
64 //#if defined __i386__ // && !defined __sun__
65 //#define id386 1
66 //#else
67 //#define id386 0
68 //#endif
69
70 #if id386
71 #define UNALIGNED_OK    1       // set to 0 if unaligned accesses are not supported
72 #else
73 #define UNALIGNED_OK    0
74 #endif
75
76 // !!! if this is changed, it must be changed in d_ifacea.h too !!!
77 #define CACHE_SIZE      32              // used to align key data structures
78
79 #define UNUSED(x)       (x = x) // for pesky compiler / lint warnings
80
81 #define MINIMUM_MEMORY                  0x550000
82 #define MINIMUM_MEMORY_LEVELPAK (MINIMUM_MEMORY + 0x100000)
83
84 #define MAX_NUM_ARGVS   50
85
86 // up / down
87 #define PITCH   0
88
89 // left / right
90 #define YAW             1
91
92 // fall over
93 #define ROLL    2
94
95
96 #define MAX_QPATH               64                      // max length of a quake game pathname
97 #define MAX_OSPATH              128                     // max length of a filesystem pathname
98
99 #define ON_EPSILON              0.1                     // point on plane side epsilon
100
101 // LordHavoc: these were 8000 and 1024 respectively, now 64000 and 8000
102 #define MAX_MSGLEN              64000           // max length of a reliable message
103 #define MAX_DATAGRAM    8000            // max length of unreliable message
104
105 //
106 // per-level limits
107 //
108 // LordHavoc: increased entity limit to 2048 from 600
109 #define MAX_EDICTS              2048            // FIXME: ouch! ouch! ouch!
110 #define MAX_LIGHTSTYLES 64
111 #define MAX_MODELS              256                     // these are sent over the net as bytes
112 #define MAX_SOUNDS              256                     // so they cannot be blindly increased
113
114 #define SAVEGAME_COMMENT_LENGTH 39
115
116 #define MAX_STYLESTRING 64
117
118 //
119 // stats are integers communicated to the client by the server
120 //
121 #define MAX_CL_STATS            32
122 #define STAT_HEALTH                     0
123 #define STAT_FRAGS                      1
124 #define STAT_WEAPON                     2
125 #define STAT_AMMO                       3
126 #define STAT_ARMOR                      4
127 #define STAT_WEAPONFRAME        5
128 #define STAT_SHELLS                     6
129 #define STAT_NAILS                      7
130 #define STAT_ROCKETS            8
131 #define STAT_CELLS                      9
132 #define STAT_ACTIVEWEAPON       10
133 #define STAT_TOTALSECRETS       11
134 #define STAT_TOTALMONSTERS      12
135 #define STAT_SECRETS            13              // bumped on client side by svc_foundsecret
136 #define STAT_MONSTERS           14              // bumped by svc_killedmonster
137
138 // stock defines
139
140 #define IT_SHOTGUN                              1
141 #define IT_SUPER_SHOTGUN                2
142 #define IT_NAILGUN                              4
143 #define IT_SUPER_NAILGUN                8
144 #define IT_GRENADE_LAUNCHER             16
145 #define IT_ROCKET_LAUNCHER              32
146 #define IT_LIGHTNING                    64
147 #define IT_SUPER_LIGHTNING      128
148 #define IT_SHELLS               256
149 #define IT_NAILS                512
150 #define IT_ROCKETS              1024
151 #define IT_CELLS                2048
152 #define IT_AXE                  4096
153 #define IT_ARMOR1               8192
154 #define IT_ARMOR2               16384
155 #define IT_ARMOR3               32768
156 #define IT_SUPERHEALTH          65536
157 #define IT_KEY1                 131072
158 #define IT_KEY2                 262144
159 #define IT_INVISIBILITY                 524288
160 #define IT_INVULNERABILITY              1048576
161 #define IT_SUIT                                 2097152
162 #define IT_QUAD                                 4194304
163 #define IT_SIGIL1               (1<<28)
164 #define IT_SIGIL2               (1<<29)
165 #define IT_SIGIL3               (1<<30)
166 #define IT_SIGIL4               (1<<31)
167
168 //===========================================
169 //rogue changed and added defines
170
171 #define RIT_SHELLS              128
172 #define RIT_NAILS               256
173 #define RIT_ROCKETS             512
174 #define RIT_CELLS               1024
175 #define RIT_AXE                 2048
176 #define RIT_LAVA_NAILGUN        4096
177 #define RIT_LAVA_SUPER_NAILGUN  8192
178 #define RIT_MULTI_GRENADE       16384
179 #define RIT_MULTI_ROCKET        32768
180 #define RIT_PLASMA_GUN          65536
181 #define RIT_ARMOR1              8388608
182 #define RIT_ARMOR2              16777216
183 #define RIT_ARMOR3              33554432
184 #define RIT_LAVA_NAILS          67108864
185 #define RIT_PLASMA_AMMO         134217728
186 #define RIT_MULTI_ROCKETS       268435456
187 #define RIT_SHIELD              536870912
188 #define RIT_ANTIGRAV            1073741824
189 #define RIT_SUPERHEALTH         2147483648
190
191 //MED 01/04/97 added hipnotic defines
192 //===========================================
193 //hipnotic added defines
194 #define HIT_PROXIMITY_GUN_BIT 16
195 #define HIT_MJOLNIR_BIT       7
196 #define HIT_LASER_CANNON_BIT  23
197 #define HIT_PROXIMITY_GUN   (1<<HIT_PROXIMITY_GUN_BIT)
198 #define HIT_MJOLNIR         (1<<HIT_MJOLNIR_BIT)
199 #define HIT_LASER_CANNON    (1<<HIT_LASER_CANNON_BIT)
200 #define HIT_WETSUIT         (1<<(23+2))
201 #define HIT_EMPATHY_SHIELDS (1<<(23+3))
202
203 //===========================================
204
205 // LordHavoc: increased player limit from 16 to 64
206 #define MAX_SCOREBOARD          64
207 #define MAX_SCOREBOARDNAME      32
208
209 #define SOUND_CHANNELS          8
210
211 // This makes anyone on id's net privileged
212 // Use for multiplayer testing only - VERY dangerous!!!
213 // #define IDGODS
214
215 #include "common.h"
216 #include "bspfile.h"
217 #include "vid.h"
218 #include "sys.h"
219 #include "zone.h"
220 #include "mathlib.h"
221
222 // LordHavoc: made this more compact, and added some more fields
223 typedef struct
224 {
225         vec3_t  origin;
226         vec3_t  angles;
227         int             effects;
228         short   modelindex;
229         short   frame;
230         byte    colormap;
231         byte    skin;
232         byte    alpha;
233         byte    scale;
234         byte    glowsize;
235         byte    glowcolor;
236         byte    colormod;
237 } entity_state_t;
238
239
240 #include "wad.h"
241 #include "draw.h"
242 #include "cvar.h"
243 #include "screen.h"
244 #include "net.h"
245 #include "protocol.h"
246 #include "cmd.h"
247 #include "sbar.h"
248 #include "sound.h"
249 #include "render.h"
250 #include "client.h"
251 #include "progs.h"
252 #include "server.h"
253
254 #include "model_shared.h"
255
256 #include "input.h"
257 #include "world.h"
258 #include "keys.h"
259 #include "console.h"
260 #include "view.h"
261 #include "menu.h"
262 #include "crc.h"
263 #include "cdaudio.h"
264
265 #include "glquake.h"
266
267 //=============================================================================
268
269 // the host system specifies the base of the directory tree, the
270 // command line parms passed to the program, and the amount of memory
271 // available for the program to use
272
273 typedef struct
274 {
275         char    *basedir;
276         char    *cachedir;              // for development over ISDN lines
277         int             argc;
278         char    **argv;
279         void    *membase;
280         int             memsize;
281 } quakeparms_t;
282
283
284 //=============================================================================
285
286
287
288 extern qboolean noclip_anglehack;
289
290
291 //
292 // host
293 //
294 extern  quakeparms_t host_parms;
295
296 extern  cvar_t          sys_ticrate;
297 extern  cvar_t          sys_nostdout;
298 extern  cvar_t          developer;
299
300 extern  qboolean        host_initialized;               // true if into command execution
301 extern  double          host_frametime;
302 extern  byte            *host_basepal;
303 extern  byte            *host_colormap;
304 extern  int                     host_framecount;        // incremented every frame, never reset
305 extern  double          realtime;                       // not bounded in any way, changed at
306                                                                                 // start of every frame, never reset
307
308 void Host_ClearMemory (void);
309 void Host_ServerFrame (void);
310 void Host_InitCommands (void);
311 void Host_Init (quakeparms_t *parms);
312 void Host_Shutdown(void);
313 void Host_Error (char *error, ...);
314 void Host_EndGame (char *message, ...);
315 void Host_Frame (float time);
316 void Host_Quit_f (void);
317 void Host_ClientCommands (char *fmt, ...);
318 void Host_ShutdownServer (qboolean crash);
319
320 extern qboolean         msg_suppress_1;         // suppresses resolution and cache size console output
321                                                                                 //  an fullscreen DIB focus gain/loss
322 extern int                      current_skill;          // skill level for currently loaded level (in case
323                                                                                 //  the user changes the cvar while the level is
324                                                                                 //  running, this reflects the level actually in use)
325
326 extern qboolean         isDedicated;
327
328 extern int                      minimum_memory;
329
330 //
331 // chase
332 //
333 extern  cvar_t  chase_active;
334
335 void Chase_Init (void);
336 void Chase_Reset (void);
337 void Chase_Update (void);