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)
120#define __attribute__(x)
125#define UNUSED_VAR __attribute__((unused))
130#if (defined _MSC_VER)
131#define Q_EXPORT __declspec(dllexport)
132#elif (defined __SUNPRO_C)
133#define Q_EXPORT __global
134#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun))
135#define Q_EXPORT __attribute__((visibility("default")))
160# define _CRTDBG_MAP_ALLOC
188size_t Q_vsnprintf(
char*
str,
size_t size,
const char* format, va_list ap);
190#define Q_vsnprintf vsnprintf
195#include "q_platform.h"
199typedef unsigned char byte;
200typedef unsigned char uchar;
202enum { qfalse, qtrue };
212typedef int qhandle_t;
213typedef int sfxHandle_t;
214typedef int fileHandle_t;
215typedef int clipHandle_t;
218#define ALIGN(x) __attribute__((aligned(x)))
223#define PAD(base, alignment) (((base)+(alignment)-1) & ~((alignment)-1))
224#define PADLEN(base, alignment) (PAD((base), (alignment)) - (base))
226#define PADP(base, alignment) ((void *) PAD((intptr_t) (base), (alignment)))
229#define QALIGN(x) __attribute__((aligned(x)))
235#define NULL ((void *)0)
239#define BIT(x) (1 << x)
244#define XSTRING(s) STRING(s)
246#define MAX_QINT 0x7fffffff
247#define MIN_QINT (-MAX_QINT-1)
249#define ARRAY_LEN(x) (sizeof(x) / sizeof(*(x)))
250#define STRARRAY_LEN(x) (ARRAY_LEN(x) - 1)
258#define stricmp strcasecmp
259#define strnicmp strncasecmp
270 PROTOCOL_MOH_MIN = 6,
271 PROTOCOL_MOH_DEMO = 6,
273 PROTOCOL_MOHTA_MIN = 15,
274 PROTOCOL_MOHTA_DEMO = 16,
297#define MAX_STRING_CHARS 2048
298#define MAX_STRING_TOKENS 1024
299#define MAX_TOKEN_CHARS 1024
301#define MAX_INFO_STRING 1350
302#define MAX_INFO_KEY 1024
303#define MAX_INFO_VALUE 1024
305#define BIG_INFO_STRING 8192
306#define BIG_INFO_KEY 8192
307#define BIG_INFO_VALUE 8192
309#define MAX_RES_NAME 64
313#define MAX_OSPATH PATH_MAX
315#define MAX_OSPATH 256
318#define MAX_NAME_LENGTH 32
332#define MAX_MAP_AREA_BYTES 32
353 ERR_SERVERDISCONNECT,
361#define PROP_GAP_WIDTH 5
362#define PROP_SPACE_WIDTH 8
363#define PROP_HEIGHT 30
364#define PROP_SMALL_SIZE_SCALE 0.75
366#define BLINK_DIVISOR 200
367#define PULSE_DIVISOR 250.0f
369#define UI_LEFT 0x00000000
370#define UI_CENTER 0x00000001
371#define UI_RIGHT 0x00000002
372#define UI_FORMATMASK 0x00000007
373#define UI_SMALLFONT 0x00000010
374#define UI_BIGFONT 0x00000020
375#define UI_GIANTFONT 0x00000040
376#define UI_DROPSHADOW 0x00000800
377#define UI_BLINK 0x00001000
378#define UI_INVERSE 0x00002000
379#define UI_PULSE 0x00004000
388#define Hunk_Alloc( size, preference ) Hunk_AllocDebug(size, preference, #size, __FILE__, __LINE__)
389void *Hunk_AllocDebug(
int size, ha_pref preference,
const char *label,
const char *file,
int line );
391void *Hunk_Alloc(
int size, ha_pref preference );
394#define Com_Memset memset
395#define Com_Memcpy memcpy
397#define Com_Allocate malloc
398#define Com_Dealloc free
416typedef vec_t vec2_t[2];
417typedef vec_t vec3_t[3];
418typedef vec_t vec4_t[4];
419typedef vec_t quat_t[4];
420typedef vec_t vec5_t[5];
421typedef vec_t matrix3x3_t[9];
422typedef vec_t matrix_t[16];
423typedef vec3_t axis_t[3];
427typedef int fixed16_t;
430#define M_PI 3.14159265358979323846
434#define M_SQRT2 1.414213562f
438#define M_SQRT1_2 7.0710678118654752440E-1
441#define NUMVERTEXNORMALS 162
442extern vec3_t bytedirs[NUMVERTEXNORMALS];
446#define SCREEN_WIDTH 640
447#define SCREEN_HEIGHT 480
449#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
450#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
452#define SMALLCHAR_WIDTH 8
453#define SMALLCHAR_HEIGHT 16
455#define BIGCHAR_WIDTH 16
456#define BIGCHAR_HEIGHT 16
458#define GIANTCHAR_WIDTH 32
459#define GIANTCHAR_HEIGHT 48
461extern vec4_t colorBlack;
462extern vec4_t colorRed;
463extern vec4_t colorGreen;
464extern vec4_t colorBlue;
465extern vec4_t colorYellow;
466extern vec4_t colorMagenta;
467extern vec4_t colorCyan;
468extern vec4_t colorWhite;
469extern vec4_t colorLtGrey;
470extern vec4_t colorMdGrey;
471extern vec4_t colorDkGrey;
482#define Q_COLOR_ESCAPE '^'
483#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1)) )
485#define COLOR_BLACK '0'
487#define COLOR_GREEN '2'
488#define COLOR_YELLOW '3'
489#define COLOR_BLUE '4'
490#define COLOR_CYAN '5'
491#define COLOR_MAGENTA '6'
492#define COLOR_WHITE '7'
493#define ColorIndex(c) ( ( (c) - '0' ) & 7 )
496#define S_COLOR_BLACK "^0"
497#define S_COLOR_RED "^1"
498#define S_COLOR_GREEN "^2"
499#define S_COLOR_YELLOW "^3"
500#define S_COLOR_BLUE "^4"
501#define S_COLOR_CYAN "^5"
502#define S_COLOR_MAGENTA "^6"
503#define S_COLOR_WHITE "^7"
505#define S_COLOR_BLACK ""
506#define S_COLOR_RED ""
507#define S_COLOR_GREEN ""
508#define S_COLOR_YELLOW ""
509#define S_COLOR_BLUE ""
510#define S_COLOR_CYAN ""
511#define S_COLOR_MAGENTA ""
512#define S_COLOR_WHITE ""
515#define HUD_MESSAGE_YELLOW "\x01"
516#define HUD_MESSAGE_WHITE "\x03"
517#define HUD_MESSAGE_CHAT_WHITE "\x02"
518#define HUD_MESSAGE_CHAT_RED "\x04"
520extern vec4_t g_color_table[8];
522#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
523#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
525#define DEG2RAD( a ) ( ( (a) * M_PI ) / 180.0F )
526#define RAD2DEG( a ) ( ( (a) * 180.0f ) / M_PI )
528#define Q_max(a, b) ((a) > (b) ? (a) : (b))
529#define Q_min(a, b) ((a) < (b) ? (a) : (b))
530#define Q_bound(a, b, c) (Q_max(a, Q_min(b, c)))
531#define Q_clamp(a, b, c) ((b) >= (c) ? (a)=(b) : (a) < (b) ? (a)=(b) : (a) > (c) ? (a)=(c) : (a))
532#define Q_lerp(from, to, frac) (from + ((to - from) * frac))
534#define LERP( a, b, w ) ( ( a ) * ( 1.0f - ( w ) ) + ( b ) * ( w ) )
535#define LUMA( red, green, blue ) ( 0.2126f * ( red ) + 0.7152f * ( green ) + 0.0722f * ( blue ) )
538#define Q_min(a,b) (((a) < (b)) ? (a) : (b))
541#define Q_max(a,b) (((a) > (b)) ? (a) : (b))
544int Q_clamp_int(
int value,
int min,
int max);
545float Q_clamp_float(
float value,
float min,
float max);
547#define bound(a,minval,maxval) ( ((a) > (minval)) ? ( ((a) < (maxval)) ? (a) : (maxval) ) : (minval) )
551extern vec3_t vec3_origin;
552extern vec3_t axisDefault[3];
553extern matrix_t matrixIdentity;
555#define nanmask (255<<23)
557#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
559static ID_INLINE
long Q_ftol(
float f)
561#if id386_sse && defined(_MSC_VER)
573static ID_INLINE
float Q_rsqrt(
float number ) {
574 float x = 0.5f * number;
577 asm(
"frsqrte %0,%1" :
"=f" (y) :
"f" (number));
579 y = __frsqrte( number );
581 return y * (1.5f - (x * y * y));
585static ID_INLINE
float Q_fabs(
float x) {
588 asm(
"fabs %0,%1" :
"=f" (abs_x) :
"f" (x));
592#define Q_fabs __fabsf
596float Q_fabs(
float f );
597float Q_rsqrt(
float f );
600#define SQRTFAST( x ) ( (x) * Q_rsqrt( x ) )
602byte ClampByte(
int i);
603signed char ClampChar(
int i );
604signed short ClampShort(
int i );
606double dEpsilon(
void );
607double dIdentity(
void );
608double dSign(
const double number );
609double dClamp(
const double value,
const double min,
const double max );
610double dDistance(
const double value1,
const double value2 );
611qboolean dCloseEnough(
const double value1,
const double value2,
const double epsilon );
612qboolean dSmallEnough(
const double value,
const double epsilon );
614float fEpsilon(
void );
615float fIdentity(
void );
616float fSign(
const float number );
617float fClamp(
const float value,
const float min,
const float max );
618float fDistance(
const float value1,
const float value2 );
619qboolean fCloseEnough(
const float value1,
const float value2,
const float epsilon );
620qboolean fSmallEnough(
const float value,
const float epsilon );
622int iSign(
const int number );
623int iClamp(
const int value,
const int min,
const int max );
626int DirToByte( vec3_t dir );
627void ByteToDir(
int b, vec3_t dir );
631#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
632#define DotProduct2D(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1])
633#define CrossProduct2D(a,b) ((a)[0]*(b)[1]-(b)[0]*(a)[1])
634#define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2])
635#define VectorAdd(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2])
636#define VectorAdd2D(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1])
637#define VectorSub2D(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1])
638#define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2])
639#define VectorCopy2D(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1])
640#define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s))
641#define VectorScale2D(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s))
642#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))
643#define VectorMA2D(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s))
647#define DotProduct(x,y) _DotProduct(x,y)
648#define VectorSubtract(a,b,c) _VectorSubtract(a,b,c)
649#define VectorAdd(a,b,c) _VectorAdd(a,b,c)
650#define VectorCopy(a,b) _VectorCopy(a,b)
651#define VectorScale(v, s, o) _VectorScale(v,s,o)
652#define VectorMA(v, s, b, o) _VectorMA(v,s,b,o)
663#define VectorCopy(a,b) (*(vec3struct_t *)b=*(vec3struct_t *)a)
667#define VectorClear2D(a) ((a)[0]=(a)[1]=0)
668#define VectorLength2DSquared(a) ((a)[0]*(a)[0]+(a)[1]*(a)[1])
669#define VectorLength2D(a) (sqrt(VectorLength2DSquared(a)))
670#define VectorSet2D(v, x, y) ((v)[0]=(x), (v)[1]=(y))
672#define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0)
673#define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2])
674#define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z))
675#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
677#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
679#define DotProduct4(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]+(x)[3]*(y)[3])
680#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])
681#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])
682#define VectorCopy4(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
683#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))
684#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))
685#define VectorClear4(a) ((a)[0]=(a)[1]=(a)[2]=(a)[3]=0)
686#define VectorNegate4(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2],(b)[3]=-(a)[3])
687#define VectorSet4(v,x,y,z,w) ((v)[0]=(x),(v)[1]=(y),(v)[2]=(z),(v)[3]=(w))
689#define VectorCopy5(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3],(b)[4]=(a)[4])
692vec_t _DotProduct(
const vec3_t v1,
const vec3_t v2 );
693void _VectorSubtract(
const vec3_t veca,
const vec3_t vecb, vec3_t out );
694void _VectorAdd(
const vec3_t veca,
const vec3_t vecb, vec3_t out );
695void _VectorCopy(
const vec3_t in, vec3_t out );
696void _VectorScale(
const vec3_t in,
float scale, vec3_t out );
697void _VectorMA(
const vec3_t veca,
float scale,
const vec3_t vecb, vec3_t vecc );
698vec_t Q_rint( vec_t in );
700unsigned ColorBytes3 (
float r,
float g,
float b);
701unsigned ColorBytes4 (
float r,
float g,
float b,
float a);
703float NormalizeColor(
const vec3_t in, vec3_t out );
704void RotatePointAroundAxis(vec3_t dst,
int axis,
const vec3_t point,
float degrees);
705void ClampColor(vec4_t color);
707float RadiusFromBounds(
const vec3_t mins,
const vec3_t maxs );
708void ClearBounds( vec3_t mins, vec3_t maxs );
709void ZeroBounds(vec3_t mins, vec3_t maxs);
710void AddPointToBounds(
const vec3_t v, vec3_t mins, vec3_t maxs );
711void BoundsAdd(vec3_t mins, vec3_t maxs,
const vec3_t mins2,
const vec3_t maxs2);
713float PointToSegmentDistanceSquared(
const vec3_t origin,
const vec3_t a,
const vec3_t b);
715#if !defined( Q3_VM ) || ( defined( Q3_VM ) && defined( __Q3_VM_MATH ) )
716static ID_INLINE
int VectorCompare(
const vec3_t v1,
const vec3_t v2 ) {
717 if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
723static ID_INLINE
int VectorCompare2D(
const vec2_t v1,
const vec2_t v2 ) {
724 if( v1[ 0 ] != v2[ 0 ] || v1[ 1 ] != v2[ 1 ] ) {
730static ID_INLINE
int VectorCompareEpsilon(
const vec3_t v1,
const vec3_t v2,
float fEpsilon )
734 for( i = 0; i < 3; i++ )
736 if( fabs( v1[ i ] - v2[ i ] ) > fEpsilon ) {
743static ID_INLINE vec_t VectorLength(
const vec3_t v ) {
744 return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
747static ID_INLINE vec_t VectorLengthSquared(
const vec3_t v ) {
748 return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
751static ID_INLINE vec_t Distance(
const vec3_t p1,
const vec3_t p2 ) {
754 VectorSubtract (p2, p1, v);
755 return VectorLength( v );
758static ID_INLINE vec_t DistanceSquared(
const vec3_t p1,
const vec3_t p2 ) {
761 VectorSubtract (p2, p1, v);
762 return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
767static ID_INLINE
void VectorNormalizeFast( vec3_t v )
771 ilength = Q_rsqrt( DotProduct( v, v ) );
778static ID_INLINE
void VectorInverse( vec3_t v ){
784static ID_INLINE
void CrossProduct(
const vec3_t v1,
const vec3_t v2, vec3_t cross ) {
785 cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
786 cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
787 cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
791int VectorCompare(
const vec3_t v1,
const vec3_t v2 );
793vec_t VectorLength(
const vec3_t v );
795vec_t VectorLengthSquared(
const vec3_t v );
797vec_t Distance(
const vec3_t p1,
const vec3_t p2 );
799vec_t DistanceSquared(
const vec3_t p1,
const vec3_t p2 );
801void VectorNormalizeFast( vec3_t v );
803void VectorInverse( vec3_t v );
805void CrossProduct(
const vec3_t v1,
const vec3_t v2, vec3_t cross );
809vec_t VectorNormalize (vec3_t v);
810vec_t VectorNormalize2(
const vec3_t v, vec3_t out );
811vec_t VectorNormalize2D( vec2_t v );
812vec_t VectorNormalize2D2(
const vec2_t v, vec2_t out );
813void VectorPackTo01( vec3_t v );
814void Vector4Scale(
const vec4_t in, vec_t scale, vec4_t out );
815void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out );
817int NearestPowerOfTwo(
int val);
820float Q_acos(
float c);
822int Q_rand(
int *seed );
823float Q_random(
int *seed );
824float Q_crandom(
int *seed );
826#define random() ((rand () & 0x7fff) / ((float)0x7fff))
827#define random2() ((rand () & 0x7fff) * (1.0 / ((float)0x7fff)))
828#define crandom() (2.0 * (random() - 0.5))
830float grandom(
void );
831float erandom(
float mean );
833#define AnglesToMat AnglesToAxis
835void vectoangles(
const vec3_t value1, vec3_t angles );
836void VectorToAngles(
const vec3_t vec, vec3_t angles );
837void AnglesToAxis(
const vec3_t angles, vec3_t axis[3]);
838void YawToAxis(
float yaw,
float axis[2]);
840float noise(
float vec[],
int len);
841float noise1(
float arg);
842float noise2(vec3_t arg);
843float noise3(vec3_t arg);
845void R_ConcatRotations(
float in1[ 3 ][ 3 ],
float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
846void R_ConcatTransforms(
float in1[ 3 ][ 4 ],
float in2[ 3 ][ 4 ],
float out[ 3 ][ 4 ] );
848void MatrixToEulerAngles(
const float mat[ 3 ][ 3 ], vec3_t ang );
849void QuatToMat(
const float q[ 4 ],
float m[ 3 ][ 3 ] );
850void SlerpQuaternion(
float from[4],
float to[4],
float t,
float res[4]);
851void EulerToQuat(
float ang[ 3 ],
float q[ 4 ] );
852void MatToQuat(
float srcMatrix[ 3 ][ 3 ],
float destQuat[ 4 ] );
854float ProjectPointOnLine(
const vec3_t i_vStart,
const vec3_t i_vEnd,
const vec3_t i_vPoint, vec3_t o_vProj );
855float ProjectLineOnPlane(
const vec3_t vPlaneNorm,
float fPlaneDist,
const vec3_t vStart,
const vec3_t vEnd, vec3_t vProj );
857float anglemod(
float a );
858float angledist(
float ang );
860void AxisClear( vec3_t axis[3] );
861void AxisCopy(
const vec3_t in[3], vec3_t out[3] );
863void SetPlaneSignbits(
struct cplane_s *out );
864int BoxOnPlaneSide (
const vec3_t emins,
const vec3_t emaxs,
struct cplane_s *plane);
866void CalculateRotatedBounds( vec3_t angles, vec3_t mins, vec3_t maxs );
867void CalculateRotatedBounds2(
float trans[ 3 ][ 3 ], vec3_t mins, vec3_t maxs );
868int BoundingBoxToInteger( vec3_t mins, vec3_t maxs );
869void IntegerToBoundingBox(
int num, vec3_t mins, vec3_t maxs );
870qboolean BoundsIntersect(
const vec3_t mins,
const vec3_t maxs,
871 const vec3_t mins2,
const vec3_t maxs2);
872qboolean BoundsIntersectSphere(
const vec3_t mins,
const vec3_t maxs,
873 const vec3_t origin, vec_t radius);
874qboolean BoundsIntersectPoint(
const vec3_t mins,
const vec3_t maxs,
875 const vec3_t origin);
877float AngleMod(
float a);
878float LerpAngle (
float from,
float to,
float frac);
879float LerpAngleFromCurrent(
float from,
float to,
float current,
float frac );
880float AngleSubtract(
float a1,
float a2 );
881void AnglesSubtract( vec3_t v1, vec3_t v2, vec3_t v3 );
883float AngleNormalize360 (
float angle );
884float AngleNormalize180 (
float angle );
885float AngleDelta (
float angle1,
float angle2 );
887qboolean PlaneFromPoints( vec4_t plane,
const vec3_t a,
const vec3_t b,
const vec3_t c );
888qboolean PlanesGetIntersectionPoint(
const vec4_t plane1,
const vec4_t plane2,
const vec4_t plane3, vec3_t out);
889void PlaneIntersectRay(
const vec3_t rayPos,
const vec3_t rayDir,
const vec4_t plane, vec3_t res);
890void ProjectPointOnPlane( vec3_t dst,
const vec3_t p,
const vec3_t normal );
891void RotatePointAroundVector( vec3_t dst,
const vec3_t dir,
const vec3_t point,
float degrees );
892void RotateAroundDirection( vec3_t axis[3],
float yaw );
893void MakeNormalVectors(
const vec3_t forward, vec3_t right, vec3_t up );
898void MatrixTransformVector(
const vec3_t in,
const float mat[ 3 ][ 3 ], vec3_t out );
899void MatrixTransformVectorRight(
const float mat[ 3 ][ 3 ],
const vec3_t in, vec3_t out );
900void Matrix3x3Multiply(
const float in1[ 3 ][ 3 ],
const float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
901void AngleVectors(
const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up );
902void AngleVectorsLeft(
const vec3_t angles, vec3_t forward, vec3_t left, vec3_t up );
903void PerpendicularVector( vec3_t dst,
const vec3_t src );
905void GetPerpendicularViewVector(
const vec3_t point,
const vec3_t p1,
const vec3_t p2, vec3_t up);
906void ProjectPointOntoVector(vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_t vProj);
908float pointToLineDistance(
const vec3_t point,
const vec3_t p1,
const vec3_t p2);
909float VectorMinComponent(vec3_t v);
910float VectorMaxComponent(vec3_t v);
913#define MAX(x,y) ((x)>(y)?(x):(y))
917#define MIN(x,y) ((x)<(y)?(x):(y))
920vec_t DistanceBetweenLineSegmentsSquared(
const vec3_t sP0,
const vec3_t sP1,
921 const vec3_t tP0,
const vec3_t tP1,
float *s,
float *t);
922vec_t DistanceBetweenLineSegments(
const vec3_t sP0,
const vec3_t sP1,
923 const vec3_t tP0,
const vec3_t tP1,
float *s,
float *t);
925void VectorMatrixInverse(
void* DstMatrix,
const void* SrcMatrix );
927void MatrixIdentity(matrix_t m);
928void MatrixClear(matrix_t m);
929void MatrixCopy(
const matrix_t in, matrix_t out);
930qboolean MatrixCompare(
const matrix_t a,
const matrix_t b);
931void MatrixTransposeIntoXMM(
const matrix_t m);
932void MatrixTranspose(
const matrix_t in, matrix_t out);
935qboolean MatrixInverse(matrix_t m);
936void MatrixSetupXRotation(matrix_t m, vec_t degrees);
937void MatrixSetupYRotation(matrix_t m, vec_t degrees);
938void MatrixSetupZRotation(matrix_t m, vec_t degrees);
939void MatrixSetupTranslation(matrix_t m, vec_t x, vec_t y, vec_t z);
940void MatrixSetupScale(matrix_t m, vec_t x, vec_t y, vec_t z);
941void MatrixSetupShear(matrix_t m, vec_t x, vec_t y);
942void Matrix4x4Multiply(
const matrix_t a,
const matrix_t b, matrix_t out);
943void MatrixMultiply(
const float in1[ 3 ][ 3 ],
const float in2[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
944void MatrixMultiply2( matrix_t m,
const matrix_t m2 );
945void MatrixMultiplyRotation(matrix_t m, vec_t pitch, vec_t yaw, vec_t roll);
946void MatrixMultiplyZRotation(matrix_t m, vec_t degrees);
947void MatrixMultiplyTranslation(matrix_t m, vec_t x, vec_t y, vec_t z);
948void MatrixMultiplyScale(matrix_t m, vec_t x, vec_t y, vec_t z);
949void MatrixMultiplyShear(matrix_t m, vec_t x, vec_t y);
950void MatrixToAngles(
const matrix_t m, vec3_t angles);
951void MatrixFromAngles(matrix_t m, vec_t pitch, vec_t yaw, vec_t roll);
952void MatrixFromVectorsFLU(matrix_t m,
const vec3_t forward,
const vec3_t left,
const vec3_t up);
953void MatrixFromVectorsFRU(matrix_t m,
const vec3_t forward,
const vec3_t right,
const vec3_t up);
954void MatrixFromQuat(matrix_t m,
const quat_t q);
955void MatrixFromPlanes(matrix_t m,
const vec4_t left,
const vec4_t right,
const vec4_t bottom,
const vec4_t top,
956 const vec4_t near,
const vec4_t far);
957void MatrixToVectorsFLU(
const matrix_t m, vec3_t forward, vec3_t left, vec3_t up);
958void MatrixToVectorsFRU(
const matrix_t m, vec3_t forward, vec3_t right, vec3_t up);
959void MatrixSetupTransformFromVectorsFLU(matrix_t m,
const vec3_t forward,
const vec3_t left,
const vec3_t up,
const vec3_t origin);
960void MatrixSetupTransformFromVectorsFRU(matrix_t m,
const vec3_t forward,
const vec3_t right,
const vec3_t up,
const vec3_t origin);
961void MatrixSetupTransformFromRotation(matrix_t m,
const matrix_t rot,
const vec3_t origin);
962void MatrixSetupTransformFromQuat(matrix_t m,
const quat_t quat,
const vec3_t origin);
963void MatrixAffineInverse(
const matrix_t in, matrix_t out);
964void MatrixTransformNormal(
const matrix_t m,
const vec3_t in, vec3_t out);
965void MatrixTransformNormal2(
const matrix_t m, vec3_t inout);
966void MatrixTransformPoint(
const matrix_t m,
const vec3_t in, vec3_t out);
967void MatrixTransformPoint2(
const matrix_t m, vec3_t inout);
968void MatrixTransform4(
const matrix_t m,
const vec4_t in, vec4_t out);
969void MatrixTransformPlane(
const matrix_t m,
const vec4_t in, vec4_t out);
970void MatrixTransformPlane2(
const matrix_t m, vec3_t inout);
971void MatrixPerspectiveProjection(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
972void MatrixPerspectiveProjectionLH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
973void MatrixPerspectiveProjectionRH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
974void MatrixPerspectiveProjectionFovYAspectLH(matrix_t m, vec_t fov, vec_t aspect, vec_t near, vec_t far);
975void MatrixPerspectiveProjectionFovXYLH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near, vec_t far);
976void MatrixPerspectiveProjectionFovXYRH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near, vec_t far);
977void MatrixPerspectiveProjectionFovXYInfiniteRH(matrix_t m, vec_t fovX, vec_t fovY, vec_t near);
978void MatrixOrthogonalProjection(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
980void MatrixOrthogonalProjectionLH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
981void MatrixOrthogonalProjectionRH(matrix_t m, vec_t left, vec_t right, vec_t bottom, vec_t top, vec_t near, vec_t far);
983void MatrixPlaneReflection(matrix_t m,
const vec4_t plane);
985void MatrixLookAtLH(matrix_t output,
const vec3_t pos,
const vec3_t dir,
const vec3_t up);
986void MatrixLookAtRH(matrix_t m,
const vec3_t eye,
const vec3_t dir,
const vec3_t up);
987void MatrixScaleTranslateToUnitCube(matrix_t m,
const vec3_t mins,
const vec3_t maxs);
988void MatrixCrop(matrix_t m,
const vec3_t mins,
const vec3_t maxs);
990void TransposeMatrix(
float in[ 3 ][ 3 ],
float out[ 3 ][ 3 ] );
992static ID_INLINE
void AnglesToMatrix(
const vec3_t angles, matrix_t m)
994 MatrixFromAngles(m, angles[PITCH], angles[YAW], angles[ROLL]);
998#define QuatSet(q,x,y,z,w) ((q)[0]=(x),(q)[1]=(y),(q)[2]=(z),(q)[3]=(w))
999#define QuatCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
1001#define QuatCompare(a,b) ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3])
1003static ID_INLINE
void QuatClear(quat_t q)
1022static ID_INLINE
void QuatCalcW(quat_t q)
1025 vec_t term = 1.0f - (q[0] * q[0] + q[1] * q[1] + q[2] * q[2]);
1032 q[3] = sqrt(fabs(1.0f - (q[0] * q[0] + q[1] * q[1] + q[2] * q[2])));
1036static ID_INLINE
void QuatInverse(quat_t q)
1043static ID_INLINE
void QuatAntipodal(quat_t q)
1051static ID_INLINE vec_t QuatLength(
const quat_t q)
1053 return (vec_t) sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]);
1056vec_t QuatNormalize(quat_t q);
1058void QuatFromAngles(quat_t q, vec_t pitch, vec_t yaw, vec_t roll);
1060static ID_INLINE
void AnglesToQuat(
const vec3_t angles, quat_t q)
1062 QuatFromAngles(q, angles[PITCH], angles[YAW], angles[ROLL]);
1065void QuatFromMatrix(quat_t q,
const matrix_t m);
1066void QuatToVectorsFLU(
const quat_t quat, vec3_t forward, vec3_t left, vec3_t up);
1067void QuatToVectorsFRU(
const quat_t quat, vec3_t forward, vec3_t right, vec3_t up);
1068void QuatToAxis(
const quat_t q, vec3_t axis[3]);
1069void QuatToAngles(
const quat_t q, vec3_t angles);
1072void QuatToRotAngle(
const quat_t q, vec_t *angle );
1073void QuatToRotAngleAxis(
const quat_t q, vec_t *angle, vec3_t axis );
1075void QuatFromRotAngleAxis( quat_t q, vec_t angle,
const vec3_t axis );
1080void QuatMultiply0(quat_t qa,
const quat_t qb);
1083void QuatMultiply1(
const quat_t qa,
const quat_t qb, quat_t qc);
1086void QuatMultiply2(
const quat_t qa,
const quat_t qb, quat_t qc);
1089void QuatMultiply3(
const quat_t qa,
const quat_t qb, quat_t qc);
1092void QuatMultiply4(
const quat_t qa,
const quat_t qb, quat_t qc);
1094void QuaternionMultiply( quat_t output, quat_t first, quat_t second );
1096void QuatSlerp(
const quat_t from,
const quat_t to,
float frac, quat_t out);
1097void QuatTransformVector(
const quat_t q,
const vec3_t in, vec3_t out);
1098int Q_isnan(
float x );
1105 qboolean frameMemory;
1106 int currentElements;
1113void Com_InitGrowList(
growList_t * list,
int maxElements);
1115int Com_AddToGrowList(
growList_t * list,
void *data);
1116void *Com_GrowListElement(
const growList_t * list,
int index);
1117int Com_IndexForGrowListElement(
const growList_t * list,
const void *element);
1122float Com_Clamp(
float min,
float max,
float value );
1124const char *COM_SkipPath(
const char *pathname );
1125const char *COM_GetExtension(
const char *name );
1126void COM_StripExtension(
const char *in,
char *out,
int destsize);
1127qboolean COM_CompareExtension(
const char* in,
const char* ext);
1128void COM_DefaultExtension(
char *path,
int maxSize,
const char *extension );
1130void COM_BeginParseSession(
const char *name );
1131int COM_GetCurrentParseLine(
void );
1132const char *COM_Parse(
char **data_p );
1133char *COM_ParseExt(
char **data_p, qboolean allowLineBreak );
1134char *COM_ParseExtIgnoreQuotes(
char **data_p, qboolean allowLineBreak );
1135const char *COM_GetToken(
char **data_p, qboolean crossline );
1136void Com_SkipRestOfLine(
char **data);
1137void Com_SkipBracedSection(
char **program);
1138void Com_Parse1DMatrix(
char **buf_p,
int x,
float *m, qboolean checkBrackets);
1139int COM_Compress(
char *data_p );
1140void COM_ParseError(
char *format, ... ) __attribute__ ((format (printf, 1, 2)));
1141void COM_ParseWarning(
char *format, ... ) __attribute__ ((format (printf, 1, 2)));
1144#define MAX_TOKENLENGTH 1024
1152#define TT_PUNCTUATION 5
1161 char string[MAX_TOKENLENGTH];
1166void COM_MatchToken(
char**buf_p,
char *match );
1168qboolean SkipBracedSection (
char **program,
int depth);
1169void SkipRestOfLine (
char **data );
1171void Parse1DMatrix (
char **buf_p,
int x,
float *m);
1172void Parse2DMatrix (
char **buf_p,
int y,
int x,
float *m);
1173void Parse3DMatrix (
char **buf_p,
int z,
int y,
int x,
float *m);
1175int Com_HexStrToInt(
const char *
str );
1177size_t QDECL Com_sprintf (
char *dest,
size_t size,
const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
1179char *Com_SkipTokens(
char *s,
int numTokens, const
char *sep );
1180char *Com_SkipCharset(
char *s, const
char *sep );
1182void Com_RandomBytes(
byte*
string,
int len);
1183void Com_BackslashToSlash(
char *
str );
1202#define CTRL(a) ((a)-'a'+1)
1204int Q_isprint(
int c );
1205int Q_islower(
int c );
1206int Q_isupper(
int c );
1207int Q_isalpha(
int c );
1208qboolean Q_isanumber(
const char *s );
1209qboolean Q_isintegral(
float f );
1212int Q_stricmp (
const char *s1,
const char *s2);
1213int Q_strncmp(
const char *s1,
const char *s2,
size_t n );
1214int Q_stricmpn (
const char *s1,
const char *s2,
size_t n);
1215char *Q_strlwr(
char *s1 );
1216char *Q_strupr(
char *s1 );
1217char *Q_strrchr(
const char*
string,
int c );
1218const char *Q_stristr(
const char *s,
const char *find);
1219qboolean Q_strreplace(
char *dest,
int destsize,
const char *find,
const char *replace);
1222void Q_strncpyz(
char *dest,
const char *src,
size_t destsize );
1223void Q_strcat(
char *dest,
int size,
const char *src );
1226int Q_PrintStrlen(
const char *
string );
1228char *Q_CleanStr(
char *
string );
1230int Q_CountChar(
const char *
string,
char tocount);
1234void Swap_Init(
void);
1250const char *va(
const char *format, ... ) __attribute__ ((format (printf, 1, 2)));
1252#define TRUNCATE_LENGTH 64
1253void Com_TruncateLongString(
char *buffer,
const char *s );
1257float vectoyaw(
const vec3_t vec);
1258int MusicMood_NameToNum(
const char * name );
1259const char * MusicMood_NumToName(
int num );
1260int EAXMode_NameToNum(
const char * name );
1261const char * EAXMode_NumToName(
int num );
1266char *Info_ValueForKey(
const char *s,
const char *key );
1267void Info_RemoveKey(
char *s,
const char *key );
1268void Info_RemoveKey_big(
char *s,
const char *key );
1269void Info_SetValueForKey(
char *s,
const char *key,
const char *value );
1270void Info_SetValueForKey_Big(
char *s,
const char *key,
const char *value );
1271qboolean Info_Validate(
const char *s );
1272void Info_NextPair(
const char **s,
char *key,
char *value );
1275void QDECL Com_Error(
int level,
const char *error, ... ) __attribute__ ((format (printf, 2, 3)));
1276void QDECL Com_Printf( const
char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
1277void QDECL Com_DPrintf( const
char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
1278void QDECL Com_DPrintf2( const
char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
1279void QDECL Com_DebugPrintf( const
char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
1293#define CVAR_ARCHIVE 0x0001
1296#define CVAR_USERINFO 0x0002
1297#define CVAR_SERVERINFO 0x0004
1298#define CVAR_SYSTEMINFO 0x0008
1299#define CVAR_INIT 0x0010
1301#define CVAR_LATCH 0x0020
1306#define CVAR_ROM 0x0040
1307#define CVAR_USER_CREATED 0x0080
1308#define CVAR_TEMP 0x0100
1309#define CVAR_CHEAT 0x0200
1310#define CVAR_NORESTART 0x0400
1312#define CVAR_SERVER_CREATED 0x0800
1314#define CVAR_SOUND_LATCH 0x1000
1320#define CVAR_TERRAIN_LATCH 0x2000
1322#define CVAR_SAVEGAME 0x4000
1324#define CVAR_VM_CREATED 0x8000
1325#define CVAR_PROTECTED 0x10000
1326#define CVAR_RESETSTRING 0x20000
1328#define CVAR_MODIFIED 0x40000000
1329#define CVAR_NONEXISTENT 0x80000000
1332typedef struct cvar_s cvar_t;
1338 char *latchedString;
1341 int modificationCount;
1357#define MAX_CVAR_VALUE_STRING 256
1359typedef int cvarHandle_t;
1364 cvarHandle_t handle;
1365 int modificationCount;
1368 char string[MAX_CVAR_VALUE_STRING];
1369 char latchedString[MAX_CVAR_VALUE_STRING];
1380#include "surfaceflags.h"
1387#define PLANE_NON_AXIAL 3
1388#define PLANE_NON_PLANAR 4
1398static ID_INLINE
int PlaneTypeForNormal(vec3_t normal)
1400 if(normal[0] == 1.0)
1403 if(normal[1] == 1.0)
1406 if(normal[2] == 1.0)
1409 if(normal[0] == 0.0 && normal[1] == 0.0 && normal[2] == 0.0)
1410 return PLANE_NON_PLANAR;
1412 return PLANE_NON_AXIAL;
1426typedef enum hitloc_e {
1428 HITLOC_GENERAL = -1,
1454 qboolean startsolid;
1470#define SAVEGAME_STRUCT_VERSION 4
1486 char saveName[ 64 ];
1487 char tm_filename[ 64 ];
1500 int iReferenceNumber;
1502 qhandle_t hTreadShader;
1506 vec3_t vStartVerts[ 2 ];
1507 float fStartTexCoord;
1510 vec3_t vMidVerts[ 2 ];
1514 vec3_t vEndVerts[ 2 ];
1534#define KEYCATCH_CONSOLE 0x0001
1535#define KEYCATCH_UI 0x0002
1536#define KEYCATCH_MESSAGE 0x0004
1537#define KEYCATCH_CGAME 0x0008
1561 CHAN_DIALOG_SECONDARY,
1569#define S_FLAG_DO_CALLBACK 0x400
1571#define DEFAULT_MIN_DIST -1.0
1572#define DEFAULT_VOL -1.0
1574#define LEVEL_WIDE_MIN_DIST 10000
1575#define LEVEL_WIDE_STRING "levelwide"
1577#define SOUND_SYNCH 0x1
1578#define SOUND_SYNCH_FADE 0x2
1579#define SOUND_RANDOM_PITCH_20 0x4
1580#define SOUND_RANDOM_PITCH_40 0x8
1581#define SOUND_LOCAL_DIALOG 0x10
1617 eax_carpetedhallway,
1643#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535)
1644#define BYTE2ANGLE(x) ((x)*(360.0/255))
1645#define SHORT2ANGLE(x) ((x)*(360.0/65536))
1647#define SNAPFLAG_RATE_DELAYED 1
1648#define SNAPFLAG_NOT_ACTIVE 2
1649#define SNAPFLAG_SERVERCOUNT 4
1654#define MAX_CLIENTS 64
1655#define MAX_LOCATIONS 64
1657#define MAX_MAP_BOUNDS 8192
1658#define MIN_MAP_BOUNDS ( -MAX_MAP_BOUNDS )
1659#define MAP_SIZE ( MAX_MAP_BOUNDS - MIN_MAP_BOUNDS )
1661#define GENTITYNUM_BITS 10
1662#define MAX_GENTITIES (1<<GENTITYNUM_BITS)
1667#define ENTITYNUM_NONE (MAX_GENTITIES-1)
1668#define ENTITYNUM_WORLD (MAX_GENTITIES-2)
1669#define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2)
1671#define MAX_SERVER_SOUNDS 64
1672#define MAX_SERVER_SOUNDS_BITS (MAX_SERVER_SOUNDS-1)
1674#define MAX_MODELS 1024
1675#define MAX_SOUNDS 512
1676#define MAX_OBJECTIVES 20
1677#define MAX_LIGHTSTYLES 32
1678#define MAX_WEAPONS 64
1680#define MAX_CONFIGSTRINGS 2736
1681#define MAX_HUDDRAW_ELEMENTS 256
1683#define MAX_SUBTITLES 4
1687#define CS_SERVERINFO 0
1688#define CS_SYSTEMINFO 1
1690#define RESERVED_CONFIGSTRINGS 2
1692#define MAX_GAMESTATE_CHARS 41952
1694 int stringOffsets[MAX_CONFIGSTRINGS];
1695 char stringData[MAX_GAMESTATE_CHARS];
1706 short int sound_index;
1716 signed char ofs[ 3 ];
1722#define MAX_ACTIVE_ITEMS 8
1724#define MAX_AMMOCOUNT 16
1726#define MAX_PERSISTANT 16
1727#define MAX_POWERUPS 16
1729#define MAX_PS_EVENTS 2
1731#define PS_PMOVEFRAMECOUNTBITS 6
1757 int delta_angles[3];
1760 int groundEntityNum;
1763 qboolean groundPlane;
1774 int iNetViewModelAnim;
1776 int iViewModelAnimChanged;
1778 int stats[MAX_STATS];
1779 int activeItems[MAX_ACTIVE_ITEMS];
1780 int ammo_name_index[MAX_AMMO];
1781 int ammo_amount[MAX_AMMOCOUNT];
1782 int max_ammo_amount[MAX_AMMOCOUNT];
1784 int current_music_mood;
1785 int fallback_music_mood;
1787 float music_volume_fade_time;
1795 vec3_t camera_origin;
1796 vec3_t camera_angles;
1799 vec3_t camera_offset;
1800 vec3_t camera_posofs;
1802 vec3_t damage_angles;
1821#define BUTTON_ATTACKLEFT_BITINDEX 0
1822#define BUTTON_ATTACKRIGHT_BITINDEX 1
1823#define BUTTON_RUN_BITINDEX 2
1824#define BUTTON_USE_BITINDEX 3
1825#define BUTTON_LEAN_LEFT_BITINDEX 4
1826#define BUTTON_LEAN_RIGHT_BITINDEX 5
1827#define BUTTON_TALK_BITINDEX 6
1828#define BUTTON_ANY_BITINDEX 14
1829#define BUTTON_MOUSE_BITINDEX 15
1831#define BUTTON_ATTACKLEFT (1 << BUTTON_ATTACKLEFT_BITINDEX)
1832#define BUTTON_ATTACKRIGHT (1 << BUTTON_ATTACKRIGHT_BITINDEX)
1833#define BUTTON_RUN (1 << BUTTON_RUN_BITINDEX)
1834#define BUTTON_USE (1 << BUTTON_USE_BITINDEX)
1835#define BUTTON_LEAN_LEFT (1 << BUTTON_LEAN_LEFT_BITINDEX)
1836#define BUTTON_LEAN_RIGHT (1 << BUTTON_LEAN_RIGHT_BITINDEX)
1837#define BUTTON_TALK (1 << BUTTON_TALK_BITINDEX)
1838#define BUTTON_ANY (1 << BUTTON_ANY_BITINDEX)
1839#define BUTTON_MOUSE (1 << BUTTON_MOUSE_BITINDEX)
1842 WEAPON_COMMAND_NONE,
1843 WEAPON_COMMAND_USE_PISTOL,
1844 WEAPON_COMMAND_USE_RIFLE,
1845 WEAPON_COMMAND_USE_SMG,
1846 WEAPON_COMMAND_USE_MG,
1847 WEAPON_COMMAND_USE_GRENADE,
1848 WEAPON_COMMAND_USE_HEAVY,
1849 WEAPON_COMMAND_USE_ITEM1,
1850 WEAPON_COMMAND_USE_ITEM2,
1851 WEAPON_COMMAND_USE_ITEM3,
1852 WEAPON_COMMAND_USE_ITEM4,
1853 WEAPON_COMMAND_USE_PREV_WEAPON,
1854 WEAPON_COMMAND_USE_NEXT_WEAPON,
1855 WEAPON_COMMAND_USE_LAST_WEAPON,
1856 WEAPON_COMMAND_HOLSTER,
1857 WEAPON_COMMAND_DROP,
1860#define WEAPON_COMMAND_MAX_VER6 15
1861#define WEAPON_COMMAND_MAX_VER17 31
1863static unsigned int GetWeaponCommandMask(
unsigned int maxCmds) {
1864 return maxCmds << 7;
1867static unsigned int GetWeaponCommand(
unsigned int buttons,
unsigned int maxCmds) {
1868 return (buttons & (maxCmds << 7)) >> 7;
1878 short unsigned int buttons;
1879 short int angles[3];
1883 signed char forwardmove, rightmove, upmove;
1891#define MDL_ANIM_DELTA_DRIVEN ( 1 << 0 )
1892#define MDL_ANIM_DEFAULT_ANGLES ( 1 << 3 )
1893#define MDL_ANIM_NO_TIMECHECK ( 1 << 4 )
1896#define SOLID_BMODEL 0xffffff
1903#define RF_THIRD_PERSON (1<<0)
1904#define RF_FIRST_PERSON (1<<1)
1905#define RF_DEPTHHACK (1<<2)
1906#define RF_VIEWLENSFLARE (1<<3)
1907#define RF_FRAMELERP (1<<4)
1908#define RF_BEAM (1<<5)
1909#define RF_DONTDRAW (1<<7)
1910#define RF_LENSFLARE (1<<8)
1911#define RF_EXTRALIGHT (1<<9)
1912#define RF_DETAIL (1<<10)
1913#define RF_SHADOW (1<<11)
1914#define RF_PORTALSURFACE (1<<12)
1915#define RF_SKYORIGIN (1<<13)
1916#define RF_SKYENTITY (1<<14)
1917#define RF_LIGHTOFFSET (1<<15)
1918#define RF_CUSTOMSHADERPASS (1<<16)
1919#define RF_MINLIGHT (1<<17)
1920#define RF_FULLBRIGHT (1<<18)
1921#define RF_LIGHTING_ORIGIN (1<<19)
1925#define RF_SHADOW_PLANE (1<<20)
1926#define RF_WRAP_FRAMES (1<<21)
1930#define RF_ADDITIVE_DLIGHT (1<<22)
1931#define RF_LIGHTSTYLE_DLIGHT (1<<23)
1932#define RF_SHADOW_PRECISE (1<<24)
1933#define RF_INVISIBLE (1<<25)
1934#define RF_VIEWMODEL (1<<26)
1935#define RF_PRECISESHADOW (1<<28)
1936#define RF_ALWAYSDRAW (1<<30)
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:1519
Definition q_shared.h:2143
Definition q_shared.h:1417
Definition q_shared.h:1334
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:1693
Definition g_public.h:168
Definition q_shared.h:2165
Definition q_shared.h:1104
Definition q_shared.h:2122
Definition q_shared.h:1493
Definition q_shared.h:1524
Definition q_shared.h:1156
Definition q_shared.h:1744
Definition q_shared.h:1239
Definition q_shared.h:2083
Definition q_shared.h:2223
Definition q_shared.h:2231
Definition q_shared.h:1472
Definition q_shared.h:1702
Definition q_shared.h:1452
Definition q_shared.h:1979
Definition q_shared.h:1499
Definition q_shared.h:1875
Definition q_shared.h:1715
Definition q_shared.h:1363
Definition q_shared.h:204