00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __Q_SHARED_H
00023 #define __Q_SHARED_H
00024
00025
00026
00027
00028
00029
00030
00031
00032 #define Q3_VERSION "DOOM 0.01"
00033
00034
00035 #define ALIGN_ON
00036 #define ALIGN_OFF
00037
00038 #ifdef _WIN32
00039
00040 #pragma warning(disable : 4018) // signed/unsigned mismatch
00041 #pragma warning(disable : 4032)
00042 #pragma warning(disable : 4051)
00043 #pragma warning(disable : 4057) // slightly different base types
00044 #pragma warning(disable : 4100) // unreferenced formal parameter
00045 #pragma warning(disable : 4115)
00046 #pragma warning(disable : 4125) // decimal digit terminates octal escape sequence
00047 #pragma warning(disable : 4127) // conditional expression is constant
00048 #pragma warning(disable : 4136)
00049 #pragma warning(disable : 4201)
00050 #pragma warning(disable : 4214)
00051 #pragma warning(disable : 4244)
00052 #pragma warning(disable : 4305) // truncation from const double to float
00053 #pragma warning(disable : 4310) // cast truncates constant value
00054 #pragma warning(disable : 4514)
00055 #pragma warning(disable : 4711) // selected for automatic inline expansion
00056 #pragma warning(disable : 4220) // varargs matches remaining parameters
00057
00058 #endif
00059
00060 #include <assert.h>
00061 #include <math.h>
00062 #include <stdio.h>
00063 #include <stdarg.h>
00064 #include <string.h>
00065 #include <stdlib.h>
00066 #include <time.h>
00067 #include <ctype.h>
00068 #ifdef WIN32 // mac doesn't have malloc.h
00069 #include <malloc.h>
00070 #endif
00071 #ifdef _WIN32
00072
00073
00074
00075 #endif
00076
00077
00078
00079 #if (defined _M_IX86 || defined __i386__) && !defined __sun__ && !defined __LCC__
00080 #define id386 1
00081 #else
00082 #define id386 0
00083 #endif
00084
00085
00086
00087 #define QDECL
00088
00089
00090
00091 #ifdef WIN32
00092
00093 #define MAC_STATIC
00094
00095 #undef QDECL
00096 #define QDECL __cdecl
00097
00098
00099 #ifdef NDEBUG
00100 #ifdef _M_IX86
00101 #define CPUSTRING "win-x86"
00102 #elif defined _M_ALPHA
00103 #define CPUSTRING "win-AXP"
00104 #endif
00105 #else
00106 #ifdef _M_IX86
00107 #define CPUSTRING "win-x86-debug"
00108 #elif defined _M_ALPHA
00109 #define CPUSTRING "win-AXP-debug"
00110 #endif
00111 #endif
00112
00113
00114 #define PATH_SEP '\\'
00115
00116 #endif
00117
00118
00119
00120 #if defined(__MACH__) && defined(__APPLE__)
00121
00122 #define MAC_STATIC
00123
00124 #ifdef __ppc__
00125 #define CPUSTRING "MacOSXS-ppc"
00126 #elif defined __i386__
00127 #define CPUSTRING "MacOSXS-i386"
00128 #else
00129 #define CPUSTRING "MacOSXS-other"
00130 #endif
00131
00132 #define PATH_SEP '/'
00133
00134 #define GAME_HARD_LINKED
00135 #define CGAME_HARD_LINKED
00136 #define UI_HARD_LINKED
00137 #define _alloca alloca
00138
00139 #undef ALIGN_ON
00140 #undef ALIGN_OFF
00141 #define ALIGN_ON #pragma align(16)
00142 #define ALIGN_OFF #pragma align()
00143
00144 #ifdef __cplusplus
00145 extern "C" {
00146 #endif
00147
00148 void *osxAllocateMemory(long size);
00149 void osxFreeMemory(void *pointer);
00150
00151 #ifdef __cplusplus
00152 }
00153 #endif
00154
00155 #endif
00156
00157
00158
00159 #ifdef __MACOS__
00160
00161 #define MAC_STATIC static
00162
00163 #define CPUSTRING "MacOS-PPC"
00164
00165 #define PATH_SEP ':'
00166
00167 void Sys_PumpEvents( void );
00168
00169 #endif
00170
00171 #ifdef __MRC__
00172
00173 #define MAC_STATIC
00174
00175 #define CPUSTRING "MacOS-PPC"
00176
00177 #define PATH_SEP ':'
00178
00179 void Sys_PumpEvents( void );
00180
00181 #undef QDECL
00182 #define QDECL __cdecl
00183
00184 #define _alloca alloca
00185 #endif
00186
00187
00188
00189
00190
00191 #ifdef __linux__
00192
00193 #define MAC_STATIC
00194
00195 #ifdef __i386__
00196 #define CPUSTRING "linux-i386"
00197 #elif defined __axp__
00198 #define CPUSTRING "linux-alpha"
00199 #else
00200 #define CPUSTRING "linux-other"
00201 #endif
00202
00203 #define PATH_SEP '/'
00204
00205 #endif
00206
00207
00208
00209
00210
00211 typedef enum {qfalse, qtrue} qboolean;
00212
00213 typedef unsigned char byte;
00214
00215 #define EQUAL_EPSILON 0.001
00216
00217 typedef int qhandle_t;
00218 typedef int sfxHandle_t;
00219 typedef int fileHandle_t;
00220 typedef int clipHandle_t;
00221
00222 typedef enum {
00223 INVALID_JOINT = -1
00224 } jointHandle_t;
00225
00226 #ifndef NULL
00227 #define NULL ((void *)0)
00228 #endif
00229
00230 #define MAX_QINT 0x7fffffff
00231 #define MIN_QINT (-MAX_QINT-1)
00232
00233 #ifndef max
00234 #define max( x, y ) ( ( ( x ) > ( y ) ) ? ( x ) : ( y ) )
00235 #define min( x, y ) ( ( ( x ) < ( y ) ) ? ( x ) : ( y ) )
00236 #endif
00237
00238 #ifndef sign
00239 #define sign( f ) ( ( f > 0 ) ? 1 : ( ( f < 0 ) ? -1 : 0 ) )
00240 #endif
00241
00242
00243 #define PITCH 0 // up / down
00244 #define YAW 1 // left / right
00245 #define ROLL 2 // fall over
00246
00247
00248
00249 #define MAX_STRING_CHARS 1024 // max length of a string passed to Cmd_TokenizeString
00250 #define MAX_STRING_TOKENS 256 // max tokens resulting from Cmd_TokenizeString
00251 #define MAX_TOKEN_CHARS 1024 // max length of an individual token
00252
00253 #define MAX_INFO_STRING 1024
00254 #define MAX_INFO_KEY 1024
00255 #define MAX_INFO_VALUE 1024
00256
00257
00258 #define MAX_QPATH 64 // max length of a quake game pathname
00259 #define MAX_OSPATH 128 // max length of a filesystem pathname
00260
00261 #define MAX_NAME_LENGTH 32 // max length of a client name
00262
00263
00264 typedef enum {
00265 EXEC_NOW,
00266
00267 EXEC_INSERT,
00268 EXEC_APPEND
00269 } cbufExec_t;
00270
00271
00272
00273
00274
00275 #define MAX_MAP_AREA_BYTES 32 // bit vector of area visibility
00276
00277 #undef ERR_FATAL // malloc.h on unix
00278
00279
00280 typedef enum {
00281 ERR_NONE,
00282 ERR_FATAL,
00283 ERR_DROP,
00284 ERR_DISCONNECT,
00285 ERR_NEED_CD
00286 } errorParm_t;
00287
00288
00289
00290
00291 #define PROP_GAP_WIDTH 3
00292 #define PROP_SPACE_WIDTH 8
00293 #define PROP_HEIGHT 27
00294 #define PROP_SMALL_SIZE_SCALE 0.75
00295
00296 #define BLINK_DIVISOR 200
00297 #define PULSE_DIVISOR 75
00298
00299 #define UI_LEFT 0x00000000 // default
00300 #define UI_CENTER 0x00000001
00301 #define UI_RIGHT 0x00000002
00302 #define UI_FORMATMASK 0x00000007
00303 #define UI_SMALLFONT 0x00000010
00304 #define UI_BIGFONT 0x00000020 // default
00305 #define UI_GIANTFONT 0x00000040
00306 #define UI_DROPSHADOW 0x00000800
00307 #define UI_BLINK 0x00001000
00308 #define UI_INVERSE 0x00002000
00309 #define UI_PULSE 0x00004000
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319 #ifdef __cplusplus // so we can include this in C code
00320 #define SIDE_FRONT 0
00321 #define SIDE_BACK 1
00322 #define SIDE_ON 2
00323 #define SIDE_CROSS 3
00324
00325 #define Q_PI 3.14159265358979323846
00326 #ifndef M_PI
00327 #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
00328 #endif
00329
00330 #include "math_vector.h"
00331 #include "math_angles.h"
00332 #include "math_matrix.h"
00333 #include "math_quaternion.h"
00334
00335 class idVec3_t;
00336 typedef idVec3_t &vec3_p;
00337 typedef const idVec3_t &vec3_c;
00338
00339 class angles_t;
00340 typedef angles_t &angles_p;
00341 typedef const angles_t &angles_c;
00342
00343 class mat3_t;
00344 typedef mat3_t &mat3_p;
00345 typedef const mat3_t &mat3_c;
00346
00347
00348
00349 #define NUMVERTEXNORMALS 162
00350 extern idVec3_t bytedirs[NUMVERTEXNORMALS];
00351
00352
00353
00354 #define SCREEN_WIDTH 640
00355 #define SCREEN_HEIGHT 480
00356
00357 #define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
00358 #define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
00359
00360 #define SMALLCHAR_WIDTH 8
00361 #define SMALLCHAR_HEIGHT 16
00362
00363 #define BIGCHAR_WIDTH 16
00364 #define BIGCHAR_HEIGHT 16
00365
00366 #define GIANTCHAR_WIDTH 32
00367 #define GIANTCHAR_HEIGHT 48
00368
00369 extern vec4_t colorBlack;
00370 extern vec4_t colorRed;
00371 extern vec4_t colorGreen;
00372 extern vec4_t colorBlue;
00373 extern vec4_t colorYellow;
00374 extern vec4_t colorMagenta;
00375 extern vec4_t colorCyan;
00376 extern vec4_t colorWhite;
00377 extern vec4_t colorLtGrey;
00378 extern vec4_t colorMdGrey;
00379 extern vec4_t colorDkGrey;
00380
00381 #define Q_COLOR_ESCAPE '^'
00382 #define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE )
00383
00384 #define COLOR_BLACK '0'
00385 #define COLOR_RED '1'
00386 #define COLOR_GREEN '2'
00387 #define COLOR_YELLOW '3'
00388 #define COLOR_BLUE '4'
00389 #define COLOR_CYAN '5'
00390 #define COLOR_MAGENTA '6'
00391 #define COLOR_WHITE '7'
00392 #define ColorIndex(c) ( ( (c) - '0' ) & 7 )
00393
00394 #define S_COLOR_BLACK "^0"
00395 #define S_COLOR_RED "^1"
00396 #define S_COLOR_GREEN "^2"
00397 #define S_COLOR_YELLOW "^3"
00398 #define S_COLOR_BLUE "^4"
00399 #define S_COLOR_CYAN "^5"
00400 #define S_COLOR_MAGENTA "^6"
00401 #define S_COLOR_WHITE "^7"
00402
00403 extern vec4_t g_color_table[8];
00404
00405 #define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
00406 #define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
00407
00408 #define DEG2RAD( a ) ( ( (a) * M_PI ) / 180.0F )
00409 #define RAD2DEG( a ) ( ( (a) * 180.0f ) / M_PI )
00410
00411 struct cplane_s;
00412
00413 extern idVec3_t vec3_origin;
00414 extern vec4_t vec4_origin;
00415 extern mat3_t axisDefault;
00416
00417 #define nanmask (255<<23)
00418
00419 #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
00420
00421 float Q_fabs( float f );
00422 float Q_rsqrt( float f );
00423
00424 #define SQRTFAST( x ) ( 1.0f / Q_rsqrt( x ) )
00425
00426 signed char ClampChar( int i );
00427 signed short ClampShort( int i );
00428
00429
00430 int DirToByte( const idVec3_t &dir );
00431 void ByteToDir( int b, vec3_p dir );
00432
00433 #define DotProduct(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])
00434 #define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2])
00435 #define VectorAdd(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2])
00436 #define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2])
00437
00438
00439 #define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s))
00440 #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))
00441 #define CrossProduct(a,b,c) ((c)[0]=(a)[1]*(b)[2]-(a)[2]*(b)[1],(c)[1]=(a)[2]*(b)[0]-(a)[0]*(b)[2],(c)[2]=(a)[0]*(b)[1]-(a)[1]*(b)[0])
00442
00443 #define DotProduct4(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]+(x)[3]*(y)[3])
00444 #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])
00445 #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])
00446 #define VectorCopy4(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
00447 #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))
00448 #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))
00449
00450
00451 #define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0)
00452 #define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2])
00453 #define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z))
00454 #define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
00455
00456 #define SnapVector(v) {v[0]=(int)v[0];v[1]=(int)v[1];v[2]=(int)v[2];}
00457
00458 float NormalizeColor( vec3_c in, vec3_p out );
00459
00460 int VectorCompare( vec3_c v1, vec3_c v2 );
00461 float VectorLength( vec3_c v );
00462 float Distance( vec3_c p1, vec3_c p2 );
00463 float DistanceSquared( vec3_c p1, vec3_c p2 );
00464 float VectorNormalize (vec3_p v);
00465 void VectorNormalizeFast(vec3_p v);
00466 float VectorNormalize2( vec3_c v, vec3_p out );
00467 void VectorInverse (vec3_p v);
00468 void VectorRotate( vec3_c in, mat3_c matrix, vec3_p out );
00469 void VectorPolar(vec3_p v, float radius, float theta, float phi);
00470 void VectorSnap(vec3_p v);
00471 void Vector53Copy( const idVec5_t &in, vec3_p out);
00472 void Vector5Scale( const idVec5_t &v, float scale, idVec5_t &out);
00473 void Vector5Add( const idVec5_t &va, const idVec5_t &vb, idVec5_t &out);
00474 void VectorRotate3( vec3_c vIn, vec3_c vRotation, vec3_p out);
00475 void VectorRotate3Origin(vec3_c vIn, vec3_c vRotation, vec3_c vOrigin, vec3_p out);
00476
00477
00478 int Q_log2(int val);
00479
00480 int Q_rand( int *seed );
00481 float Q_random( int *seed );
00482 float Q_crandom( int *seed );
00483
00484 #define random() ((rand () & 0x7fff) / ((float)0x7fff))
00485 #define crandom() (2.0 * (random() - 0.5))
00486
00487 float Q_rint( float in );
00488
00489 void vectoangles( vec3_c value1, angles_p angles);
00490 void AnglesToAxis( angles_c angles, mat3_p axis );
00491
00492 void AxisCopy( mat3_c in, mat3_p out );
00493 qboolean AxisRotated( mat3_c in );
00494
00495 int SignbitsForNormal( vec3_c normal );
00496 int BoxOnPlaneSide( const Bounds &b, struct cplane_s *p );
00497
00498 float AngleMod(float a);
00499 float LerpAngle (float from, float to, float frac);
00500 float AngleSubtract( float a1, float a2 );
00501 void AnglesSubtract( angles_c v1, angles_c v2, angles_p v3 );
00502
00503 float AngleNormalize360 ( float angle );
00504 float AngleNormalize180 ( float angle );
00505 float AngleDelta ( float angle1, float angle2 );
00506
00507 qboolean PlaneFromPoints( vec4_t &plane, vec3_c a, vec3_c b, vec3_c c );
00508 void ProjectPointOnPlane( vec3_p dst, vec3_c p, vec3_c normal );
00509 void RotatePointAroundVector( vec3_p dst, vec3_c dir, vec3_c point, float degrees );
00510 void RotateAroundDirection( mat3_p axis, float yaw );
00511 void MakeNormalVectors( vec3_c forward, vec3_p right, vec3_p up );
00512
00513
00514 int PlaneTypeForNormal( vec3_c normal );
00515
00516 void MatrixMultiply( mat3_c in1, mat3_c in2, mat3_p out );
00517 void MatrixInverseMultiply( mat3_c in1, mat3_c in2, mat3_p out );
00518 void MatrixTransformVector( vec3_c in, mat3_c matrix, vec3_p out );
00519 void MatrixProjectVector( vec3_c in, mat3_c matrix, vec3_p out );
00520 void AngleVectors( angles_c angles, vec3_p forward, vec3_p right, vec3_p up);
00521 void PerpendicularVector( vec3_p dst, vec3_c src );
00522
00523 float TriangleArea( vec3_c a, vec3_c b, vec3_c c );
00524 #endif // __cplusplus
00525
00526
00527
00528 float Com_Clamp( float min, float max, float value );
00529
00530 #define FILE_HASH_SIZE 1024
00531 int Com_HashString( const char *fname );
00532
00533 char *Com_SkipPath( char *pathname );
00534
00535
00536 void Com_StripExtension( const char *in, char *out );
00537
00538
00539 void Com_DefaultExtension( char *path, int maxSize, const char *extension );
00540
00541 int Com_ParseInfos( const char *buf, int max, char infos[][MAX_INFO_STRING] );
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552 void Com_BeginParseSession( const char *filename );
00553 void Com_EndParseSession( void );
00554
00555 int Com_GetCurrentParseLine( void );
00556
00557
00558
00559
00560
00561
00562 const char *Com_Parse( const char *(*data_p) );
00563 const char *Com_ParseOnLine( const char *(*data_p) );
00564 const char *Com_ParseRestOfLine( const char *(*data_p) );
00565
00566 void Com_UngetToken( void );
00567
00568 #ifdef __cplusplus
00569 void Com_MatchToken( const char *(*buf_p), const char *match, qboolean warning = qfalse );
00570 #else
00571 void Com_MatchToken( const char *(*buf_p), const char *match, qboolean warning );
00572 #endif
00573
00574 void Com_ScriptError( const char *msg, ... );
00575 void Com_ScriptWarning( const char *msg, ... );
00576
00577 void Com_SkipBracedSection( const char *(*program) );
00578 void Com_SkipRestOfLine( const char *(*data) );
00579
00580 float Com_ParseFloat( const char *(*buf_p) );
00581 int Com_ParseInt( const char *(*buf_p) );
00582
00583 void Com_Parse1DMatrix( const char *(*buf_p), int x, float *m );
00584 void Com_Parse2DMatrix( const char *(*buf_p), int y, int x, float *m );
00585 void Com_Parse3DMatrix( const char *(*buf_p), int z, int y, int x, float *m );
00586
00587
00588 #ifdef __cplusplus
00589 extern "C" {
00590 #endif
00591
00592 void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...);
00593
00594
00595
00596 typedef enum {
00597 FS_READ,
00598 FS_WRITE,
00599 FS_APPEND,
00600 FS_APPEND_SYNC
00601 } fsMode_t;
00602
00603 typedef enum {
00604 FS_SEEK_CUR,
00605 FS_SEEK_END,
00606 FS_SEEK_SET
00607 } fsOrigin_t;
00608
00609
00610
00611 int Q_isprint( int c );
00612 int Q_islower( int c );
00613 int Q_isupper( int c );
00614 int Q_isalpha( int c );
00615
00616
00617 int Q_stricmp (const char *s1, const char *s2);
00618 int Q_strncmp (const char *s1, const char *s2, int n);
00619 int Q_stricmpn (const char *s1, const char *s2, int n);
00620 char *Q_strlwr( char *s1 );
00621 char *Q_strupr( char *s1 );
00622 char *Q_strrchr( const char* string, int c );
00623
00624
00625 void Q_strncpyz( char *dest, const char *src, int destsize );
00626 void Q_strcat( char *dest, int size, const char *src );
00627
00628
00629 int Q_PrintStrlen( const char *string );
00630
00631 char *Q_CleanStr( char *string );
00632
00633 int Com_Filter( const char *filter, const char *name, int casesensitive );
00634 const char *Com_StringContains( const char *str1, const char *str2, int casesensitive );
00635
00636
00637
00638
00639 short BigShort(short l);
00640 short LittleShort(short l);
00641 int BigLong (int l);
00642 int LittleLong (int l);
00643 float BigFloat (float l);
00644 float LittleFloat (float l);
00645
00646 void Swap_Init (void);
00647 char * QDECL va(char *format, ...);
00648
00649 #ifdef __cplusplus
00650 }
00651 #endif
00652
00653
00654
00655 #ifdef __cplusplus
00656
00657
00658
00659 typedef struct ePair_s {
00660 char *key;
00661 char *value;
00662 } ePair_t;
00663
00664 typedef struct mapSide_s {
00665 char material[MAX_QPATH];
00666 vec4_t plane;
00667 vec4_t textureVectors[2];
00668 } mapSide_t;
00669
00670 typedef struct {
00671 int numSides;
00672 mapSide_t **sides;
00673 } mapBrush_t;
00674
00675 typedef struct {
00676 idVec3_t xyz;
00677 float st[2];
00678 } patchVertex_t;
00679
00680 typedef struct {
00681 char material[MAX_QPATH];
00682 int width, height;
00683 patchVertex_t *patchVerts;
00684 } mapPatch_t;
00685
00686 typedef struct {
00687 char modelName[MAX_QPATH];
00688 float matrix[16];
00689 } mapModel_t;
00690
00691 typedef struct mapPrimitive_s {
00692 int numEpairs;
00693 ePair_t **ePairs;
00694
00695
00696 mapBrush_t *brush;
00697 mapPatch_t *patch;
00698 mapModel_t *model;
00699 } mapPrimitive_t;
00700
00701 typedef struct mapEntity_s {
00702 int numPrimitives;
00703 mapPrimitive_t **primitives;
00704
00705 int numEpairs;
00706 ePair_t **ePairs;
00707 } mapEntity_t;
00708
00709 typedef struct {
00710 int numEntities;
00711 mapEntity_t **entities;
00712 } mapFile_t;
00713
00714
00715
00716
00717 mapFile_t *ParseMapFile( const char *text );
00718 void FreeMapFile( mapFile_t *mapFile );
00719 void WriteMapFile( const mapFile_t *mapFile, FILE *f );
00720
00721
00722 const char *ValueForMapEntityKey( const mapEntity_t *ent, const char *key );
00723 float FloatForMapEntityKey( const mapEntity_t *ent, const char *key );
00724 qboolean GetVectorForMapEntityKey( const mapEntity_t *ent, const char *key, idVec3_t &vec );
00725
00726 typedef struct {
00727 idVec3_t xyz;
00728 idVec2_t st;
00729 idVec3_t normal;
00730 idVec3_t tangents[2];
00731 byte smoothing[4];
00732 } drawVert_t;
00733
00734 typedef struct {
00735 int width, height;
00736 drawVert_t *verts;
00737 } drawVertMesh_t;
00738
00739
00740
00741 drawVertMesh_t *SubdivideMapPatch( const mapPatch_t *patch, float maxError );
00742 #endif // __cplusplus
00743
00744
00745
00746 #ifdef __cplusplus
00747 extern "C" {
00748 #endif
00749
00750 void QDECL Com_Error( int level, const char *error, ... );
00751 void QDECL Com_Printf( const char *msg, ... );
00752 void QDECL Com_DPrintf( const char *msg, ... );
00753
00754 #ifdef __cplusplus
00755 }
00756 #endif
00757
00758
00759 typedef struct {
00760 qboolean frameMemory;
00761 int currentElements;
00762 int maxElements;
00763 void **elements;
00764 } growList_t;
00765
00766
00767
00768 void Com_InitGrowList( growList_t *list, int maxElements );
00769 int Com_AddToGrowList( growList_t *list, void *data );
00770 void *Com_GrowListElement( const growList_t *list, int index );
00771 int Com_IndexForGrowListElement( const growList_t *list, const void *element );
00772
00773
00774
00775
00776
00777 char *Info_ValueForKey( const char *s, const char *key );
00778 void Info_RemoveKey( char *s, const char *key );
00779 void Info_SetValueForKey( char *s, const char *key, const char *value );
00780 qboolean Info_Validate( const char *s );
00781 void Info_NextPair( const char *(*s), char key[MAX_INFO_KEY], char value[MAX_INFO_VALUE] );
00782
00783
00784
00785
00786
00787
00788
00789 #ifdef __cplusplus
00790
00791
00792
00793
00794
00795 #endif // __cplusplus
00796
00797 #endif // __Q_SHARED_H
00798