]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - quakedef.h
Update build system, fix and enable ODE by default
[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 #ifndef QUAKEDEF_H
23 #define QUAKEDEF_H
24
25 #if defined(__GNUC__) && (__GNUC__ > 2)
26 #define DP_FUNC_PRINTF(n) __attribute__ ((format (printf, n, n+1)))
27 #define DP_FUNC_PURE      __attribute__ ((pure))
28 #define DP_FUNC_NORETURN  __attribute__ ((noreturn))
29 #else
30 #define DP_FUNC_PRINTF(n)
31 #define DP_FUNC_PURE
32 #define DP_FUNC_NORETURN
33 #endif
34
35 #include <sys/types.h>
36 #include <ctype.h>
37 #include <math.h>
38 #include <string.h>
39 #include <stdarg.h>
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <limits.h>
43 #include <setjmp.h>
44
45 #include "qtypes.h"
46
47 extern const char *buildstring;
48 extern char engineversion[128];
49
50 #define GAMENAME "id1"
51
52 #define MAX_NUM_ARGVS   50
53
54 #ifdef DP_SMALLMEMORY
55 #define MAX_INPUTLINE                   1024
56 #define CON_TEXTSIZE                    16384
57 #define CON_MAXLINES                    256
58 #define HIST_TEXTSIZE                   2048
59 #define HIST_MAXLINES                   16
60 #define MAX_ALIAS_NAME                  32
61 #define CMDBUFSIZE                              131072
62 #define MAX_ARGS                                80
63
64 #define NET_MAXMESSAGE                  65536
65 #define MAX_PACKETFRAGMENT              1024
66 #define MAX_EDICTS                              4096
67 #define MAX_MODELS                              1024
68 #define MAX_SOUNDS                              1024
69 #define MAX_LIGHTSTYLES                 64
70 #define MAX_STYLESTRING                 16
71 #define MAX_SCOREBOARD                  32
72 #define MAX_SCOREBOARDNAME              128
73 #define MAX_USERINFO_STRING             196
74 #define MAX_SERVERINFO_STRING   512
75 #define MAX_LOCALINFO_STRING    1 // not actually used by DP servers
76 #define CL_MAX_USERCMDS                 32
77 #define CVAR_HASHSIZE                   1024
78 #define M_MAX_EDICTS                    4096
79 #define MAX_DEMOS                               8
80 #define MAX_DEMONAME                    16
81 #define MAX_SAVEGAMES                   12
82 #define SAVEGAME_COMMENT_LENGTH 39
83 #define MAX_CLIENTNETWORKEYES   2
84 #define MAX_LEVELNETWORKEYES    0 // no portal support
85 #define MAX_OCCLUSION_QUERIES   256
86
87 #define CRYPTO_HOSTKEY_HASHSIZE 256
88 #define MAX_NETWM_ICON 1026 // one 32x32
89
90 #define MAX_WATERPLANES                 2
91 #define MAX_CUBEMAPS                    1024
92 #define MAX_EXPLOSIONS                  8
93 #define MAX_DLIGHTS                             16
94 #define MAX_CACHED_PICS                 1024 // this is 144 bytes each (or 152 on 64bit)
95 #define CACHEPICHASHSIZE                256
96 #define MAX_PARTICLEEFFECTNAME  256
97 #define MAX_PARTICLEEFFECTINFO  1024
98 #define MAX_PARTICLETEXTURES    256
99 #define MAXCLVIDEOS                             1
100 #define MAX_DYNAMIC_TEXTURE_COUNT       2
101 #define MAX_MAP_LEAFS                   8192
102
103 #define MAXTRACKS                               256
104 #define MAX_DYNAMIC_CHANNELS    64
105 #define MAX_CHANNELS                    260
106 #define MODLIST_TOTALSIZE               32
107 #define MAX_FAVORITESERVERS             32
108 #define MAX_DECALSYSTEM_QUEUE   64
109 #define PAINTBUFFER_SIZE                512
110 #define MAX_BINDMAPS                    8
111 #define MAX_PARTICLES_INITIAL   8192
112 #define MAX_PARTICLES                   8192
113 #define MAX_DECALS_INITIAL              1024
114 #define MAX_DECALS                              1024
115 #define MAX_ENITIES_INITIAL             256
116 #define MAX_STATICENTITIES              256
117 #define MAX_EFFECTS                             16
118 #define MAX_BEAMS                               16
119 #define MAX_TEMPENTITIES                256
120 #define SERVERLIST_TOTALSIZE            1024
121 #define SERVERLIST_ANDMASKCOUNT         5
122 #define SERVERLIST_ORMASKCOUNT          5
123 #else
124 #define MAX_INPUTLINE                   16384 ///< maximum length of console commandline, QuakeC strings, and many other text processing buffers
125 #define CON_TEXTSIZE                    1048576 ///< max scrollback buffer characters in console
126 #define CON_MAXLINES                    16384 ///< max scrollback buffer lines in console
127 #define HIST_TEXTSIZE                   262144 ///< max command history buffer characters in console
128 #define HIST_MAXLINES                   4096 ///< max command history buffer lines in console
129 #define MAX_ALIAS_NAME                  32
130 #define CMDBUFSIZE                              655360 ///< maximum script size that can be loaded by the exec command (8192 in Quake)
131 #define MAX_ARGS                                80 ///< maximum number of parameters to a console command or alias
132
133 #define NET_MAXMESSAGE                  65536 ///< max reliable packet size (sent as multiple fragments of MAX_PACKETFRAGMENT)
134 #define MAX_PACKETFRAGMENT              1024 ///< max length of packet fragment
135 #define MAX_EDICTS                              32768 ///< max number of objects in game world at once (32768 protocol limit)
136 #define MAX_MODELS                              8192 ///< max number of models loaded at once (including during level transitions)
137 #define MAX_SOUNDS                              4096 ///< max number of sounds loaded at once
138 #define MAX_LIGHTSTYLES                 256 ///< max flickering light styles in level (note: affects savegame format)
139 #define MAX_STYLESTRING                 64 ///< max length of flicker pattern for light style
140 #define MAX_SCOREBOARD                  255 ///< max number of players in game at once (255 protocol limit)
141 #define MAX_SCOREBOARDNAME              128 ///< max length of player name in game
142 #define MAX_USERINFO_STRING             1280 ///< max length of infostring for PROTOCOL_QUAKEWORLD (196 in QuakeWorld)
143 #define MAX_SERVERINFO_STRING   1280 ///< max length of server infostring for PROTOCOL_QUAKEWORLD (512 in QuakeWorld)
144 #define MAX_LOCALINFO_STRING    32768 ///< max length of server-local infostring for PROTOCOL_QUAKEWORLD (32768 in QuakeWorld)
145 #define CL_MAX_USERCMDS                 128 ///< max number of predicted input packets in queue
146 #define CVAR_HASHSIZE                   65536 ///< number of hash buckets for accelerating cvar name lookups
147 #define M_MAX_EDICTS                    32768 ///< max objects in menu vm
148 #define MAX_DEMOS                               8 ///< max demos provided to demos command
149 #define MAX_DEMONAME                    16 ///< max demo name length for demos command
150 #define MAX_SAVEGAMES                   12 ///< max savegames listed in savegame menu
151 #define SAVEGAME_COMMENT_LENGTH 39 ///< max comment length of savegame in menu
152 #define MAX_CLIENTNETWORKEYES   16 ///< max number of locations that can be added to pvs when culling network entities (must be at least 2 for prediction)
153 #define MAX_LEVELNETWORKEYES    512 ///< max number of locations that can be added to pvs when culling network entities (must be at least 2 for prediction)
154 #define MAX_OCCLUSION_QUERIES   4096 ///< max number of GL_ARB_occlusion_query objects that can be used in one frame
155
156 #define CRYPTO_HOSTKEY_HASHSIZE 8192 ///< number of hash buckets for accelerating host key lookups
157 #define MAX_NETWM_ICON 352822 // 16x16, 22x22, 24x24, 32x32, 48x48, 64x64, 128x128, 256x256, 512x512
158
159 #define MAX_WATERPLANES                 16 ///< max number of water planes visible (each one causes additional view renders)
160 #define MAX_CUBEMAPS                    1024 ///< max number of cubemap textures loaded for light filters
161 #define MAX_EXPLOSIONS                  64 ///< max number of explosion shell effects active at once (not particle related)
162 #define MAX_DLIGHTS                             256 ///< max number of dynamic lights (rocket flashes, etc) in scene at once
163 #define MAX_CACHED_PICS                 1024 ///< max number of 2D pics loaded at once
164 #define CACHEPICHASHSIZE                256 ///< number of hash buckets for accelerating 2D pic name lookups
165 #define MAX_PARTICLEEFFECTNAME  256 ///< maximum number of unique names of particle effects (for particleeffectnum)
166 #define MAX_PARTICLEEFFECTINFO  4096 ///< maximum number of unique particle effects (each name may associate with several of these)
167 #define MAX_PARTICLETEXTURES    256 ///< maximum number of unique particle textures in the particle font
168 #define MAXCLVIDEOS                             65 ///< maximum number of video streams being played back at once (1 is reserved for the playvideo command)
169 #define MAX_DYNAMIC_TEXTURE_COUNT       64 ///< maximum number of dynamic textures (web browsers, playvideo, etc)
170 #define MAX_MAP_LEAFS                   65536 ///< maximum number of BSP leafs in world (8192 in Quake)
171
172 #define MAXTRACKS                               256 ///< max CD track index
173 // 0 to NUM_AMBIENTS - 1 = water, etc
174 // NUM_AMBIENTS to NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS - 1 = normal entity sounds
175 // NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS to total_channels = static sounds
176 #define MAX_DYNAMIC_CHANNELS    512
177 #define MAX_CHANNELS                    1028
178 #define MODLIST_TOTALSIZE               256
179 #define MAX_FAVORITESERVERS             256
180 #define MAX_DECALSYSTEM_QUEUE   1024
181 #define PAINTBUFFER_SIZE                2048
182 #define MAX_BINDMAPS                    8
183 #define MAX_PARTICLES_INITIAL   8192 ///< initial allocation for cl.particles
184 #define MAX_PARTICLES                   1048576 ///< upper limit on cl.particles size
185 #define MAX_DECALS_INITIAL              8192 ///< initial allocation for cl.decals
186 #define MAX_DECALS                              1048576 ///< upper limit on cl.decals size
187 #define MAX_ENITIES_INITIAL             256 ///< initial size of cl.entities
188 #define MAX_STATICENTITIES              1024 ///< limit on size of cl.static_entities
189 #define MAX_EFFECTS                             256 ///< limit on size of cl.effects
190 #define MAX_BEAMS                               256 ///< limit on size of cl.beams
191 #define MAX_TEMPENTITIES                4096 ///< max number of temporary models visible per frame (certain sprite effects, certain types of CSQC entities also use this)
192 #define SERVERLIST_TOTALSIZE            2048 ///< max servers in the server list
193 #define SERVERLIST_ANDMASKCOUNT         16 ///< max items in server list AND mask
194 #define SERVERLIST_ORMASKCOUNT          16 ///< max items in server list OR mask
195 #endif
196
197
198 #define CMD_TOKENIZELENGTH (MAX_INPUTLINE + MAX_ARGS) ///< maximum tokenizable commandline length (counting trailing 0)
199
200
201 #define MAX_QPATH               128                     ///< max length of a quake game pathname
202 #ifdef PATH_MAX
203 #define MAX_OSPATH              PATH_MAX
204 #elif MAX_PATH
205 #define MAX_OSPATH              MAX_PATH
206 #else
207 #define MAX_OSPATH              1024            ///< max length of a filesystem pathname
208 #endif
209
210 #define ON_EPSILON              0.1                     ///< point on plane side epsilon
211
212 #define NET_MINRATE             1000 ///< limits "rate" and "sv_maxrate" cvars
213
214 //
215 // stats are integers communicated to the client by the server
216 //
217 #define MAX_CL_STATS            256
218 #define STAT_HEALTH                     0
219 //#define       STAT_FRAGS                      1
220 #define STAT_WEAPON                     2
221 #define STAT_AMMO                       3
222 #define STAT_ARMOR                      4
223 #define STAT_WEAPONFRAME        5
224 #define STAT_SHELLS                     6
225 #define STAT_NAILS                      7
226 #define STAT_ROCKETS            8
227 #define STAT_CELLS                      9
228 #define STAT_ACTIVEWEAPON       10
229 #define STAT_TOTALSECRETS       11
230 #define STAT_TOTALMONSTERS      12
231 #define STAT_SECRETS            13              ///< bumped on client side by svc_foundsecret
232 #define STAT_MONSTERS           14              ///< bumped by svc_killedmonster
233 #define STAT_ITEMS                      15 ///< FTE, DP
234 #define STAT_VIEWHEIGHT         16 ///< FTE, DP
235 //#define STAT_TIME                     17 ///< FTE
236 //#define STAT_VIEW2            20 ///< FTE
237 #define STAT_VIEWZOOM           21 ///< DP
238 #define STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR 220 ///< DP
239 #define STAT_MOVEVARS_AIRCONTROL_PENALTY                                        221 ///< DP
240 #define STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW 222 ///< DP
241 #define STAT_MOVEVARS_AIRSTRAFEACCEL_QW 223 ///< DP
242 #define STAT_MOVEVARS_AIRCONTROL_POWER                                  224 ///< DP
243 #define STAT_MOVEFLAGS                              225 ///< DP
244 #define STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL       226 ///< DP
245 #define STAT_MOVEVARS_WARSOWBUNNY_ACCEL                         227 ///< DP
246 #define STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED                      228 ///< DP
247 #define STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL                     229 ///< DP
248 #define STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO       230 ///< DP
249 #define STAT_MOVEVARS_AIRSTOPACCELERATE                         231 ///< DP
250 #define STAT_MOVEVARS_AIRSTRAFEACCELERATE                       232 ///< DP
251 #define STAT_MOVEVARS_MAXAIRSTRAFESPEED                         233 ///< DP
252 #define STAT_MOVEVARS_AIRCONTROL                                        234 ///< DP
253 #define STAT_FRAGLIMIT                                                          235 ///< DP
254 #define STAT_TIMELIMIT                                                          236 ///< DP
255 #define STAT_MOVEVARS_WALLFRICTION                                      237 ///< DP
256 #define STAT_MOVEVARS_FRICTION                                          238 ///< DP
257 #define STAT_MOVEVARS_WATERFRICTION                                     239 ///< DP
258 #define STAT_MOVEVARS_TICRATE                                           240 ///< DP
259 #define STAT_MOVEVARS_TIMESCALE                                         241 ///< DP
260 #define STAT_MOVEVARS_GRAVITY                                           242 ///< DP
261 #define STAT_MOVEVARS_STOPSPEED                                         243 ///< DP
262 #define STAT_MOVEVARS_MAXSPEED                                          244 ///< DP
263 #define STAT_MOVEVARS_SPECTATORMAXSPEED                         245 ///< DP
264 #define STAT_MOVEVARS_ACCELERATE                                        246 ///< DP
265 #define STAT_MOVEVARS_AIRACCELERATE                                     247 ///< DP
266 #define STAT_MOVEVARS_WATERACCELERATE                           248 ///< DP
267 #define STAT_MOVEVARS_ENTGRAVITY                                        249 ///< DP
268 #define STAT_MOVEVARS_JUMPVELOCITY                                      250 ///< DP
269 #define STAT_MOVEVARS_EDGEFRICTION                                      251 ///< DP
270 #define STAT_MOVEVARS_MAXAIRSPEED                                       252 ///< DP
271 #define STAT_MOVEVARS_STEPHEIGHT                                        253 ///< DP
272 #define STAT_MOVEVARS_AIRACCEL_QW                                       254 ///< DP
273 #define STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION        255 ///< DP
274
275 // moveflags values
276 #define MOVEFLAG_VALID 0x80000000
277 #define MOVEFLAG_Q2AIRACCELERATE 0x00000001
278 #define MOVEFLAG_NOGRAVITYONGROUND 0x00000002
279 #define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE 0x00000004
280
281 // stock defines
282
283 #define IT_SHOTGUN                              1
284 #define IT_SUPER_SHOTGUN                2
285 #define IT_NAILGUN                              4
286 #define IT_SUPER_NAILGUN                8
287 #define IT_GRENADE_LAUNCHER             16
288 #define IT_ROCKET_LAUNCHER              32
289 #define IT_LIGHTNING                    64
290 #define IT_SUPER_LIGHTNING      128
291 #define IT_SHELLS               256
292 #define IT_NAILS                512
293 #define IT_ROCKETS              1024
294 #define IT_CELLS                2048
295 #define IT_AXE                  4096
296 #define IT_ARMOR1               8192
297 #define IT_ARMOR2               16384
298 #define IT_ARMOR3               32768
299 #define IT_SUPERHEALTH          65536
300 #define IT_KEY1                 131072
301 #define IT_KEY2                 262144
302 #define IT_INVISIBILITY                 524288
303 #define IT_INVULNERABILITY              1048576
304 #define IT_SUIT                                 2097152
305 #define IT_QUAD                                 4194304
306 #define IT_SIGIL1               (1<<28)
307 #define IT_SIGIL2               (1<<29)
308 #define IT_SIGIL3               (1<<30)
309 #define IT_SIGIL4               (1<<31)
310
311 //===========================================
312 // AK nexuiz changed and added defines
313
314 #define NEX_IT_UZI              1
315 #define NEX_IT_SHOTGUN          2
316 #define NEX_IT_GRENADE_LAUNCHER 4
317 #define NEX_IT_ELECTRO          8
318 #define NEX_IT_CRYLINK          16
319 #define NEX_IT_NEX              32
320 #define NEX_IT_HAGAR            64
321 #define NEX_IT_ROCKET_LAUNCHER  128
322 #define NEX_IT_SHELLS           256
323 #define NEX_IT_BULLETS          512
324 #define NEX_IT_ROCKETS          1024
325 #define NEX_IT_CELLS            2048
326 #define NEX_IT_LASER            4094
327 #define NEX_IT_STRENGTH         8192
328 #define NEX_IT_INVINCIBLE       16384
329 #define NEX_IT_SPEED            32768
330 #define NEX_IT_SLOWMO           65536
331
332 //===========================================
333 //rogue changed and added defines
334
335 #define RIT_SHELLS              128
336 #define RIT_NAILS               256
337 #define RIT_ROCKETS             512
338 #define RIT_CELLS               1024
339 #define RIT_AXE                 2048
340 #define RIT_LAVA_NAILGUN        4096
341 #define RIT_LAVA_SUPER_NAILGUN  8192
342 #define RIT_MULTI_GRENADE       16384
343 #define RIT_MULTI_ROCKET        32768
344 #define RIT_PLASMA_GUN          65536
345 #define RIT_ARMOR1              8388608
346 #define RIT_ARMOR2              16777216
347 #define RIT_ARMOR3              33554432
348 #define RIT_LAVA_NAILS          67108864
349 #define RIT_PLASMA_AMMO         134217728
350 #define RIT_MULTI_ROCKETS       268435456
351 #define RIT_SHIELD              536870912
352 #define RIT_ANTIGRAV            1073741824
353 #define RIT_SUPERHEALTH         2147483648
354
355 //MED 01/04/97 added hipnotic defines
356 //===========================================
357 //hipnotic added defines
358 #define HIT_PROXIMITY_GUN_BIT 16
359 #define HIT_MJOLNIR_BIT       7
360 #define HIT_LASER_CANNON_BIT  23
361 #define HIT_PROXIMITY_GUN   (1<<HIT_PROXIMITY_GUN_BIT)
362 #define HIT_MJOLNIR         (1<<HIT_MJOLNIR_BIT)
363 #define HIT_LASER_CANNON    (1<<HIT_LASER_CANNON_BIT)
364 #define HIT_WETSUIT         (1<<(23+2))
365 #define HIT_EMPATHY_SHIELDS (1<<(23+3))
366
367 //===========================================
368
369 #include "zone.h"
370 #include "fs.h"
371 #include "common.h"
372 #include "cvar.h"
373 #include "bspfile.h"
374 #include "sys.h"
375 #include "vid.h"
376 #include "mathlib.h"
377
378 #include "r_textures.h"
379
380 #include "crypto.h"
381 #include "draw.h"
382 #include "screen.h"
383 #include "netconn.h"
384 #include "protocol.h"
385 #include "cmd.h"
386 #include "sbar.h"
387 #include "sound.h"
388 #include "model_shared.h"
389 #include "world.h"
390 #include "client.h"
391 #include "render.h"
392 #include "progs.h"
393 #include "progsvm.h"
394 #include "server.h"
395
396 #include "input.h"
397 #include "keys.h"
398 #include "console.h"
399 #include "menu.h"
400 #include "csprogs.h"
401
402 extern qboolean noclip_anglehack;
403
404 extern cvar_t developer;
405 extern cvar_t developer_extra;
406 extern cvar_t developer_insane;
407 extern cvar_t developer_loadfile;
408 extern cvar_t developer_loading;
409
410 extern cvar_t sessionid;
411
412 #define STARTCONFIGFILENAME "quake.rc"
413 #define CONFIGFILENAME "config.cfg"
414
415 /* Preprocessor macros to identify platform
416     DP_OS_NAME  - "friendly" name of the OS, for humans to read
417     DP_OS_STR   - "identifier" of the OS, more suited for code to use
418     DP_ARCH_STR - "identifier" of the processor architecture
419  */
420 #if defined(__ANDROID__) /* must come first because it also defines linux */
421 # define DP_OS_NAME             "Android"
422 # define DP_OS_STR              "android"
423 # define USE_GLES2              1
424 # define LINK_TO_ZLIB   1
425 # define LINK_TO_LIBVORBIS 1
426 # define DP_MOBILETOUCH 1
427 # define DP_FREETYPE_STATIC 1
428 #elif defined(TARGET_OS_IPHONE) /* must come first because it also defines MACOSX */
429 # define DP_OS_NAME             "iPhoneOS"
430 # define DP_OS_STR              "iphoneos"
431 # define USE_GLES2              1
432 # define LINK_TO_ZLIB   1
433 # define LINK_TO_LIBVORBIS 1
434 # define DP_MOBILETOUCH 1
435 # define DP_FREETYPE_STATIC 1
436 #elif defined(__linux__)
437 # define DP_OS_NAME             "Linux"
438 # define DP_OS_STR              "linux"
439 #elif defined(_WIN64)
440 # define DP_OS_NAME             "Windows64"
441 # define DP_OS_STR              "win64"
442 #elif defined(WIN32)
443 # define DP_OS_NAME             "Windows"
444 # define DP_OS_STR              "win32"
445 #elif defined(__FreeBSD__)
446 # define DP_OS_NAME             "FreeBSD"
447 # define DP_OS_STR              "freebsd"
448 #elif defined(__NetBSD__)
449 # define DP_OS_NAME             "NetBSD"
450 # define DP_OS_STR              "netbsd"
451 #elif defined(__OpenBSD__)
452 # define DP_OS_NAME             "OpenBSD"
453 # define DP_OS_STR              "openbsd"
454 #elif defined(MACOSX)
455 # define DP_OS_NAME             "Mac OS X"
456 # define DP_OS_STR              "osx"
457 #elif defined(__MORPHOS__)
458 # define DP_OS_NAME             "MorphOS"
459 # define DP_OS_STR              "morphos"
460 #else
461 # define DP_OS_NAME             "Unknown"
462 # define DP_OS_STR              "unknown"
463 #endif
464
465 #if defined(__GNUC__)
466 # if defined(__i386__)
467 #  define DP_ARCH_STR           "686"
468 #  define SSE_POSSIBLE
469 #  ifdef __SSE__
470 #   define SSE_PRESENT
471 #  endif
472 #  ifdef __SSE2__
473 #   define SSE2_PRESENT
474 #  endif
475 # elif defined(__x86_64__)
476 #  define DP_ARCH_STR           "x86_64"
477 #  define SSE_PRESENT
478 #  define SSE2_PRESENT
479 # elif defined(__powerpc__)
480 #  define DP_ARCH_STR           "ppc"
481 # endif
482 #elif defined(_WIN64)
483 # define DP_ARCH_STR            "x86_64"
484 # define SSE_PRESENT
485 # define SSE2_PRESENT
486 #elif defined(WIN32)
487 # define DP_ARCH_STR            "x86"
488 # define SSE_POSSIBLE
489 #endif
490
491 #ifdef SSE_PRESENT
492 # define SSE_POSSIBLE
493 #endif
494
495 #ifdef NO_SSE
496 # undef SSE_PRESENT
497 # undef SSE_POSSIBLE
498 # undef SSE2_PRESENT
499 #endif
500
501 #ifdef SSE_POSSIBLE
502 // runtime detection of SSE/SSE2 capabilities for x86
503 qboolean Sys_HaveSSE(void);
504 qboolean Sys_HaveSSE2(void);
505 #else
506 #define Sys_HaveSSE() false
507 #define Sys_HaveSSE2() false
508 #endif
509
510 #include "glquake.h"
511
512 #include "palette.h"
513
514 /// incremented every frame, never reset
515 extern int host_framecount;
516 /// not bounded in any way, changed at start of every frame, never reset
517 extern double realtime;
518 /// equal to Sys_DirtyTime() at the start of this host frame
519 extern double host_dirtytime;
520
521 void Host_InitCommands(void);
522 void Host_Main(void);
523 void Host_Shutdown(void);
524 void Host_StartVideo(void);
525 void Host_Error(const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN;
526 void Host_Quit_f(void);
527 void Host_ClientCommands(const char *fmt, ...) DP_FUNC_PRINTF(1);
528 void Host_ShutdownServer(void);
529 void Host_Reconnect_f(void);
530 void Host_NoOperation_f(void);
531 void Host_LockSession(void);
532 void Host_UnlockSession(void);
533
534 void Host_AbortCurrentFrame(void);
535
536 /// 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)
537 extern int current_skill;
538
539 //
540 // chase
541 //
542 extern cvar_t chase_active;
543 extern cvar_t cl_viewmodel_scale;
544
545 void Chase_Init (void);
546 void Chase_Reset (void);
547 void Chase_Update (void);
548
549 void fractalnoise(unsigned char *noise, int size, int startgrid);
550 void fractalnoisequick(unsigned char *noise, int size, int startgrid);
551 float noise4f(float x, float y, float z, float w);
552
553 void Sys_Shared_Init(void);
554
555 // Flag in size field of demos to indicate a client->server packet. Demo
556 // playback will ignore this, but it may be useful to make DP sniff packets to
557 // debug protocol exploits.
558 #define DEMOMSG_CLIENT_TO_SERVER 0x80000000
559
560 // In Quake, any char in 0..32 counts as whitespace
561 //#define ISWHITESPACE(ch) ((unsigned char) ch <= (unsigned char) ' ')
562 #define ISWHITESPACE(ch) (!(ch) || (ch) == ' ' || (ch) == '\t' || (ch) == '\r' || (ch) == '\n')
563
564 // This also includes extended characters, and ALL control chars
565 #define ISWHITESPACEORCONTROL(ch) ((signed char) (ch) <= (signed char) ' ')
566
567
568 #ifdef PRVM_64
569 #define FLOAT_IS_TRUE_FOR_INT(x) ((x) & 0x7FFFFFFFFFFFFFFF) // also match "negative zero" doubles of value 0x8000000000000000
570 #define FLOAT_LOSSLESS_FORMAT "%.17g"
571 #define VECTOR_LOSSLESS_FORMAT "%.17g %.17g %.17g"
572 #else
573 #define FLOAT_IS_TRUE_FOR_INT(x) ((x) & 0x7FFFFFFF) // also match "negative zero" floats of value 0x80000000
574 #define FLOAT_LOSSLESS_FORMAT "%.9g"
575 #define VECTOR_LOSSLESS_FORMAT "%.9g %.9g %.9g"
576 #endif
577
578 // originally this was _MSC_VER
579 // but here we want to test the system libc, which on win32 is borked, and NOT the compiler
580 #ifdef WIN32
581 #define INT_LOSSLESS_FORMAT_SIZE "I64"
582 #define INT_LOSSLESS_FORMAT_CONVERT_S(x) ((__int64)(x))
583 #define INT_LOSSLESS_FORMAT_CONVERT_U(x) ((unsigned __int64)(x))
584 #else
585 #define INT_LOSSLESS_FORMAT_SIZE "j"
586 #define INT_LOSSLESS_FORMAT_CONVERT_S(x) ((intmax_t)(x))
587 #define INT_LOSSLESS_FORMAT_CONVERT_U(x) ((uintmax_t)(x))
588 #endif
589
590 #endif
591