-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprecompiled.h
400 lines (320 loc) · 10 KB
/
precompiled.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
#ifndef __PRECOMPILED_H__
#define __PRECOMPILED_H__
#ifdef __cplusplus
// RAVEN BEGIN
// nrausch: conditional cvar archive flag so that the pc build will archive certain cvars
#ifdef _XENON
#undef _WINDOWS
#define PC_CVAR_ARCHIVE CVAR_NOCHEAT //so it doesn't clobber
#else
#define PC_CVAR_ARCHIVE CVAR_ARCHIVE
#endif
// RAVEN END
class ThreadedAlloc; // class that is only used to expand the AutoCrit template to tag allocs/frees called from inside the R_AddModelSurfaces call graph
//-----------------------------------------------------
// RAVEN BEGIN
// jscott: set up conditional compiles
#ifdef _DEBUG_MEMORY
#define ID_REDIRECT_NEWDELETE // Doesn't work with Radiant
#define ID_DEBUG_MEMORY
#endif
#if defined( _FINAL ) && !defined( _MPBETA )
#define ID_CONSOLE_LOCK
#endif
#ifdef _WINDOWS
// _WIN32 always defined
// _WIN64 also defined for x64 target
#if !defined( _WIN64 )
#define ID_WIN_X86_ASM
#define ID_WIN_X86_MMX
#define ID_WIN_X86_SSE
//#define ID_WIN_X86_SSE2
#endif
// we should never rely on this define in our code. this is here so dodgy external libraries don't get confused
#ifndef WIN32
#define WIN32
#endif
#undef _XBOX
#undef _CONSOLE // Used to comment out code that can't be used on a console
#define _OPENGL
#define _LITTLE_ENDIAN
#undef _CASE_SENSITIVE_FILESYSTEM
#define _USE_OPENAL
#define _USE_VOICECHAT
#define __WITH_PB__
//#define _RV_MEM_SYS_SUPPORT
// when using the PC to make Xenon builds, enable _MD5R_SUPPORT / _MD5R_WRITE_SUPPORT and run with fs_game q4baseXenon
#ifdef Q4SDK
// the SDK can't be compiled with _MD5R_SUPPORT, but since the PC version is we need to maintain ABI
// to make things worse, only the windows version was compiled with _MD5R enabled, the Linux and Mac builds didn't
#define Q4SDK_MD5R
#else // Q4SDK
#define _MD5R_SUPPORT
#define _MD5R_WRITE_SUPPORT
#endif // !Q4SDK
#define _GLVAS_SUPPPORT
//#define RV_BINARYDECLS
#define RV_SINGLE_DECL_FILE
// this can't be used with _RV_MEM_SYS_SUPPORT and actually shouldn't be used at all on the Xenon at present
#if !defined(_RV_MEM_SYS_SUPPORT) && !defined(ID_REDIRECT_NEWDELETE)
#define RV_UNIFIED_ALLOCATOR
#endif
// SMP support for running the backend on a 2nd thread
#define ENABLE_INTEL_SMP
// Enables the batching of vertex cache request in SMP mode.
// Note (TTimo): is tied to ENABLE_INTEL_SMP
#define ENABLE_INTEL_VERTEXCACHE_OPT
// Empty define for Xbox 360 compatibility
#define RESTRICT
#define TIME_THIS_SCOPE(x)
#define NEWLINE "\r\n"
#pragma warning( disable : 4100 ) // unreferenced formal parameter
#pragma warning( disable : 4127 ) // conditional expression is constant
#pragma warning( disable : 4201 ) // non standard extension nameless struct or union
#pragma warning( disable : 4244 ) // conversion to smaller type, possible loss of data
#pragma warning( disable : 4245 ) // signed/unsigned mismatch
#pragma warning( disable : 4389 ) // signed/unsigned mismatch
#pragma warning( disable : 4714 ) // function marked as __forceinline not inlined
#pragma warning( disable : 4800 ) // forcing value to bool 'true' or 'false' (performance warning)
class AlignmentChecker
{
public:
static void UpdateCount(void const * const ptr) {}
static void ClearCount() {}
static void Print() {}
};
#endif // _WINDOWS
#ifdef __linux__
// for offsetof
#include <stddef.h>
// FLT_MAX and such
#include <limits.h>
#include <float.h>
#define __WITH_PB__
#undef WIN32
#undef _XBOX
#undef _CONSOLE
#define _OPENGL
#define _LITTLE_ENDIAN
#define _CASE_SENSITIVE_FILESYSTEM
#define NEWLINE "\n"
#define _GLVAS_SUPPPORT
class AlignmentChecker
{
public:
static void UpdateCount(void const * const ptr) {}
static void ClearCount() {}
static void Print() {}
};
#define RESTRICT
#define TIME_THIS_SCOPE(x)
// we release both a non-SMP and an SMP binary for Linux
#ifdef ENABLE_INTEL_SMP
// Enables the batching of vertex cache request in SMP mode.
// Note (TTimo): is tied to ENABLE_INTEL_SMP
#define ENABLE_INTEL_VERTEXCACHE_OPT
#endif
#endif
#ifdef MACOS_X
// for offsetof
#include <stddef.h>
#include <ppc_intrinsics.h> // for square root estimate instruction
#include <limits.h>
#include <float.h> // for FLT_MIN
// SMP support for running the backend on a 2nd thread
#ifndef ENABLE_INTEL_SMP
#define ENABLE_INTEL_SMP
#endif
// Enables the batching of vertex cache request in SMP mode.
// Note (TTimo): is tied to ENABLE_INTEL_SMP
#define ENABLE_INTEL_VERTEXCACHE_OPT
#define __WITH_PB__
#undef WIN32
#undef _XBOX
#undef _CONSOLE
#define _OPENGL
#ifdef __ppc__
#undef _LITTLE_ENDIAN
#else
#define _LITTLE_ENDIAN
#endif
#define _CASE_SENSITIVE_FILESYSTEM
#define _USE_OPENAL
#define ID_INLINE inline
#define NEWLINE "\n"
#define _GLVAS_SUPPPORT
class AlignmentChecker
{
public:
static void UpdateCount(void const * const ptr) {}
static void ClearCount() {}
static void Print() {}
};
#define RESTRICT
#define TIME_THIS_SCOPE(x)
#endif
#ifdef _WINDOWS
#ifndef Q4SDK
#if !defined( GAME_DLL ) && !defined( GAME_MONO )
#define _WIN32_WINNT 0x501
#define WINVER 0x501
#ifdef ID_DEDICATED
// dedicated sets windows version here
#define WIN32_LEAN_AND_MEAN
#else
#ifdef TOOL_DLL
// non-dedicated includes MFC and sets windows verion here
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // prevent auto literal to string conversion
#include "../tools/comafx/StdAfx.h"
#endif // TOOL_DLL
#endif // ID_DEDICATED
#include <winsock2.h>
#include <mmsystem.h>
#include <mmreg.h>
#define DIRECTINPUT_VERSION 0x0700
#define DIRECTSOUND_VERSION 0x0800
#include "../mssdk/include/dsound.h"
#include "../mssdk/include/dinput.h"
#include "../mssdk/include/dxerr8.h"
#endif // GAME_DLL
#endif // !Q4SDK
#include <malloc.h> // no malloc.h on mac or unix
#include <windows.h> // for qgl.h
// RAVEN BEGIN
// bdube: for dual monitor support in tools
#ifndef GET_X_LPARAM
#define GET_X_LPARAM(lParam) ((int)(short)LOWORD(lParam))
#endif
#ifndef GET_Y_LPARAM
#define GET_Y_LPARAM(lParam) ((int)(short)HIWORD(lParam))
#endif
// RAVEN END
#undef FindText // stupid namespace poluting Microsoft monkeys
#endif // _WINDOWS
//-----------------------------------------------------
#if !defined( _DEBUG ) && !defined( NDEBUG )
// don't generate asserts
#define NDEBUG
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <ctype.h>
#include <typeinfo>
#include <errno.h>
#include <math.h>
//-----------------------------------------------------
// non-portable system services
#include "../sys/sys_public.h"
// id lib
#include "../idlib/Lib.h"
#if !defined( Q4SDK ) && defined( __WITH_PB__ )
#include "../punkbuster/pbcommon.h"
#endif
// RAVEN BEGIN
// jsinger: added to allow support for serialization/deserialization of binary decls
#ifdef RV_BINARYDECLS
// jsinger: Serializable class support
#include "../serialization/Serializable.h"
#endif
// RAVEN END
// framework
#include "../framework/BuildVersion.h"
#include "../framework/BuildDefines.h"
#include "../framework/licensee.h"
#include "../framework/CmdSystem.h"
#include "../framework/CVarSystem.h"
#include "../framework/Common.h"
#include "../framework/File.h"
#include "../framework/FileSystem.h"
#include "../framework/UsercmdGen.h"
// decls
#include "../framework/declManager.h"
#include "../framework/declTable.h"
#include "../framework/declSkin.h"
#include "../framework/declEntityDef.h"
// RAVEN BEGIN
// jscott: not using
//#include "../framework/DeclFX.h"
//#include "../framework/DeclParticle.h"
// RAVEN END
#include "../framework/declAF.h"
#include "../framework/DeclPDA.h"
#include "../framework/DeclPlayerModel.h"
// RAVEN BEGIN
// jscott: new decl types
#include "../framework/declMatType.h"
#include "../framework/declLipSync.h"
#include "../framework/declPlayback.h"
// RAVEN END
// We have expression parsing and evaluation code in multiple places:
// materials, sound shaders, and guis. We should unify them.
const int MAX_EXPRESSION_OPS = 4096;
const int MAX_EXPRESSION_REGISTERS = 4096;
// Sanity check for any axis in bounds
const float MAX_BOUND_SIZE = 65536.0f;
// renderer
#include "../renderer/qgl.h"
#include "../renderer/Cinematic.h"
#include "../renderer/Material.h"
#include "../renderer/Model.h"
#include "../renderer/ModelManager.h"
#include "../renderer/RenderSystem.h"
#include "../renderer/RenderWorld.h"
// sound engine
#include "../sound/sound.h"
// RAVEN BEGIN
// jscott: Effects system interface
#include "../bse/BSEInterface.h"
// RAVEN END
// asynchronous networking
#include "../framework/async/NetworkSystem.h"
// user interfaces
#include "../ui/ListGUI.h"
#include "../ui/UserInterface.h"
// collision detection system
#include "../cm/CollisionModel.h"
// AAS files and manager
#include "../aas/AASFile.h"
#include "../aas/AASFileManager.h"
// game
#include "../game/Game.h"
//-----------------------------------------------------
#if defined( Q4SDK ) || defined( GAME_DLL ) || defined( GAME_MONO )
#ifdef GAME_MPAPI
#include "../mpgame/Game_local.h"
#else
#include "../game/Game_local.h"
#endif
#else
#include "../framework/DemoChecksum.h"
// framework
#include "../framework/Compressor.h"
#include "../framework/EventLoop.h"
#include "../framework/KeyInput.h"
#include "../framework/EditField.h"
#include "../framework/Console.h"
#include "../framework/DemoFile.h"
#include "../framework/Session.h"
// asynchronous networking
#include "../framework/async/AsyncNetwork.h"
// RAVEN BEGIN
#include "../tools/Tools.h"
// RAVEN END
#endif /* !GAME_DLL */
// RAVEN BEGIN
// jsinger: add AutoPtr and text-to-binary compiler support
#include "AutoPtr.h"
#include "LexerFactory.h"
#include "TextCompiler.h"
// jsinger: AutoCrit.h contains classes which aid in code synchronization
// AutoAcquire.h contains a class that aids in thread acquisition of the direct3D device for xenon
// Both compile out completely if the #define's above are not present
#include "threads/AutoCrit.h"
// RAVEN END
//-----------------------------------------------------
#endif /* __cplusplus */
#endif /* !__PRECOMPILED_H__ */