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 ".openmohaa"
81#define HOMEPATH_NAME_WIN "openmohaa"
82#define HOMEPATH_NAME_MACOSX HOMEPATH_NAME_WIN
84#define CLIENT_WINDOW_TITLE PRODUCT_NAME
85#define CLIENT_WINDOW_MIN_TITLE PRODUCT_NAME
87#define MAX_MASTER_SERVERS 5
93#pragma warning(disable : 4018)
94#pragma warning(disable : 4032)
95#pragma warning(disable : 4051)
96#pragma warning(disable : 4057)
97#pragma warning(disable : 4100)
98#pragma warning(disable : 4115)
99#pragma warning(disable : 4125)
100#pragma warning(disable : 4127)
101#pragma warning(disable : 4136)
102#pragma warning(disable : 4152)
105#pragma warning(disable : 4244)
106#pragma warning(disable : 4142)
110#pragma warning(disable : 4514)
111#pragma warning(disable : 4702)
112#pragma warning(disable : 4711)
113#pragma warning(disable : 4220)
118#define Q_UNUSED_VAR __attribute__((unused))
119#define Q_NO_RETURN __attribute__((noreturn))
123#define Q_PRINTF_FUNC(fmt, va) \
124 __attribute__((format(gnu_printf, fmt, va))) \
125 __attribute__((format(ms_printf, fmt, va)))
127#define Q_PRINTF_FUNC(fmt, va) __attribute__((format(printf, fmt, va)))
130#define Q_SCANF_FUNC(fmt, va) __attribute__((format(scanf, fmt, va)))
131#define Q_ALIGN(x) __attribute__((aligned(x)))
135#define Q_PRINTF_FUNC(fmt, va)
136#define Q_SCANF_FUNC(fmt, va)
140#if (defined _MSC_VER)
141#define Q_EXPORT __declspec(dllexport)
142#elif (defined __SUNPRO_C)
143#define Q_EXPORT __global
144#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun))
145#define Q_EXPORT __attribute__((visibility("default")))
170# define _CRTDBG_MAP_ALLOC
190 size_t Q_vsnprintf(
char *str,
size_t size,
const char *format, va_list ap) Q_PRINTF_FUNC(3, 0);
192#define Q_vsnprintf vsnprintf
197#include "q_platform.h"
201typedef unsigned char byte;
202typedef unsigned char uchar;
204enum { qfalse, qtrue };
214typedef int qhandle_t;
215typedef int sfxHandle_t;
216typedef int fileHandle_t;
217typedef int clipHandle_t;
220#define ALIGN(x) __attribute__((aligned(x)))
225#define PAD(base, alignment) (((base)+(alignment)-1) & ~((alignment)-1))
226#define PADLEN(base, alignment) (PAD((base), (alignment)) - (base))
228#define PADP(base, alignment) ((void *) PAD((intptr_t) (base), (alignment)))
231#define NULL ((void *)0)
235#define BIT(x) (1 << x)
240#define XSTRING(s) STRING(s)
242#define MAX_QINT 0x7fffffff
243#define MIN_QINT (-MAX_QINT-1)
245#define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x)))
246#define STRARRAY_LEN(x) (ARRAY_LEN(x) - 1)
254#define stricmp strcasecmp
255#define strnicmp strncasecmp
266 PROTOCOL_MOH_MIN = 6,
267 PROTOCOL_MOH_DEMO = 6,
269 PROTOCOL_MOHTA_MIN = 15,
270 PROTOCOL_MOHTA_DEMO = 16,
293#define MAX_STRING_CHARS 2048
294#define MAX_STRING_TOKENS 1024
295#define MAX_TOKEN_CHARS 1024
297#define MAX_INFO_STRING 1350
298#define MAX_INFO_KEY 1024
299#define MAX_INFO_VALUE 1024
301#define BIG_INFO_STRING 8192
302#define BIG_INFO_KEY 8192
303#define BIG_INFO_VALUE 8192
305#define MAX_RES_NAME 64
309#define MAX_OSPATH PATH_MAX
311#define MAX_OSPATH 256
314#define MAX_NAME_LENGTH 32
328#define MAX_MAP_AREA_BYTES 32
349 ERR_SERVERDISCONNECT,
357#define PROP_GAP_WIDTH 5
358#define PROP_SPACE_WIDTH 8
359#define PROP_HEIGHT 30
360#define PROP_SMALL_SIZE_SCALE 0.75
362#define BLINK_DIVISOR 200
363#define PULSE_DIVISOR 250.0f
365#define UI_LEFT 0x00000000
366#define UI_CENTER 0x00000001
367#define UI_RIGHT 0x00000002
368#define UI_FORMATMASK 0x00000007
369#define UI_SMALLFONT 0x00000010
370#define UI_BIGFONT 0x00000020
371#define UI_GIANTFONT 0x00000040
372#define UI_DROPSHADOW 0x00000800
373#define UI_BLINK 0x00001000
374#define UI_INVERSE 0x00002000
375#define UI_PULSE 0x00004000
384#define Hunk_Alloc( size, preference ) Hunk_AllocDebug(size, preference, #size, __FILE__, __LINE__)
385void *Hunk_AllocDebug(
int size, ha_pref preference,
const char *label,
const char *file,
int line );
387void *Hunk_Alloc(
int size, ha_pref preference );
390#define Com_Memset memset
391#define Com_Memcpy memcpy
393#define Com_Allocate malloc
394#define Com_Dealloc free
412typedef vec_t vec2_t[2];
413typedef vec_t vec3_t[3];
414typedef vec_t vec4_t[4];
415typedef vec_t quat_t[4];
416typedef vec_t vec5_t[5];
417typedef vec_t matrix3x3_t[9];
418typedef vec_t matrix_t[16];
419typedef vec3_t axis_t[3];
423typedef int fixed16_t;
426#define M_PI 3.14159265358979323846
430#define M_SQRT2 1.414213562f
434#define M_SQRT1_2 7.0710678118654752440E-1
437#define NUMVERTEXNORMALS 162
438extern vec3_t bytedirs[NUMVERTEXNORMALS];
442#define SCREEN_WIDTH 640
443#define SCREEN_HEIGHT 480
445#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
446#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
448#define SMALLCHAR_WIDTH 8
449#define SMALLCHAR_HEIGHT 16
451#define BIGCHAR_WIDTH 16
452#define BIGCHAR_HEIGHT 16
454#define GIANTCHAR_WIDTH 32
455#define GIANTCHAR_HEIGHT 48
457extern vec4_t colorBlack;
458extern vec4_t colorRed;
459extern vec4_t colorGreen;
460extern vec4_t colorBlue;
461extern vec4_t colorYellow;
462extern vec4_t colorMagenta;
463extern vec4_t colorCyan;
464extern vec4_t colorWhite;
465extern vec4_t colorLtGrey;
466extern vec4_t colorMdGrey;
467extern vec4_t colorDkGrey;
478#define Q_COLOR_ESCAPE '^'
479#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1)) )
481#define COLOR_BLACK '0'
483#define COLOR_GREEN '2'
484#define COLOR_YELLOW '3'
485#define COLOR_BLUE '4'
486#define COLOR_CYAN '5'
487#define COLOR_MAGENTA '6'
488#define COLOR_WHITE '7'
489#define ColorIndex(c) ( ( (c) - '0' ) & 7 )
492#define S_COLOR_BLACK "^0"
493#define S_COLOR_RED "^1"
494#define S_COLOR_GREEN "^2"
495#define S_COLOR_YELLOW "^3"
496#define S_COLOR_BLUE "^4"
497#define S_COLOR_CYAN "^5"
498#define S_COLOR_MAGENTA "^6"
499#define S_COLOR_WHITE "^7"
501#define S_COLOR_BLACK ""
502#define S_COLOR_RED ""
503#define S_COLOR_GREEN ""
504#define S_COLOR_YELLOW ""
505#define S_COLOR_BLUE ""
506#define S_COLOR_CYAN ""
507#define S_COLOR_MAGENTA ""
508#define S_COLOR_WHITE ""
511#define HUD_MESSAGE_YELLOW "\x01"
512#define HUD_MESSAGE_WHITE "\x03"
513#define HUD_MESSAGE_CHAT_WHITE "\x02"
514#define HUD_MESSAGE_CHAT_RED "\x04"
516extern vec4_t g_color_table[8];
518#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
519#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
521#define DEG2RAD( a ) ( ( (a) * M_PI ) / 180.0F )
522#define RAD2DEG( a ) ( ( (a) * 180.0f ) / M_PI )
524#define Q_max(a, b) ((a) > (b) ? (a) : (b))
525#define Q_min(a, b) ((a) < (b) ? (a) : (b))
526#define Q_bound(a, b, c) (Q_max(a, Q_min(b, c)))
527#define Q_clamp(a, b, c) ((b) >= (c) ? (a)=(b) : (a) < (b) ? (a)=(b) : (a) > (c) ? (a)=(c) : (a))
528#define Q_lerp(from, to, frac) (from + ((to - from) * frac))
530#define LERP( a, b, w ) ( ( a ) * ( 1.0f - ( w ) ) + ( b ) * ( w ) )
531#define LUMA( red, green, blue ) ( 0.2126f * ( red ) + 0.7152f * ( green ) + 0.0722f * ( blue ) )
534#define Q_min(a,b) (((a) < (b)) ? (a) : (b))
537#define Q_max(a,b) (((a) > (b)) ? (a) : (b))
540int Q_clamp_int(
int value,
int min,
int max);
541float Q_clamp_float(
float value,
float min,
float max);
543#define bound(a,minval,maxval) ( ((a) > (minval)) ? ( ((a) < (maxval)) ? (a) : (maxval) ) : (minval) )
547extern vec3_t vec3_origin;
548extern vec3_t axisDefault[3];
549extern matrix_t matrixIdentity;
551#define nanmask (255<<23)
553#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
555static ID_INLINE
long Q_ftol(
float f)
557#if id386_sse && defined(_MSC_VER)
569static ID_INLINE
float Q_rsqrt(
float number ) {
570 float x = 0.5f * number;
573 asm(
"frsqrte %0,%1" :
"=f" (y) :
"f" (number));
575 y = __frsqrte( number );
577 return y * (1.5f - (x * y * y));
581static ID_INLINE
float Q_fabs(
float x) {
584 asm(
"fabs %0,%1" :
"=f" (abs_x) :
"f" (x));
588#define Q_fabs __fabsf
592float Q_fabs(
float f );
593float Q_rsqrt(
float f );
596#define SQRTFAST( x ) ( (x) * Q_rsqrt( x ) )
598byte ClampByte(
int i);
599signed char ClampChar(
int i );
600signed short ClampShort(
int i );
602double dEpsilon(
void );
603double dIdentity(
void );
604double dSign(
const double number );
605double dClamp(
const double value,
const double min,
const double max );
606double dDistance(
const double value1,
const double value2 );
607qboolean dCloseEnough(
const double value1,
const double value2,
const double epsilon );
608qboolean dSmallEnough(
const double value,
const double epsilon );
610float fEpsilon(
void );
611float fIdentity(
void );
612float fSign(
const float number );
613float fClamp(
const float value,
const float min,
const float max );
614float fDistance(
const float value1,
const float value2 );
615qboolean fCloseEnough(
const float value1,
const float value2,
const float epsilon );
616qboolean fSmallEnough(
const float value,
const float epsilon );
618int iSign(
const int number );
619int iClamp(
const int value,
const int min,
const int max );
622int DirToByte( vec3_t dir );
623void ByteToDir(
int b, vec3_t dir );
627#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
628#define DotProduct2D(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1])
629#define CrossProduct2D(a,b) ((a)[0]*(b)[1]-(b)[0]*(a)[1])
630#define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2])
631#define VectorAdd(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2])
632#define VectorAdd2D(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1])
633#define VectorSub2D(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1])
634#define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2])
635#define VectorCopy2D(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1])
636#define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s))
637#define VectorScale2D(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s))
638#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))
639#define VectorMA2D(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s))
643#define DotProduct(x,y) _DotProduct(x,y)
644#define VectorSubtract(a,b,c) _VectorSubtract(a,b,c)
645#define VectorAdd(a,b,c) _VectorAdd(a,b,c)
646#define VectorCopy(a,b) _VectorCopy(a,b)
647#define VectorScale(v, s, o) _VectorScale(v,s,o)
648#define VectorMA(v, s, b, o) _VectorMA(v,s,b,o)
659#define VectorCopy(a,b) (*(vec3struct_t *)b=*(vec3struct_t *)a)
663#define VectorClear2D(a) ((a)[0]=(a)[1]=0)
664#define VectorLength2DSquared(a) ((a)[0]*(a)[0]+(a)[1]*(a)[1])
665#define VectorLength2D(a) (sqrt(VectorLength2DSquared(a)))
666#define VectorSet2D(v, x, y) ((v)[0]=(x), (v)[1]=(y))
668#define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0)
669#define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2])
670#define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z))
671#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
673#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
675#define DotProduct4(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]+(x)[3]*(y)[3])
676#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])
677#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])
678#define VectorCopy4(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
679#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))
680#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))
681#define VectorClear4(a) ((a)[0]=(a)[1]=(a)[2]=(a)[3]=0)
682#define VectorNegate4(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2],(b)[3]=-(a)[3])
683#define VectorSet4(v,x,y,z,w) ((v)[0]=(x),(v)[1]=(y),(v)[2]=(z),(v)[3]=(w))
685#define VectorCopy5(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3],(b)[4]=(a)[4])
688vec_t _DotProduct(
const vec3_t v1,
const vec3_t v2 );
689void _VectorSubtract(
const vec3_t veca,
const vec3_t vecb, vec3_t out );
690void _VectorAdd(
const vec3_t veca,
const vec3_t vecb, vec3_t out );
691void _VectorCopy(
const vec3_t in, vec3_t out );
692void _VectorScale(
const vec3_t in,
float scale, vec3_t out );
693void _VectorMA(
const vec3_t veca,
float scale,
const vec3_t vecb, vec3_t vecc );
694vec_t Q_rint( vec_t in );
696unsigned ColorBytes3 (
float r,
float g,
float b);
697unsigned ColorBytes4 (
float r,
float g,
float b,
float a);
699float NormalizeColor(
const vec3_t in, vec3_t out );
700void RotatePointAroundAxis(vec3_t dst,
int axis,
const vec3_t point,
float degrees);
701void ClampColor(vec4_t color);
703float RadiusFromBounds(
const vec3_t mins,
const vec3_t maxs );
704void ClearBounds( vec3_t mins, vec3_t maxs );
705void ZeroBounds(vec3_t mins, vec3_t maxs);
706void AddPointToBounds(
const vec3_t v, vec3_t mins, vec3_t maxs );
707void BoundsAdd(vec3_t mins, vec3_t maxs,
const vec3_t mins2,
const vec3_t maxs2);
709float PointToSegmentDistanceSquared(
const vec3_t origin,
const vec3_t a,
const vec3_t b);
711#if !defined( Q3_VM ) || ( defined( Q3_VM ) && defined( __Q3_VM_MATH ) )
712static ID_INLINE
int VectorCompare(
const vec3_t v1,
const vec3_t v2 ) {
713 if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
719static ID_INLINE
int VectorCompare2D(
const vec2_t v1,
const vec2_t v2 ) {
720 if( v1[ 0 ] != v2[ 0 ] || v1[ 1 ] != v2[ 1 ] ) {
726static ID_INLINE
int VectorCompareEpsilon(
const vec3_t v1,
const vec3_t v2,
float fEpsilon )
730 for( i = 0; i < 3; i++ )
732 if( fabs( v1[ i ] - v2[ i ] ) > fEpsilon ) {
739static ID_INLINE vec_t VectorLength(
const vec3_t v ) {
740 return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
743static ID_INLINE vec_t VectorLengthSquared(
const vec3_t v ) {
744 return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
747static ID_INLINE vec_t Distance(
const vec3_t p1,
const vec3_t p2 ) {
750 VectorSubtract (p2, p1, v);
751 return VectorLength( v );
754static ID_INLINE vec_t DistanceSquared(
const vec3_t p1,
const vec3_t p2 ) {
757 VectorSubtract (p2, p1, v);
758 return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
763static ID_INLINE
void VectorNormalizeFast( vec3_t v )
767 ilength = Q_rsqrt( DotProduct( v, v ) );
774static ID_INLINE
void VectorInverse( vec3_t v ){
780static ID_INLINE
void CrossProduct(
const vec3_t v1,
const vec3_t v2, vec3_t cross ) {
781 cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
782 cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
783 cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
787int VectorCompare(
const vec3_t v1,
const vec3_t v2 );
789vec_t VectorLength(
const vec3_t v );
791vec_t VectorLengthSquared(
const vec3_t v );
793vec_t Distance(
const vec3_t p1,
const vec3_t p2 );
795vec_t DistanceSquared(
const vec3_t p1,
const vec3_t p2 );
797void VectorNormalizeFast( vec3_t v );
799void VectorInverse( vec3_t v );
801void CrossProduct(
const vec3_t v1,
const vec3_t v2, vec3_t cross );
805vec_t VectorNormalize (vec3_t v);
806vec_t VectorNormalize2(
const vec3_t v, vec3_t out );
807vec_t VectorNormalize2D( vec2_t v );
808vec_t VectorNormalize2D2(
const vec2_t v, vec2_t out );
809void VectorPackTo01( vec3_t v );
810void Vector4Scale(
const vec4_t in, vec_t scale, vec4_t out );
811void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out );
813int NearestPowerOfTwo(
int val);
816float Q_acos(
float c);
818int Q_rand(
int *seed );
819float Q_random(
int *seed );
820float Q_crandom(
int *seed );
822#define random() ((rand () & 0x7fff) / ((float)0x7fff))
823#define random2() ((rand () & 0x7fff) * (1.0 / ((float)0x7fff)))
824#define crandom() (2.0 * (random() - 0.5))
826float grandom(
void );
827float erandom(
float mean );
829#define AnglesToMat AnglesToAxis
831void vectoangles(
const vec3_t value1, vec3_t angles );
832void VectorToAngles(
const vec3_t vec, vec3_t angles );
833void AnglesToAxis(
const vec3_t angles, vec3_t axis[3]);
834void YawToAxis(
float yaw,
float axis[2]);
836float noise(
float vec[],
int len);
837float noise1(
float arg);
838float noise2(vec3_t arg);
839float noise3(vec3_t arg);
841void R_ConcatRotations(
float in1[ 3 ][ 3 ],
float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
842void R_ConcatTransforms(
float in1[ 3 ][ 4 ],
float in2[ 3 ][ 4 ],
float out[ 3 ][ 4 ] );
844void MatrixToEulerAngles(
const float mat[ 3 ][ 3 ], vec3_t ang );
845void QuatToMat(
const float q[ 4 ],
float m[ 3 ][ 3 ] );
846void SlerpQuaternion(
float from[4],
float to[4],
float t,
float res[4]);
847void EulerToQuat(
float ang[ 3 ],
float q[ 4 ] );
848void MatToQuat(
float srcMatrix[ 3 ][ 3 ],
float destQuat[ 4 ] );
850float ProjectPointOnLine(
const vec3_t i_vStart,
const vec3_t i_vEnd,
const vec3_t i_vPoint, vec3_t o_vProj );
851float ProjectLineOnPlane(
const vec3_t vPlaneNorm,
float fPlaneDist,
const vec3_t vStart,
const vec3_t vEnd, vec3_t vProj );
853float anglemod(
float a );
854float angledist(
float ang );
856void AxisClear( vec3_t axis[3] );
857void AxisCopy(
const vec3_t in[3], vec3_t out[3] );
859void SetPlaneSignbits(
struct cplane_s *out );
860int BoxOnPlaneSide (
const vec3_t emins,
const vec3_t emaxs,
struct cplane_s *plane);
862void CalculateRotatedBounds( vec3_t angles, vec3_t mins, vec3_t maxs );
863void CalculateRotatedBounds2(
float trans[ 3 ][ 3 ], vec3_t mins, vec3_t maxs );
864int BoundingBoxToInteger( vec3_t mins, vec3_t maxs );
865void IntegerToBoundingBox(
int num, vec3_t mins, vec3_t maxs );
866qboolean BoundsIntersect(
const vec3_t mins,
const vec3_t maxs,
867 const vec3_t mins2,
const vec3_t maxs2);
868qboolean BoundsIntersectSphere(
const vec3_t mins,
const vec3_t maxs,
869 const vec3_t origin, vec_t radius);
870qboolean BoundsIntersectPoint(
const vec3_t mins,
const vec3_t maxs,
871 const vec3_t origin);
873float AngleMod(
float a);
874float LerpAngle (
float from,
float to,
float frac);
875float LerpAngleFromCurrent(
float from,
float to,
float current,
float frac );
876float AngleSubtract(
float a1,
float a2 );
877void AnglesSubtract( vec3_t v1, vec3_t v2, vec3_t v3 );
879float AngleNormalize360 (
float angle );
880float AngleNormalize180 (
float angle );
881float AngleDelta (
float angle1,
float angle2 );
883qboolean PlaneFromPoints( vec4_t plane,
const vec3_t a,
const vec3_t b,
const vec3_t c );
884qboolean PlanesGetIntersectionPoint(
const vec4_t plane1,
const vec4_t plane2,
const vec4_t plane3, vec3_t out);
885void PlaneIntersectRay(
const vec3_t rayPos,
const vec3_t rayDir,
const vec4_t plane, vec3_t res);
886void ProjectPointOnPlane( vec3_t dst,
const vec3_t p,
const vec3_t normal );
887void RotatePointAroundVector( vec3_t dst,
const vec3_t dir,
const vec3_t point,
float degrees );
888void RotateAroundDirection( vec3_t axis[3],
float yaw );
889void MakeNormalVectors(
const vec3_t forward, vec3_t right, vec3_t up );
894void MatrixTransformVector(
const vec3_t in,
const float mat[ 3 ][ 3 ], vec3_t out );
895void MatrixTransformVectorRight(
const float mat[ 3 ][ 3 ],
const vec3_t in, vec3_t out );
896void Matrix3x3Multiply(
const float in1[ 3 ][ 3 ],
const float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
897void AngleVectors(
const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up );
898void AngleVectorsLeft(
const vec3_t angles, vec3_t forward, vec3_t left, vec3_t up );
899void PerpendicularVector( vec3_t dst,
const vec3_t src );
901void GetPerpendicularViewVector(
const vec3_t point,
const vec3_t p1,
const vec3_t p2, vec3_t up);
902void ProjectPointOntoVector(vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_t vProj);
904float pointToLineDistance(
const vec3_t point,
const vec3_t p1,
const vec3_t p2);
905float VectorMinComponent(vec3_t v);
906float VectorMaxComponent(vec3_t v);
909#define MAX(x,y) ((x)>(y)?(x):(y))
913#define MIN(x,y) ((x)<(y)?(x):(y))
916vec_t DistanceBetweenLineSegmentsSquared(
const vec3_t sP0,
const vec3_t sP1,
917 const vec3_t tP0,
const vec3_t tP1,
float *s,
float *t);
918vec_t DistanceBetweenLineSegments(
const vec3_t sP0,
const vec3_t sP1,
919 const vec3_t tP0,
const vec3_t tP1,
float *s,
float *t);
921void VectorMatrixInverse(
void* DstMatrix,
const void* SrcMatrix );
923void MatrixIdentity(matrix_t m);
924void MatrixClear(matrix_t m);
925void MatrixCopy(
const matrix_t in, matrix_t out);
926qboolean MatrixCompare(
const matrix_t a,
const matrix_t b);
927void MatrixTransposeIntoXMM(
const matrix_t m);
928void MatrixTranspose(
const matrix_t in, matrix_t out);
931qboolean MatrixInverse(matrix_t m);
932void MatrixSetupXRotation(matrix_t m, vec_t degrees);
933void MatrixSetupYRotation(matrix_t m, vec_t degrees);
934void MatrixSetupZRotation(matrix_t m, vec_t degrees);
935void MatrixSetupTranslation(matrix_t m, vec_t x, vec_t y, vec_t z);
936void MatrixSetupScale(matrix_t m, vec_t x, vec_t y, vec_t z);
937void MatrixSetupShear(matrix_t m, vec_t x, vec_t y);
938void Matrix4x4Multiply(
const matrix_t a,
const matrix_t b, matrix_t out);
939void MatrixMultiply(
const float in1[ 3 ][ 3 ],
const float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
940void MatrixMultiply2( matrix_t m,
const matrix_t m2 );
941void MatrixMultiplyRotation(matrix_t m, vec_t pitch, vec_t yaw, vec_t roll);
942void MatrixMultiplyZRotation(matrix_t m, vec_t degrees);
943void MatrixMultiplyTranslation(matrix_t m, vec_t x, vec_t y, vec_t z);
944void MatrixMultiplyScale(matrix_t m, vec_t x, vec_t y, vec_t z);
945void MatrixMultiplyShear(matrix_t m, vec_t x, vec_t y);
946void MatrixToAngles(
const matrix_t m, vec3_t angles);
947void MatrixFromAngles(matrix_t m, vec_t pitch, vec_t yaw, vec_t roll);
948void MatrixFromVectorsFLU(matrix_t m,
const vec3_t forward,
const vec3_t left,
const vec3_t up);
949void MatrixFromVectorsFRU(matrix_t m,
const vec3_t forward,
const vec3_t right,
const vec3_t up);
950void MatrixFromQuat(matrix_t m,
const quat_t q);
951void MatrixFromPlanes(matrix_t m,
const vec4_t left,
const vec4_t right,
const vec4_t bottom,
const vec4_t top,
952 const vec4_t near,
const vec4_t far);
953void MatrixToVectorsFLU(
const matrix_t m, vec3_t forward, vec3_t left, vec3_t up);
954void MatrixToVectorsFRU(
const matrix_t m, vec3_t forward, vec3_t right, vec3_t up);
955void MatrixSetupTransformFromVectorsFLU(matrix_t m,
const vec3_t forward,
const vec3_t left,
const vec3_t up,
const vec3_t origin);
956void MatrixSetupTransformFromVectorsFRU(matrix_t m,
const vec3_t forward,
const vec3_t right,
const vec3_t up,
const vec3_t origin);
957void MatrixSetupTransformFromRotation(matrix_t m,
const matrix_t rot,
const vec3_t origin);
958void MatrixSetupTransformFromQuat(matrix_t m,
const quat_t quat,
const vec3_t origin);
959void MatrixAffineInverse(
const matrix_t in, matrix_t out);
960void MatrixTransformNormal(
const matrix_t m,
const vec3_t in, vec3_t out);
961void MatrixTransformNormal2(
const matrix_t m, vec3_t inout);
962void MatrixTransformPoint(
const matrix_t m,
const vec3_t in, vec3_t out);
963void MatrixTransformPoint2(
const matrix_t m, vec3_t inout);
964void MatrixTransform4(
const matrix_t m,
const vec4_t in, vec4_t out);
965void MatrixTransformPlane(
const matrix_t m,
const vec4_t in, vec4_t out);
966void MatrixTransformPlane2(
const matrix_t m, vec3_t inout);
967void MatrixPerspectiveProjection(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
968void MatrixPerspectiveProjectionLH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
969void MatrixPerspectiveProjectionRH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
970void MatrixPerspectiveProjectionFovYAspectLH(matrix_t m, vec_t fov, vec_t aspect, vec_t near, vec_t far);
971void MatrixPerspectiveProjectionFovXYLH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near, vec_t far);
972void MatrixPerspectiveProjectionFovXYRH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near, vec_t far);
973void MatrixPerspectiveProjectionFovXYInfiniteRH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near);
974void MatrixOrthogonalProjection(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
976void MatrixOrthogonalProjectionLH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
977void MatrixOrthogonalProjectionRH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
979void MatrixPlaneReflection(matrix_t m,
const vec4_t plane);
981void MatrixLookAtLH(matrix_t output,
const vec3_t pos,
const vec3_t dir,
const vec3_t up);
982void MatrixLookAtRH(matrix_t m,
const vec3_t eye,
const vec3_t dir,
const vec3_t up);
983void MatrixScaleTranslateToUnitCube(matrix_t m,
const vec3_t mins,
const vec3_t maxs);
984void MatrixCrop(matrix_t m,
const vec3_t mins,
const vec3_t maxs);
986void TransposeMatrix(
float in[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
988static ID_INLINE
void AnglesToMatrix(
const vec3_t angles, matrix_t m)
990 MatrixFromAngles(m, angles[PITCH], angles[YAW], angles[ROLL]);
994#define QuatSet(q,x,y,z,w) ((q)[0]=(x),(q)[1]=(y),(q)[2]=(z),(q)[3]=(w))
995#define QuatCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
997#define QuatCompare(a,b) ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3])
999static ID_INLINE
void QuatClear(quat_t q)
1018static ID_INLINE
void QuatCalcW(quat_t q)
1021 vec_t term = 1.0f - (q[0] * q[0] + q[1] * q[1] + q[2] * q[2]);
1028 q[3] = sqrt(fabs(1.0f - (q[0] * q[0] + q[1] * q[1] + q[2] * q[2])));
1032static ID_INLINE
void QuatInverse(quat_t q)
1039static ID_INLINE
void QuatAntipodal(quat_t q)
1047static ID_INLINE vec_t QuatLength(
const quat_t q)
1049 return (vec_t) sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]);
1052vec_t QuatNormalize(quat_t q);
1054void QuatFromAngles(quat_t q, vec_t pitch, vec_t yaw, vec_t roll);
1056static ID_INLINE
void AnglesToQuat(
const vec3_t angles, quat_t q)
1058 QuatFromAngles(q, angles[PITCH], angles[YAW], angles[ROLL]);
1061void QuatFromMatrix(quat_t q,
const matrix_t m);
1062void QuatToVectorsFLU(
const quat_t quat, vec3_t forward, vec3_t left, vec3_t up);
1063void QuatToVectorsFRU(
const quat_t quat, vec3_t forward, vec3_t right, vec3_t up);
1064void QuatToAxis(
const quat_t q, vec3_t axis[3]);
1065void QuatToAngles(
const quat_t q, vec3_t angles);
1068void QuatToRotAngle(
const quat_t q, vec_t *angle );
1069void QuatToRotAngleAxis(
const quat_t q, vec_t *angle, vec3_t axis );
1071void QuatFromRotAngleAxis( quat_t q, vec_t angle,
const vec3_t axis );
1076void QuatMultiply0(quat_t qa,
const quat_t qb);
1079void QuatMultiply1(
const quat_t qa,
const quat_t qb, quat_t qc);
1082void QuatMultiply2(
const quat_t qa,
const quat_t qb, quat_t qc);
1085void QuatMultiply3(
const quat_t qa,
const quat_t qb, quat_t qc);
1088void QuatMultiply4(
const quat_t qa,
const quat_t qb, quat_t qc);
1090void QuaternionMultiply( quat_t output, quat_t first, quat_t second );
1092void QuatSlerp(
const quat_t from,
const quat_t to,
float frac, quat_t out);
1093void QuatTransformVector(
const quat_t q,
const vec3_t in, vec3_t out);
1094int Q_isnan(
float x );
1101 qboolean frameMemory;
1102 int currentElements;
1109void Com_InitGrowList(
growList_t * list,
int maxElements);
1111int Com_AddToGrowList(
growList_t * list,
void *data);
1112void *Com_GrowListElement(
const growList_t * list,
int index);
1113int Com_IndexForGrowListElement(
const growList_t * list,
const void *element);
1118float Com_Clamp(
float min,
float max,
float value );
1120const char *COM_SkipPath(
const char *pathname );
1121const char *COM_GetExtension(
const char *name );
1122void COM_StripExtension(
const char *in,
char *out,
int destsize);
1123qboolean COM_CompareExtension(
const char* in,
const char* ext);
1124void COM_DefaultExtension(
char *path,
int maxSize,
const char *extension );
1126void COM_BeginParseSession(
const char *name );
1127int COM_GetCurrentParseLine(
void );
1128const char *COM_Parse(
char **data_p );
1129char *COM_ParseExt(
char **data_p, qboolean allowLineBreak );
1130char *COM_ParseExtIgnoreQuotes(
char **data_p, qboolean allowLineBreak );
1131const char *COM_GetToken(
char **data_p, qboolean crossline );
1132void Com_SkipRestOfLine(
char **data);
1133void Com_SkipBracedSection(
char **program);
1134void Com_Parse1DMatrix(
char **buf_p,
int x,
float *m, qboolean checkBrackets);
1135int COM_Compress(
char *data_p );
1136void COM_ParseError(
char *format, ... ) Q_PRINTF_FUNC(1, 2);
1137void COM_ParseWarning(
char *format, ... ) Q_PRINTF_FUNC(1, 2);
1140#define MAX_TOKENLENGTH 1024
1148#define TT_PUNCTUATION 5
1157 char string[MAX_TOKENLENGTH];
1162void COM_MatchToken(
char**buf_p,
char *match );
1164qboolean SkipBracedSection (
char **program,
int depth);
1165void SkipRestOfLine (
char **data );
1167void Parse1DMatrix (
char **buf_p,
int x,
float *m);
1168void Parse2DMatrix (
char **buf_p,
int y,
int x,
float *m);
1169void Parse3DMatrix (
char **buf_p,
int z,
int y,
int x,
float *m);
1171int Com_HexStrToInt(
const char *str );
1173size_t QDECL Com_sprintf (
char *dest,
size_t size,
const char *fmt, ...) Q_PRINTF_FUNC(3, 4);
1175char *Com_SkipTokens(
char *s,
int numTokens, const
char *sep );
1176char *Com_SkipCharset(
char *s, const
char *sep );
1178void Com_RandomBytes(
byte*
string,
int len);
1179void Com_BackslashToSlash(
char *str );
1198#define CTRL(a) ((a)-'a'+1)
1200int Q_isprint(
int c );
1201int Q_islower(
int c );
1202int Q_isupper(
int c );
1203int Q_isalpha(
int c );
1204qboolean Q_isanumber(
const char *s );
1205qboolean Q_isintegral(
float f );
1208int Q_stricmp (
const char *s1,
const char *s2);
1209int Q_strncmp(
const char *s1,
const char *s2,
size_t n );
1210int Q_stricmpn (
const char *s1,
const char *s2,
size_t n);
1211char *Q_strlwr(
char *s1 );
1212char *Q_strupr(
char *s1 );
1213char *Q_strrchr(
const char*
string,
int c );
1214const char *Q_stristr(
const char *s,
const char *find);
1215qboolean Q_strreplace(
char *dest,
int destsize,
const char *find,
const char *replace);
1218void Q_strncpyz(
char *dest,
const char *src,
size_t destsize );
1219void Q_strcat(
char *dest,
int size,
const char *src );
1222int Q_PrintStrlen(
const char *
string );
1224char *Q_CleanStr(
char *
string );
1226int Q_CountChar(
const char *
string,
char tocount);
1230void Swap_Init(
void);
1246void Swap_Init (
void);
1248const char * QDECL va(
const char *format, ...) Q_PRINTF_FUNC(1, 2);
1250#define TRUNCATE_LENGTH 64
1251void Com_TruncateLongString(
char *buffer,
const char *s );
1255float vectoyaw(
const vec3_t vec);
1256int MusicMood_NameToNum(
const char * name );
1257const char * MusicMood_NumToName(
int num );
1258int EAXMode_NameToNum(
const char * name );
1259const char * EAXMode_NumToName(
int num );
1264char *Info_ValueForKey(
const char *s,
const char *key );
1265void Info_RemoveKey(
char *s,
const char *key );
1266void Info_RemoveKey_big(
char *s,
const char *key );
1267void Info_SetValueForKey(
char *s,
const char *key,
const char *value );
1268void Info_SetValueForKey_Big(
char *s,
const char *key,
const char *value );
1269qboolean Info_Validate(
const char *s );
1270void Info_NextPair(
const char **s,
char *key,
char *value );
1273void QDECL Com_Error(
int level,
const char *error, ... ) Q_NO_RETURN Q_PRINTF_FUNC(2, 3);
1274void QDECL Com_Printf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1275void QDECL Com_DPrintf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1276void QDECL Com_DPrintf2( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1277void QDECL Com_DebugPrintf( const
char *msg, ... ) Q_PRINTF_FUNC(1, 2);
1291#define CVAR_ARCHIVE 0x0001
1294#define CVAR_USERINFO 0x0002
1295#define CVAR_SERVERINFO 0x0004
1296#define CVAR_SYSTEMINFO 0x0008
1297#define CVAR_INIT 0x0010
1299#define CVAR_LATCH 0x0020
1304#define CVAR_ROM 0x0040
1305#define CVAR_USER_CREATED 0x0080
1306#define CVAR_TEMP 0x0100
1307#define CVAR_CHEAT 0x0200
1308#define CVAR_NORESTART 0x0400
1310#define CVAR_SERVER_CREATED 0x0800
1312#define CVAR_SOUND_LATCH 0x1000
1318#define CVAR_TERRAIN_LATCH 0x2000
1320#define CVAR_SAVEGAME 0x4000
1322#define CVAR_VM_CREATED 0x8000
1323#define CVAR_PROTECTED 0x10000
1324#define CVAR_RESETSTRING 0x20000
1326#define CVAR_MODIFIED 0x40000000
1327#define CVAR_NONEXISTENT 0x80000000
1330typedef struct cvar_s cvar_t;
1336 char *latchedString;
1339 int modificationCount;
1355#define MAX_CVAR_VALUE_STRING 256
1357typedef int cvarHandle_t;
1362 cvarHandle_t handle;
1363 int modificationCount;
1366 char string[MAX_CVAR_VALUE_STRING];
1367 char latchedString[MAX_CVAR_VALUE_STRING];
1378#include "surfaceflags.h"
1385#define PLANE_NON_AXIAL 3
1386#define PLANE_NON_PLANAR 4
1396static ID_INLINE
int PlaneTypeForNormal(vec3_t normal)
1398 if(normal[0] == 1.0)
1401 if(normal[1] == 1.0)
1404 if(normal[2] == 1.0)
1407 if(normal[0] == 0.0 && normal[1] == 0.0 && normal[2] == 0.0)
1408 return PLANE_NON_PLANAR;
1410 return PLANE_NON_AXIAL;
1424typedef enum hitloc_e {
1426 HITLOC_GENERAL = -1,
1452 qboolean startsolid;
1468#define SAVEGAME_STRUCT_VERSION 4
1484 char saveName[ 64 ];
1485 char tm_filename[ 64 ];
1498 int iReferenceNumber;
1500 qhandle_t hTreadShader;
1504 vec3_t vStartVerts[ 2 ];
1505 float fStartTexCoord;
1508 vec3_t vMidVerts[ 2 ];
1512 vec3_t vEndVerts[ 2 ];
1532#define KEYCATCH_CONSOLE 0x0001
1533#define KEYCATCH_UI 0x0002
1534#define KEYCATCH_MESSAGE 0x0004
1535#define KEYCATCH_CGAME 0x0008
1559 CHAN_DIALOG_SECONDARY,
1567#define S_FLAG_DO_CALLBACK 0x400
1569#define DEFAULT_MIN_DIST -1.0
1570#define DEFAULT_VOL -1.0
1572#define LEVEL_WIDE_MIN_DIST 10000
1573#define LEVEL_WIDE_STRING "levelwide"
1575#define SOUND_SYNCH 0x1
1576#define SOUND_SYNCH_FADE 0x2
1577#define SOUND_RANDOM_PITCH_20 0x4
1578#define SOUND_RANDOM_PITCH_40 0x8
1579#define SOUND_LOCAL_DIALOG 0x10
1615 eax_carpetedhallway,
1641#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535)
1642#define BYTE2ANGLE(x) ((x)*(360.0/255))
1643#define SHORT2ANGLE(x) ((x)*(360.0/65536))
1645#define SNAPFLAG_RATE_DELAYED 1
1646#define SNAPFLAG_NOT_ACTIVE 2
1647#define SNAPFLAG_SERVERCOUNT 4
1652#define MAX_CLIENTS 64
1653#define MAX_LOCATIONS 64
1655#define MAX_MAP_BOUNDS 8192
1656#define MIN_MAP_BOUNDS ( -MAX_MAP_BOUNDS )
1657#define MAP_SIZE ( MAX_MAP_BOUNDS - MIN_MAP_BOUNDS )
1659#define GENTITYNUM_BITS 10
1660#define MAX_GENTITIES (1<<GENTITYNUM_BITS)
1665#define ENTITYNUM_NONE (MAX_GENTITIES-1)
1666#define ENTITYNUM_WORLD (MAX_GENTITIES-2)
1667#define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2)
1669#define MAX_SERVER_SOUNDS 64
1670#define MAX_SERVER_SOUNDS_BITS (MAX_SERVER_SOUNDS-1)
1672#define MAX_MODELS 1024
1673#define MAX_SOUNDS 512
1674#define MAX_OBJECTIVES 20
1675#define MAX_LIGHTSTYLES 32
1676#define MAX_WEAPONS 64
1678#define MAX_CONFIGSTRINGS 2736
1679#define MAX_HUDDRAW_ELEMENTS 256
1681#define MAX_SUBTITLES 4
1685#define CS_SERVERINFO 0
1686#define CS_SYSTEMINFO 1
1688#define RESERVED_CONFIGSTRINGS 2
1690#define MAX_GAMESTATE_CHARS 41952
1692 int stringOffsets[MAX_CONFIGSTRINGS];
1693 char stringData[MAX_GAMESTATE_CHARS];
1704 short int sound_index;
1714 signed char ofs[ 3 ];
1720#define MAX_ACTIVE_ITEMS 8
1722#define MAX_AMMOCOUNT 16
1724#define MAX_PERSISTANT 16
1725#define MAX_POWERUPS 16
1727#define MAX_PS_EVENTS 2
1729#define PS_PMOVEFRAMECOUNTBITS 6
1755 int delta_angles[3];
1758 int groundEntityNum;
1761 qboolean groundPlane;
1772 int iNetViewModelAnim;
1774 int iViewModelAnimChanged;
1776 int stats[MAX_STATS];
1777 int activeItems[MAX_ACTIVE_ITEMS];
1778 int ammo_name_index[MAX_AMMO];
1779 int ammo_amount[MAX_AMMOCOUNT];
1780 int max_ammo_amount[MAX_AMMOCOUNT];
1782 int current_music_mood;
1783 int fallback_music_mood;
1785 float music_volume_fade_time;
1793 vec3_t camera_origin;
1794 vec3_t camera_angles;
1797 vec3_t camera_offset;
1798 vec3_t camera_posofs;
1800 vec3_t damage_angles;
1819#define BUTTON_ATTACKLEFT_BITINDEX 0
1820#define BUTTON_ATTACKRIGHT_BITINDEX 1
1821#define BUTTON_RUN_BITINDEX 2
1822#define BUTTON_USE_BITINDEX 3
1823#define BUTTON_LEAN_LEFT_BITINDEX 4
1824#define BUTTON_LEAN_RIGHT_BITINDEX 5
1825#define BUTTON_TALK_BITINDEX 6
1826#define BUTTON_ANY_BITINDEX 14
1827#define BUTTON_MOUSE_BITINDEX 15
1829#define BUTTON_ATTACKLEFT (1 << BUTTON_ATTACKLEFT_BITINDEX)
1830#define BUTTON_ATTACKRIGHT (1 << BUTTON_ATTACKRIGHT_BITINDEX)
1831#define BUTTON_RUN (1 << BUTTON_RUN_BITINDEX)
1832#define BUTTON_USE (1 << BUTTON_USE_BITINDEX)
1833#define BUTTON_LEAN_LEFT (1 << BUTTON_LEAN_LEFT_BITINDEX)
1834#define BUTTON_LEAN_RIGHT (1 << BUTTON_LEAN_RIGHT_BITINDEX)
1835#define BUTTON_TALK (1 << BUTTON_TALK_BITINDEX)
1836#define BUTTON_ANY (1 << BUTTON_ANY_BITINDEX)
1837#define BUTTON_MOUSE (1 << BUTTON_MOUSE_BITINDEX)
1840 WEAPON_COMMAND_NONE,
1841 WEAPON_COMMAND_USE_PISTOL,
1842 WEAPON_COMMAND_USE_RIFLE,
1843 WEAPON_COMMAND_USE_SMG,
1844 WEAPON_COMMAND_USE_MG,
1845 WEAPON_COMMAND_USE_GRENADE,
1846 WEAPON_COMMAND_USE_HEAVY,
1847 WEAPON_COMMAND_USE_ITEM1,
1848 WEAPON_COMMAND_USE_ITEM2,
1849 WEAPON_COMMAND_USE_ITEM3,
1850 WEAPON_COMMAND_USE_ITEM4,
1851 WEAPON_COMMAND_USE_PREV_WEAPON,
1852 WEAPON_COMMAND_USE_NEXT_WEAPON,
1853 WEAPON_COMMAND_USE_LAST_WEAPON,
1854 WEAPON_COMMAND_HOLSTER,
1855 WEAPON_COMMAND_DROP,
1858#define WEAPON_COMMAND_MAX_VER6 15
1859#define WEAPON_COMMAND_MAX_VER17 31
1861static unsigned int GetWeaponCommandMask(
unsigned int maxCmds) {
1862 return maxCmds << 7;
1865static unsigned int GetWeaponCommand(
unsigned int buttons,
unsigned int maxCmds) {
1866 return (buttons & (maxCmds << 7)) >> 7;
1876 short unsigned int buttons;
1877 short int angles[3];
1881 signed char forwardmove, rightmove, upmove;
1889#define MDL_ANIM_DELTA_DRIVEN ( 1 << 0 )
1890#define MDL_ANIM_DEFAULT_ANGLES ( 1 << 3 )
1891#define MDL_ANIM_NO_TIMECHECK ( 1 << 4 )
1894#define SOLID_BMODEL 0xffffff
1901#define RF_THIRD_PERSON (1<<0)
1902#define RF_FIRST_PERSON (1<<1)
1903#define RF_DEPTHHACK (1<<2)
1904#define RF_VIEWLENSFLARE (1<<3)
1905#define RF_FRAMELERP (1<<4)
1906#define RF_BEAM (1<<5)
1907#define RF_DONTDRAW (1<<7)
1908#define RF_LENSFLARE (1<<8)
1909#define RF_EXTRALIGHT (1<<9)
1910#define RF_DETAIL (1<<10)
1911#define RF_SHADOW (1<<11)
1912#define RF_PORTALSURFACE (1<<12)
1913#define RF_SKYORIGIN (1<<13)
1914#define RF_SKYENTITY (1<<14)
1915#define RF_LIGHTOFFSET (1<<15)
1916#define RF_CUSTOMSHADERPASS (1<<16)
1917#define RF_MINLIGHT (1<<17)
1918#define RF_FULLBRIGHT (1<<18)
1919#define RF_LIGHTING_ORIGIN (1<<19)
1923#define RF_SHADOW_PLANE (1<<20)
1924#define RF_WRAP_FRAMES (1<<21)
1928#define RF_ADDITIVE_DLIGHT (1<<22)
1929#define RF_LIGHTSTYLE_DLIGHT (1<<23)
1930#define RF_SHADOW_PRECISE (1<<24)
1931#define RF_INVISIBLE (1<<25)
1932#define RF_ALWAYSDRAW (1<<26)
1933#define RF_PRECISESHADOW (1<<28)
1937#define RF_FLAGS_NOT_INHERITED ( RF_LENSFLARE | RF_VIEWLENSFLARE | RF_BEAM | RF_EXTRALIGHT | RF_SKYORIGIN | RF_SHADOW | RF_SHADOW_PRECISE | RF_SHADOW_PLANE )
1942#define RF_FORCENOLOD 1024
1944#define BEAM_LIGHTNING_EFFECT (1<<0)
1945#define BEAM_USEMODEL (1<<1)
1946#define BEAM_PERSIST_EFFECT (1<<2)
1947#define BEAM_SPHERE_EFFECT (1<<3)
1948#define BEAM_RANDOM_DELAY (1<<4)
1949#define BEAM_TOGGLE (1<<5)
1950#define BEAM_RANDOM_TOGGLEDELAY (1<<6)
1951#define BEAM_WAVE_EFFECT (1<<7)
1952#define BEAM_USE_NOISE (1<<8)
1953#define BEAM_PARENT (1<<9)
1954#define BEAM_TILESHADER (1<<10)
1955#define BEAM_OFFSET_ENDPOINTS (1<<11)
1956#define BEAM_FADE (1<<12)
1957#define BEAM_INVERTED (1<<13)
1958#define BEAM_INVERTED_FAST (1<<14)
1981#define NUM_BONE_CONTROLLERS 5
1983#define NUM_MORPH_CONTROLLERS 10
1985#define MAX_MODEL_SURFACES 32
1987#define MDL_SURFACE_SKINOFFSET_BIT0 ( 1 << 0 )
1988#define MDL_SURFACE_SKINOFFSET_BIT1 ( 1 << 1 )
1989#define MDL_SURFACE_NODRAW ( 1 << 2 )
1990#define MDL_SURFACE_SURFACETYPE_BIT0 ( 1 << 3 )
1991#define MDL_SURFACE_SURFACETYPE_BIT1 ( 1 << 4 )
1992#define MDL_SURFACE_SURFACETYPE_BIT2 ( 1 << 5 )
1993#define MDL_SURFACE_CROSSFADE_SKINS ( 1 << 6 )
1994#define MDL_SURFACE_SKIN_NO_DAMAGE ( 1 << 7 )
1996#define CROUCH_HEIGHT 36
1997#define CROUCH_EYE_HEIGHT 48
1998#define STAND_HEIGHT 72
1999#define STAND_EYE_HEIGHT 82
2001#define MAX_FRAMEINFOS 16
2002#define FRAMEINFO_BLEND ( MAX_FRAMEINFOS >> 1 )
2027 float loopSoundVolume;
2028 float loopSoundMinDist;
2029 float loopSoundMaxDist;
2030 float loopSoundPitch;
2036 qboolean attach_use_angles;
2037 vec3_t attach_offset;
2045 frameInfo_t frameInfo[ MAX_FRAMEINFOS ];
2048 int bone_tag[ NUM_BONE_CONTROLLERS ];
2049 vec3_t bone_angles[ NUM_BONE_CONTROLLERS ];
2050 quat_t bone_quat[ NUM_BONE_CONTROLLERS ];
2051 byte surfaces[ 32 ];
2054 int groundEntityNum;
2061 float shader_data[ 2 ];
2098 unsigned short factor;
2099 unsigned short pattern;
2111 HUD_ALIGN_X_LEFT = 0,
2112 HUD_ALIGN_X_CENTER = 1,
2113 HUD_ALIGN_X_RIGHT = 2,
2114 HUD_ALIGN_Y_TOP = 0,
2115 HUD_ALIGN_Y_CENTER = 1,
2116 HUD_ALIGN_Y_BOTTOM = 2,
2121 char shaderName[ MAX_RES_NAME ];
2130 int iHorizontalAlign;
2132 qboolean bVirtualScreen;
2134 char string[ MAX_STRING_CHARS ];
2135 char fontName[ MAX_RES_NAME ];
2141 frameInfo_t g_VMFrameInfo[MAX_FRAMEINFOS];
2144 int g_iLastVMAnimChanged;
2145 int g_iCurrentVMAnimSlot;
2146 int g_iCurrentVMDuration;
2148 qboolean g_bCrossblending;
2150 int g_iLastEquippedWeaponStat;
2151 char g_szLastActiveItem[ 80 ];
2152 int g_iLastAnimPrefixIndex;
2154 float g_vCurrentVMPosOffset[ 3 ];
2157#define GLYPH_START 0
2158#define GLYPH_END 255
2159#define GLYPH_CHARSTART 32
2160#define GLYPH_CHAREND 127
2161#define GLYPHS_PER_FONT GLYPH_END - GLYPH_START + 1
2175 char shaderName[32];
2181 char name[MAX_QPATH];
2184#define Square(x) ((x)*(x))
2192#define AS_MPLAYER 99
2194#define AS_FAVORITES 3
2209typedef enum _flag_status {
2235#define MAX_GLOBAL_SERVERS 2048
2236#define MAX_OTHER_SERVERS 128
2237#define MAX_PINGREQUESTS 32
2238#define MAX_SERVERSTATUSREQUESTS 16
2245#define CDCHKSUM_LEN 2
2247#define FLOAT_TO_INT( x, fracbits ) ( ( x ) * ( 1 << ( fracbits ) ) )
2249#define FLOAT_TO_PKT( x, dest, wholebits, fracbits ) \
2251 if ( ( x ) >= ( 1 << ( wholebits ) ) ) \
2253 ( dest ) = FLOAT_TO_INT( ( 1 << ( wholebits ) ), ( fracbits ) ) - 1; \
2255 else if ( ( x ) < 0 ) \
2261 ( dest ) = FLOAT_TO_INT( ( x ), ( fracbits ) ); \
2265#define SIGNED_FLOAT_TO_PKT( x, dest, wholebits, fracbits ) \
2268 temp_x = ( x ) + ( 1 << ( wholebits ) ); \
2269 if ( temp_x >= ( 1 << ( ( wholebits ) + 1 ) ) ) \
2270 ( dest ) = FLOAT_TO_INT( ( 1 << ( ( wholebits ) + 1 ) ), ( fracbits ) ) - 1; \
2271 else if ( temp_x < 0 ) \
2274 ( dest ) = FLOAT_TO_INT( temp_x, ( fracbits ) ); \
2277#define INT_TO_FLOAT( x, wholebits, fracbits ) ( ( float )( ( ( float )( x ) ) / ( float )( 1 << ( fracbits ) ) - ( float )( 1 << ( wholebits ) ) ) )
2278#define UINT_TO_FLOAT( x, fracbits ) ( ( float )( ( ( float )( x ) ) / ( float )( 1 << ( fracbits ) ) ) )
2280#define TRANSLATION_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 11 )
2281#define PKT_TO_TRANSLATION( x ) UINT_TO_FLOAT( ( x ), 11 )
2283#define OFFSET_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 1, 14 )
2284#define PKT_TO_OFFSET( x ) UINT_TO_FLOAT( ( x ), 14 )
2286#define ROTATE_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 9, 6 )
2287#define PKT_TO_ROTATE( x ) UINT_TO_FLOAT( ( x ), 6 )
2289#define BASE_TO_PKT( x, dest ) SIGNED_FLOAT_TO_PKT( ( x ), ( dest ), 3, 4 )
2290#define PKT_TO_BASE( x ) INT_TO_FLOAT( ( x ), 3, 4 )
2292#define AMPLITUDE_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2293#define PKT_TO_AMPLITUDE( x ) UINT_TO_FLOAT( ( x ), 4 )
2295#define PHASE_TO_PKT( x, dest ) SIGNED_FLOAT_TO_PKT( ( x ), ( dest ), 3, 4 )
2296#define PKT_TO_PHASE( x ) INT_TO_FLOAT( ( x ), 3, 4 )
2298#define FREQUENCY_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2299#define PKT_TO_FREQUENCY( x ) UINT_TO_FLOAT( ( x ), 4 )
2301#define BEAM_PARM_TO_PKT( x, dest ) FLOAT_TO_PKT( ( x ), ( dest ), 4, 4 )
2302#define PKT_TO_BEAM_PARM( x ) UINT_TO_FLOAT( ( x ), 4 )
2304#define STUB() printf( "STUB: function %s in %s line %d.\n", __FUNCTION__, __FILE__, __LINE__ )
2305#define STUB_DESC( description ) printf( "STUB: %s in %s line %d.\n", description, __FILE__, __LINE__ )
2306#define UNIMPLEMENTED() Com_Printf( "FIXME: (%s) is unimplemented (file %s:%d)\n", __FUNCTION__, __FILE__, __LINE__ )
2308#if defined(__cplusplus)
2315using qcclock_t = std::chrono::steady_clock;
2316using qctime_t = qcclock_t::time_point;
2317using qctimedelta_t = qcclock_t::duration;
Definition q_shared.h:1517
Definition q_shared.h:2140
Definition q_shared.h:1415
Definition q_shared.h:1332
Definition q_shared.h:2092
Definition q_shared.h:2102
Definition q_shared.h:2011
Definition q_shared.h:2178
Definition q_shared.h:1960
Definition q_shared.h:1691
Definition g_public.h:168
Definition q_shared.h:2162
Definition q_shared.h:1100
Definition q_shared.h:2119
Definition q_shared.h:1491
Definition q_shared.h:1522
Definition q_shared.h:1152
Definition q_shared.h:1742
Definition q_shared.h:1235
Definition q_shared.h:2080
Definition q_shared.h:2220
Definition q_shared.h:2228
Definition q_shared.h:1470
Definition q_shared.h:1700
Definition q_shared.h:1450
Definition q_shared.h:1976
Definition q_shared.h:1497
Definition q_shared.h:1873
Definition q_shared.h:1713
Definition q_shared.h:1361
Definition q_shared.h:206