2 Copyright (C) 1996-1997 Id Software, Inc.
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.
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.
13 See the GNU General Public License for more details.
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.
20 // quakedef.h -- primary header for client
26 # include <TargetConditionals.h>
29 #include <sys/types.h>
40 extern const char *buildstring;
41 extern char engineversion[128];
43 #define GAMENAME "id1"
49 #define MOVEFLAG_VALID 0x80000000
50 #define MOVEFLAG_Q2AIRACCELERATE 0x00000001
51 #define MOVEFLAG_NOGRAVITYONGROUND 0x00000002
52 #define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE 0x00000004
57 #define IT_SUPER_SHOTGUN 2
59 #define IT_SUPER_NAILGUN 8
60 #define IT_GRENADE_LAUNCHER 16
61 #define IT_ROCKET_LAUNCHER 32
62 #define IT_LIGHTNING 64
63 #define IT_SUPER_LIGHTNING 128
66 #define IT_ROCKETS 1024
69 #define IT_ARMOR1 8192
70 #define IT_ARMOR2 16384
71 #define IT_ARMOR3 32768
72 #define IT_SUPERHEALTH 65536
73 #define IT_KEY1 131072
74 #define IT_KEY2 262144
75 #define IT_INVISIBILITY 524288
76 #define IT_INVULNERABILITY 1048576
77 #define IT_SUIT 2097152
78 #define IT_QUAD 4194304
79 #define IT_SIGIL1 (1<<28)
80 #define IT_SIGIL2 (1<<29)
81 #define IT_SIGIL3 (1<<30)
82 #define IT_SIGIL4 (1<<31)
84 //===========================================
85 // AK nexuiz changed and added defines
88 #define NEX_IT_SHOTGUN 2
89 #define NEX_IT_GRENADE_LAUNCHER 4
90 #define NEX_IT_ELECTRO 8
91 #define NEX_IT_CRYLINK 16
93 #define NEX_IT_HAGAR 64
94 #define NEX_IT_ROCKET_LAUNCHER 128
95 #define NEX_IT_SHELLS 256
96 #define NEX_IT_BULLETS 512
97 #define NEX_IT_ROCKETS 1024
98 #define NEX_IT_CELLS 2048
99 #define NEX_IT_LASER 4094
100 #define NEX_IT_STRENGTH 8192
101 #define NEX_IT_INVINCIBLE 16384
102 #define NEX_IT_SPEED 32768
103 #define NEX_IT_SLOWMO 65536
105 //===========================================
106 //rogue changed and added defines
108 #define RIT_SHELLS 128
109 #define RIT_NAILS 256
110 #define RIT_ROCKETS 512
111 #define RIT_CELLS 1024
113 #define RIT_LAVA_NAILGUN 4096
114 #define RIT_LAVA_SUPER_NAILGUN 8192
115 #define RIT_MULTI_GRENADE 16384
116 #define RIT_MULTI_ROCKET 32768
117 #define RIT_PLASMA_GUN 65536
118 #define RIT_ARMOR1 8388608
119 #define RIT_ARMOR2 16777216
120 #define RIT_ARMOR3 33554432
121 #define RIT_LAVA_NAILS 67108864
122 #define RIT_PLASMA_AMMO 134217728
123 #define RIT_MULTI_ROCKETS 268435456
124 #define RIT_SHIELD 536870912
125 #define RIT_ANTIGRAV 1073741824
126 #define RIT_SUPERHEALTH 2147483648
128 //MED 01/04/97 added hipnotic defines
129 //===========================================
130 //hipnotic added defines
131 #define HIT_PROXIMITY_GUN_BIT 16
132 #define HIT_MJOLNIR_BIT 7
133 #define HIT_LASER_CANNON_BIT 23
134 #define HIT_PROXIMITY_GUN (1<<HIT_PROXIMITY_GUN_BIT)
135 #define HIT_MJOLNIR (1<<HIT_MJOLNIR_BIT)
136 #define HIT_LASER_CANNON (1<<HIT_LASER_CANNON_BIT)
137 #define HIT_WETSUIT (1<<(23+2))
138 #define HIT_EMPATHY_SHIELDS (1<<(23+3))
140 //===========================================
146 #include "com_list.h"
153 #include "r_textures.h"
159 #include "protocol.h"
164 #include "model_shared.h"
180 extern qbool noclip_anglehack;
182 extern cvar_t developer;
183 extern cvar_t developer_entityparsing;
184 extern cvar_t developer_extra;
185 extern cvar_t developer_insane;
186 extern cvar_t developer_loadfile;
187 extern cvar_t developer_loading;
189 extern cvar_t sessionid;
191 #define STARTCONFIGFILENAME "quake.rc"
192 #define CONFIGFILENAME "config.cfg"
194 /* Preprocessor macros to identify platform
195 DP_OS_NAME - "friendly" name of the OS, for humans to read
196 DP_OS_STR - "identifier" of the OS, more suited for code to use
197 DP_ARCH_STR - "identifier" of the processor architecture
199 #if defined(__ANDROID__) /* must come first because it also defines linux */
200 # define DP_OS_NAME "Android"
201 # define DP_OS_STR "android"
204 # define LINK_TO_ZLIB 1
205 # define LINK_TO_LIBVORBIS 1
207 # define LINK_TO_LIBXMP 1 // nyov: if someone can test with the android NDK compiled libxmp?
209 # define DP_MOBILETOUCH 1
210 # define DP_FREETYPE_STATIC 1
211 #elif TARGET_OS_IPHONE /* must come first because it also defines MACOSX */
212 # define DP_OS_NAME "iPhoneOS"
213 # define DP_OS_STR "iphoneos"
215 # define LINK_TO_ZLIB 1
216 # define LINK_TO_LIBVORBIS 1
217 # define DP_MOBILETOUCH 1
218 # define DP_FREETYPE_STATIC 1
219 #elif defined(__linux__)
220 # define DP_OS_NAME "Linux"
221 # define DP_OS_STR "linux"
222 #elif defined(_WIN64)
223 # define DP_OS_NAME "Windows64"
224 # define DP_OS_STR "win64"
226 # define DP_OS_NAME "Windows"
227 # define DP_OS_STR "win32"
228 #elif defined(__FreeBSD__)
229 # define DP_OS_NAME "FreeBSD"
230 # define DP_OS_STR "freebsd"
231 #elif defined(__NetBSD__)
232 # define DP_OS_NAME "NetBSD"
233 # define DP_OS_STR "netbsd"
234 #elif defined(__OpenBSD__)
235 # define DP_OS_NAME "OpenBSD"
236 # define DP_OS_STR "openbsd"
237 #elif defined(__DragonFly__)
238 # define DP_OS_NAME "DragonFlyBSD"
239 # define DP_OS_STR "dragonflybsd"
240 #elif defined(MACOSX)
241 # define DP_OS_NAME "Mac OS X"
242 # define DP_OS_STR "osx"
243 #elif defined(__MORPHOS__)
244 # define DP_OS_NAME "MorphOS"
245 # define DP_OS_STR "morphos"
246 #elif defined (sun) || defined (__sun)
247 # if defined (__SVR4) || defined (__svr4__)
248 # define DP_OS_NAME "Solaris"
249 # define DP_OS_STR "solaris"
251 # define DP_OS_NAME "SunOS"
252 # define DP_OS_STR "sunos"
255 # define DP_OS_NAME "Unknown"
256 # define DP_OS_STR "unknown"
259 #if defined(__GNUC__) || (__clang__)
260 # if defined(__i386__)
261 # define DP_ARCH_STR "686"
262 # define SSE_POSSIBLE
267 # define SSE2_PRESENT
269 # elif defined(__x86_64__)
270 # define DP_ARCH_STR "x86_64"
272 # define SSE2_PRESENT
273 # elif defined(__powerpc__)
274 # define DP_ARCH_STR "ppc"
276 #elif defined(_WIN64)
277 # define DP_ARCH_STR "x86_64"
279 # define SSE2_PRESENT
281 # define DP_ARCH_STR "x86"
282 # define SSE_POSSIBLE
286 # define SSE_POSSIBLE
296 // runtime detection of SSE/SSE2 capabilities for x86
297 qbool Sys_HaveSSE(void);
298 qbool Sys_HaveSSE2(void);
300 #define Sys_HaveSSE() false
301 #define Sys_HaveSSE2() false
307 extern cvar_t host_isclient;
309 /// skill level for currently loaded level (in case the user changes the cvar while the level is running, this reflects the level actually in use)
310 extern int current_skill;
315 extern cvar_t chase_active;
316 extern cvar_t cl_viewmodel_scale;
318 void Chase_Init (void);
319 void Chase_Reset (void);
320 void Chase_Update (void);
322 void fractalnoise(unsigned char *noise, int size, int startgrid);
323 void fractalnoisequick(unsigned char *noise, int size, int startgrid);
324 float noise4f(float x, float y, float z, float w);
326 void Sys_Shared_Init(void);
328 // Flag in size field of demos to indicate a client->server packet. Demo
329 // playback will ignore this, but it may be useful to make DP sniff packets to
330 // debug protocol exploits.
331 #define DEMOMSG_CLIENT_TO_SERVER 0x80000000
333 // In Quake, any char in 0..32 counts as whitespace
334 //#define ISWHITESPACE(ch) ((unsigned char) ch <= (unsigned char) ' ')
335 #define ISWHITESPACE(ch) (!(ch) || (ch) == ' ' || (ch) == '\t' || (ch) == '\r' || (ch) == '\n')
336 #define ISCOMMENT(ch, pos) ch[pos] == '/' && ch[pos + 1] == '/' && (pos == 0 || ISWHITESPACE(ch[pos - 1]))
337 // This also includes extended characters, and ALL control chars
338 #define ISWHITESPACEORCONTROL(ch) ((signed char) (ch) <= (signed char) ' ')
342 #define FLOAT_IS_TRUE_FOR_INT(x) ((x) & 0x7FFFFFFFFFFFFFFF) // also match "negative zero" doubles of value 0x8000000000000000
343 #define FLOAT_LOSSLESS_FORMAT "%.17g"
344 #define VECTOR_LOSSLESS_FORMAT "%.17g %.17g %.17g"
346 #define FLOAT_IS_TRUE_FOR_INT(x) ((x) & 0x7FFFFFFF) // also match "negative zero" floats of value 0x80000000
347 #define FLOAT_LOSSLESS_FORMAT "%.9g"
348 #define VECTOR_LOSSLESS_FORMAT "%.9g %.9g %.9g"
351 // originally this was _MSC_VER
352 // but here we want to test the system libc, which on win32 is borked, and NOT the compiler
354 #define INT_LOSSLESS_FORMAT_SIZE "I64"
355 #define INT_LOSSLESS_FORMAT_CONVERT_S(x) ((__int64)(x))
356 #define INT_LOSSLESS_FORMAT_CONVERT_U(x) ((unsigned __int64)(x))
358 #define INT_LOSSLESS_FORMAT_SIZE "j"
359 #define INT_LOSSLESS_FORMAT_CONVERT_S(x) ((intmax_t)(x))
360 #define INT_LOSSLESS_FORMAT_CONVERT_U(x) ((uintmax_t)(x))