]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - quakedef.h
dbaf99cc4a82c37d1513a31ca2a1d54bb0612ad9
[xonotic/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 QUAKE_GAME // as opposed to utilities
23
24 #include <math.h>
25 #include <string.h>
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <setjmp.h>
30
31 extern char *buildstring;
32
33 typedef unsigned char qbyte;
34
35 #undef true
36 #undef false
37
38 typedef enum {false, true} qboolean;
39
40 #ifndef NULL
41 #define NULL ((void *)0)
42 #endif
43
44 #ifndef FALSE
45 #define FALSE 0
46 #define TRUE 1
47 #endif
48
49 //define        PARANOID                        // speed sapping error checking
50 #ifdef _DEBUG
51 #define ASSERT(condition) if (!(condition)) Sys_Error("assertion (##condition) failed at " __FILE__ ":" __LINE__ "\n");
52 #else
53 #define ASSERT(condition)
54 #endif
55
56 #define GAMENAME "id1"
57
58 #define MAX_NUM_ARGVS   50
59
60 // up / down
61 #define PITCH   0
62
63 // left / right
64 #define YAW             1
65
66 // fall over
67 #define ROLL    2
68
69
70 #define MAX_QPATH               128                     // max length of a quake game pathname
71 #define MAX_OSPATH              1024            // max length of a filesystem pathname
72
73 #define ON_EPSILON              0.1                     // point on plane side epsilon
74
75 // LordHavoc: these were 8000 and 1024 respectively, now 64000 and 8000
76 #define MAX_MSGLEN              64000           // max length of a reliable message
77 #define MAX_DATAGRAM    8000            // max length of unreliable message
78
79 //
80 // per-level limits
81 //
82 // LordHavoc: increased entity limit to 2048 from 600
83 #define MAX_EDICTS              2048            // FIXME: ouch! ouch! ouch!
84 #define MAX_LIGHTSTYLES 64
85 // LordHavoc: increased model and sound limits from 256 and 256 to 1024 and 1024 (and added protocol extensions accordingly)
86 #define MAX_MODELS              1024                    // these are sent over the net as bytes
87 #define MAX_SOUNDS              1024                    // so they cannot be blindly increased
88
89 #define SAVEGAME_COMMENT_LENGTH 39
90
91 #define MAX_STYLESTRING 64
92
93 //
94 // stats are integers communicated to the client by the server
95 //
96 #define MAX_CL_STATS            32
97 #define STAT_HEALTH                     0
98 #define STAT_FRAGS                      1
99 #define STAT_WEAPON                     2
100 #define STAT_AMMO                       3
101 #define STAT_ARMOR                      4
102 #define STAT_WEAPONFRAME        5
103 #define STAT_SHELLS                     6
104 #define STAT_NAILS                      7
105 #define STAT_ROCKETS            8
106 #define STAT_CELLS                      9
107 #define STAT_ACTIVEWEAPON       10
108 #define STAT_TOTALSECRETS       11
109 #define STAT_TOTALMONSTERS      12
110 #define STAT_SECRETS            13              // bumped on client side by svc_foundsecret
111 #define STAT_MONSTERS           14              // bumped by svc_killedmonster
112
113 // stock defines
114
115 #define IT_SHOTGUN                              1
116 #define IT_SUPER_SHOTGUN                2
117 #define IT_NAILGUN                              4
118 #define IT_SUPER_NAILGUN                8
119 #define IT_GRENADE_LAUNCHER             16
120 #define IT_ROCKET_LAUNCHER              32
121 #define IT_LIGHTNING                    64
122 #define IT_SUPER_LIGHTNING      128
123 #define IT_SHELLS               256
124 #define IT_NAILS                512
125 #define IT_ROCKETS              1024
126 #define IT_CELLS                2048
127 #define IT_AXE                  4096
128 #define IT_ARMOR1               8192
129 #define IT_ARMOR2               16384
130 #define IT_ARMOR3               32768
131 #define IT_SUPERHEALTH          65536
132 #define IT_KEY1                 131072
133 #define IT_KEY2                 262144
134 #define IT_INVISIBILITY                 524288
135 #define IT_INVULNERABILITY              1048576
136 #define IT_SUIT                                 2097152
137 #define IT_QUAD                                 4194304
138 #define IT_SIGIL1               (1<<28)
139 #define IT_SIGIL2               (1<<29)
140 #define IT_SIGIL3               (1<<30)
141 #define IT_SIGIL4               (1<<31)
142
143 //===========================================
144 //rogue changed and added defines
145
146 #define RIT_SHELLS              128
147 #define RIT_NAILS               256
148 #define RIT_ROCKETS             512
149 #define RIT_CELLS               1024
150 #define RIT_AXE                 2048
151 #define RIT_LAVA_NAILGUN        4096
152 #define RIT_LAVA_SUPER_NAILGUN  8192
153 #define RIT_MULTI_GRENADE       16384
154 #define RIT_MULTI_ROCKET        32768
155 #define RIT_PLASMA_GUN          65536
156 #define RIT_ARMOR1              8388608
157 #define RIT_ARMOR2              16777216
158 #define RIT_ARMOR3              33554432
159 #define RIT_LAVA_NAILS          67108864
160 #define RIT_PLASMA_AMMO         134217728
161 #define RIT_MULTI_ROCKETS       268435456
162 #define RIT_SHIELD              536870912
163 #define RIT_ANTIGRAV            1073741824
164 #define RIT_SUPERHEALTH         2147483648
165
166 //MED 01/04/97 added hipnotic defines
167 //===========================================
168 //hipnotic added defines
169 #define HIT_PROXIMITY_GUN_BIT 16
170 #define HIT_MJOLNIR_BIT       7
171 #define HIT_LASER_CANNON_BIT  23
172 #define HIT_PROXIMITY_GUN   (1<<HIT_PROXIMITY_GUN_BIT)
173 #define HIT_MJOLNIR         (1<<HIT_MJOLNIR_BIT)
174 #define HIT_LASER_CANNON    (1<<HIT_LASER_CANNON_BIT)
175 #define HIT_WETSUIT         (1<<(23+2))
176 #define HIT_EMPATHY_SHIELDS (1<<(23+3))
177
178 //===========================================
179
180 // LordHavoc: increased player limit from 16 to 64
181 #define MAX_SCOREBOARD          64
182 #define MAX_SCOREBOARDNAME      32
183
184 #define SOUND_CHANNELS          8
185
186 #include "zone.h"
187 #include "quakeio.h"
188 #include "common.h"
189 #include "cvar.h"
190 #include "bspfile.h"
191 #include "vid.h"
192 #include "sys.h"
193 #include "mathlib.h"
194
195 #include "r_textures.h"
196
197 #include "wad.h"
198 #include "draw.h"
199 #include "screen.h"
200 #include "net.h"
201 #include "protocol.h"
202 #include "cmd.h"
203 #include "sbar.h"
204 #include "sound.h"
205 #include "model_shared.h"
206 #include "client.h"
207 #include "render.h"
208 #include "progs.h"
209 #include "server.h"
210
211 #include "input.h"
212 #include "world.h"
213 #include "keys.h"
214 #include "console.h"
215 #include "menu.h"
216 #include "crc.h"
217 #include "cdaudio.h"
218
219 #include "glquake.h"
220
221 #include "ui.h"
222
223 #include "portals.h"
224
225 //=============================================================================
226
227 // the host system specifies the base of the directory tree, the
228 // command line parms passed to the program, and the amount of memory
229 // available for the program to use
230
231 typedef struct
232 {
233         char    *basedir;
234 #if CACHEENABLE
235         char    *cachedir;              // for development over ISDN lines
236 #endif
237         int             argc;
238         char    **argv;
239 } quakeparms_t;
240
241
242 //=============================================================================
243
244
245
246 extern qboolean noclip_anglehack;
247
248
249 //
250 // host
251 //
252 extern  quakeparms_t host_parms;
253
254 extern  cvar_t          sys_ticrate;
255 extern  cvar_t          developer;
256
257 extern  qboolean        host_initialized;               // true if into command execution
258 extern  double          host_frametime;
259 extern  double          host_realframetime;     // LordHavoc: the real frametime, before slowmo and clamping are applied (used for console scrolling)
260 extern  int                     host_framecount;        // incremented every frame, never reset
261 extern  double          realtime;                       // not bounded in any way, changed at
262                                                                                 // start of every frame, never reset
263
264 void Host_ClearMemory (void);
265 void Host_ServerFrame (void);
266 void Host_InitCommands (void);
267 void Host_Init (void);
268 void Host_Shutdown(void);
269 void Host_Error (char *error, ...);
270 void Host_EndGame (char *message, ...);
271 void Host_Frame (float time);
272 void Host_Quit_f (void);
273 void Host_ClientCommands (char *fmt, ...);
274 void Host_ShutdownServer (qboolean crash);
275
276 extern qboolean         msg_suppress_1;         // suppresses resolution and cache size console output
277                                                                                 //  an fullscreen DIB focus gain/loss
278 extern int                      current_skill;          // skill level for currently loaded level (in case
279                                                                                 //  the user changes the cvar while the level is
280                                                                                 //  running, this reflects the level actually in use)
281
282 extern int                      minimum_memory;
283
284 //
285 // chase
286 //
287 extern  cvar_t  chase_active;
288
289 void Chase_Init (void);
290 void Chase_Reset (void);
291 void Chase_Update (void);
292
293 void fractalnoise(unsigned char *noise, int size, int startgrid);
294 void fractalnoisequick(unsigned char *noise, int size, int startgrid);
295
296 #include "palette.h"
297 #include "image.h"
298
299 void Sys_Shared_Init(void);