28#if defined(__cplusplus)
32#define PRODUCT_NAME "OpenMoHAA"
33#define PRODUCT_DATE __DATE__
35#define BASEGAME "main"
37#define LEGACY_PROTOCOL
39#define GAME_EXTENSION_MOH "main"
40#define PRODUCT_EXTENSION_MOH "Allied Assault"
41#define TARGET_GAME_VERSION_MOH "1.12"
42#define TARGET_GAME_PROTOCOL_DEMO_MOH 6
43#define TARGET_GAME_PROTOCOL_MOH 8
44#define TARGET_GAME_NAME_MOH "mohaa"
46#define HOMEPATH_NAME_UNIX_MOH ".moh"
47#define HOMEPATH_NAME_WIN_MOH "moh"
48#define HOMEPATH_NAME_MACOSX_MOH HOMEPATH_NAME_WIN_MOH
50#define GAME_EXTENSION_MOHTA "mainta"
51#define PRODUCT_EXTENSION_MOHTA "Spearhead"
52#define TARGET_GAME_VERSION_MOHTA "2.16"
53#define TARGET_GAME_PROTOCOL_MIN_MOHTA 16
54#define TARGET_GAME_PROTOCOL_MOHTA 17
55#define TARGET_GAME_NAME_MOHTA "mohaas"
57#define HOMEPATH_NAME_UNIX_MOHTA ".mohta"
58#define HOMEPATH_NAME_WIN_MOHTA "mohta"
59#define HOMEPATH_NAME_MACOSX_MOHTA HOMEPATH_NAME_WIN_MOHTA
61#define GAME_EXTENSION_BASE_MOHTT "maintt"
62#define PRODUCT_EXTENSION_MOHTT "Breakthrough"
64#define TARGET_GAME_VERSION_MOHTT "2.41"
65#define TARGET_GAME_VERSION_MOHTT_DEMO "0.31"
66#define TARGET_GAME_PROTOCOL_MIN_MOHTT 16
67#define TARGET_GAME_PROTOCOL_MOHTT 17
68#define TARGET_GAME_NAME_MOHTT "mohaab"
70#define HOMEPATH_NAME_UNIX_MOHTT ".mohtt"
71#define HOMEPATH_NAME_WIN_MOHTT "mohtt"
72#define HOMEPATH_NAME_MACOSX_MOHTT HOMEPATH_NAME_WIN_MOHTT
80 #define HOMEPATH_NAME_UNIX_LEGACY ".openmohaa"
81 #define HOMEPATH_NAME "openmohaa"
83#define CONFIG_PREFIX "opmconfig"
85#define CLIENT_WINDOW_TITLE PRODUCT_NAME
86#define CLIENT_WINDOW_MIN_TITLE PRODUCT_NAME
88#define MAX_MASTER_SERVERS 5
94#pragma warning(disable : 4018)
95#pragma warning(disable : 4032)
96#pragma warning(disable : 4051)
97#pragma warning(disable : 4057)
98#pragma warning(disable : 4100)
99#pragma warning(disable : 4115)
100#pragma warning(disable : 4125)
101#pragma warning(disable : 4127)
102#pragma warning(disable : 4136)
103#pragma warning(disable : 4152)
106#pragma warning(disable : 4244)
107#pragma warning(disable : 4142)
111#pragma warning(disable : 4514)
112#pragma warning(disable : 4702)
113#pragma warning(disable : 4711)
114#pragma warning(disable : 4220)
119#define Q_UNUSED_VAR __attribute__((unused))
120#define Q_NO_RETURN __attribute__((noreturn))
124#define Q_PRINTF_FUNC(fmt, va) \
125 __attribute__((format(gnu_printf, fmt, va))) \
126 __attribute__((format(ms_printf, fmt, va)))
128#define Q_PRINTF_FUNC(fmt, va) __attribute__((format(printf, fmt, va)))
131#define Q_SCANF_FUNC(fmt, va) __attribute__((format(scanf, fmt, va)))
132#define Q_ALIGN(x) __attribute__((aligned(x)))
136#define Q_PRINTF_FUNC(fmt, va)
137#define Q_SCANF_FUNC(fmt, va)
141#if (defined _MSC_VER)
142#define Q_EXPORT __declspec(dllexport)
143#elif (defined __SUNPRO_C)
144#define Q_EXPORT __global
145#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun))
146#define Q_EXPORT __attribute__((visibility("default")))
171# define _CRTDBG_MAP_ALLOC
191 size_t Q_vsnprintf(
char *str,
size_t size,
const char *format, va_list ap) Q_PRINTF_FUNC(3, 0);
193#define Q_vsnprintf vsnprintf
198#include "q_platform.h"
202typedef unsigned char byte;
203typedef unsigned char uchar;
205enum { qfalse, qtrue };
215typedef int qhandle_t;
216typedef int sfxHandle_t;
217typedef int fileHandle_t;
218typedef int clipHandle_t;
221#define ALIGN(x) __attribute__((aligned(x)))
226#define PAD(base, alignment) (((base)+(alignment)-1) & ~((alignment)-1))
227#define PADLEN(base, alignment) (PAD((base), (alignment)) - (base))
229#define PADP(base, alignment) ((void *) PAD((intptr_t) (base), (alignment)))
232#define NULL ((void *)0)
236#define BIT(x) (1 << x)
241#define XSTRING(s) STRING(s)
243#define MAX_QINT 0x7fffffff
244#define MIN_QINT (-MAX_QINT-1)
246#define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x)))
247#define STRARRAY_LEN(x) (ARRAY_LEN(x) - 1)
255#define stricmp strcasecmp
256#define strnicmp strncasecmp
267 PROTOCOL_MOH_MIN = 6,
268 PROTOCOL_MOH_DEMO = 6,
270 PROTOCOL_MOHTA_MIN = 15,
271 PROTOCOL_MOHTA_DEMO = 16,
294#define MAX_STRING_CHARS 2048
295#define MAX_STRING_TOKENS 1024
296#define MAX_TOKEN_CHARS 1024
298#define MAX_INFO_STRING 1350
299#define MAX_INFO_KEY 1024
300#define MAX_INFO_VALUE 1024
302#define BIG_INFO_STRING 8192
303#define BIG_INFO_KEY 8192
304#define BIG_INFO_VALUE 8192
306#define MAX_RES_NAME 64
310#define MAX_OSPATH PATH_MAX
312#define MAX_OSPATH 256
315#define MAX_NAME_LENGTH 32
316#define MAX_HOSTNAME_LENGTH 80
330#define MAX_MAP_AREA_BYTES 32
351 ERR_SERVERDISCONNECT,
359#define PROP_GAP_WIDTH 5
360#define PROP_SPACE_WIDTH 8
361#define PROP_HEIGHT 30
362#define PROP_SMALL_SIZE_SCALE 0.75
364#define BLINK_DIVISOR 200
365#define PULSE_DIVISOR 250.0f
367#define UI_LEFT 0x00000000
368#define UI_CENTER 0x00000001
369#define UI_RIGHT 0x00000002
370#define UI_FORMATMASK 0x00000007
371#define UI_SMALLFONT 0x00000010
372#define UI_BIGFONT 0x00000020
373#define UI_GIANTFONT 0x00000040
374#define UI_DROPSHADOW 0x00000800
375#define UI_BLINK 0x00001000
376#define UI_INVERSE 0x00002000
377#define UI_PULSE 0x00004000
386#define Hunk_Alloc( size, preference ) Hunk_AllocDebug(size, preference, #size, __FILE__, __LINE__)
387void *Hunk_AllocDebug(
int size, ha_pref preference,
const char *label,
const char *file,
int line );
389void *Hunk_Alloc(
int size, ha_pref preference );
392#define Com_Memset memset
393#define Com_Memcpy memcpy
395#define Com_Allocate malloc
396#define Com_Dealloc free
414typedef vec_t vec2_t[2];
415typedef vec_t vec3_t[3];
416typedef vec_t vec4_t[4];
417typedef vec_t quat_t[4];
418typedef vec_t vec5_t[5];
419typedef vec_t matrix3x3_t[9];
420typedef vec_t matrix_t[16];
421typedef vec3_t axis_t[3];
425typedef int fixed16_t;
428#define M_PI 3.14159265358979323846
432#define M_SQRT2 1.414213562f
436#define M_SQRT1_2 7.0710678118654752440E-1
439#define NUMVERTEXNORMALS 162
440extern vec3_t bytedirs[NUMVERTEXNORMALS];
444#define SCREEN_WIDTH 640
445#define SCREEN_HEIGHT 480
447#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
448#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
450#define SMALLCHAR_WIDTH 8
451#define SMALLCHAR_HEIGHT 16
453#define BIGCHAR_WIDTH 16
454#define BIGCHAR_HEIGHT 16
456#define GIANTCHAR_WIDTH 32
457#define GIANTCHAR_HEIGHT 48
459extern vec4_t colorBlack;
460extern vec4_t colorRed;
461extern vec4_t colorGreen;
462extern vec4_t colorBlue;
463extern vec4_t colorYellow;
464extern vec4_t colorMagenta;
465extern vec4_t colorCyan;
466extern vec4_t colorWhite;
467extern vec4_t colorLtGrey;
468extern vec4_t colorMdGrey;
469extern vec4_t colorDkGrey;
480#define Q_COLOR_ESCAPE '^'
481#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1)) )
483#define COLOR_BLACK '0'
485#define COLOR_GREEN '2'
486#define COLOR_YELLOW '3'
487#define COLOR_BLUE '4'
488#define COLOR_CYAN '5'
489#define COLOR_MAGENTA '6'
490#define COLOR_WHITE '7'
491#define ColorIndex(c) ( ( (c) - '0' ) & 7 )
494#define S_COLOR_BLACK "^0"
495#define S_COLOR_RED "^1"
496#define S_COLOR_GREEN "^2"
497#define S_COLOR_YELLOW "^3"
498#define S_COLOR_BLUE "^4"
499#define S_COLOR_CYAN "^5"
500#define S_COLOR_MAGENTA "^6"
501#define S_COLOR_WHITE "^7"
503#define S_COLOR_BLACK ""
504#define S_COLOR_RED ""
505#define S_COLOR_GREEN ""
506#define S_COLOR_YELLOW ""
507#define S_COLOR_BLUE ""
508#define S_COLOR_CYAN ""
509#define S_COLOR_MAGENTA ""
510#define S_COLOR_WHITE ""
513#define HUD_MESSAGE_YELLOW "\x01"
514#define HUD_MESSAGE_WHITE "\x03"
515#define HUD_MESSAGE_CHAT_WHITE "\x02"
516#define HUD_MESSAGE_CHAT_RED "\x04"
518extern vec4_t g_color_table[8];
520#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
521#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
523#define DEG2RAD( a ) ( ( (a) * M_PI ) / 180.0F )
524#define RAD2DEG( a ) ( ( (a) * 180.0f ) / M_PI )
526#define Q_max(a, b) ((a) > (b) ? (a) : (b))
527#define Q_min(a, b) ((a) < (b) ? (a) : (b))
528#define Q_bound(a, b, c) (Q_max(a, Q_min(b, c)))
529#define Q_clamp(a, b, c) ((b) >= (c) ? (a)=(b) : (a) < (b) ? (a)=(b) : (a) > (c) ? (a)=(c) : (a))
530#define Q_lerp(from, to, frac) (from + ((to - from) * frac))
532#define LERP( a, b, w ) ( ( a ) * ( 1.0f - ( w ) ) + ( b ) * ( w ) )
533#define LUMA( red, green, blue ) ( 0.2126f * ( red ) + 0.7152f * ( green ) + 0.0722f * ( blue ) )
536#define Q_min(a,b) (((a) < (b)) ? (a) : (b))
539#define Q_max(a,b) (((a) > (b)) ? (a) : (b))
542int Q_clamp_int(
int value,
int min,
int max);
543float Q_clamp_float(
float value,
float min,
float max);
545#define bound(a,minval,maxval) ( ((a) > (minval)) ? ( ((a) < (maxval)) ? (a) : (maxval) ) : (minval) )
549extern vec3_t vec3_origin;
550extern vec3_t axisDefault[3];
551extern matrix_t matrixIdentity;
553#define nanmask (255<<23)
555#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
557static ID_INLINE
long Q_ftol(
float f)
559#if id386_sse && defined(_MSC_VER)
571static ID_INLINE
float Q_rsqrt(
float number ) {
572 float x = 0.5f * number;
575 asm(
"frsqrte %0,%1" :
"=f" (y) :
"f" (number));
577 y = __frsqrte( number );
579 return y * (1.5f - (x * y * y));
583static ID_INLINE
float Q_fabs(
float x) {
586 asm(
"fabs %0,%1" :
"=f" (abs_x) :
"f" (x));
590#define Q_fabs __fabsf
594float Q_fabs(
float f );
595float Q_rsqrt(
float f );
598#define SQRTFAST( x ) ( (x) * Q_rsqrt( x ) )
600byte ClampByte(
int i);
601signed char ClampChar(
int i );
602signed short ClampShort(
int i );
604double dEpsilon(
void );
605double dIdentity(
void );
606double dSign(
const double number );
607double dClamp(
const double value,
const double min,
const double max );
608double dDistance(
const double value1,
const double value2 );
609qboolean dCloseEnough(
const double value1,
const double value2,
const double epsilon );
610qboolean dSmallEnough(
const double value,
const double epsilon );
612float fEpsilon(
void );
613float fIdentity(
void );
614float fSign(
const float number );
615float fClamp(
const float value,
const float min,
const float max );
616float fDistance(
const float value1,
const float value2 );
617qboolean fCloseEnough(
const float value1,
const float value2,
const float epsilon );
618qboolean fSmallEnough(
const float value,
const float epsilon );
620int iSign(
const int number );
621int iClamp(
const int value,
const int min,
const int max );
624int DirToByte( vec3_t dir );
625void ByteToDir(
int b, vec3_t dir );
629#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
630#define DotProduct2D(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1])
631#define CrossProduct2D(a,b) ((a)[0]*(b)[1]-(b)[0]*(a)[1])
632#define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2])
633#define VectorAdd(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2])
634#define VectorAdd2D(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1])
635#define VectorSub2D(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1])
636#define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2])
637#define VectorCopy2D(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1])
638#define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s))
639#define VectorScale2D(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s))
640#define VectorMA(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s),(o)[2]=(v)[2]+(b)[2]*(s))
641#define VectorMA2D(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s))
645#define DotProduct(x,y) _DotProduct(x,y)
646#define VectorSubtract(a,b,c) _VectorSubtract(a,b,c)
647#define VectorAdd(a,b,c) _VectorAdd(a,b,c)
648#define VectorCopy(a,b) _VectorCopy(a,b)
649#define VectorScale(v, s, o) _VectorScale(v,s,o)
650#define VectorMA(v, s, b, o) _VectorMA(v,s,b,o)
661#define VectorCopy(a,b) (*(vec3struct_t *)b=*(vec3struct_t *)a)
665#define VectorClear2D(a) ((a)[0]=(a)[1]=0)
666#define VectorLength2DSquared(a) ((a)[0]*(a)[0]+(a)[1]*(a)[1])
667#define VectorLength2D(a) (sqrt(VectorLength2DSquared(a)))
668#define VectorSet2D(v, x, y) ((v)[0]=(x), (v)[1]=(y))
670#define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0)
671#define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2])
672#define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z))
673#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
675#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
677#define DotProduct4(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]+(x)[3]*(y)[3])
678#define VectorSubtract4(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2],(c)[3]=(a)[3]-(b)[3])
679#define VectorAdd4(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2],(c)[3]=(a)[3]+(b)[3])
680#define VectorCopy4(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
681#define VectorScale4(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s),(o)[3]=(v)[3]*(s))
682#define VectorMA4(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s),(o)[2]=(v)[2]+(b)[2]*(s),(o)[3]=(v)[3]+(b)[3]*(s))
683#define VectorClear4(a) ((a)[0]=(a)[1]=(a)[2]=(a)[3]=0)
684#define VectorNegate4(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2],(b)[3]=-(a)[3])
685#define VectorSet4(v,x,y,z,w) ((v)[0]=(x),(v)[1]=(y),(v)[2]=(z),(v)[3]=(w))
687#define VectorCopy5(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3],(b)[4]=(a)[4])
690vec_t _DotProduct(
const vec3_t v1,
const vec3_t v2 );
691void _VectorSubtract(
const vec3_t veca,
const vec3_t vecb, vec3_t out );
692void _VectorAdd(
const vec3_t veca,
const vec3_t vecb, vec3_t out );
693void _VectorCopy(
const vec3_t in, vec3_t out );
694void _VectorScale(
const vec3_t in,
float scale, vec3_t out );
695void _VectorMA(
const vec3_t veca,
float scale,
const vec3_t vecb, vec3_t vecc );
696vec_t Q_rint( vec_t in );
698unsigned ColorBytes3 (
float r,
float g,
float b);
699unsigned ColorBytes4 (
float r,
float g,
float b,
float a);
701float NormalizeColor(
const vec3_t in, vec3_t out );
702void RotatePointAroundAxis(vec3_t dst,
int axis,
const vec3_t point,
float degrees);
703void ClampColor(vec4_t color);
705float RadiusFromBounds(
const vec3_t mins,
const vec3_t maxs );
706void ClearBounds( vec3_t mins, vec3_t maxs );
707void ZeroBounds(vec3_t mins, vec3_t maxs);
708void AddPointToBounds(
const vec3_t v, vec3_t mins, vec3_t maxs );
709void BoundsAdd(vec3_t mins, vec3_t maxs,
const vec3_t mins2,
const vec3_t maxs2);
711float PointToSegmentDistanceSquared(
const vec3_t origin,
const vec3_t a,
const vec3_t b);
713#if !defined( Q3_VM ) || ( defined( Q3_VM ) && defined( __Q3_VM_MATH ) )
714static ID_INLINE
int VectorCompare(
const vec3_t v1,
const vec3_t v2 ) {
715 if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
721static ID_INLINE
int VectorCompare2D(
const vec2_t v1,
const vec2_t v2 ) {
722 if( v1[ 0 ] != v2[ 0 ] || v1[ 1 ] != v2[ 1 ] ) {
728static ID_INLINE
int VectorCompareEpsilon(
const vec3_t v1,
const vec3_t v2,
float fEpsilon )
732 for( i = 0; i < 3; i++ )
734 if( fabs( v1[ i ] - v2[ i ] ) > fEpsilon ) {
741static ID_INLINE vec_t VectorLength(
const vec3_t v ) {
742 return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
745static ID_INLINE vec_t VectorLengthSquared(
const vec3_t v ) {
746 return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
749static ID_INLINE vec_t Distance(
const vec3_t p1,
const vec3_t p2 ) {
752 VectorSubtract (p2, p1, v);
753 return VectorLength( v );
756static ID_INLINE vec_t DistanceSquared(
const vec3_t p1,
const vec3_t p2 ) {
759 VectorSubtract (p2, p1, v);
760 return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
765static ID_INLINE
void VectorNormalizeFast( vec3_t v )
769 ilength = Q_rsqrt( DotProduct( v, v ) );
776static ID_INLINE
void VectorInverse( vec3_t v ){
782static ID_INLINE
void CrossProduct(
const vec3_t v1,
const vec3_t v2, vec3_t cross ) {
783 cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
784 cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
785 cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
789int VectorCompare(
const vec3_t v1,
const vec3_t v2 );
791vec_t VectorLength(
const vec3_t v );
793vec_t VectorLengthSquared(
const vec3_t v );
795vec_t Distance(
const vec3_t p1,
const vec3_t p2 );
797vec_t DistanceSquared(
const vec3_t p1,
const vec3_t p2 );
799void VectorNormalizeFast( vec3_t v );
801void VectorInverse( vec3_t v );
803void CrossProduct(
const vec3_t v1,
const vec3_t v2, vec3_t cross );
807vec_t VectorNormalize (vec3_t v);
808vec_t VectorNormalize2(
const vec3_t v, vec3_t out );
809vec_t VectorNormalize2D( vec2_t v );
810vec_t VectorNormalize2D2(
const vec2_t v, vec2_t out );
811void VectorPackTo01( vec3_t v );
812void Vector4Scale(
const vec4_t in, vec_t scale, vec4_t out );
813void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out );
815int NearestPowerOfTwo(
int val);
818float Q_acos(
float c);
820int Q_rand(
int *seed );
821float Q_random(
int *seed );
822float Q_crandom(
int *seed );
824#define random() ((rand () & 0x7fff) / ((float)0x7fff))
825#define random2() ((rand () & 0x7fff) * (1.0 / ((float)0x7fff)))
826#define crandom() (2.0 * (random() - 0.5))
828float grandom(
void );
829float erandom(
float mean );
831#define AnglesToMat AnglesToAxis
833void vectoangles(
const vec3_t value1, vec3_t angles );
834void VectorToAngles(
const vec3_t vec, vec3_t angles );
835void AnglesToAxis(
const vec3_t angles, vec3_t axis[3]);
836void YawToAxis(
float yaw,
float axis[2]);
838float noise(
float vec[],
int len);
839float noise1(
float arg);
840float noise2(vec3_t arg);
841float noise3(vec3_t arg);
843void R_ConcatRotations(
float in1[ 3 ][ 3 ],
float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
844void R_ConcatTransforms(
float in1[ 3 ][ 4 ],
float in2[ 3 ][ 4 ],
float out[ 3 ][ 4 ] );
846void MatrixToEulerAngles(
const float mat[ 3 ][ 3 ], vec3_t ang );
847void QuatToMat(
const float q[ 4 ],
float m[ 3 ][ 3 ] );
848void SlerpQuaternion(
float from[4],
float to[4],
float t,
float res[4]);
849void EulerToQuat(
float ang[ 3 ],
float q[ 4 ] );
850void MatToQuat(
float srcMatrix[ 3 ][ 3 ],
float destQuat[ 4 ] );
852float ProjectPointOnLine(
const vec3_t i_vStart,
const vec3_t i_vEnd,
const vec3_t i_vPoint, vec3_t o_vProj );
853float ProjectLineOnPlane(
const vec3_t vPlaneNorm,
float fPlaneDist,
const vec3_t vStart,
const vec3_t vEnd, vec3_t vProj );
855float anglemod(
float a );
856float angledist(
float ang );
858void AxisClear( vec3_t axis[3] );
859void AxisCopy(
const vec3_t in[3], vec3_t out[3] );
861void SetPlaneSignbits(
struct cplane_s *out );
862int BoxOnPlaneSide (
const vec3_t emins,
const vec3_t emaxs,
struct cplane_s *plane);
864void CalculateRotatedBounds( vec3_t angles, vec3_t mins, vec3_t maxs );
865void CalculateRotatedBounds2(
float trans[ 3 ][ 3 ], vec3_t mins, vec3_t maxs );
866int BoundingBoxToInteger( vec3_t mins, vec3_t maxs );
867void IntegerToBoundingBox(
int num, vec3_t mins, vec3_t maxs );
868qboolean BoundsIntersect(
const vec3_t mins,
const vec3_t maxs,
869 const vec3_t mins2,
const vec3_t maxs2);
870qboolean BoundsIntersectSphere(
const vec3_t mins,
const vec3_t maxs,
871 const vec3_t origin, vec_t radius);
872qboolean BoundsIntersectPoint(
const vec3_t mins,
const vec3_t maxs,
873 const vec3_t origin);
875float AngleMod(
float a);
876float LerpAngle (
float from,
float to,
float frac);
877float LerpAngleFromCurrent(
float from,
float to,
float current,
float frac );
878float AngleSubtract(
float a1,
float a2 );
879void AnglesSubtract( vec3_t v1, vec3_t v2, vec3_t v3 );
881float AngleNormalize360 (
float angle );
882float AngleNormalize180 (
float angle );
883float AngleDelta (
float angle1,
float angle2 );
885qboolean PlaneFromPoints( vec4_t plane,
const vec3_t a,
const vec3_t b,
const vec3_t c );
886qboolean PlanesGetIntersectionPoint(
const vec4_t plane1,
const vec4_t plane2,
const vec4_t plane3, vec3_t out);
887void PlaneIntersectRay(
const vec3_t rayPos,
const vec3_t rayDir,
const vec4_t plane, vec3_t res);
888void ProjectPointOnPlane( vec3_t dst,
const vec3_t p,
const vec3_t normal );
889void RotatePointAroundVector( vec3_t dst,
const vec3_t dir,
const vec3_t point,
float degrees );
890void RotateAroundDirection( vec3_t axis[3],
float yaw );
891void MakeNormalVectors(
const vec3_t forward, vec3_t right, vec3_t up );
896void MatrixTransformVector(
const vec3_t in,
const float mat[ 3 ][ 3 ], vec3_t out );
897void MatrixTransformVectorRight(
const float mat[ 3 ][ 3 ],
const vec3_t in, vec3_t out );
898void Matrix3x3Multiply(
const float in1[ 3 ][ 3 ],
const float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
899void AngleVectors(
const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up );
900void AngleVectorsLeft(
const vec3_t angles, vec3_t forward, vec3_t left, vec3_t up );
901void PerpendicularVector( vec3_t dst,
const vec3_t src );
903void GetPerpendicularViewVector(
const vec3_t point,
const vec3_t p1,
const vec3_t p2, vec3_t up);
904void ProjectPointOntoVector(vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_t vProj);
906float pointToLineDistance(
const vec3_t point,
const vec3_t p1,
const vec3_t p2);
907float VectorMinComponent(vec3_t v);
908float VectorMaxComponent(vec3_t v);
911#define MAX(x,y) ((x)>(y)?(x):(y))
915#define MIN(x,y) ((x)<(y)?(x):(y))
918vec_t DistanceBetweenLineSegmentsSquared(
const vec3_t sP0,
const vec3_t sP1,
919 const vec3_t tP0,
const vec3_t tP1,
float *s,
float *t);
920vec_t DistanceBetweenLineSegments(
const vec3_t sP0,
const vec3_t sP1,
921 const vec3_t tP0,
const vec3_t tP1,
float *s,
float *t);
923void VectorMatrixInverse(
void* DstMatrix,
const void* SrcMatrix );
925void MatrixIdentity(matrix_t m);
926void MatrixClear(matrix_t m);
927void MatrixCopy(
const matrix_t in, matrix_t out);
928qboolean MatrixCompare(
const matrix_t a,
const matrix_t b);
929void MatrixTransposeIntoXMM(
const matrix_t m);
930void MatrixTranspose(
const matrix_t in, matrix_t out);
933qboolean MatrixInverse(matrix_t m);
934void MatrixSetupXRotation(matrix_t m, vec_t degrees);
935void MatrixSetupYRotation(matrix_t m, vec_t degrees);
936void MatrixSetupZRotation(matrix_t m, vec_t degrees);
937void MatrixSetupTranslation(matrix_t m, vec_t x, vec_t y, vec_t z);
938void MatrixSetupScale(matrix_t m, vec_t x, vec_t y, vec_t z);
939void MatrixSetupShear(matrix_t m, vec_t x, vec_t y);
940void Matrix4x4Multiply(
const matrix_t a,
const matrix_t b, matrix_t out);
941void MatrixMultiply(
const float in1[ 3 ][ 3 ],
const float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
942void MatrixMultiply2( matrix_t m,
const matrix_t m2 );
943void MatrixMultiplyRotation(matrix_t m, vec_t pitch, vec_t yaw, vec_t roll);
944void MatrixMultiplyZRotation(matrix_t m, vec_t degrees);
945void MatrixMultiplyTranslation(matrix_t m, vec_t x, vec_t y, vec_t z);
946void MatrixMultiplyScale(matrix_t m, vec_t x, vec_t y, vec_t z);
947void MatrixMultiplyShear(matrix_t m, vec_t x, vec_t y);
948void MatrixToAngles(
const matrix_t m, vec3_t angles);
949void MatrixFromAngles(matrix_t m, vec_t pitch, vec_t yaw, vec_t roll);
950void MatrixFromVectorsFLU(matrix_t m,
const vec3_t forward,
const vec3_t left,
const vec3_t up);
951void MatrixFromVectorsFRU(matrix_t m,
const vec3_t forward,
const vec3_t right,
const vec3_t up);
952void MatrixFromQuat(matrix_t m,
const quat_t q);
953void MatrixFromPlanes(matrix_t m,
const vec4_t left,
const vec4_t right,
const vec4_t bottom,
const vec4_t top,
954 const vec4_t near,
const vec4_t far);
955void MatrixToVectorsFLU(
const matrix_t m, vec3_t forward, vec3_t left, vec3_t up);
956void MatrixToVectorsFRU(
const matrix_t m, vec3_t forward, vec3_t right, vec3_t up);
957void MatrixSetupTransformFromVectorsFLU(matrix_t m,
const vec3_t forward,
const vec3_t left,
const vec3_t up,
const vec3_t origin);
958void MatrixSetupTransformFromVectorsFRU(matrix_t m,
const vec3_t forward,
const vec3_t right,
const vec3_t up,
const vec3_t origin);
959void MatrixSetupTransformFromRotation(matrix_t m,
const matrix_t rot,
const vec3_t origin);
960void MatrixSetupTransformFromQuat(matrix_t m,
const quat_t quat,
const vec3_t origin);
961void MatrixAffineInverse(
const matrix_t in, matrix_t out);
962void MatrixTransformNormal(
const matrix_t m,
const vec3_t in, vec3_t out);
963void MatrixTransformNormal2(
const matrix_t m, vec3_t inout);
964void MatrixTransformPoint(
const matrix_t m,
const vec3_t in, vec3_t out);
965void MatrixTransformPoint2(
const matrix_t m, vec3_t inout);
966void MatrixTransform4(
const matrix_t m,
const vec4_t in, vec4_t out);
967void MatrixTransformPlane(
const matrix_t m,
const vec4_t in, vec4_t out);
968void MatrixTransformPlane2(
const matrix_t m, vec3_t inout);
969void MatrixPerspectiveProjection(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
970void MatrixPerspectiveProjectionLH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
971void MatrixPerspectiveProjectionRH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
972void MatrixPerspectiveProjectionFovYAspectLH(matrix_t m, vec_t fov, vec_t aspect, vec_t near, vec_t far);
973void MatrixPerspectiveProjectionFovXYLH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near, vec_t far);
974void MatrixPerspectiveProjectionFovXYRH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near, vec_t far);
975void MatrixPerspectiveProjectionFovXYInfiniteRH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near);
976void MatrixOrthogonalProjection(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
978void MatrixOrthogonalProjectionLH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
979void MatrixOrthogonalProjectionRH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
981void MatrixPlaneReflection(matrix_t m,
const vec4_t plane);
983void MatrixLookAtLH(matrix_t output,
const vec3_t pos,
const vec3_t dir,
const vec3_t up);
984void MatrixLookAtRH(matrix_t m,
const vec3_t eye,
const vec3_t dir,
const vec3_t up);
985void MatrixScaleTranslateToUnitCube(matrix_t m,
const vec3_t mins,
const vec3_t maxs);
986void MatrixCrop(matrix_t m,
const vec3_t mins,
const vec3_t maxs);
988void TransposeMatrix(
float in[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
990static ID_INLINE
void AnglesToMatrix(
const vec3_t angles, matrix_t m)
992 MatrixFromAngles(m, angles[PITCH], angles[YAW], angles[ROLL]);
996#define QuatSet(q,x,y,z,w) ((q)[0]=(x),(q)[1]=(y),(q)[2]=(z),(q)[3]=(w))
997#define QuatCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
999#define QuatCompare(a,b) ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3])
1001static ID_INLINE
void QuatClear(quat_t q)
1020static ID_INLINE
void QuatCalcW(quat_t q)
1023 vec_t term = 1.0f - (q[0] * q[0] + q[1] * q[1] + q[2] * q[2]);
1030 q[3] = sqrt(fabs(1.0f - (q[0] * q[0] + q[1] * q[1] + q[2] * q[2])));
1034static ID_INLINE
void QuatInverse(quat_t q)
1041static ID_INLINE
void QuatAntipodal(quat_t q)
1049static ID_INLINE vec_t QuatLength(
const quat_t q)
1051 return (vec_t) sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]);
1054vec_t QuatNormalize(quat_t q);
1056void QuatFromAngles(quat_t q, vec_t pitch, vec_t yaw, vec_t roll);
1058static ID_INLINE
void AnglesToQuat(
const vec3_t angles, quat_t q)
1060 QuatFromAngles(q, angles[PITCH], angles[YAW], angles[ROLL]);
1063void QuatFromMatrix(quat_t q,
const matrix_t m);
1064void QuatToVectorsFLU(
const quat_t quat, vec3_t forward, vec3_t left, vec3_t up);
1065void QuatToVectorsFRU(
const quat_t quat, vec3_t forward, vec3_t right, vec3_t up);
1066void QuatToAxis(
const quat_t q, vec3_t axis[3]);
1067void QuatToAngles(
const quat_t q, vec3_t angles);
1070void QuatToRotAngle(
const quat_t q, vec_t *angle );
1071void QuatToRotAngleAxis(
const quat_t q, vec_t *angle, vec3_t axis );
1073void QuatFromRotAngleAxis( quat_t q, vec_t angle,
const vec3_t axis );
1078void QuatMultiply0(quat_t qa,
const quat_t qb);
1081void QuatMultiply1(
const quat_t qa,
const quat_t qb, quat_t qc);
1084void QuatMultiply2(
const quat_t qa,
const quat_t qb, quat_t qc);
1087void QuatMultiply3(
const quat_t qa,
const quat_t qb, quat_t qc);
1090void QuatMultiply4(
const quat_t qa,
const quat_t qb, quat_t qc);
1092void QuaternionMultiply( quat_t output, quat_t first, quat_t second );
1094void QuatSlerp(
const quat_t from,
const quat_t to,
float frac, quat_t out);
1095void QuatTransformVector(
const quat_t q,
const vec3_t in, vec3_t out);
1096int Q_isnan(
float x );
1103 qboolean frameMemory;
1104 int currentElements;
1111void Com_InitGrowList(
growList_t * list,
int maxElements);
1113int Com_AddToGrowList(
growList_t * list,
void *data);
1114void *Com_GrowListElement(
const growList_t * list,
int index);
1115int Com_IndexForGrowListElement(
const growList_t * list,
const void *element);
1120float Com_Clamp(
float min,
float max,
float value );
1122const char *COM_SkipPath(
const char *pathname );
1123const char *COM_GetExtension(
const char *name );
1124void COM_StripExtension(
const char *in,
char *out,
int destsize);
1125qboolean COM_CompareExtension(
const char* in,
const char* ext);
1126void COM_DefaultExtension(
char *path,
int maxSize,
const char *extension );
1128void COM_BeginParseSession(
const char *name );
1129int COM_GetCurrentParseLine(
void );
1130const char *COM_Parse(
char **data_p );
1131char *COM_ParseExt(
char **data_p, qboolean allowLineBreak );
1132char *COM_ParseExtIgnoreQuotes(
char **data_p, qboolean allowLineBreak );
1133const char *COM_GetToken(
char **data_p, qboolean crossline );
1134void Com_SkipRestOfLine(
char **data);
1135void Com_SkipBracedSection(
char **program);
1136void Com_Parse1DMatrix(
char **buf_p,
int x,
float *m, qboolean checkBrackets);
1137int COM_Compress(
char *data_p );
1138void COM_ParseError(
char *format, ... ) Q_PRINTF_FUNC(1, 2);
1139void COM_ParseWarning(
char *format, ... ) Q_PRINTF_FUNC(1, 2);
1142#define MAX_TOKENLENGTH 1024
1150#define TT_PUNCTUATION 5
1159 char string[MAX_TOKENLENGTH];
1164void COM_MatchToken(
char**buf_p,
char *match );
1166qboolean SkipBracedSection (
char **program,
int depth);
1167void SkipRestOfLine (
char **data );
1169void Parse1DMatrix (
char **buf_p,
int x,
float *m);
1170void Parse2DMatrix (
char **buf_p,
int y,
int x,
float *m);
1171void Parse3DMatrix (
char **buf_p,
int z,
int y,
int x,
float *m);
1173int Com_HexStrToInt(
const char *str );
1175size_t QDECL Com_sprintf (
char *dest,
size_t size,
const char *fmt, ...) Q_PRINTF_FUNC(3, 4);
1177char *Com_SkipTokens(
char *s,
int numTokens, const
char *sep );
1178char *Com_SkipCharset(
char *s, const
char *sep );
1180void Com_RandomBytes(
byte*
string,
int len);
1181void Com_BackslashToSlash(
char *str );
1200#define CTRL(a) ((a)-'a'+1)
1202int Q_isprint(
int c );
1203int Q_islower(
int c );
1204int Q_isupper(
int c );
1205int Q_isalpha(
int c );
1206qboolean Q_isanumber(
const char *s );
1207qboolean Q_isintegral(
float f );
1210int Q_stricmp (
const char *s1,
const char *s2);
1211int Q_strncmp(
const char *s1,
const char *s2,
size_t n );
1212int Q_stricmpn (
const char *s1,
const char *s2,
size_t n);
1213char *Q_strlwr(
char *s1 );
1214char *Q_strupr(
char *s1 );
1215char *Q_strrchr(
const char*
string,
int c );
1216const char *Q_stristr(
const char *s,
const char *find);
1217qboolean Q_strreplace(
char *dest,
int destsize,
const char *find,
const char *replace);
1220void Q_strncpyz(
char *dest,
const char *src,
size_t destsize );
1221void Q_strcat(
char *dest,
int size,
const char *src );
1224int Q_PrintStrlen(
const char *
string );
1226char *Q_CleanStr(
char *
string );
1228int Q_CountChar(
const char *
string,
char tocount);
1232void Swap_Init(
void);
1248void Swap_Init (
void);
1250const char * QDECL va(
const char *format, ...) Q_PRINTF_FUNC(1, 2);
1252#define TRUNCATE_LENGTH 64
1253void Com_TruncateLongString(
char *buffer,
const char *s );
1257float vectoyaw(
const vec3_t vec);
1258int MusicMood_NameToNum(
const char * name );
1259const char * MusicMood_NumToName(
int num );
1260int EAXMode_NameToNum(
const char * name );
1261const char * EAXMode_NumToName(
int num );
1266char *Info_ValueForKey(
const char *s,
const char *key );
1267void Info_RemoveKey(
char *s,
const char *key );
1268void Info_RemoveKey_big(
char *s,
const char *key );
1269void Info_SetValueForKey(
char *s,
const char *key,
const char *value );
1270void Info_SetValueForKey_Big(
char *s,
const char *key,
const char *value );
1271qboolean Info_Validate(
const char *s );
1272void Info_NextPair(
const char **s,
char *key,
char *value );
1275void QDECL Com_Error(
int level,
const char *error, ... ) Q_NO_RETURN Q_PRINTF_FUNC(2, 3);
1276void QDECL Com_Printf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1277void QDECL Com_DPrintf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1278void QDECL Com_DPrintf2( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1279void QDECL Com_DebugPrintf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1293#define CVAR_ARCHIVE 0x0001
1296#define CVAR_USERINFO 0x0002
1297#define CVAR_SERVERINFO 0x0004
1298#define CVAR_SYSTEMINFO 0x0008
1299#define CVAR_INIT 0x0010
1301#define CVAR_LATCH 0x0020
1306#define CVAR_ROM 0x0040
1307#define CVAR_USER_CREATED 0x0080
1308#define CVAR_TEMP 0x0100
1309#define CVAR_CHEAT 0x0200
1310#define CVAR_NORESTART 0x0400
1312#define CVAR_SERVER_CREATED 0x0800
1314#define CVAR_SOUND_LATCH 0x1000
1320#define CVAR_TERRAIN_LATCH 0x2000
1322#define CVAR_SAVEGAME 0x4000
1324#define CVAR_VM_CREATED 0x8000
1325#define CVAR_PROTECTED 0x10000
1326#define CVAR_RESETSTRING 0x20000
1328#define CVAR_MODIFIED 0x40000000
1329#define CVAR_NONEXISTENT 0x80000000
1332typedef struct cvar_s cvar_t;
1338 char *latchedString;
1341 int modificationCount;
1357#define MAX_CVAR_VALUE_STRING 256
1359typedef int cvarHandle_t;
1364 cvarHandle_t handle;
1365 int modificationCount;
1368 char string[MAX_CVAR_VALUE_STRING];
1369 char latchedString[MAX_CVAR_VALUE_STRING];
1380#include "surfaceflags.h"
1387#define PLANE_NON_AXIAL 3
1388#define PLANE_NON_PLANAR 4
1398static ID_INLINE
int PlaneTypeForNormal(vec3_t normal)
1400 if(normal[0] == 1.0)
1403 if(normal[1] == 1.0)
1406 if(normal[2] == 1.0)
1409 if(normal[0] == 0.0 && normal[1] == 0.0 && normal[2] == 0.0)
1410 return PLANE_NON_PLANAR;
1412 return PLANE_NON_AXIAL;
1426typedef enum hitloc_e {
1428 HITLOC_GENERAL = -1,
1454 qboolean startsolid;
1470#define SAVEGAME_STRUCT_VERSION 4
1486 char saveName[ 64 ];
1487 char tm_filename[ 64 ];
1500 int iReferenceNumber;
1502 qhandle_t hTreadShader;
1506 vec3_t vStartVerts[ 2 ];
1507 float fStartTexCoord;
1510 vec3_t vMidVerts[ 2 ];
1514 vec3_t vEndVerts[ 2 ];
1534#define KEYCATCH_CONSOLE 0x0001
1535#define KEYCATCH_UI 0x0002
1536#define KEYCATCH_MESSAGE 0x0004
1537#define KEYCATCH_CGAME 0x0008
1561 CHAN_DIALOG_SECONDARY,
1569#define S_FLAG_DO_CALLBACK 0x400
1571#define DEFAULT_MIN_DIST -1.0
1572#define DEFAULT_VOL -1.0
1574#define LEVEL_WIDE_MIN_DIST 10000
1575#define LEVEL_WIDE_STRING "levelwide"
1577#define SOUND_SYNCH 0x1
1578#define SOUND_SYNCH_FADE 0x2
1579#define SOUND_RANDOM_PITCH_20 0x4
1580#define SOUND_RANDOM_PITCH_40 0x8
1581#define SOUND_LOCAL_DIALOG 0x10
1617 eax_carpetedhallway,
1643#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535)
1644#define BYTE2ANGLE(x) ((x)*(360.0/255))
1645#define SHORT2ANGLE(x) ((x)*(360.0/65536))
1647#define SNAPFLAG_RATE_DELAYED 1
1648#define SNAPFLAG_NOT_ACTIVE 2
1649#define SNAPFLAG_SERVERCOUNT 4
1654#define MAX_CLIENTS 64
1655#define MAX_LOCATIONS 64
1657#define MAX_MAP_BOUNDS 8192
1658#define MIN_MAP_BOUNDS ( -MAX_MAP_BOUNDS )
1659#define MAP_SIZE ( MAX_MAP_BOUNDS - MIN_MAP_BOUNDS )
1661#define GENTITYNUM_BITS 10
1662#define MAX_GENTITIES (1<<GENTITYNUM_BITS)
1667#define ENTITYNUM_NONE (MAX_GENTITIES-1)
1668#define ENTITYNUM_WORLD (MAX_GENTITIES-2)
1669#define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2)
1671#define MAX_SERVER_SOUNDS 64
1672#define MAX_SERVER_SOUNDS_BITS (MAX_SERVER_SOUNDS-1)
1674#define MAX_MODELS 1024
1675#define MAX_SOUNDS 512
1676#define MAX_OBJECTIVES 20
1677#define MAX_LIGHTSTYLES 32
1678#define MAX_WEAPONS 64
1680#define MAX_CONFIGSTRINGS 2736
1681#define MAX_HUDDRAW_ELEMENTS 256
1683#define MAX_SUBTITLES 4
1687#define CS_SERVERINFO 0
1688#define CS_SYSTEMINFO 1
1690#define RESERVED_CONFIGSTRINGS 2
1692#define MAX_GAMESTATE_CHARS 41952
1694 int stringOffsets[MAX_CONFIGSTRINGS];
1695 char stringData[MAX_GAMESTATE_CHARS];
1706 short int sound_index;
1716 signed char ofs[ 3 ];
1722#define MAX_ACTIVE_ITEMS 8
1724#define MAX_AMMOCOUNT 16
1726#define MAX_PERSISTANT 16
1727#define MAX_POWERUPS 16
1729#define MAX_PS_EVENTS 2
1731#define PS_PMOVEFRAMECOUNTBITS 6
1757 int delta_angles[3];
1760 int groundEntityNum;
1763 qboolean groundPlane;
1774 int iNetViewModelAnim;
1776 int iViewModelAnimChanged;
1778 int stats[MAX_STATS];
1779 int activeItems[MAX_ACTIVE_ITEMS];
1780 int ammo_name_index[MAX_AMMO];
1781 int ammo_amount[MAX_AMMOCOUNT];
1782 int max_ammo_amount[MAX_AMMOCOUNT];
1784 int current_music_mood;
1785 int fallback_music_mood;
1787 float music_volume_fade_time;
1795 vec3_t camera_origin;
1796 vec3_t camera_angles;
1799 vec3_t camera_offset;
1800 vec3_t camera_posofs;
1802 vec3_t damage_angles;
1821#define BUTTON_ATTACKLEFT_BITINDEX 0
1822#define BUTTON_ATTACKRIGHT_BITINDEX 1
1823#define BUTTON_RUN_BITINDEX 2
1824#define BUTTON_USE_BITINDEX 3
1825#define BUTTON_LEAN_LEFT_BITINDEX 4
1826#define BUTTON_LEAN_RIGHT_BITINDEX 5
1827#define BUTTON_TALK_BITINDEX 6
1828#define BUTTON_ANY_BITINDEX 14
1829#define BUTTON_MOUSE_BITINDEX 15
1831#define BUTTON_ATTACKLEFT (1 << BUTTON_ATTACKLEFT_BITINDEX)
1832#define BUTTON_ATTACKRIGHT (1 << BUTTON_ATTACKRIGHT_BITINDEX)
1833#define BUTTON_RUN (1 << BUTTON_RUN_BITINDEX)
1834#define BUTTON_USE (1 << BUTTON_USE_BITINDEX)
1835#define BUTTON_LEAN_LEFT (1 << BUTTON_LEAN_LEFT_BITINDEX)
1836#define BUTTON_LEAN_RIGHT (1 << BUTTON_LEAN_RIGHT_BITINDEX)
1837#define BUTTON_TALK (1 << BUTTON_TALK_BITINDEX)
1838#define BUTTON_ANY (1 << BUTTON_ANY_BITINDEX)
1839#define BUTTON_MOUSE (1 << BUTTON_MOUSE_BITINDEX)
1842 WEAPON_COMMAND_NONE,
1843 WEAPON_COMMAND_USE_PISTOL,
1844 WEAPON_COMMAND_USE_RIFLE,
1845 WEAPON_COMMAND_USE_SMG,
1846 WEAPON_COMMAND_USE_MG,
1847 WEAPON_COMMAND_USE_GRENADE,
1848 WEAPON_COMMAND_USE_HEAVY,
1849 WEAPON_COMMAND_USE_ITEM1,
1850 WEAPON_COMMAND_USE_ITEM2,
1851 WEAPON_COMMAND_USE_ITEM3,
1852 WEAPON_COMMAND_USE_ITEM4,
1853 WEAPON_COMMAND_USE_PREV_WEAPON,
1854 WEAPON_COMMAND_USE_NEXT_WEAPON,
1855 WEAPON_COMMAND_USE_LAST_WEAPON,
1856 WEAPON_COMMAND_HOLSTER,
1857 WEAPON_COMMAND_DROP,
1860#define WEAPON_COMMAND_MAX_VER6 15
1861#define WEAPON_COMMAND_MAX_VER17 31
1863static unsigned int GetWeaponCommandMask(
unsigned int maxCmds) {
1864 return maxCmds << 7;
1867static unsigned int GetWeaponCommand(
unsigned int buttons,
unsigned int maxCmds) {
1868 return (buttons & (maxCmds << 7)) >> 7;
1878 short unsigned int buttons;
1879 short int angles[3];
1883 signed char forwardmove, rightmove, upmove;
1891#define MDL_ANIM_DELTA_DRIVEN ( 1 << 0 )
1892#define MDL_ANIM_DEFAULT_ANGLES ( 1 << 3 )
1893#define MDL_ANIM_NO_TIMECHECK ( 1 << 4 )
1896#define SOLID_BMODEL 0xffffff
1903#define RF_THIRD_PERSON (1<<0)
1904#define RF_FIRST_PERSON (1<<1)
1905#define RF_DEPTHHACK (1<<2)
1906#define RF_VIEWLENSFLARE (1<<3)
1907#define RF_FRAMELERP (1<<4)
1908#define RF_BEAM (1<<5)
1909#define RF_DONTDRAW (1<<7)
1910#define RF_LENSFLARE (1<<8)
1911#define RF_EXTRALIGHT (1<<9)
1912#define RF_DETAIL (1<<10)
1913#define RF_SHADOW (1<<11)
1914#define RF_PORTALSURFACE (1<<12)
1915#define RF_SKYORIGIN (1<<13)
1916#define RF_SKYENTITY (1<<14)
1917#define RF_LIGHTOFFSET (1<<15)
1918#define RF_CUSTOMSHADERPASS (1<<16)
1919#define RF_MINLIGHT (1<<17)
1920#define RF_FULLBRIGHT (1<<18)
1921#define RF_LIGHTING_ORIGIN (1<<19)
1925#define RF_SHADOW_PLANE (1<<20)
1926#define RF_WRAP_FRAMES (1<<21)
1930#define RF_ADDITIVE_DLIGHT (1<<22)
1931#define RF_LIGHTSTYLE_DLIGHT (1<<23)
1932#define RF_SHADOW_PRECISE (1<<24)
1933#define RF_INVISIBLE (1<<25)
1934#define RF_ALWAYSDRAW (1<<26)
1935#define RF_PRECISESHADOW (1<<28)
1939#define RF_FLAGS_NOT_INHERITED ( RF_LENSFLARE | RF_VIEWLENSFLARE | RF_BEAM | RF_EXTRALIGHT | RF_SKYORIGIN | RF_SHADOW | RF_SHADOW_PRECISE | RF_SHADOW_PLANE )
1944#define RF_FORCENOLOD 1024
1946#define BEAM_LIGHTNING_EFFECT (1<<0)
1947#define BEAM_USEMODEL (1<<1)
1948#define BEAM_PERSIST_EFFECT (1<<2)
1949#define BEAM_SPHERE_EFFECT (1<<3)
1950#define BEAM_RANDOM_DELAY (1<<4)
1951#define BEAM_TOGGLE (1<<5)
1952#define BEAM_RANDOM_TOGGLEDELAY (1<<6)
1953#define BEAM_WAVE_EFFECT (1<<7)
1954#define BEAM_USE_NOISE (1<<8)
1955#define BEAM_PARENT (1<<9)
1956#define BEAM_TILESHADER (1<<10)
1957#define BEAM_OFFSET_ENDPOINTS (1<<11)
1958#define BEAM_FADE (1<<12)
1959#define BEAM_INVERTED (1<<13)
1960#define BEAM_INVERTED_FAST (1<<14)
1983#define NUM_BONE_CONTROLLERS 5
1985#define NUM_MORPH_CONTROLLERS 10
1987#define MAX_MODEL_SURFACES 32
1989#define MDL_SURFACE_SKINOFFSET_BIT0 ( 1 << 0 )
1990#define MDL_SURFACE_SKINOFFSET_BIT1 ( 1 << 1 )
1991#define MDL_SURFACE_NODRAW ( 1 << 2 )
1992#define MDL_SURFACE_SURFACETYPE_BIT0 ( 1 << 3 )
1993#define MDL_SURFACE_SURFACETYPE_BIT1 ( 1 << 4 )
1994#define MDL_SURFACE_SURFACETYPE_BIT2 ( 1 << 5 )
1995#define MDL_SURFACE_CROSSFADE_SKINS ( 1 << 6 )
1996#define MDL_SURFACE_SKIN_NO_DAMAGE ( 1 << 7 )
1998#define CROUCH_HEIGHT 36
1999#define CROUCH_EYE_HEIGHT 48
2000#define STAND_HEIGHT 72
2001#define STAND_EYE_HEIGHT 82
2003#define MAX_FRAMEINFOS 16
2004#define FRAMEINFO_BLEND ( MAX_FRAMEINFOS >> 1 )
2029 float loopSoundVolume;
2030 float loopSoundMinDist;
2031 float loopSoundMaxDist;
2032 float loopSoundPitch;
2038 qboolean attach_use_angles;
2039 vec3_t attach_offset;
2047 frameInfo_t frameInfo[ MAX_FRAMEINFOS ];
2050 int bone_tag[ NUM_BONE_CONTROLLERS ];
2051 vec3_t bone_angles[ NUM_BONE_CONTROLLERS ];
2052 quat_t bone_quat[ NUM_BONE_CONTROLLERS ];
2053 byte surfaces[ 32 ];
2056 int groundEntityNum;
2063 float shader_data[ 2 ];
2100 unsigned short factor;
2101 unsigned short pattern;
2113 HUD_ALIGN_X_LEFT = 0,
2114 HUD_ALIGN_X_CENTER = 1,
2115 HUD_ALIGN_X_RIGHT = 2,
2116 HUD_ALIGN_Y_TOP = 0,
2117 HUD_ALIGN_Y_CENTER = 1,
2118 HUD_ALIGN_Y_BOTTOM = 2,
2123 char shaderName[ MAX_RES_NAME ];
2132 int iHorizontalAlign;
2134 qboolean bVirtualScreen;
2136 char string[ MAX_STRING_CHARS ];
2137 char fontName[ MAX_RES_NAME ];
2143 frameInfo_t g_VMFrameInfo[MAX_FRAMEINFOS];
2146 int g_iLastVMAnimChanged;
2147 int g_iCurrentVMAnimSlot;
2148 int g_iCurrentVMDuration;
2150 qboolean g_bCrossblending;
2152 int g_iLastEquippedWeaponStat;
2153 char g_szLastActiveItem[ 80 ];
2154 int g_iLastAnimPrefixIndex;
2156 float g_vCurrentVMPosOffset[ 3 ];
2159#define GLYPH_START 0
2160#define GLYPH_END 255
2161#define GLYPH_CHARSTART 32
2162#define GLYPH_CHAREND 127
2163#define GLYPHS_PER_FONT GLYPH_END - GLYPH_START + 1
2177 char shaderName[32];
2183 char name[MAX_QPATH];
2186#define Square(x) ((x)*(x))
2194#define AS_MPLAYER 99
2196#define AS_FAVORITES 3
2211typedef enum _flag_status {
2237#define MAX_GLOBAL_SERVERS 2048
2238#define MAX_OTHER_SERVERS 128
2239#define MAX_PINGREQUESTS 32
2240#define MAX_SERVERSTATUSREQUESTS 16
2247#define CDCHKSUM_LEN 2
2249#define FLOAT_TO_INT( x, fracbits ) ( ( x ) * ( 1 << ( fracbits ) ) )
2251#define FLOAT_TO_PKT( x, dest, wholebits, fracbits ) \
2253 if ( ( x ) >= ( 1 << ( wholebits ) ) ) \
2255 ( dest ) = FLOAT_TO_INT( ( 1 << ( wholebits ) ), ( fracbits ) ) - 1; \
2257 else if ( ( x ) < 0 ) \
2263 ( dest ) = FLOAT_TO_INT( ( x ), ( fracbits ) ); \
2267#define SIGNED_FLOAT_TO_PKT( x, dest, wholebits, fracbits ) \
2270 temp_x = ( x ) + ( 1 << ( wholebits ) ); \
2271 if ( temp_x >= ( 1 << ( ( wholebits ) + 1 ) ) ) \
2272 ( dest ) = FLOAT_TO_INT( ( 1 << ( ( wholebits ) + 1 ) ), ( fracbits ) ) - 1; \
2273 else if ( temp_x < 0 ) \
2276 ( dest ) = FLOAT_TO_INT( temp_x, ( fracbits ) ); \
2279#define INT_TO_FLOAT( x, wholebits, fracbits ) ( ( float )( ( ( float )( x ) ) / ( float )( 1 << ( fracbits ) ) - ( float )( 1 << ( wholebits ) ) ) )
2280#define UINT_TO_FLOAT( x, fracbits ) ( ( float )( ( ( float )( x ) ) / ( float )( 1 << ( fracbits ) ) ) )
2282#define TRANSLATION_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 11 )
2283#define PKT_TO_TRANSLATION( x ) UINT_TO_FLOAT( ( x ), 11 )
2285#define OFFSET_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 1, 14 )
2286#define PKT_TO_OFFSET( x ) UINT_TO_FLOAT( ( x ), 14 )
2288#define ROTATE_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 9, 6 )
2289#define PKT_TO_ROTATE( x ) UINT_TO_FLOAT( ( x ), 6 )
2291#define BASE_TO_PKT( x, dest ) SIGNED_FLOAT_TO_PKT( ( x ), ( dest ), 3, 4 )
2292#define PKT_TO_BASE( x ) INT_TO_FLOAT( ( x ), 3, 4 )
2294#define AMPLITUDE_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2295#define PKT_TO_AMPLITUDE( x ) UINT_TO_FLOAT( ( x ), 4 )
2297#define PHASE_TO_PKT( x, dest ) SIGNED_FLOAT_TO_PKT( ( x ), ( dest ), 3, 4 )
2298#define PKT_TO_PHASE( x ) INT_TO_FLOAT( ( x ), 3, 4 )
2300#define FREQUENCY_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2301#define PKT_TO_FREQUENCY( x ) UINT_TO_FLOAT( ( x ), 4 )
2303#define BEAM_PARM_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2304#define PKT_TO_BEAM_PARM( x ) UINT_TO_FLOAT( ( x ), 4 )
2306#define STUB() printf( "STUB: function %s in %s line %d.\n", __FUNCTION__, __FILE__, __LINE__ )
2307#define STUB_DESC( description ) printf( "STUB: %s in %s line %d.\n", description, __FILE__, __LINE__ )
2308#define UNIMPLEMENTED() Com_Printf( "FIXME: (%s) is unimplemented (file %s:%d)\n", __FUNCTION__, __FILE__, __LINE__ )
2310#if defined(__cplusplus)
2317using qcclock_t = std::chrono::steady_clock;
2318using qctime_t = qcclock_t::time_point;
2319using qctimedelta_t = qcclock_t::duration;
Definition q_shared.h:1519
Definition q_shared.h:2142
Definition q_shared.h:1417
Definition q_shared.h:1334
Definition q_shared.h:2094
Definition q_shared.h:2104
Definition q_shared.h:2013
Definition q_shared.h:2180
Definition q_shared.h:1962
Definition q_shared.h:1693
Definition g_public.h:168
Definition q_shared.h:2164
Definition q_shared.h:1102
Definition q_shared.h:2121
Definition q_shared.h:1493
Definition q_shared.h:1524
Definition q_shared.h:1154
Definition q_shared.h:1744
Definition q_shared.h:1237
Definition q_shared.h:2082
Definition q_shared.h:2222
Definition q_shared.h:2230
Definition q_shared.h:1472
Definition q_shared.h:1702
Definition q_shared.h:1452
Definition q_shared.h:1978
Definition q_shared.h:1499
Definition q_shared.h:1875
Definition q_shared.h:1715
Definition q_shared.h:1363
Definition q_shared.h:207