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 "omconfig"
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
192 size_t Q_vsnprintf(
char *str,
size_t size,
const char *format, va_list ap) Q_PRINTF_FUNC(3, 0);
194#define Q_vsnprintf vsnprintf
199#include "q_platform.h"
203typedef unsigned char byte;
204typedef unsigned char uchar;
206enum { qfalse, qtrue };
216typedef int qhandle_t;
217typedef int sfxHandle_t;
218typedef int fileHandle_t;
219typedef int clipHandle_t;
222#define ALIGN(x) __attribute__((aligned(x)))
227#define PAD(base, alignment) (((base)+(alignment)-1) & ~((alignment)-1))
228#define PADLEN(base, alignment) (PAD((base), (alignment)) - (base))
230#define PADP(base, alignment) ((void *) PAD((intptr_t) (base), (alignment)))
233#define NULL ((void *)0)
237#define BIT(x) (1 << x)
242#define XSTRING(s) STRING(s)
244#define MAX_QINT 0x7fffffff
245#define MIN_QINT (-MAX_QINT-1)
247#define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x)))
248#define STRARRAY_LEN(x) (ARRAY_LEN(x) - 1)
256#define stricmp strcasecmp
257#define strnicmp strncasecmp
268 PROTOCOL_MOH_MIN = 6,
269 PROTOCOL_MOH_DEMO = 6,
271 PROTOCOL_MOHTA_MIN = 15,
272 PROTOCOL_MOHTA_DEMO = 16,
295#define MAX_STRING_CHARS 2048
296#define MAX_STRING_TOKENS 1024
297#define MAX_TOKEN_CHARS 1024
299#define MAX_INFO_STRING 1350
300#define MAX_INFO_KEY 1024
301#define MAX_INFO_VALUE 1024
303#define BIG_INFO_STRING 8192
304#define BIG_INFO_KEY 8192
305#define BIG_INFO_VALUE 8192
307#define MAX_RES_NAME 64
311#define MAX_OSPATH PATH_MAX
313#define MAX_OSPATH 256
316#define MAX_NAME_LENGTH 32
317#define MAX_HOSTNAME_LENGTH 80
331#define MAX_MAP_AREA_BYTES 32
352 ERR_SERVERDISCONNECT,
360#define PROP_GAP_WIDTH 5
361#define PROP_SPACE_WIDTH 8
362#define PROP_HEIGHT 30
363#define PROP_SMALL_SIZE_SCALE 0.75
365#define BLINK_DIVISOR 200
366#define PULSE_DIVISOR 250.0f
368#define UI_LEFT 0x00000000
369#define UI_CENTER 0x00000001
370#define UI_RIGHT 0x00000002
371#define UI_FORMATMASK 0x00000007
372#define UI_SMALLFONT 0x00000010
373#define UI_BIGFONT 0x00000020
374#define UI_GIANTFONT 0x00000040
375#define UI_DROPSHADOW 0x00000800
376#define UI_BLINK 0x00001000
377#define UI_INVERSE 0x00002000
378#define UI_PULSE 0x00004000
387#define Hunk_Alloc( size, preference ) Hunk_AllocDebug(size, preference, #size, __FILE__, __LINE__)
388void *Hunk_AllocDebug(
int size, ha_pref preference,
const char *label,
const char *file,
int line );
390void *Hunk_Alloc(
int size, ha_pref preference );
393#define Com_Memset memset
394#define Com_Memcpy memcpy
396#define Com_Allocate malloc
397#define Com_Dealloc free
415typedef vec_t vec2_t[2];
416typedef vec_t vec3_t[3];
417typedef vec_t vec4_t[4];
418typedef vec_t quat_t[4];
419typedef vec_t vec5_t[5];
420typedef vec_t matrix3x3_t[9];
421typedef vec_t matrix_t[16];
422typedef vec3_t axis_t[3];
426typedef int fixed16_t;
429#define M_PI 3.14159265358979323846
433#define M_SQRT2 1.414213562f
437#define M_SQRT1_2 7.0710678118654752440E-1
440#define NUMVERTEXNORMALS 162
441extern vec3_t bytedirs[NUMVERTEXNORMALS];
445#define SCREEN_WIDTH 640
446#define SCREEN_HEIGHT 480
448#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
449#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
451#define SMALLCHAR_WIDTH 8
452#define SMALLCHAR_HEIGHT 16
454#define BIGCHAR_WIDTH 16
455#define BIGCHAR_HEIGHT 16
457#define GIANTCHAR_WIDTH 32
458#define GIANTCHAR_HEIGHT 48
460extern vec4_t colorBlack;
461extern vec4_t colorRed;
462extern vec4_t colorGreen;
463extern vec4_t colorBlue;
464extern vec4_t colorYellow;
465extern vec4_t colorMagenta;
466extern vec4_t colorCyan;
467extern vec4_t colorWhite;
468extern vec4_t colorLtGrey;
469extern vec4_t colorMdGrey;
470extern vec4_t colorDkGrey;
481#define Q_COLOR_ESCAPE '^'
482#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1)) )
484#define COLOR_BLACK '0'
486#define COLOR_GREEN '2'
487#define COLOR_YELLOW '3'
488#define COLOR_BLUE '4'
489#define COLOR_CYAN '5'
490#define COLOR_MAGENTA '6'
491#define COLOR_WHITE '7'
492#define ColorIndex(c) ( ( (c) - '0' ) & 7 )
495#define S_COLOR_BLACK "^0"
496#define S_COLOR_RED "^1"
497#define S_COLOR_GREEN "^2"
498#define S_COLOR_YELLOW "^3"
499#define S_COLOR_BLUE "^4"
500#define S_COLOR_CYAN "^5"
501#define S_COLOR_MAGENTA "^6"
502#define S_COLOR_WHITE "^7"
504#define S_COLOR_BLACK ""
505#define S_COLOR_RED ""
506#define S_COLOR_GREEN ""
507#define S_COLOR_YELLOW ""
508#define S_COLOR_BLUE ""
509#define S_COLOR_CYAN ""
510#define S_COLOR_MAGENTA ""
511#define S_COLOR_WHITE ""
514#define HUD_MESSAGE_YELLOW "\x01"
515#define HUD_MESSAGE_WHITE "\x03"
516#define HUD_MESSAGE_CHAT_WHITE "\x02"
517#define HUD_MESSAGE_CHAT_RED "\x04"
519extern vec4_t g_color_table[8];
521#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
522#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
524#define DEG2RAD( a ) ( ( (a) * M_PI ) / 180.0F )
525#define RAD2DEG( a ) ( ( (a) * 180.0f ) / M_PI )
527#define Q_max(a, b) ((a) > (b) ? (a) : (b))
528#define Q_min(a, b) ((a) < (b) ? (a) : (b))
529#define Q_bound(a, b, c) (Q_max(a, Q_min(b, c)))
530#define Q_clamp(a, b, c) ((b) >= (c) ? (a)=(b) : (a) < (b) ? (a)=(b) : (a) > (c) ? (a)=(c) : (a))
531#define Q_lerp(from, to, frac) (from + ((to - from) * frac))
533#define LERP( a, b, w ) ( ( a ) * ( 1.0f - ( w ) ) + ( b ) * ( w ) )
534#define LUMA( red, green, blue ) ( 0.2126f * ( red ) + 0.7152f * ( green ) + 0.0722f * ( blue ) )
537#define Q_min(a,b) (((a) < (b)) ? (a) : (b))
540#define Q_max(a,b) (((a) > (b)) ? (a) : (b))
543int Q_clamp_int(
int value,
int min,
int max);
544float Q_clamp_float(
float value,
float min,
float max);
546#define bound(a,minval,maxval) ( ((a) > (minval)) ? ( ((a) < (maxval)) ? (a) : (maxval) ) : (minval) )
550extern vec3_t vec3_origin;
551extern vec3_t axisDefault[3];
552extern matrix_t matrixIdentity;
554#define nanmask (255<<23)
556#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
558static ID_INLINE
long Q_ftol(
float f)
560#if id386_sse && defined(_MSC_VER)
572static ID_INLINE
float Q_rsqrt(
float number ) {
573 float x = 0.5f * number;
576 asm(
"frsqrte %0,%1" :
"=f" (y) :
"f" (number));
578 y = __frsqrte( number );
580 return y * (1.5f - (x * y * y));
584static ID_INLINE
float Q_fabs(
float x) {
587 asm(
"fabs %0,%1" :
"=f" (abs_x) :
"f" (x));
591#define Q_fabs __fabsf
595float Q_fabs(
float f );
596float Q_rsqrt(
float f );
599#define SQRTFAST( x ) ( (x) * Q_rsqrt( x ) )
601byte ClampByte(
int i);
602signed char ClampChar(
int i );
603signed short ClampShort(
int i );
605double dEpsilon(
void );
606double dIdentity(
void );
607double dSign(
const double number );
608double dClamp(
const double value,
const double min,
const double max );
609double dDistance(
const double value1,
const double value2 );
610qboolean dCloseEnough(
const double value1,
const double value2,
const double epsilon );
611qboolean dSmallEnough(
const double value,
const double epsilon );
613float fEpsilon(
void );
614float fIdentity(
void );
615float fSign(
const float number );
616float fClamp(
const float value,
const float min,
const float max );
617float fDistance(
const float value1,
const float value2 );
618qboolean fCloseEnough(
const float value1,
const float value2,
const float epsilon );
619qboolean fSmallEnough(
const float value,
const float epsilon );
621int iSign(
const int number );
622int iClamp(
const int value,
const int min,
const int max );
625int DirToByte( vec3_t dir );
626void ByteToDir(
int b, vec3_t dir );
630#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
631#define DotProduct2D(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1])
632#define CrossProduct2D(a,b) ((a)[0]*(b)[1]-(b)[0]*(a)[1])
633#define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2])
634#define VectorAdd(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2])
635#define VectorAdd2D(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1])
636#define VectorSub2D(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1])
637#define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2])
638#define VectorCopy2D(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1])
639#define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s))
640#define VectorScale2D(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s))
641#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))
642#define VectorMA2D(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s))
646#define DotProduct(x,y) _DotProduct(x,y)
647#define VectorSubtract(a,b,c) _VectorSubtract(a,b,c)
648#define VectorAdd(a,b,c) _VectorAdd(a,b,c)
649#define VectorCopy(a,b) _VectorCopy(a,b)
650#define VectorScale(v, s, o) _VectorScale(v,s,o)
651#define VectorMA(v, s, b, o) _VectorMA(v,s,b,o)
662#define VectorCopy(a,b) (*(vec3struct_t *)b=*(vec3struct_t *)a)
666#define VectorClear2D(a) ((a)[0]=(a)[1]=0)
667#define VectorLength2DSquared(a) ((a)[0]*(a)[0]+(a)[1]*(a)[1])
668#define VectorLength2D(a) (sqrt(VectorLength2DSquared(a)))
669#define VectorSet2D(v, x, y) ((v)[0]=(x), (v)[1]=(y))
671#define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0)
672#define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2])
673#define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z))
674#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
676#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
678#define DotProduct4(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]+(x)[3]*(y)[3])
679#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])
680#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])
681#define VectorCopy4(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
682#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))
683#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))
684#define VectorClear4(a) ((a)[0]=(a)[1]=(a)[2]=(a)[3]=0)
685#define VectorNegate4(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2],(b)[3]=-(a)[3])
686#define VectorSet4(v,x,y,z,w) ((v)[0]=(x),(v)[1]=(y),(v)[2]=(z),(v)[3]=(w))
688#define VectorCopy5(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3],(b)[4]=(a)[4])
691vec_t _DotProduct(
const vec3_t v1,
const vec3_t v2 );
692void _VectorSubtract(
const vec3_t veca,
const vec3_t vecb, vec3_t out );
693void _VectorAdd(
const vec3_t veca,
const vec3_t vecb, vec3_t out );
694void _VectorCopy(
const vec3_t in, vec3_t out );
695void _VectorScale(
const vec3_t in,
float scale, vec3_t out );
696void _VectorMA(
const vec3_t veca,
float scale,
const vec3_t vecb, vec3_t vecc );
697vec_t Q_rint( vec_t in );
699unsigned ColorBytes3 (
float r,
float g,
float b);
700unsigned ColorBytes4 (
float r,
float g,
float b,
float a);
702float NormalizeColor(
const vec3_t in, vec3_t out );
703void RotatePointAroundAxis(vec3_t dst,
int axis,
const vec3_t point,
float degrees);
704void ClampColor(vec4_t color);
706float RadiusFromBounds(
const vec3_t mins,
const vec3_t maxs );
707void ClearBounds( vec3_t mins, vec3_t maxs );
708void ZeroBounds(vec3_t mins, vec3_t maxs);
709void AddPointToBounds(
const vec3_t v, vec3_t mins, vec3_t maxs );
710void BoundsAdd(vec3_t mins, vec3_t maxs,
const vec3_t mins2,
const vec3_t maxs2);
712float PointToSegmentDistanceSquared(
const vec3_t origin,
const vec3_t a,
const vec3_t b);
714#if !defined( Q3_VM ) || ( defined( Q3_VM ) && defined( __Q3_VM_MATH ) )
715static ID_INLINE
int VectorCompare(
const vec3_t v1,
const vec3_t v2 ) {
716 if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
722static ID_INLINE
int VectorCompare2D(
const vec2_t v1,
const vec2_t v2 ) {
723 if( v1[ 0 ] != v2[ 0 ] || v1[ 1 ] != v2[ 1 ] ) {
729static ID_INLINE
int VectorCompareEpsilon(
const vec3_t v1,
const vec3_t v2,
float fEpsilon )
733 for( i = 0; i < 3; i++ )
735 if( fabs( v1[ i ] - v2[ i ] ) > fEpsilon ) {
742static ID_INLINE vec_t VectorLength(
const vec3_t v ) {
743 return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
746static ID_INLINE vec_t VectorLengthSquared(
const vec3_t v ) {
747 return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
750static ID_INLINE vec_t Distance(
const vec3_t p1,
const vec3_t p2 ) {
753 VectorSubtract (p2, p1, v);
754 return VectorLength( v );
757static ID_INLINE vec_t DistanceSquared(
const vec3_t p1,
const vec3_t p2 ) {
760 VectorSubtract (p2, p1, v);
761 return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
766static ID_INLINE
void VectorNormalizeFast( vec3_t v )
770 ilength = Q_rsqrt( DotProduct( v, v ) );
777static ID_INLINE
void VectorInverse( vec3_t v ){
783static ID_INLINE
void CrossProduct(
const vec3_t v1,
const vec3_t v2, vec3_t cross ) {
784 cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
785 cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
786 cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
790int VectorCompare(
const vec3_t v1,
const vec3_t v2 );
792vec_t VectorLength(
const vec3_t v );
794vec_t VectorLengthSquared(
const vec3_t v );
796vec_t Distance(
const vec3_t p1,
const vec3_t p2 );
798vec_t DistanceSquared(
const vec3_t p1,
const vec3_t p2 );
800void VectorNormalizeFast( vec3_t v );
802void VectorInverse( vec3_t v );
804void CrossProduct(
const vec3_t v1,
const vec3_t v2, vec3_t cross );
808vec_t VectorNormalize (vec3_t v);
809vec_t VectorNormalize2(
const vec3_t v, vec3_t out );
810vec_t VectorNormalize2D( vec2_t v );
811vec_t VectorNormalize2D2(
const vec2_t v, vec2_t out );
812void VectorPackTo01( vec3_t v );
813void Vector4Scale(
const vec4_t in, vec_t scale, vec4_t out );
814void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out );
816int NearestPowerOfTwo(
int val);
819float Q_acos(
float c);
821int Q_rand(
int *seed );
822float Q_random(
int *seed );
823float Q_crandom(
int *seed );
825#define random() ((rand () & 0x7fff) / ((float)0x7fff))
826#define random2() ((rand () & 0x7fff) * (1.0 / ((float)0x7fff)))
827#define crandom() (2.0 * (random() - 0.5))
829float grandom(
void );
830float erandom(
float mean );
832#define AnglesToMat AnglesToAxis
834void vectoangles(
const vec3_t value1, vec3_t angles );
835void VectorToAngles(
const vec3_t vec, vec3_t angles );
836void AnglesToAxis(
const vec3_t angles, vec3_t axis[3]);
837void YawToAxis(
float yaw,
float axis[2]);
839float noise(
float vec[],
int len);
840float noise1(
float arg);
841float noise2(vec3_t arg);
842float noise3(vec3_t arg);
844void R_ConcatRotations(
float in1[ 3 ][ 3 ],
float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
845void R_ConcatTransforms(
float in1[ 3 ][ 4 ],
float in2[ 3 ][ 4 ],
float out[ 3 ][ 4 ] );
847void MatrixToEulerAngles(
const float mat[ 3 ][ 3 ], vec3_t ang );
848void QuatToMat(
const float q[ 4 ],
float m[ 3 ][ 3 ] );
849void SlerpQuaternion(
float from[4],
float to[4],
float t,
float res[4]);
850void EulerToQuat(
float ang[ 3 ],
float q[ 4 ] );
851void MatToQuat(
float srcMatrix[ 3 ][ 3 ],
float destQuat[ 4 ] );
853float ProjectPointOnLine(
const vec3_t i_vStart,
const vec3_t i_vEnd,
const vec3_t i_vPoint, vec3_t o_vProj );
854float ProjectLineOnPlane(
const vec3_t vPlaneNorm,
float fPlaneDist,
const vec3_t vStart,
const vec3_t vEnd, vec3_t vProj );
856float anglemod(
float a );
857float angledist(
float ang );
859void AxisClear( vec3_t axis[3] );
860void AxisCopy(
const vec3_t in[3], vec3_t out[3] );
862void SetPlaneSignbits(
struct cplane_s *out );
863int BoxOnPlaneSide (
const vec3_t emins,
const vec3_t emaxs,
struct cplane_s *plane);
865void CalculateRotatedBounds( vec3_t angles, vec3_t mins, vec3_t maxs );
866void CalculateRotatedBounds2(
float trans[ 3 ][ 3 ], vec3_t mins, vec3_t maxs );
867int BoundingBoxToInteger( vec3_t mins, vec3_t maxs );
868void IntegerToBoundingBox(
int num, vec3_t mins, vec3_t maxs );
869qboolean BoundsIntersect(
const vec3_t mins,
const vec3_t maxs,
870 const vec3_t mins2,
const vec3_t maxs2);
871qboolean BoundsIntersectSphere(
const vec3_t mins,
const vec3_t maxs,
872 const vec3_t origin, vec_t radius);
873qboolean BoundsIntersectPoint(
const vec3_t mins,
const vec3_t maxs,
874 const vec3_t origin);
876float AngleMod(
float a);
877float LerpAngle (
float from,
float to,
float frac);
878float LerpAngleFromCurrent(
float from,
float to,
float current,
float frac );
879float AngleSubtract(
float a1,
float a2 );
880void AnglesSubtract( vec3_t v1, vec3_t v2, vec3_t v3 );
882float AngleNormalize360 (
float angle );
883float AngleNormalize180 (
float angle );
884float AngleDelta (
float angle1,
float angle2 );
886qboolean PlaneFromPoints( vec4_t plane,
const vec3_t a,
const vec3_t b,
const vec3_t c );
887qboolean PlanesGetIntersectionPoint(
const vec4_t plane1,
const vec4_t plane2,
const vec4_t plane3, vec3_t out);
888void PlaneIntersectRay(
const vec3_t rayPos,
const vec3_t rayDir,
const vec4_t plane, vec3_t res);
889void ProjectPointOnPlane( vec3_t dst,
const vec3_t p,
const vec3_t normal );
890void RotatePointAroundVector( vec3_t dst,
const vec3_t dir,
const vec3_t point,
float degrees );
891void RotateAroundDirection( vec3_t axis[3],
float yaw );
892void MakeNormalVectors(
const vec3_t forward, vec3_t right, vec3_t up );
897void MatrixTransformVector(
const vec3_t in,
const float mat[ 3 ][ 3 ], vec3_t out );
898void MatrixTransformVectorRight(
const float mat[ 3 ][ 3 ],
const vec3_t in, vec3_t out );
899void Matrix3x3Multiply(
const float in1[ 3 ][ 3 ],
const float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
900void AngleVectors(
const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up );
901void AngleVectorsLeft(
const vec3_t angles, vec3_t forward, vec3_t left, vec3_t up );
902void PerpendicularVector( vec3_t dst,
const vec3_t src );
904void GetPerpendicularViewVector(
const vec3_t point,
const vec3_t p1,
const vec3_t p2, vec3_t up);
905void ProjectPointOntoVector(vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_t vProj);
907float pointToLineDistance(
const vec3_t point,
const vec3_t p1,
const vec3_t p2);
908float VectorMinComponent(vec3_t v);
909float VectorMaxComponent(vec3_t v);
912#define MAX(x,y) ((x)>(y)?(x):(y))
916#define MIN(x,y) ((x)<(y)?(x):(y))
919vec_t DistanceBetweenLineSegmentsSquared(
const vec3_t sP0,
const vec3_t sP1,
920 const vec3_t tP0,
const vec3_t tP1,
float *s,
float *t);
921vec_t DistanceBetweenLineSegments(
const vec3_t sP0,
const vec3_t sP1,
922 const vec3_t tP0,
const vec3_t tP1,
float *s,
float *t);
924void VectorMatrixInverse(
void* DstMatrix,
const void* SrcMatrix );
926void MatrixIdentity(matrix_t m);
927void MatrixClear(matrix_t m);
928void MatrixCopy(
const matrix_t in, matrix_t out);
929qboolean MatrixCompare(
const matrix_t a,
const matrix_t b);
930void MatrixTransposeIntoXMM(
const matrix_t m);
931void MatrixTranspose(
const matrix_t in, matrix_t out);
934qboolean MatrixInverse(matrix_t m);
935void MatrixSetupXRotation(matrix_t m, vec_t degrees);
936void MatrixSetupYRotation(matrix_t m, vec_t degrees);
937void MatrixSetupZRotation(matrix_t m, vec_t degrees);
938void MatrixSetupTranslation(matrix_t m, vec_t x, vec_t y, vec_t z);
939void MatrixSetupScale(matrix_t m, vec_t x, vec_t y, vec_t z);
940void MatrixSetupShear(matrix_t m, vec_t x, vec_t y);
941void Matrix4x4Multiply(
const matrix_t a,
const matrix_t b, matrix_t out);
942void MatrixMultiply(
const float in1[ 3 ][ 3 ],
const float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
943void MatrixMultiply2( matrix_t m,
const matrix_t m2 );
944void MatrixMultiplyRotation(matrix_t m, vec_t pitch, vec_t yaw, vec_t roll);
945void MatrixMultiplyZRotation(matrix_t m, vec_t degrees);
946void MatrixMultiplyTranslation(matrix_t m, vec_t x, vec_t y, vec_t z);
947void MatrixMultiplyScale(matrix_t m, vec_t x, vec_t y, vec_t z);
948void MatrixMultiplyShear(matrix_t m, vec_t x, vec_t y);
949void MatrixToAngles(
const matrix_t m, vec3_t angles);
950void MatrixFromAngles(matrix_t m, vec_t pitch, vec_t yaw, vec_t roll);
951void MatrixFromVectorsFLU(matrix_t m,
const vec3_t forward,
const vec3_t left,
const vec3_t up);
952void MatrixFromVectorsFRU(matrix_t m,
const vec3_t forward,
const vec3_t right,
const vec3_t up);
953void MatrixFromQuat(matrix_t m,
const quat_t q);
954void MatrixFromPlanes(matrix_t m,
const vec4_t left,
const vec4_t right,
const vec4_t bottom,
const vec4_t top,
955 const vec4_t near,
const vec4_t far);
956void MatrixToVectorsFLU(
const matrix_t m, vec3_t forward, vec3_t left, vec3_t up);
957void MatrixToVectorsFRU(
const matrix_t m, vec3_t forward, vec3_t right, vec3_t up);
958void MatrixSetupTransformFromVectorsFLU(matrix_t m,
const vec3_t forward,
const vec3_t left,
const vec3_t up,
const vec3_t origin);
959void MatrixSetupTransformFromVectorsFRU(matrix_t m,
const vec3_t forward,
const vec3_t right,
const vec3_t up,
const vec3_t origin);
960void MatrixSetupTransformFromRotation(matrix_t m,
const matrix_t rot,
const vec3_t origin);
961void MatrixSetupTransformFromQuat(matrix_t m,
const quat_t quat,
const vec3_t origin);
962void MatrixAffineInverse(
const matrix_t in, matrix_t out);
963void MatrixTransformNormal(
const matrix_t m,
const vec3_t in, vec3_t out);
964void MatrixTransformNormal2(
const matrix_t m, vec3_t inout);
965void MatrixTransformPoint(
const matrix_t m,
const vec3_t in, vec3_t out);
966void MatrixTransformPoint2(
const matrix_t m, vec3_t inout);
967void MatrixTransform4(
const matrix_t m,
const vec4_t in, vec4_t out);
968void MatrixTransformPlane(
const matrix_t m,
const vec4_t in, vec4_t out);
969void MatrixTransformPlane2(
const matrix_t m, vec3_t inout);
970void MatrixPerspectiveProjection(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
971void MatrixPerspectiveProjectionLH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
972void MatrixPerspectiveProjectionRH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
973void MatrixPerspectiveProjectionFovYAspectLH(matrix_t m, vec_t fov, vec_t aspect, vec_t near, vec_t far);
974void MatrixPerspectiveProjectionFovXYLH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near, vec_t far);
975void MatrixPerspectiveProjectionFovXYRH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near, vec_t far);
976void MatrixPerspectiveProjectionFovXYInfiniteRH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near);
977void MatrixOrthogonalProjection(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
979void MatrixOrthogonalProjectionLH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
980void MatrixOrthogonalProjectionRH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
982void MatrixPlaneReflection(matrix_t m,
const vec4_t plane);
984void MatrixLookAtLH(matrix_t output,
const vec3_t pos,
const vec3_t dir,
const vec3_t up);
985void MatrixLookAtRH(matrix_t m,
const vec3_t eye,
const vec3_t dir,
const vec3_t up);
986void MatrixScaleTranslateToUnitCube(matrix_t m,
const vec3_t mins,
const vec3_t maxs);
987void MatrixCrop(matrix_t m,
const vec3_t mins,
const vec3_t maxs);
989void TransposeMatrix(
float in[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
991static ID_INLINE
void AnglesToMatrix(
const vec3_t angles, matrix_t m)
993 MatrixFromAngles(m, angles[PITCH], angles[YAW], angles[ROLL]);
997#define QuatSet(q,x,y,z,w) ((q)[0]=(x),(q)[1]=(y),(q)[2]=(z),(q)[3]=(w))
998#define QuatCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
1000#define QuatCompare(a,b) ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3])
1002static ID_INLINE
void QuatClear(quat_t q)
1021static ID_INLINE
void QuatCalcW(quat_t q)
1024 vec_t term = 1.0f - (q[0] * q[0] + q[1] * q[1] + q[2] * q[2]);
1031 q[3] = sqrt(fabs(1.0f - (q[0] * q[0] + q[1] * q[1] + q[2] * q[2])));
1035static ID_INLINE
void QuatInverse(quat_t q)
1042static ID_INLINE
void QuatAntipodal(quat_t q)
1050static ID_INLINE vec_t QuatLength(
const quat_t q)
1052 return (vec_t) sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]);
1055vec_t QuatNormalize(quat_t q);
1057void QuatFromAngles(quat_t q, vec_t pitch, vec_t yaw, vec_t roll);
1059static ID_INLINE
void AnglesToQuat(
const vec3_t angles, quat_t q)
1061 QuatFromAngles(q, angles[PITCH], angles[YAW], angles[ROLL]);
1064void QuatFromMatrix(quat_t q,
const matrix_t m);
1065void QuatToVectorsFLU(
const quat_t quat, vec3_t forward, vec3_t left, vec3_t up);
1066void QuatToVectorsFRU(
const quat_t quat, vec3_t forward, vec3_t right, vec3_t up);
1067void QuatToAxis(
const quat_t q, vec3_t axis[3]);
1068void QuatToAngles(
const quat_t q, vec3_t angles);
1071void QuatToRotAngle(
const quat_t q, vec_t *angle );
1072void QuatToRotAngleAxis(
const quat_t q, vec_t *angle, vec3_t axis );
1074void QuatFromRotAngleAxis( quat_t q, vec_t angle,
const vec3_t axis );
1079void QuatMultiply0(quat_t qa,
const quat_t qb);
1082void QuatMultiply1(
const quat_t qa,
const quat_t qb, quat_t qc);
1085void QuatMultiply2(
const quat_t qa,
const quat_t qb, quat_t qc);
1088void QuatMultiply3(
const quat_t qa,
const quat_t qb, quat_t qc);
1091void QuatMultiply4(
const quat_t qa,
const quat_t qb, quat_t qc);
1093void QuaternionMultiply( quat_t output, quat_t first, quat_t second );
1095void QuatSlerp(
const quat_t from,
const quat_t to,
float frac, quat_t out);
1096void QuatTransformVector(
const quat_t q,
const vec3_t in, vec3_t out);
1097int Q_isnan(
float x );
1104 qboolean frameMemory;
1105 int currentElements;
1112void Com_InitGrowList(
growList_t * list,
int maxElements);
1114int Com_AddToGrowList(
growList_t * list,
void *data);
1115void *Com_GrowListElement(
const growList_t * list,
int index);
1116int Com_IndexForGrowListElement(
const growList_t * list,
const void *element);
1121float Com_Clamp(
float min,
float max,
float value );
1123const char *COM_SkipPath(
const char *pathname );
1124const char *COM_GetExtension(
const char *name );
1125void COM_StripExtension(
const char *in,
char *out,
int destsize);
1126qboolean COM_CompareExtension(
const char* in,
const char* ext);
1127void COM_DefaultExtension(
char *path,
int maxSize,
const char *extension );
1129void COM_BeginParseSession(
const char *name );
1130int COM_GetCurrentParseLine(
void );
1131const char *COM_Parse(
char **data_p );
1132char *COM_ParseExt(
char **data_p, qboolean allowLineBreak );
1133char *COM_ParseExtIgnoreQuotes(
char **data_p, qboolean allowLineBreak );
1134const char *COM_GetToken(
char **data_p, qboolean crossline );
1135void Com_SkipRestOfLine(
char **data);
1136void Com_SkipBracedSection(
char **program);
1137void Com_Parse1DMatrix(
char **buf_p,
int x,
float *m, qboolean checkBrackets);
1138int COM_Compress(
char *data_p );
1139void COM_ParseError(
char *format, ... ) Q_PRINTF_FUNC(1, 2);
1140void COM_ParseWarning(
char *format, ... ) Q_PRINTF_FUNC(1, 2);
1143#define MAX_TOKENLENGTH 1024
1151#define TT_PUNCTUATION 5
1160 char string[MAX_TOKENLENGTH];
1165void COM_MatchToken(
char**buf_p,
char *match );
1167qboolean SkipBracedSection (
char **program,
int depth);
1168void SkipRestOfLine (
char **data );
1170void Parse1DMatrix (
char **buf_p,
int x,
float *m);
1171void Parse2DMatrix (
char **buf_p,
int y,
int x,
float *m);
1172void Parse3DMatrix (
char **buf_p,
int z,
int y,
int x,
float *m);
1174int Com_HexStrToInt(
const char *str );
1176size_t QDECL Com_sprintf (
char *dest,
size_t size,
const char *fmt, ...) Q_PRINTF_FUNC(3, 4);
1178char *Com_SkipTokens(
char *s,
int numTokens, const
char *sep );
1179char *Com_SkipCharset(
char *s, const
char *sep );
1181void Com_RandomBytes(
byte*
string,
int len);
1182void Com_BackslashToSlash(
char *str );
1201#define CTRL(a) ((a)-'a'+1)
1203int Q_isprint(
int c );
1204int Q_islower(
int c );
1205int Q_isupper(
int c );
1206int Q_isalpha(
int c );
1207qboolean Q_isanumber(
const char *s );
1208qboolean Q_isintegral(
float f );
1211int Q_stricmp (
const char *s1,
const char *s2);
1212int Q_strncmp(
const char *s1,
const char *s2,
size_t n );
1213int Q_stricmpn (
const char *s1,
const char *s2,
size_t n);
1214char *Q_strlwr(
char *s1 );
1215char *Q_strupr(
char *s1 );
1216char *Q_strrchr(
const char*
string,
int c );
1217const char *Q_stristr(
const char *s,
const char *find);
1218qboolean Q_strreplace(
char *dest,
int destsize,
const char *find,
const char *replace);
1221void Q_strncpyz(
char *dest,
const char *src,
size_t destsize );
1222void Q_strcat(
char *dest,
int size,
const char *src );
1225int Q_PrintStrlen(
const char *
string );
1227char *Q_CleanStr(
char *
string );
1229int Q_CountChar(
const char *
string,
char tocount);
1233void Swap_Init(
void);
1249void Swap_Init (
void);
1251const char * QDECL va(
const char *format, ...) Q_PRINTF_FUNC(1, 2);
1253#define TRUNCATE_LENGTH 64
1254void Com_TruncateLongString(
char *buffer,
const char *s );
1258float vectoyaw(
const vec3_t vec);
1259int MusicMood_NameToNum(
const char * name );
1260const char * MusicMood_NumToName(
int num );
1261int EAXMode_NameToNum(
const char * name );
1262const char * EAXMode_NumToName(
int num );
1267char *Info_ValueForKey(
const char *s,
const char *key );
1268void Info_RemoveKey(
char *s,
const char *key );
1269void Info_RemoveKey_big(
char *s,
const char *key );
1270void Info_SetValueForKey(
char *s,
const char *key,
const char *value );
1271void Info_SetValueForKey_Big(
char *s,
const char *key,
const char *value );
1272qboolean Info_Validate(
const char *s );
1273void Info_NextPair(
const char **s,
char *key,
char *value );
1276void QDECL Com_Error(
int level,
const char *error, ... ) Q_NO_RETURN Q_PRINTF_FUNC(2, 3);
1277void QDECL Com_Printf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1278void QDECL Com_DPrintf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1279void QDECL Com_DPrintf2( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1280void QDECL Com_DebugPrintf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1294#define CVAR_ARCHIVE 0x0001
1297#define CVAR_USERINFO 0x0002
1298#define CVAR_SERVERINFO 0x0004
1299#define CVAR_SYSTEMINFO 0x0008
1300#define CVAR_INIT 0x0010
1302#define CVAR_LATCH 0x0020
1307#define CVAR_ROM 0x0040
1308#define CVAR_USER_CREATED 0x0080
1309#define CVAR_TEMP 0x0100
1310#define CVAR_CHEAT 0x0200
1311#define CVAR_NORESTART 0x0400
1313#define CVAR_SERVER_CREATED 0x0800
1315#define CVAR_SOUND_LATCH 0x1000
1321#define CVAR_TERRAIN_LATCH 0x2000
1323#define CVAR_SAVEGAME 0x4000
1325#define CVAR_VM_CREATED 0x8000
1326#define CVAR_PROTECTED 0x10000
1327#define CVAR_RESETSTRING 0x20000
1329#define CVAR_MODIFIED 0x40000000
1330#define CVAR_NONEXISTENT 0x80000000
1333typedef struct cvar_s cvar_t;
1339 char *latchedString;
1342 int modificationCount;
1358#define MAX_CVAR_VALUE_STRING 256
1360typedef int cvarHandle_t;
1365 cvarHandle_t handle;
1366 int modificationCount;
1369 char string[MAX_CVAR_VALUE_STRING];
1370 char latchedString[MAX_CVAR_VALUE_STRING];
1381#include "surfaceflags.h"
1388#define PLANE_NON_AXIAL 3
1389#define PLANE_NON_PLANAR 4
1399static ID_INLINE
int PlaneTypeForNormal(vec3_t normal)
1401 if(normal[0] == 1.0)
1404 if(normal[1] == 1.0)
1407 if(normal[2] == 1.0)
1410 if(normal[0] == 0.0 && normal[1] == 0.0 && normal[2] == 0.0)
1411 return PLANE_NON_PLANAR;
1413 return PLANE_NON_AXIAL;
1427typedef enum hitloc_e {
1429 HITLOC_GENERAL = -1,
1455 qboolean startsolid;
1471#define SAVEGAME_STRUCT_VERSION 4
1487 char saveName[ 64 ];
1488 char tm_filename[ 64 ];
1501 int iReferenceNumber;
1503 qhandle_t hTreadShader;
1507 vec3_t vStartVerts[ 2 ];
1508 float fStartTexCoord;
1511 vec3_t vMidVerts[ 2 ];
1515 vec3_t vEndVerts[ 2 ];
1535#define KEYCATCH_CONSOLE 0x0001
1536#define KEYCATCH_UI 0x0002
1537#define KEYCATCH_MESSAGE 0x0004
1538#define KEYCATCH_CGAME 0x0008
1562 CHAN_DIALOG_SECONDARY,
1570#define S_FLAG_DO_CALLBACK 0x400
1572#define DEFAULT_MIN_DIST -1.0
1573#define DEFAULT_VOL -1.0
1575#define LEVEL_WIDE_MIN_DIST 10000
1576#define LEVEL_WIDE_STRING "levelwide"
1578#define SOUND_SYNCH 0x1
1579#define SOUND_SYNCH_FADE 0x2
1580#define SOUND_RANDOM_PITCH_20 0x4
1581#define SOUND_RANDOM_PITCH_40 0x8
1582#define SOUND_LOCAL_DIALOG 0x10
1618 eax_carpetedhallway,
1644#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535)
1645#define BYTE2ANGLE(x) ((x)*(360.0/255))
1646#define SHORT2ANGLE(x) ((x)*(360.0/65536))
1648#define SNAPFLAG_RATE_DELAYED 1
1649#define SNAPFLAG_NOT_ACTIVE 2
1650#define SNAPFLAG_SERVERCOUNT 4
1655#define MAX_CLIENTS 64
1656#define MAX_LOCATIONS 64
1658#define MAX_MAP_BOUNDS 8192
1659#define MIN_MAP_BOUNDS ( -MAX_MAP_BOUNDS )
1660#define MAP_SIZE ( MAX_MAP_BOUNDS - MIN_MAP_BOUNDS )
1662#define GENTITYNUM_BITS 10
1663#define MAX_GENTITIES (1<<GENTITYNUM_BITS)
1668#define ENTITYNUM_NONE (MAX_GENTITIES-1)
1669#define ENTITYNUM_WORLD (MAX_GENTITIES-2)
1670#define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2)
1672#define MAX_SERVER_SOUNDS 64
1673#define MAX_SERVER_SOUNDS_BITS (MAX_SERVER_SOUNDS-1)
1675#define MAX_MODELS 1024
1676#define MAX_SOUNDS 512
1677#define MAX_OBJECTIVES 20
1678#define MAX_LIGHTSTYLES 32
1679#define MAX_WEAPONS 64
1681#define MAX_CONFIGSTRINGS 2736
1682#define MAX_HUDDRAW_ELEMENTS 256
1684#define MAX_SUBTITLES 4
1688#define CS_SERVERINFO 0
1689#define CS_SYSTEMINFO 1
1691#define RESERVED_CONFIGSTRINGS 2
1693#define MAX_GAMESTATE_CHARS 41952
1695 int stringOffsets[MAX_CONFIGSTRINGS];
1696 char stringData[MAX_GAMESTATE_CHARS];
1707 short int sound_index;
1717 signed char ofs[ 3 ];
1723#define MAX_ACTIVE_ITEMS 8
1725#define MAX_AMMOCOUNT 16
1727#define MAX_PERSISTANT 16
1728#define MAX_POWERUPS 16
1730#define MAX_PS_EVENTS 2
1732#define PS_PMOVEFRAMECOUNTBITS 6
1758 int delta_angles[3];
1761 int groundEntityNum;
1764 qboolean groundPlane;
1775 int iNetViewModelAnim;
1777 int iViewModelAnimChanged;
1779 int stats[MAX_STATS];
1780 int activeItems[MAX_ACTIVE_ITEMS];
1781 int ammo_name_index[MAX_AMMO];
1782 int ammo_amount[MAX_AMMOCOUNT];
1783 int max_ammo_amount[MAX_AMMOCOUNT];
1785 int current_music_mood;
1786 int fallback_music_mood;
1788 float music_volume_fade_time;
1796 vec3_t camera_origin;
1797 vec3_t camera_angles;
1800 vec3_t camera_offset;
1801 vec3_t camera_posofs;
1803 vec3_t damage_angles;
1822#define BUTTON_ATTACKLEFT_BITINDEX 0
1823#define BUTTON_ATTACKRIGHT_BITINDEX 1
1824#define BUTTON_RUN_BITINDEX 2
1825#define BUTTON_USE_BITINDEX 3
1826#define BUTTON_LEAN_LEFT_BITINDEX 4
1827#define BUTTON_LEAN_RIGHT_BITINDEX 5
1828#define BUTTON_TALK_BITINDEX 6
1829#define BUTTON_ANY_BITINDEX 14
1830#define BUTTON_MOUSE_BITINDEX 15
1832#define BUTTON_ATTACKLEFT (1 << BUTTON_ATTACKLEFT_BITINDEX)
1833#define BUTTON_ATTACKRIGHT (1 << BUTTON_ATTACKRIGHT_BITINDEX)
1834#define BUTTON_RUN (1 << BUTTON_RUN_BITINDEX)
1835#define BUTTON_USE (1 << BUTTON_USE_BITINDEX)
1836#define BUTTON_LEAN_LEFT (1 << BUTTON_LEAN_LEFT_BITINDEX)
1837#define BUTTON_LEAN_RIGHT (1 << BUTTON_LEAN_RIGHT_BITINDEX)
1838#define BUTTON_TALK (1 << BUTTON_TALK_BITINDEX)
1839#define BUTTON_ANY (1 << BUTTON_ANY_BITINDEX)
1840#define BUTTON_MOUSE (1 << BUTTON_MOUSE_BITINDEX)
1843 WEAPON_COMMAND_NONE,
1844 WEAPON_COMMAND_USE_PISTOL,
1845 WEAPON_COMMAND_USE_RIFLE,
1846 WEAPON_COMMAND_USE_SMG,
1847 WEAPON_COMMAND_USE_MG,
1848 WEAPON_COMMAND_USE_GRENADE,
1849 WEAPON_COMMAND_USE_HEAVY,
1850 WEAPON_COMMAND_USE_ITEM1,
1851 WEAPON_COMMAND_USE_ITEM2,
1852 WEAPON_COMMAND_USE_ITEM3,
1853 WEAPON_COMMAND_USE_ITEM4,
1854 WEAPON_COMMAND_USE_PREV_WEAPON,
1855 WEAPON_COMMAND_USE_NEXT_WEAPON,
1856 WEAPON_COMMAND_USE_LAST_WEAPON,
1857 WEAPON_COMMAND_HOLSTER,
1858 WEAPON_COMMAND_DROP,
1861#define WEAPON_COMMAND_MAX_VER6 15
1862#define WEAPON_COMMAND_MAX_VER17 31
1864static unsigned int GetWeaponCommandMask(
unsigned int maxCmds) {
1865 return maxCmds << 7;
1868static unsigned int GetWeaponCommand(
unsigned int buttons,
unsigned int maxCmds) {
1869 return (buttons & (maxCmds << 7)) >> 7;
1879 short unsigned int buttons;
1880 short int angles[3];
1884 signed char forwardmove, rightmove, upmove;
1892#define MDL_ANIM_DELTA_DRIVEN ( 1 << 0 )
1893#define MDL_ANIM_DEFAULT_ANGLES ( 1 << 3 )
1894#define MDL_ANIM_NO_TIMECHECK ( 1 << 4 )
1897#define SOLID_BMODEL 0xffffff
1904#define RF_THIRD_PERSON (1<<0)
1905#define RF_FIRST_PERSON (1<<1)
1906#define RF_DEPTHHACK (1<<2)
1907#define RF_VIEWLENSFLARE (1<<3)
1908#define RF_FRAMELERP (1<<4)
1909#define RF_BEAM (1<<5)
1910#define RF_DONTDRAW (1<<7)
1911#define RF_LENSFLARE (1<<8)
1912#define RF_EXTRALIGHT (1<<9)
1913#define RF_DETAIL (1<<10)
1914#define RF_SHADOW (1<<11)
1915#define RF_PORTALSURFACE (1<<12)
1916#define RF_SKYORIGIN (1<<13)
1917#define RF_SKYENTITY (1<<14)
1918#define RF_LIGHTOFFSET (1<<15)
1919#define RF_CUSTOMSHADERPASS (1<<16)
1920#define RF_MINLIGHT (1<<17)
1921#define RF_FULLBRIGHT (1<<18)
1922#define RF_LIGHTING_ORIGIN (1<<19)
1926#define RF_SHADOW_PLANE (1<<20)
1927#define RF_WRAP_FRAMES (1<<21)
1931#define RF_ADDITIVE_DLIGHT (1<<22)
1932#define RF_LIGHTSTYLE_DLIGHT (1<<23)
1933#define RF_SHADOW_PRECISE (1<<24)
1934#define RF_INVISIBLE (1<<25)
1935#define RF_ALWAYSDRAW (1<<26)
1936#define RF_PRECISESHADOW (1<<28)
1940#define RF_FLAGS_NOT_INHERITED ( RF_LENSFLARE | RF_VIEWLENSFLARE | RF_BEAM | RF_EXTRALIGHT | RF_SKYORIGIN | RF_SHADOW | RF_SHADOW_PRECISE | RF_SHADOW_PLANE )
1945#define RF_FORCENOLOD 1024
1947#define BEAM_LIGHTNING_EFFECT (1<<0)
1948#define BEAM_USEMODEL (1<<1)
1949#define BEAM_PERSIST_EFFECT (1<<2)
1950#define BEAM_SPHERE_EFFECT (1<<3)
1951#define BEAM_RANDOM_DELAY (1<<4)
1952#define BEAM_TOGGLE (1<<5)
1953#define BEAM_RANDOM_TOGGLEDELAY (1<<6)
1954#define BEAM_WAVE_EFFECT (1<<7)
1955#define BEAM_USE_NOISE (1<<8)
1956#define BEAM_PARENT (1<<9)
1957#define BEAM_TILESHADER (1<<10)
1958#define BEAM_OFFSET_ENDPOINTS (1<<11)
1959#define BEAM_FADE (1<<12)
1960#define BEAM_INVERTED (1<<13)
1961#define BEAM_INVERTED_FAST (1<<14)
1984#define NUM_BONE_CONTROLLERS 5
1986#define NUM_MORPH_CONTROLLERS 10
1988#define MAX_MODEL_SURFACES 32
1990#define MDL_SURFACE_SKINOFFSET_BIT0 ( 1 << 0 )
1991#define MDL_SURFACE_SKINOFFSET_BIT1 ( 1 << 1 )
1992#define MDL_SURFACE_NODRAW ( 1 << 2 )
1993#define MDL_SURFACE_SURFACETYPE_BIT0 ( 1 << 3 )
1994#define MDL_SURFACE_SURFACETYPE_BIT1 ( 1 << 4 )
1995#define MDL_SURFACE_SURFACETYPE_BIT2 ( 1 << 5 )
1996#define MDL_SURFACE_CROSSFADE_SKINS ( 1 << 6 )
1997#define MDL_SURFACE_SKIN_NO_DAMAGE ( 1 << 7 )
1999#define CROUCH_HEIGHT 36
2000#define CROUCH_EYE_HEIGHT 48
2001#define STAND_HEIGHT 72
2002#define STAND_EYE_HEIGHT 82
2004#define MAX_FRAMEINFOS 16
2005#define FRAMEINFO_BLEND ( MAX_FRAMEINFOS >> 1 )
2030 float loopSoundVolume;
2031 float loopSoundMinDist;
2032 float loopSoundMaxDist;
2033 float loopSoundPitch;
2039 qboolean attach_use_angles;
2040 vec3_t attach_offset;
2048 frameInfo_t frameInfo[ MAX_FRAMEINFOS ];
2051 int bone_tag[ NUM_BONE_CONTROLLERS ];
2052 vec3_t bone_angles[ NUM_BONE_CONTROLLERS ];
2053 quat_t bone_quat[ NUM_BONE_CONTROLLERS ];
2054 byte surfaces[ 32 ];
2057 int groundEntityNum;
2064 float shader_data[ 2 ];
2101 unsigned short factor;
2102 unsigned short pattern;
2114 HUD_ALIGN_X_LEFT = 0,
2115 HUD_ALIGN_X_CENTER = 1,
2116 HUD_ALIGN_X_RIGHT = 2,
2117 HUD_ALIGN_Y_TOP = 0,
2118 HUD_ALIGN_Y_CENTER = 1,
2119 HUD_ALIGN_Y_BOTTOM = 2,
2124 char shaderName[ MAX_RES_NAME ];
2133 int iHorizontalAlign;
2135 qboolean bVirtualScreen;
2137 char string[ MAX_STRING_CHARS ];
2138 char fontName[ MAX_RES_NAME ];
2144 frameInfo_t g_VMFrameInfo[MAX_FRAMEINFOS];
2147 int g_iLastVMAnimChanged;
2148 int g_iCurrentVMAnimSlot;
2149 int g_iCurrentVMDuration;
2151 qboolean g_bCrossblending;
2153 int g_iLastEquippedWeaponStat;
2154 char g_szLastActiveItem[ 80 ];
2155 int g_iLastAnimPrefixIndex;
2157 float g_vCurrentVMPosOffset[ 3 ];
2160#define GLYPH_START 0
2161#define GLYPH_END 255
2162#define GLYPH_CHARSTART 32
2163#define GLYPH_CHAREND 127
2164#define GLYPHS_PER_FONT GLYPH_END - GLYPH_START + 1
2178 char shaderName[32];
2184 char name[MAX_QPATH];
2187#define Square(x) ((x)*(x))
2195#define AS_MPLAYER 99
2197#define AS_FAVORITES 3
2212typedef enum _flag_status {
2238#define MAX_GLOBAL_SERVERS 2048
2239#define MAX_OTHER_SERVERS 128
2240#define MAX_PINGREQUESTS 32
2241#define MAX_SERVERSTATUSREQUESTS 16
2248#define CDCHKSUM_LEN 2
2250#define FLOAT_TO_INT( x, fracbits ) ( ( x ) * ( 1 << ( fracbits ) ) )
2252#define FLOAT_TO_PKT( x, dest, wholebits, fracbits ) \
2254 if ( ( x ) >= ( 1 << ( wholebits ) ) ) \
2256 ( dest ) = FLOAT_TO_INT( ( 1 << ( wholebits ) ), ( fracbits ) ) - 1; \
2258 else if ( ( x ) < 0 ) \
2264 ( dest ) = FLOAT_TO_INT( ( x ), ( fracbits ) ); \
2268#define SIGNED_FLOAT_TO_PKT( x, dest, wholebits, fracbits ) \
2271 temp_x = ( x ) + ( 1 << ( wholebits ) ); \
2272 if ( temp_x >= ( 1 << ( ( wholebits ) + 1 ) ) ) \
2273 ( dest ) = FLOAT_TO_INT( ( 1 << ( ( wholebits ) + 1 ) ), ( fracbits ) ) - 1; \
2274 else if ( temp_x < 0 ) \
2277 ( dest ) = FLOAT_TO_INT( temp_x, ( fracbits ) ); \
2280#define INT_TO_FLOAT( x, wholebits, fracbits ) ( ( float )( ( ( float )( x ) ) / ( float )( 1 << ( fracbits ) ) - ( float )( 1 << ( wholebits ) ) ) )
2281#define UINT_TO_FLOAT( x, fracbits ) ( ( float )( ( ( float )( x ) ) / ( float )( 1 << ( fracbits ) ) ) )
2283#define TRANSLATION_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 11 )
2284#define PKT_TO_TRANSLATION( x ) UINT_TO_FLOAT( ( x ), 11 )
2286#define OFFSET_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 1, 14 )
2287#define PKT_TO_OFFSET( x ) UINT_TO_FLOAT( ( x ), 14 )
2289#define ROTATE_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 9, 6 )
2290#define PKT_TO_ROTATE( x ) UINT_TO_FLOAT( ( x ), 6 )
2292#define BASE_TO_PKT( x, dest ) SIGNED_FLOAT_TO_PKT( ( x ), ( dest ), 3, 4 )
2293#define PKT_TO_BASE( x ) INT_TO_FLOAT( ( x ), 3, 4 )
2295#define AMPLITUDE_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2296#define PKT_TO_AMPLITUDE( x ) UINT_TO_FLOAT( ( x ), 4 )
2298#define PHASE_TO_PKT( x, dest ) SIGNED_FLOAT_TO_PKT( ( x ), ( dest ), 3, 4 )
2299#define PKT_TO_PHASE( x ) INT_TO_FLOAT( ( x ), 3, 4 )
2301#define FREQUENCY_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2302#define PKT_TO_FREQUENCY( x ) UINT_TO_FLOAT( ( x ), 4 )
2304#define BEAM_PARM_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2305#define PKT_TO_BEAM_PARM( x ) UINT_TO_FLOAT( ( x ), 4 )
2307#define STUB() printf( "STUB: function %s in %s line %d.\n", __FUNCTION__, __FILE__, __LINE__ )
2308#define STUB_DESC( description ) printf( "STUB: %s in %s line %d.\n", description, __FILE__, __LINE__ )
2309#define UNIMPLEMENTED() Com_Printf( "FIXME: (%s) is unimplemented (file %s:%d)\n", __FUNCTION__, __FILE__, __LINE__ )
2311#if defined(__cplusplus)
2318using qcclock_t = std::chrono::steady_clock;
2319using qctime_t = qcclock_t::time_point;
2320using qctimedelta_t = qcclock_t::duration;
Definition q_shared.h:1520
Definition q_shared.h:2143
Definition q_shared.h:1418
Definition q_shared.h:1335
Definition q_shared.h:2095
Definition q_shared.h:2105
Definition q_shared.h:2014
Definition q_shared.h:2181
Definition q_shared.h:1963
Definition q_shared.h:1694
Definition g_public.h:168
Definition q_shared.h:2165
Definition q_shared.h:1103
Definition q_shared.h:2122
Definition q_shared.h:1494
Definition q_shared.h:1525
Definition q_shared.h:1155
Definition q_shared.h:1745
Definition q_shared.h:1238
Definition q_shared.h:2083
Definition q_shared.h:2223
Definition q_shared.h:2231
Definition q_shared.h:1473
Definition q_shared.h:1703
Definition q_shared.h:1453
Definition q_shared.h:1979
Definition q_shared.h:1500
Definition q_shared.h:1876
Definition q_shared.h:1716
Definition q_shared.h:1364
Definition q_shared.h:208