1 /*
2 Copyright (C) 1996-2001 Id Software, Inc.
3 Copyright (C) 2002-2009 John Fitzgibbons and others
4 Copyright (C) 2007-2008 Kristian Duske
5 Copyright (C) 2010-2021 QuakeSpasm developers
6 Copyright (C) 2016-2021 vkQuake developers
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 
23 */
24 
25 #ifndef QUAKEDEFS_H
26 #define QUAKEDEFS_H
27 
28 // quakedef.h -- primary header for client
29 
30 #define	QUAKE_GAME		// as opposed to utilities
31 
32 #define	VERSION			1.09
33 #define	GLQUAKE_VERSION		1.00
34 #define	D3DQUAKE_VERSION	0.01
35 #define	WINQUAKE_VERSION	0.996
36 #define	LINUX_VERSION		1.30
37 #define	X11_VERSION		1.10
38 
39 #define	FITZQUAKE_VERSION	0.85	//johnfitz
40 #define	QUAKESPASM_VERSION	0.94
41 #define	QUAKESPASM_VER_PATCH	2	// helper to print a string like 0.94.2
42 #ifndef	QUAKESPASM_VER_SUFFIX
43 #define	QUAKESPASM_VER_SUFFIX		// optional version suffix string literal like "-beta1"
44 #endif
45 #define	VKQUAKE_VERSION		1.12
46 #define	VKQUAKE_VER_PATCH	2	// helper to print a string like 0.92.1
47 #ifndef	VKQUAKE_VER_SUFFIX
48 #define	VKQUAKE_VER_SUFFIX ""	// optional version suffix like -beta1
49 #endif
50 
51 #define	QS_STRINGIFY_(x)	#x
52 #define	QS_STRINGIFY(x)	QS_STRINGIFY_(x)
53 
54 // combined version string like "0.92.1-beta1"
55 #define	QUAKESPASM_VER_STRING	QS_STRINGIFY(QUAKESPASM_VERSION) "." QS_STRINGIFY(QUAKESPASM_VER_PATCH) QUAKESPASM_VER_SUFFIX
56 #define VKQUAKE_VER_STRING	QS_STRINGIFY(VKQUAKE_VERSION) "." QS_STRINGIFY(VKQUAKE_VER_PATCH) VKQUAKE_VER_SUFFIX
57 
58 #ifdef QSS_DATE
59 	// combined version string like "2020-10-20-beta1"
60 	#define	ENGINE_NAME_AND_VER	"vkQuake " QS_STRINGIFY(QSS_DATE) VKQUAKE_VER_SUFFIX
61 #else
62 	#define ENGINE_NAME_AND_VER "vkQuake" " " VKQUAKE_VER_STRING
63 #endif
64 
65 //define	PARANOID			// speed sapping error checking
66 
67 #define	GAMENAME	"id1"		// directory to look in by default
68 
69 #define PSET_SCRIPT		//enable the scriptable particle system (poorly ported from FTE)
70 #define PSET_SCRIPT_EFFECTINFO	//scripted particle system can load dp's effects
71 
72 #include "q_stdinc.h"
73 
74 // !!! if this is changed, it must be changed in d_ifacea.h too !!!
75 #define CACHE_SIZE	32	// used to align key data structures
76 
77 #define Q_UNUSED(x)	(x = x)	// for pesky compiler / lint warnings
78 
79 #define	MINIMUM_MEMORY	0x550000
80 #define	MINIMUM_MEMORY_LEVELPAK	(MINIMUM_MEMORY + 0x100000)
81 
82 #define MAX_NUM_ARGVS	50
83 
84 // up / down
85 #define	PITCH		0
86 
87 // left / right
88 #define	YAW		1
89 
90 // fall over
91 #define	ROLL		2
92 
93 
94 #define	MAX_QPATH	64		// max length of a quake game pathname
95 
96 #define	ON_EPSILON	0.1		// point on plane side epsilon
97 
98 #define	DIST_EPSILON	(0.03125)	// 1/32 epsilon to keep floating point happy (moved from world.c)
99 
100 #define	MAX_MSGLEN	64000		// max length of a reliable message //ericw -- was 32000
101 #define	MAX_DATAGRAM	32000		// max length of unreliable message //johnfitz -- was 1024
102 
103 #define	DATAGRAM_MTU	1400		// johnfitz -- actual limit for unreliable messages to nonlocal clients
104 
105 //
106 // per-level limits
107 //
108 #define	MIN_EDICTS	256		// johnfitz -- lowest allowed value for max_edicts cvar
109 #define	MAX_EDICTS	32000		// johnfitz -- highest allowed value for max_edicts cvar
110 						// ents past 8192 can't play sounds in the standard protocol
111 #define	MAX_LIGHTSTYLES	64
112 #define	MAX_MODELS	2048		// johnfitz -- was 256
113 #define	MAX_SOUNDS	2048		// johnfitz -- was 256
114 #define	MAX_PARTICLETYPES	2048
115 
116 #define	SAVEGAME_COMMENT_LENGTH	39
117 
118 #define	MAX_STYLESTRING		64
119 
120 //
121 // stats are integers communicated to the client by the server
122 //
123 #define	MAX_CL_STATS		256
124 #define	STAT_HEALTH		0
125 #define	STAT_FRAGS		1
126 #define	STAT_WEAPON		2
127 #define	STAT_AMMO		3
128 #define	STAT_ARMOR		4
129 #define	STAT_WEAPONFRAME	5
130 #define	STAT_SHELLS		6
131 #define	STAT_NAILS		7
132 #define	STAT_ROCKETS		8
133 #define	STAT_CELLS		9
134 #define	STAT_ACTIVEWEAPON	10
135 #define	STAT_TOTALSECRETS	11
136 #define	STAT_TOTALMONSTERS	12
137 #define	STAT_SECRETS		13	// bumped on client side by svc_foundsecret
138 #define	STAT_MONSTERS		14	// bumped by svc_killedmonster
139 #define STAT_ITEMS			15	//replaces clc_clientdata info
140 #define STAT_VIEWHEIGHT		16	//replaces clc_clientdata info
141 #define STAT_IDEALPITCH		25	//nq-emu
142 #define STAT_PUNCHANGLE_X	26	//nq-emu
143 #define STAT_PUNCHANGLE_Y	27	//nq-emu
144 #define STAT_PUNCHANGLE_Z	28	//nq-emu
145 
146 // stock defines
147 //
148 #define	IT_SHOTGUN		1
149 #define	IT_SUPER_SHOTGUN	2
150 #define	IT_NAILGUN		4
151 #define	IT_SUPER_NAILGUN	8
152 #define	IT_GRENADE_LAUNCHER	16
153 #define	IT_ROCKET_LAUNCHER	32
154 #define	IT_LIGHTNING		64
155 #define	IT_SUPER_LIGHTNING	128
156 #define	IT_SHELLS		256
157 #define	IT_NAILS		512
158 #define	IT_ROCKETS		1024
159 #define	IT_CELLS		2048
160 #define	IT_AXE			4096
161 #define	IT_ARMOR1		8192
162 #define	IT_ARMOR2		16384
163 #define	IT_ARMOR3		32768
164 #define	IT_SUPERHEALTH		65536
165 #define	IT_KEY1			131072
166 #define	IT_KEY2			262144
167 #define	IT_INVISIBILITY		524288
168 #define	IT_INVULNERABILITY	1048576
169 #define	IT_SUIT			2097152
170 #define	IT_QUAD			4194304
171 #define	IT_SIGIL1		(1<<28)
172 #define	IT_SIGIL2		(1<<29)
173 #define	IT_SIGIL3		(1<<30)
174 #define	IT_SIGIL4		(1<<31)
175 
176 //===========================================
177 //rogue changed and added defines
178 
179 #define	RIT_SHELLS		128
180 #define	RIT_NAILS		256
181 #define	RIT_ROCKETS		512
182 #define	RIT_CELLS		1024
183 #define	RIT_AXE			2048
184 #define	RIT_LAVA_NAILGUN	4096
185 #define	RIT_LAVA_SUPER_NAILGUN	8192
186 #define	RIT_MULTI_GRENADE	16384
187 #define	RIT_MULTI_ROCKET	32768
188 #define	RIT_PLASMA_GUN		65536
189 #define	RIT_ARMOR1		8388608
190 #define	RIT_ARMOR2		16777216
191 #define	RIT_ARMOR3		33554432
192 #define	RIT_LAVA_NAILS		67108864
193 #define	RIT_PLASMA_AMMO		134217728
194 #define	RIT_MULTI_ROCKETS	268435456
195 #define	RIT_SHIELD		536870912
196 #define	RIT_ANTIGRAV		1073741824
197 #define	RIT_SUPERHEALTH		2147483648
198 
199 //MED 01/04/97 added hipnotic defines
200 //===========================================
201 //hipnotic added defines
202 #define	HIT_PROXIMITY_GUN_BIT	16
203 #define	HIT_MJOLNIR_BIT		7
204 #define	HIT_LASER_CANNON_BIT	23
205 #define	HIT_PROXIMITY_GUN	(1<<HIT_PROXIMITY_GUN_BIT)
206 #define	HIT_MJOLNIR		(1<<HIT_MJOLNIR_BIT)
207 #define	HIT_LASER_CANNON	(1<<HIT_LASER_CANNON_BIT)
208 #define	HIT_WETSUIT		(1<<(23+2))
209 #define	HIT_EMPATHY_SHIELDS	(1<<(23+3))
210 
211 //===========================================
212 
213 #define	MAX_SCOREBOARD		16
214 #define	MAX_SCOREBOARDNAME	32
215 
216 #define	SOUND_CHANNELS		8
217 
218 #define WARPIMAGESIZE		512
219 #define WARPIMAGEMIPS		5
220 
221 typedef struct
222 {
223 	const char *basedir;
224 	const char *userdir;	// user's directory on UNIX platforms.
225 				// if user directories are enabled, basedir
226 				// and userdir will point to different
227 				// memory locations, otherwise to the same.
228 	int	argc;
229 	char	**argv;
230 	void	*membase;
231 	int	memsize;
232 	int	numcpus;
233 	int	errstate;
234 } quakeparms_t;
235 
236 #include "common.h"
237 #include "bspfile.h"
238 #include "sys.h"
239 #include "zone.h"
240 #include "mathlib.h"
241 #include "cvar.h"
242 
243 #include "protocol.h"
244 #include "net.h"
245 
246 #include "cmd.h"
247 #include "crc.h"
248 
249 #include "progs.h"
250 #include "server.h"
251 
252 #include "platform.h"
253 
254 #include <vulkan/vulkan_core.h>
255 
256 #include "console.h"
257 #include "wad.h"
258 #include "vid.h"
259 #include "screen.h"
260 #include "draw.h"
261 #include "render.h"
262 #include "view.h"
263 #include "sbar.h"
264 #include "q_sound.h"
265 #include "client.h"
266 
267 #include "gl_model.h"
268 #include "world.h"
269 
270 #include "image.h"	//johnfitz
271 #include "gl_texmgr.h"	//johnfitz
272 #include "input.h"
273 #include "keys.h"
274 #include "menu.h"
275 #include "cdaudio.h"
276 #include "glquake.h"
277 #include "../Shaders/shaders.h"
278 
279 //=============================================================================
280 
281 // the host system specifies the base of the directory tree, the
282 // command line parms passed to the program, and the amount of memory
283 // available for the program to use
284 
285 extern qboolean noclip_anglehack;
286 
287 //
288 // host
289 //
290 extern	quakeparms_t *host_parms;
291 
292 extern	cvar_t		sys_ticrate;
293 extern	cvar_t		sys_nostdout;
294 extern	cvar_t		developer;
295 extern	cvar_t		max_edicts; //johnfitz
296 
297 extern	qboolean	host_initialized;	// true if into command execution
298 extern	double		host_frametime;
299 extern	byte		*host_colormap;
300 extern	int		host_framecount;	// incremented every frame, never reset
301 extern	double		realtime;		// not bounded in any way, changed at
302 							// start of every frame, never reset
303 
304 typedef struct filelist_item_s
305 {
306 	char			name[32];
307 	struct filelist_item_s	*next;
308 } filelist_item_t;
309 
310 extern filelist_item_t	*modlist;
311 extern filelist_item_t	*extralevels;
312 extern filelist_item_t	*demolist;
313 
314 void Host_ClearMemory (void);
315 void Host_ServerFrame (void);
316 void Host_InitCommands (void);
317 void Host_Init (void);
318 void Host_Shutdown(void);
319 void Host_Callback_Notify (cvar_t *var);	/* callback function for CVAR_NOTIFY */
320 FUNC_NORETURN void Host_Error (const char *error, ...) FUNC_PRINTF(1,2);
321 FUNC_NORETURN void Host_EndGame (const char *message, ...) FUNC_PRINTF(1,2);
322 void Host_Frame (double time);
323 void Host_Quit_f (void);
324 void Host_ClientCommands (const char *fmt, ...) FUNC_PRINTF(1,2);
325 void Host_ShutdownServer (qboolean crash);
326 void Host_WriteConfiguration (void);
327 
328 void ExtraMaps_Init (void);
329 void Modlist_Init (void);
330 void DemoList_Init (void);
331 
332 void ExtraMaps_NewGame (void);
333 void DemoList_Rebuild (void);
334 
335 extern int		current_skill;	// skill level for currently loaded level (in case
336 					//  the user changes the cvar while the level is
337 					//  running, this reflects the level actually in use)
338 
339 extern qboolean		isDedicated;
340 
341 extern int		minimum_memory;
342 
343 extern int num_vulkan_tex_allocations;
344 extern int num_vulkan_bmodel_allocations;
345 extern int num_vulkan_mesh_allocations;
346 extern int num_vulkan_misc_allocations;
347 extern int num_vulkan_dynbuf_allocations;
348 extern int num_vulkan_combined_image_samplers;
349 extern int num_vulkan_ubos_dynamic;
350 extern int num_vulkan_input_attachments;
351 extern int num_vulkan_storage_images;
352 
353 #endif	/* QUAKEDEFS_H */
354 
355