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