00001
00002
00003 #ifndef __Q_SHARED_H
00004 #define __Q_SHARED_H
00005
00006
00007
00008
00009
00010 #define Q3_SCRIPT_DIR "scripts"
00011
00012 #define MAX_TEAMNAME 32
00013
00014 #include "../qcommon/disablewarnings.h"
00015
00016 #include "teams.h"
00017
00018 #define MAX_WORLD_COORD ( 64 * 1024 )
00019 #define MIN_WORLD_COORD ( -64 * 1024 )
00020 #define WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD )
00021
00022
00023 #define VALID( a ) ( a != NULL )
00024 #define VALIDATE( a ) ( assert( a ) )
00025
00026 #define VALIDATEV( a ) if ( a == NULL ) { assert(0); return; }
00027 #define VALIDATEB( a ) if ( a == NULL ) { assert(0); return qfalse; }
00028 #define VALIDATEP( a ) if ( a == NULL ) { assert(0); return NULL; }
00029
00030 #define VALIDSTRING( a ) ( ( a != 0 ) && ( a[0] != 0 ) )
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef FINAL_BUILD
00046 #define G2_PERFORMANCE_ANALYSIS
00047 #define _FULL_G2_LEAK_CHECKING
00048 extern int g_Ghoul2Allocations;
00049 extern int g_G2ServerAlloc;
00050 extern int g_G2ClientAlloc;
00051 extern int g_G2AllocServer;
00052 #endif
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 #ifdef Q3_VM
00071
00072 #include "bg_lib.h"
00073
00074 #define assert(exp) ((void)0)
00075
00076 #define min(x,y) ((x)<(y)?(x):(y))
00077 #define max(x,y) ((x)>(y)?(x):(y))
00078
00079 #else
00080
00081 #include <assert.h>
00082 #include <math.h>
00083 #include <stdio.h>
00084 #include <stdarg.h>
00085 #include <string.h>
00086 #include <stdlib.h>
00087 #include <time.h>
00088 #include <ctype.h>
00089 #include <limits.h>
00090
00091
00092
00093 #ifdef _XBOX
00094 #define min(x,y) ((x)<(y)?(x):(y))
00095 #define max(x,y) ((x)>(y)?(x):(y))
00096
00097 #define tvector(T) std::vector< T >
00098 #define tdeque(T) std::deque< T >
00099
00100 #define tlist(T) std::list< T >
00101 #define tslist(T) std::slist< T >
00102
00103 #define tset(T) std::set< T, std::less< T > >
00104 #define tmultiset(T) std::multiset< T, std::less< T > >
00105
00106 #define tcset(T,C) std::set< T, C >
00107 #define tcmultiset(T,C) std::multiset< T, C >
00108
00109 #define tmap(K,T) std::map< K, T, std::less< K > >
00110 #define tmultimap(K,T) std::multimap< K, T, std::less< K > >
00111
00112 #define tcmap(K,T,C) std::map< K, T, C >
00113 #define tcmultimap(K,T,C) std::multimap< K, T, C >
00114 #endif
00115
00116 #endif
00117
00118 #ifdef _WIN32
00119
00120
00121
00122 #endif
00123
00124
00125 #if (defined _M_IX86 || defined __i386__) && !defined __sun__ && !defined __LCC__
00126 #define id386 1
00127 #else
00128 #define id386 0
00129 #endif
00130
00131 #if (defined(powerc) || defined(powerpc) || defined(ppc) || defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY)
00132 #define idppc 1
00133 #else
00134 #define idppc 0
00135 #endif
00136
00137
00138
00139 #define QDECL
00140
00141 short ShortSwap (short l);
00142 int LongSwap (int l);
00143 float FloatSwap (const float *f);
00144
00145
00146
00147 #ifdef WIN32
00148
00149 #define MAC_STATIC
00150
00151 #undef QDECL
00152 #define QDECL __cdecl
00153
00154
00155 #ifdef NDEBUG
00156 #ifdef _M_IX86
00157 #define CPUSTRING "win-x86"
00158 #elif defined _M_ALPHA
00159 #define CPUSTRING "win-AXP"
00160 #endif
00161 #else
00162 #ifdef _M_IX86
00163 #define CPUSTRING "win-x86-debug"
00164 #elif defined _M_ALPHA
00165 #define CPUSTRING "win-AXP-debug"
00166 #endif
00167 #endif
00168
00169 #define ID_INLINE __inline
00170
00171 static ID_INLINE short BigShort( short l) { return ShortSwap(l); }
00172 #define LittleShort
00173 static ID_INLINE int BigLong(int l) { return LongSwap(l); }
00174 #define LittleLong
00175 static ID_INLINE float BigFloat(const float *l) { FloatSwap(l); }
00176 #define LittleFloat
00177
00178 #define PATH_SEP '\\'
00179
00180 #endif
00181
00182
00183
00184 #if defined(MACOS_X)
00185
00186 #define MAC_STATIC
00187 #define __cdecl
00188 #define __declspec(x)
00189 #define stricmp strcasecmp
00190 #define ID_INLINE inline
00191
00192 #ifdef __ppc__
00193 #define CPUSTRING "MacOSX-ppc"
00194 #elif defined __i386__
00195 #define CPUSTRING "MacOSX-i386"
00196 #else
00197 #define CPUSTRING "MacOSX-other"
00198 #endif
00199
00200 #define PATH_SEP '/'
00201
00202 #define __rlwimi(out, in, shift, maskBegin, maskEnd) asm("rlwimi %0,%1,%2,%3,%4" : "=r" (out) : "r" (in), "i" (shift), "i" (maskBegin), "i" (maskEnd))
00203 #define __dcbt(addr, offset) asm("dcbt %0,%1" : : "b" (addr), "r" (offset))
00204
00205 static inline unsigned int __lwbrx(register void *addr, register int offset) {
00206 register unsigned int word;
00207
00208 asm("lwbrx %0,%2,%1" : "=r" (word) : "r" (addr), "b" (offset));
00209 return word;
00210 }
00211
00212 static inline unsigned short __lhbrx(register void *addr, register int offset) {
00213 register unsigned short halfword;
00214
00215 asm("lhbrx %0,%2,%1" : "=r" (halfword) : "r" (addr), "b" (offset));
00216 return halfword;
00217 }
00218
00219 static inline float __fctiw(register float f) {
00220 register float fi;
00221
00222 asm("fctiw %0,%1" : "=f" (fi) : "f" (f));
00223
00224 return fi;
00225 }
00226
00227 #define BigShort
00228 static inline short LittleShort(short l) { return ShortSwap(l); }
00229 #define BigLong
00230 static inline int LittleLong (int l) { return LongSwap(l); }
00231 #define BigFloat
00232 static inline float LittleFloat (const float l) { return FloatSwap(&l); }
00233
00234 #endif
00235
00236
00237
00238 #ifdef __MACOS__
00239
00240 #include <MacTypes.h>
00241 #define MAC_STATIC
00242 #define ID_INLINE inline
00243
00244 #define CPUSTRING "MacOS-PPC"
00245
00246 #define PATH_SEP ':'
00247
00248 void Sys_PumpEvents( void );
00249
00250 #define BigShort
00251 static inline short LittleShort(short l) { return ShortSwap(l); }
00252 #define BigLong
00253 static inline int LittleLong (int l) { return LongSwap(l); }
00254 #define BigFloat
00255 static inline float LittleFloat (const float l) { return FloatSwap(&l); }
00256
00257 #endif
00258
00259
00260
00261
00262
00263 #ifdef __linux__
00264
00265
00266 #define stricmp strcasecmp
00267
00268 #define MAC_STATIC // bk: FIXME
00269 #define ID_INLINE inline
00270
00271 #ifdef __i386__
00272 #define CPUSTRING "linux-i386"
00273 #elif defined __axp__
00274 #define CPUSTRING "linux-alpha"
00275 #else
00276 #define CPUSTRING "linux-other"
00277 #endif
00278
00279 #define PATH_SEP '/'
00280
00281
00282 #ifdef Q3_STATIC
00283 #define GAME_HARD_LINKED
00284 #define CGAME_HARD_LINKED
00285 #define UI_HARD_LINKED
00286 #define BOTLIB_HARD_LINKED
00287 #endif
00288
00289 #if !idppc
00290 inline static short BigShort( short l) { return ShortSwap(l); }
00291 #define LittleShort
00292 inline static int BigLong(int l) { return LongSwap(l); }
00293 #define LittleLong
00294 inline static float BigFloat(const float *l) { return FloatSwap(l); }
00295 #define LittleFloat
00296 #else
00297 #define BigShort
00298 inline static short LittleShort(short l) { return ShortSwap(l); }
00299 #define BigLong
00300 inline static int LittleLong (int l) { return LongSwap(l); }
00301 #define BigFloat
00302 inline static float LittleFloat (const float *l) { return FloatSwap(l); }
00303 #endif
00304
00305 #endif
00306
00307
00308 #ifdef __FreeBSD__ // rb010123
00309
00310 #define stricmp strcasecmp
00311
00312 #define MAC_STATIC
00313 #define ID_INLINE inline
00314
00315 #ifdef __i386__
00316 #define CPUSTRING "freebsd-i386"
00317 #elif defined __axp__
00318 #define CPUSTRING "freebsd-alpha"
00319 #else
00320 #define CPUSTRING "freebsd-other"
00321 #endif
00322
00323 #define PATH_SEP '/'
00324
00325
00326
00327 #if !idppc
00328 static short BigShort( short l) { return ShortSwap(l); }
00329 #define LittleShort
00330 static int BigLong(int l) { LongSwap(l); }
00331 #define LittleLong
00332 static float BigFloat(const float *l) { FloatSwap(l); }
00333 #define LittleFloat
00334 #else
00335 #define BigShort
00336 static short LittleShort(short l) { return ShortSwap(l); }
00337 #define BigLong
00338 static int LittleLong (int l) { return LongSwap(l); }
00339 #define BigFloat
00340 static float LittleFloat (const float *l) { return FloatSwap(l); }
00341 #endif
00342
00343 #endif
00344
00345
00346
00347
00348
00349 typedef unsigned char byte;
00350 typedef unsigned short word;
00351 typedef unsigned long ulong;
00352
00353 typedef enum {qfalse, qtrue} qboolean;
00354 #ifdef _XBOX
00355 #define qboolean int //don't want strict type checking on the qboolean
00356 #endif
00357
00358 typedef int qhandle_t;
00359 typedef int thandle_t;
00360 typedef int fxHandle_t;
00361 typedef int sfxHandle_t;
00362 typedef int fileHandle_t;
00363 typedef int clipHandle_t;
00364
00365 #ifndef NULL
00366 #define NULL ((void *)0)
00367 #endif
00368
00369 #define MAX_QINT 0x7fffffff
00370 #define MIN_QINT (-MAX_QINT-1)
00371
00372
00373
00374 #define PITCH 0 // up / down
00375 #define YAW 1 // left / right
00376 #define ROLL 2 // fall over
00377
00378
00379
00380 #define MAX_STRING_CHARS 1024 // max length of a string passed to Cmd_TokenizeString
00381 #define MAX_STRING_TOKENS 1024 // max tokens resulting from Cmd_TokenizeString
00382 #define MAX_TOKEN_CHARS 1024 // max length of an individual token
00383
00384 #define MAX_INFO_STRING 1024
00385 #define MAX_INFO_KEY 1024
00386 #define MAX_INFO_VALUE 1024
00387
00388 #define BIG_INFO_STRING 8192 // used for system info key only
00389 #define BIG_INFO_KEY 8192
00390 #define BIG_INFO_VALUE 8192
00391
00392
00393 #define MAX_QPATH 64 // max length of a quake game pathname
00394 #ifdef PATH_MAX
00395 #define MAX_OSPATH PATH_MAX
00396 #else
00397 #define MAX_OSPATH 256 // max length of a filesystem pathname
00398 #endif
00399
00400 #define MAX_NAME_LENGTH 32 // max length of a client name
00401
00402 #define MAX_SAY_TEXT 150
00403
00404
00405 typedef enum {
00406 EXEC_NOW,
00407
00408 EXEC_INSERT,
00409 EXEC_APPEND
00410 } cbufExec_t;
00411
00412
00413
00414
00415
00416 #define MAX_MAP_AREA_BYTES 32 // bit vector of area visibility
00417
00418
00419 #define LS_STYLES_START 0
00420 #define LS_NUM_STYLES 32
00421 #define LS_SWITCH_START (LS_STYLES_START+LS_NUM_STYLES)
00422 #define LS_NUM_SWITCH 32
00423 #if !defined MAX_LIGHT_STYLES
00424 #define MAX_LIGHT_STYLES 64
00425 #endif
00426
00427
00428 enum WL_e {
00429 WL_ERROR=1,
00430 WL_WARNING,
00431 WL_VERBOSE,
00432 WL_DEBUG
00433 };
00434
00435 extern float forceSpeedLevels[4];
00436
00437
00438 typedef enum {
00439 PRINT_ALL,
00440 PRINT_DEVELOPER,
00441 PRINT_WARNING,
00442 PRINT_ERROR
00443 } printParm_t;
00444
00445
00446 #ifdef ERR_FATAL
00447 #undef ERR_FATAL // this is be defined in malloc.h
00448 #endif
00449
00450
00451 typedef enum {
00452 ERR_FATAL,
00453 ERR_DROP,
00454 ERR_SERVERDISCONNECT,
00455 ERR_DISCONNECT,
00456 ERR_NEED_CD
00457 } errorParm_t;
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467 #define PROP_GAP_WIDTH 2
00468
00469 #define PROP_SPACE_WIDTH 4
00470 #define PROP_HEIGHT 16
00471
00472 #define PROP_TINY_SIZE_SCALE 1
00473 #define PROP_SMALL_SIZE_SCALE 1
00474 #define PROP_BIG_SIZE_SCALE 1
00475 #define PROP_GIANT_SIZE_SCALE 2
00476
00477 #define PROP_TINY_HEIGHT 10
00478 #define PROP_GAP_TINY_WIDTH 1
00479 #define PROP_SPACE_TINY_WIDTH 3
00480
00481 #define PROP_BIG_HEIGHT 24
00482 #define PROP_GAP_BIG_WIDTH 3
00483 #define PROP_SPACE_BIG_WIDTH 6
00484
00485 #define BLINK_DIVISOR 200
00486 #define PULSE_DIVISOR 75
00487
00488 #define UI_LEFT 0x00000000 // default
00489 #define UI_CENTER 0x00000001
00490 #define UI_RIGHT 0x00000002
00491 #define UI_FORMATMASK 0x00000007
00492 #define UI_SMALLFONT 0x00000010
00493 #define UI_BIGFONT 0x00000020 // default
00494
00495 #define UI_DROPSHADOW 0x00000800
00496 #define UI_BLINK 0x00001000
00497 #define UI_INVERSE 0x00002000
00498 #define UI_PULSE 0x00004000
00499
00500 #if defined(_DEBUG) && !defined(BSPC) && !defined(_XBOX)
00501 #define HUNK_DEBUG
00502 #endif
00503
00504 typedef enum {
00505 h_high,
00506 h_low,
00507 h_dontcare
00508 } ha_pref;
00509
00510 void *Hunk_Alloc( int size, ha_pref preference );
00511
00512 void Com_Memset (void* dest, const int val, const size_t count);
00513 void Com_Memcpy (void* dest, const void* src, const size_t count);
00514
00515 #define CIN_system 1
00516 #define CIN_loop 2
00517 #define CIN_hold 4
00518 #define CIN_silent 8
00519 #define CIN_shader 16
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530 typedef float vec_t;
00531 typedef vec_t vec2_t[2];
00532 typedef vec_t vec3_t[3];
00533 typedef vec_t vec4_t[4];
00534 typedef vec_t vec5_t[5];
00535
00536
00537 typedef vec3_t vec3pair_t[2];
00538
00539 typedef int ivec3_t[3];
00540 typedef int ivec4_t[4];
00541 typedef int ivec5_t[5];
00542
00543 typedef int fixed4_t;
00544 typedef int fixed8_t;
00545 typedef int fixed16_t;
00546
00547 #ifndef M_PI
00548 #define M_PI 3.14159265358979323846f // matches value in gcc v2 math.h
00549 #endif
00550
00551
00552 typedef enum {
00553 BLK_NO,
00554 BLK_TIGHT,
00555 BLK_WIDE
00556 } saberBlockType_t;
00557
00558 typedef enum {
00559 BLOCKED_NONE,
00560 BLOCKED_BOUNCE_MOVE,
00561 BLOCKED_PARRY_BROKEN,
00562 BLOCKED_ATK_BOUNCE,
00563 BLOCKED_UPPER_RIGHT,
00564 BLOCKED_UPPER_LEFT,
00565 BLOCKED_LOWER_RIGHT,
00566 BLOCKED_LOWER_LEFT,
00567 BLOCKED_TOP,
00568 BLOCKED_UPPER_RIGHT_PROJ,
00569 BLOCKED_UPPER_LEFT_PROJ,
00570 BLOCKED_LOWER_RIGHT_PROJ,
00571 BLOCKED_LOWER_LEFT_PROJ,
00572 BLOCKED_TOP_PROJ
00573 } saberBlockedType_t;
00574
00575
00576
00577 typedef enum
00578 {
00579 SABER_RED,
00580 SABER_ORANGE,
00581 SABER_YELLOW,
00582 SABER_GREEN,
00583 SABER_BLUE,
00584 SABER_PURPLE,
00585 NUM_SABER_COLORS
00586
00587 };
00588 typedef int saber_colors_t;
00589
00590 typedef enum
00591 {
00592 FP_FIRST = 0,
00593 FP_HEAL = 0,
00594 FP_LEVITATION,
00595 FP_SPEED,
00596 FP_PUSH,
00597 FP_PULL,
00598 FP_TELEPATHY,
00599 FP_GRIP,
00600 FP_LIGHTNING,
00601 FP_RAGE,
00602 FP_PROTECT,
00603 FP_ABSORB,
00604 FP_TEAM_HEAL,
00605 FP_TEAM_FORCE,
00606 FP_DRAIN,
00607 FP_SEE,
00608 FP_SABER_OFFENSE,
00609 FP_SABER_DEFENSE,
00610 FP_SABERTHROW,
00611 NUM_FORCE_POWERS
00612 };
00613 typedef int forcePowers_t;
00614
00615 typedef enum
00616 {
00617 SABER_NONE = 0,
00618 SABER_SINGLE,
00619 SABER_STAFF,
00620 SABER_DAGGER,
00621 SABER_BROAD,
00622 SABER_PRONG,
00623 SABER_ARC,
00624 SABER_SAI,
00625 SABER_CLAW,
00626 SABER_LANCE,
00627 SABER_STAR,
00628 SABER_TRIDENT,
00629 SABER_SITH_SWORD,
00630 NUM_SABERS
00631 } saberType_t;
00632
00633 typedef struct
00634 {
00635
00636 int inAction;
00637 int duration;
00638 int lastTime;
00639 vec3_t base;
00640 vec3_t tip;
00641
00642 vec3_t dualbase;
00643 vec3_t dualtip;
00644
00645
00646 qboolean haveOldPos[2];
00647 vec3_t oldPos[2];
00648 vec3_t oldNormal[2];
00649
00650 } saberTrail_t;
00651
00652 typedef struct
00653 {
00654 qboolean active;
00655 saber_colors_t color;
00656 float radius;
00657 float length;
00658 float lengthMax;
00659 float lengthOld;
00660 float desiredLength;
00661 vec3_t muzzlePoint;
00662 vec3_t muzzlePointOld;
00663 vec3_t muzzleDir;
00664 vec3_t muzzleDirOld;
00665 saberTrail_t trail;
00666 int hitWallDebounceTime;
00667 int storageTime;
00668 int extendDebounce;
00669 } bladeInfo_t;
00670 #define MAX_BLADES 8
00671
00672 typedef enum
00673 {
00674 SS_NONE = 0,
00675 SS_FAST,
00676 SS_MEDIUM,
00677 SS_STRONG,
00678 SS_DESANN,
00679 SS_TAVION,
00680 SS_DUAL,
00681 SS_STAFF,
00682 SS_NUM_SABER_STYLES
00683 } saber_styles_t;
00684
00685
00686
00687 #define SFL_NOT_LOCKABLE (1<<0)//can't get into a saberlock
00688 #define SFL_NOT_THROWABLE (1<<1)//can't be thrown - FIXME: maybe make this a max level of force saber throw that can be used with this saber?
00689 #define SFL_NOT_DISARMABLE (1<<2)//can't be dropped
00690 #define SFL_NOT_ACTIVE_BLOCKING (1<<3)//don't to try to block incoming shots with this saber
00691 #define SFL_TWO_HANDED (1<<4)//uses both hands
00692 #define SFL_SINGLE_BLADE_THROWABLE (1<<5)//can throw this saber if only the first blade is on
00693 #define SFL_RETURN_DAMAGE (1<<6)//when returning from a saber throw, it keeps spinning and doing damage
00694
00695 #define SFL_ON_IN_WATER (1<<7)//if set, weapon stays active even in water
00696 #define SFL_BOUNCE_ON_WALLS (1<<8)//if set, the saber will bounce back when it hits solid architecture (good for real-sword type mods)
00697 #define SFL_BOLT_TO_WRIST (1<<9)//if set, saber model is bolted to wrist, not in hand... useful for things like claws & shields, etc.
00698
00699
00700
00701 #define SFL_NO_PULL_ATTACK (1<<10)//if set, cannot do pull+attack move (move not available in MP anyway)
00702 #define SFL_NO_BACK_ATTACK (1<<11)//if set, cannot do back-stab moves
00703 #define SFL_NO_STABDOWN (1<<12)//if set, cannot do stabdown move (when enemy is on ground)
00704 #define SFL_NO_WALL_RUNS (1<<13)//if set, cannot side-run or forward-run on walls
00705 #define SFL_NO_WALL_FLIPS (1<<14)//if set, cannot do backflip off wall or side-flips off walls
00706 #define SFL_NO_WALL_GRAB (1<<15)//if set, cannot grab wall & jump off
00707 #define SFL_NO_ROLLS (1<<16)//if set, cannot roll
00708 #define SFL_NO_FLIPS (1<<17)//if set, cannot do flips
00709 #define SFL_NO_CARTWHEELS (1<<18)//if set, cannot do cartwheels
00710 #define SFL_NO_KICKS (1<<19)//if set, cannot do kicks (can't do kicks anyway if using a throwable saber/sword)
00711 #define SFL_NO_MIRROR_ATTACKS (1<<20)//if set, cannot do the simultaneous attack left/right moves (only available in Dual Lightsaber Combat Style)
00712 #define SFL_NO_ROLL_STAB (1<<21)//if set, cannot do roll-stab move at end of roll
00713
00714
00715 #define SFL2_NO_WALL_MARKS (1<<0)//if set, stops the saber from drawing marks on the world (good for real-sword type mods)
00716 #define SFL2_NO_DLIGHT (1<<1)//if set, stops the saber from drawing a dynamic light (good for real-sword type mods)
00717 #define SFL2_NO_BLADE (1<<2)//if set, stops the saber from drawing a blade (good for real-sword type mods)
00718 #define SFL2_NO_CLASH_FLARE (1<<3)//if set, the saber will not do the big, white clash flare with other sabers
00719 #define SFL2_NO_DISMEMBERMENT (1<<4)//if set, the saber never does dismemberment (good for pointed/blunt melee weapons)
00720 #define SFL2_NO_IDLE_EFFECT (1<<5)//if set, the saber will not do damage or any effects when it is idle (not in an attack anim). (good for real-sword type mods)
00721 #define SFL2_ALWAYS_BLOCK (1<<6)//if set, the blades will always be blocking (good for things like shields that should always block)
00722 #define SFL2_NO_MANUAL_DEACTIVATE (1<<7)//if set, the blades cannot manually be toggled on and off
00723 #define SFL2_TRANSITION_DAMAGE (1<<8)//if set, the blade does damage in start, transition and return anims (like strong style does)
00724
00725 #define SFL2_NO_WALL_MARKS2 (1<<9)//if set, stops the saber from drawing marks on the world (good for real-sword type mods)
00726 #define SFL2_NO_DLIGHT2 (1<<10)//if set, stops the saber from drawing a dynamic light (good for real-sword type mods)
00727 #define SFL2_NO_BLADE2 (1<<11)//if set, stops the saber from drawing a blade (good for real-sword type mods)
00728 #define SFL2_NO_CLASH_FLARE2 (1<<12)//if set, the saber will not do the big, white clash flare with other sabers
00729 #define SFL2_NO_DISMEMBERMENT2 (1<<13)//if set, the saber never does dismemberment (good for pointed/blunt melee weapons)
00730 #define SFL2_NO_IDLE_EFFECT2 (1<<14)//if set, the saber will not do damage or any effects when it is idle (not in an attack anim). (good for real-sword type mods)
00731 #define SFL2_ALWAYS_BLOCK2 (1<<15)//if set, the blades will always be blocking (good for things like shields that should always block)
00732 #define SFL2_NO_MANUAL_DEACTIVATE2 (1<<16)//if set, the blades cannot manually be toggled on and off
00733 #define SFL2_TRANSITION_DAMAGE2 (1<<17)//if set, the blade does damage in start, transition and return anims (like strong style does)
00734
00735 typedef struct
00736 {
00737 char name[64];
00738 char fullName[64];
00739 saberType_t type;
00740 char model[MAX_QPATH];
00741 qhandle_t skin;
00742 int soundOn;
00743 int soundLoop;
00744 int soundOff;
00745 int numBlades;
00746 bladeInfo_t blade[MAX_BLADES];
00747 int stylesLearned;
00748 int stylesForbidden;
00749 int maxChain;
00750 int forceRestrictions;
00751 int lockBonus;
00752 int parryBonus;
00753 int breakParryBonus;
00754 int breakParryBonus2;
00755 int disarmBonus;
00756 int disarmBonus2;
00757 saber_styles_t singleBladeStyle;
00758
00759
00760
00761
00762 int saberFlags;
00763 int saberFlags2;
00764
00765
00766 qhandle_t spinSound;
00767 qhandle_t swingSound[3];
00768
00769
00770 float moveSpeedScale;
00771 float animSpeedScale;
00772
00773
00774 int kataMove;
00775 int lungeAtkMove;
00776 int jumpAtkUpMove;
00777 int jumpAtkFwdMove;
00778 int jumpAtkBackMove;
00779 int jumpAtkRightMove;
00780 int jumpAtkLeftMove;
00781 int readyAnim;
00782 int drawAnim;
00783 int putawayAnim;
00784 int tauntAnim;
00785 int bowAnim;
00786 int meditateAnim;
00787 int flourishAnim;
00788 int gloatAnim;
00789
00790
00791 int bladeStyle2Start;
00792
00793
00794
00795
00796
00797 int trailStyle;
00798 int g2MarksShader;
00799 int g2WeaponMarkShader;
00800
00801
00802 qhandle_t hitSound[3];
00803 qhandle_t blockSound[3];
00804 qhandle_t bounceSound[3];
00805 int blockEffect;
00806 int hitPersonEffect;
00807 int hitOtherEffect;
00808 int bladeEffect;
00809
00810
00811 float knockbackScale;
00812 float damageScale;
00813 float splashRadius;
00814 int splashDamage;
00815 float splashKnockback;
00816
00817
00818
00819 int trailStyle2;
00820 int g2MarksShader2;
00821 int g2WeaponMarkShader2;
00822
00823
00824 qhandle_t hit2Sound[3];
00825 qhandle_t block2Sound[3];
00826 qhandle_t bounce2Sound[3];
00827 int blockEffect2;
00828 int hitPersonEffect2;
00829 int hitOtherEffect2;
00830 int bladeEffect2;
00831
00832
00833 float knockbackScale2;
00834 float damageScale2;
00835 float splashRadius2;
00836 int splashDamage2;
00837 float splashKnockback2;
00838
00839
00840 } saberInfo_t;
00841 #define MAX_SABERS 2
00842
00843 typedef enum
00844 {
00845 FORCE_LEVEL_0,
00846 FORCE_LEVEL_1,
00847 FORCE_LEVEL_2,
00848 FORCE_LEVEL_3,
00849 NUM_FORCE_POWER_LEVELS
00850 };
00851
00852 #define FORCE_LEVEL_4 (FORCE_LEVEL_3+1)
00853 #define FORCE_LEVEL_5 (FORCE_LEVEL_4+1)
00854
00855
00856 enum sharedERagPhase
00857 {
00858 RP_START_DEATH_ANIM,
00859 RP_END_DEATH_ANIM,
00860 RP_DEATH_COLLISION,
00861 RP_CORPSE_SHOT,
00862 RP_GET_PELVIS_OFFSET,
00863 RP_SET_PELVIS_OFFSET,
00864 RP_DISABLE_EFFECTORS
00865 };
00866
00867 enum sharedERagEffector
00868 {
00869 RE_MODEL_ROOT= 0x00000001,
00870 RE_PELVIS= 0x00000002,
00871 RE_LOWER_LUMBAR= 0x00000004,
00872 RE_UPPER_LUMBAR= 0x00000008,
00873 RE_THORACIC= 0x00000010,
00874 RE_CRANIUM= 0x00000020,
00875 RE_RHUMEROUS= 0x00000040,
00876 RE_LHUMEROUS= 0x00000080,
00877 RE_RRADIUS= 0x00000100,
00878 RE_LRADIUS= 0x00000200,
00879 RE_RFEMURYZ= 0x00000400,
00880 RE_LFEMURYZ= 0x00000800,
00881 RE_RTIBIA= 0x00001000,
00882 RE_LTIBIA= 0x00002000,
00883 RE_RHAND= 0x00004000,
00884 RE_LHAND= 0x00008000,
00885 RE_RTARSAL= 0x00010000,
00886 RE_LTARSAL= 0x00020000,
00887 RE_RTALUS= 0x00040000,
00888 RE_LTALUS= 0x00080000,
00889 RE_RRADIUSX= 0x00100000,
00890 RE_LRADIUSX= 0x00200000,
00891 RE_RFEMURX= 0x00400000,
00892 RE_LFEMURX= 0x00800000,
00893 RE_CEYEBROW= 0x01000000
00894 };
00895
00896 typedef struct
00897 {
00898 vec3_t angles;
00899 vec3_t position;
00900 vec3_t scale;
00901 vec3_t pelvisAnglesOffset;
00902 vec3_t pelvisPositionOffset;
00903
00904 float fImpactStrength;
00905 float fShotStrength;
00906 int me;
00907
00908
00909 int startFrame;
00910 int endFrame;
00911
00912 int collisionType;
00913
00914 qboolean CallRagDollBegin;
00915
00916 int RagPhase;
00917
00918
00919
00920 int effectorsToTurnOff;
00921
00922 } sharedRagDollParams_t;
00923
00924
00925 typedef struct
00926 {
00927 vec3_t angles;
00928 vec3_t position;
00929 vec3_t scale;
00930 vec3_t velocity;
00931 int me;
00932 int settleFrame;
00933 } sharedRagDollUpdateParams_t;
00934
00935
00936 typedef struct
00937 {
00938 char boneName[512];
00939 vec3_t desiredOrigin;
00940 vec3_t origin;
00941 float movementSpeed;
00942 } sharedIKMoveParams_t;
00943
00944
00945 typedef struct
00946 {
00947 vec3_t pcjMins;
00948 vec3_t pcjMaxs;
00949 vec3_t origin;
00950 vec3_t angles;
00951 vec3_t scale;
00952 float radius;
00953 int blendTime;
00954 int pcjOverrides;
00955 int startFrame;
00956 int endFrame;
00957 qboolean forceAnimOnBone;
00958 } sharedSetBoneIKStateParams_t;
00959
00960 enum sharedEIKMoveState
00961 {
00962 IKS_NONE = 0,
00963 IKS_DYNAMIC
00964 };
00965
00966
00967 typedef enum
00968 {
00969 MAT_METAL = 0,
00970 MAT_GLASS,
00971 MAT_ELECTRICAL,
00972 MAT_ELEC_METAL,
00973 MAT_DRK_STONE,
00974 MAT_LT_STONE,
00975 MAT_GLASS_METAL,
00976 MAT_METAL2,
00977 MAT_NONE,
00978 MAT_GREY_STONE,
00979 MAT_METAL3,
00980 MAT_CRATE1,
00981 MAT_GRATE1,
00982 MAT_ROPE,
00983 MAT_CRATE2,
00984 MAT_WHITE_METAL,
00985 MAT_SNOWY_ROCK,
00986
00987 NUM_MATERIALS
00988
00989 };
00990 typedef int material_t;
00991
00992
00993 #define MAX_WPARRAY_SIZE 4096
00994 #define MAX_NEIGHBOR_SIZE 32
00995
00996 #define MAX_NEIGHBOR_LINK_DISTANCE 128
00997 #define MAX_NEIGHBOR_FORCEJUMP_LINK_DISTANCE 400
00998
00999 #define DEFAULT_GRID_SPACING 400
01000
01001 typedef struct wpneighbor_s
01002 {
01003 int num;
01004 int forceJumpTo;
01005 } wpneighbor_t;
01006
01007 typedef struct wpobject_s
01008 {
01009 vec3_t origin;
01010 int inuse;
01011 int index;
01012 float weight;
01013 float disttonext;
01014 int flags;
01015 int associated_entity;
01016
01017 int forceJumpTo;
01018
01019 int neighbornum;
01020 wpneighbor_t neighbors[MAX_NEIGHBOR_SIZE];
01021 } wpobject_t;
01022
01023
01024 #define NUMVERTEXNORMALS 162
01025 extern vec3_t bytedirs[NUMVERTEXNORMALS];
01026
01027
01028
01029 #define SCREEN_WIDTH 640
01030 #define SCREEN_HEIGHT 480
01031
01032 #define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
01033 #define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
01034
01035 #define SMALLCHAR_WIDTH 8
01036 #define SMALLCHAR_HEIGHT 16
01037
01038 #define BIGCHAR_WIDTH 16
01039 #define BIGCHAR_HEIGHT 16
01040
01041 #define GIANTCHAR_WIDTH 32
01042 #define GIANTCHAR_HEIGHT 48
01043
01044 typedef enum
01045 {
01046 CT_NONE,
01047 CT_BLACK,
01048 CT_RED,
01049 CT_GREEN,
01050 CT_BLUE,
01051 CT_YELLOW,
01052 CT_MAGENTA,
01053 CT_CYAN,
01054 CT_WHITE,
01055 CT_LTGREY,
01056 CT_MDGREY,
01057 CT_DKGREY,
01058 CT_DKGREY2,
01059
01060 CT_VLTORANGE,
01061 CT_LTORANGE,
01062 CT_DKORANGE,
01063 CT_VDKORANGE,
01064
01065 CT_VLTBLUE1,
01066 CT_LTBLUE1,
01067 CT_DKBLUE1,
01068 CT_VDKBLUE1,
01069
01070 CT_VLTBLUE2,
01071 CT_LTBLUE2,
01072 CT_DKBLUE2,
01073 CT_VDKBLUE2,
01074
01075 CT_VLTBROWN1,
01076 CT_LTBROWN1,
01077 CT_DKBROWN1,
01078 CT_VDKBROWN1,
01079
01080 CT_VLTGOLD1,
01081 CT_LTGOLD1,
01082 CT_DKGOLD1,
01083 CT_VDKGOLD1,
01084
01085 CT_VLTPURPLE1,
01086 CT_LTPURPLE1,
01087 CT_DKPURPLE1,
01088 CT_VDKPURPLE1,
01089
01090 CT_VLTPURPLE2,
01091 CT_LTPURPLE2,
01092 CT_DKPURPLE2,
01093 CT_VDKPURPLE2,
01094
01095 CT_VLTPURPLE3,
01096 CT_LTPURPLE3,
01097 CT_DKPURPLE3,
01098 CT_VDKPURPLE3,
01099
01100 CT_VLTRED1,
01101 CT_LTRED1,
01102 CT_DKRED1,
01103 CT_VDKRED1,
01104 CT_VDKRED,
01105 CT_DKRED,
01106
01107 CT_VLTAQUA,
01108 CT_LTAQUA,
01109 CT_DKAQUA,
01110 CT_VDKAQUA,
01111
01112 CT_LTPINK,
01113 CT_DKPINK,
01114 CT_LTCYAN,
01115 CT_DKCYAN,
01116 CT_LTBLUE3,
01117 CT_BLUE3,
01118 CT_DKBLUE3,
01119
01120 CT_HUD_GREEN,
01121 CT_HUD_RED,
01122 CT_ICON_BLUE,
01123 CT_NO_AMMO_RED,
01124 CT_HUD_ORANGE,
01125
01126 CT_MAX
01127 } ct_table_t;
01128
01129 extern vec4_t colorTable[CT_MAX];
01130
01131 extern vec4_t colorBlack;
01132 extern vec4_t colorRed;
01133 extern vec4_t colorGreen;
01134 extern vec4_t colorBlue;
01135 extern vec4_t colorYellow;
01136 extern vec4_t colorMagenta;
01137 extern vec4_t colorCyan;
01138 extern vec4_t colorWhite;
01139 extern vec4_t colorLtGrey;
01140 extern vec4_t colorMdGrey;
01141 extern vec4_t colorDkGrey;
01142 extern vec4_t colorLtBlue;
01143 extern vec4_t colorDkBlue;
01144
01145 #define Q_COLOR_ESCAPE '^'
01146
01147 #define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE && *((p)+1) <= '7' && *((p)+1) >= '0' )
01148
01149
01150 #define COLOR_BLACK '0'
01151 #define COLOR_RED '1'
01152 #define COLOR_GREEN '2'
01153 #define COLOR_YELLOW '3'
01154 #define COLOR_BLUE '4'
01155 #define COLOR_CYAN '5'
01156 #define COLOR_MAGENTA '6'
01157 #define COLOR_WHITE '7'
01158 #define ColorIndex(c) ( ( (c) - '0' ) & 7 )
01159
01160 #define S_COLOR_BLACK "^0"
01161 #define S_COLOR_RED "^1"
01162 #define S_COLOR_GREEN "^2"
01163 #define S_COLOR_YELLOW "^3"
01164 #define S_COLOR_BLUE "^4"
01165 #define S_COLOR_CYAN "^5"
01166 #define S_COLOR_MAGENTA "^6"
01167 #define S_COLOR_WHITE "^7"
01168
01169 extern vec4_t g_color_table[8];
01170
01171 #define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
01172 #define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
01173
01174 #define DEG2RAD( a ) ( ( (a) * M_PI ) / 180.0F )
01175 #define RAD2DEG( a ) ( ( (a) * 180.0f ) / M_PI )
01176
01177 struct cplane_s;
01178
01179 extern vec3_t vec3_origin;
01180 extern vec3_t axisDefault[3];
01181
01182 #define nanmask (255<<23)
01183
01184 #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
01185
01186 #ifdef _XBOX
01187 inline void Q_CastShort2Float(float *f, const short *s)
01188 {
01189 *f = ((float)*s);
01190 }
01191
01192 inline void Q_CastUShort2Float(float *f, const unsigned short *s)
01193 {
01194 *f = ((float)*s);
01195 }
01196
01197 inline void Q_CastShort2FloatScale(float *f, const short *s, float scale)
01198 {
01199 *f = ((float)*s) * scale;
01200 }
01201
01202 inline void Q_CastUShort2FloatScale(float *f, const unsigned short *s, float scale)
01203 {
01204 *f = ((float)*s) * scale;
01205 }
01206 #endif // _XBOX
01207
01208 #if idppc
01209
01210 static inline float Q_rsqrt( float number ) {
01211 float x = 0.5f * number;
01212 float y;
01213 #ifdef __GNUC__
01214 asm("frsqrte %0,%1" : "=f" (y) : "f" (number));
01215 #else
01216 y = __frsqrte( number );
01217 #endif
01218 return y * (1.5f - (x * y * y));
01219 }
01220
01221 #ifdef __GNUC__
01222 static inline float Q_fabs(float x) {
01223 float abs_x;
01224
01225 asm("fabs %0,%1" : "=f" (abs_x) : "f" (x));
01226 return abs_x;
01227 }
01228 #else
01229 #define Q_fabs __fabsf
01230 #endif
01231
01232 #else
01233 float Q_fabs( float f );
01234 float Q_rsqrt( float f );
01235 #endif
01236
01237 #define SQRTFAST( x ) ( (x) * Q_rsqrt( x ) )
01238
01239 signed char ClampChar( int i );
01240 signed short ClampShort( int i );
01241
01242 float powf ( float x, int y );
01243
01244
01245 int DirToByte( vec3_t dir );
01246 void ByteToDir( int b, vec3_t dir );
01247
01248 #ifdef _XBOX
01249
01250 inline vec_t DotProduct( const vec3_t v1, const vec3_t v2 ) {
01251 #if defined (_XBOX)
01252 float res;
01253 __asm {
01254 mov edx, v1
01255 movss xmm1, [edx]
01256 movhps xmm1, [edx+4]
01257
01258 mov edx, v2
01259 movss xmm2, [edx]
01260 movhps xmm2, [edx+4]
01261
01262 mulps xmm1, xmm2
01263
01264 movaps xmm0, xmm1
01265
01266 shufps xmm0, xmm0, 32h
01267 addps xmm1, xmm0
01268
01269 shufps xmm0, xmm0, 32h
01270 addps xmm1, xmm0
01271
01272 movss [res], xmm1
01273 }
01274 return res;
01275 #else
01276 return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
01277 #endif
01278 }
01279
01280 inline void VectorSubtract( const vec3_t veca, const vec3_t vecb, vec3_t o ) {
01281 #ifdef _XBOX
01282 __asm {
01283 mov ecx, veca
01284 movss xmm0, [ecx]
01285 movhps xmm0, [ecx+4]
01286
01287 mov edx, vecb
01288 movss xmm1, [edx]
01289 movhps xmm1, [edx+4]
01290
01291 subps xmm0, xmm1
01292
01293 mov eax, o
01294 movss [eax], xmm0
01295 movhps [eax+4], xmm0
01296 }
01297 #else
01298 o[0] = veca[0]-vecb[0];
01299 o[1] = veca[1]-vecb[1];
01300 o[2] = veca[2]-vecb[2];
01301 #endif
01302 }
01303
01304 inline void VectorAdd( const vec3_t veca, const vec3_t vecb, vec3_t o ) {
01305 #ifdef _XBOX
01306 __asm {
01307 mov ecx, veca
01308 movss xmm0, [ecx]
01309 movhps xmm0, [ecx+4]
01310
01311 mov edx, vecb
01312 movss xmm1, [edx]
01313 movhps xmm1, [edx+4]
01314
01315 addps xmm0, xmm1
01316
01317 mov eax, o
01318 movss [eax], xmm0
01319 movhps [eax+4], xmm0
01320 }
01321 #else
01322 o[0] = veca[0]+vecb[0];
01323 o[1] = veca[1]+vecb[1];
01324 o[2] = veca[2]+vecb[2];
01325 #endif
01326 }
01327
01328 inline void VectorScale( const vec3_t i, vec_t scale, vec3_t o ) {
01329 #ifdef _XBOX
01330 __asm {
01331 movss xmm0, scale
01332 shufps xmm0, xmm0, 0h
01333
01334 mov edx, i
01335 movss xmm1, [edx]
01336 movhps xmm1, [edx+4]
01337
01338 mulps xmm0, xmm1
01339
01340 mov eax, o
01341 movss [eax], xmm0
01342 movhps [eax+4], xmm0
01343 }
01344 #else
01345 o[0] = i[0]*scale;
01346 o[1] = i[1]*scale;
01347 o[2] = i[2]*scale;
01348 #endif
01349 }
01350 #endif // _XBOX
01351
01352 #if 1
01353
01354 #define minimum(x,y) ((x)<(y)?(x):(y))
01355 #define maximum(x,y) ((x)>(y)?(x):(y))
01356
01357 #ifndef _XBOX // Done above to use SSE
01358 #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
01359 #define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2])
01360 #define VectorAdd(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2])
01361 #define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s))
01362 #endif
01363 #define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2])
01364 #define VectorCopy4(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
01365 #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))
01366 #define VectorInc(v) ((v)[0] += 1.0f,(v)[1] += 1.0f,(v)[2] +=1.0f)
01367 #define VectorDec(v) ((v)[0] -= 1.0f,(v)[1] -= 1.0f,(v)[2] -=1.0f)
01368 #define VectorInverseScaleVector(a,b,c) ((c)[0]=(a)[0]/(b)[0],(c)[1]=(a)[1]/(b)[1],(c)[2]=(a)[2]/(b)[2])
01369 #define VectorScaleVectorAdd(c,a,b,o) ((o)[0]=(c)[0]+((a)[0]*(b)[0]),(o)[1]=(c)[1]+((a)[1]*(b)[1]),(o)[2]=(c)[2]+((a)[2]*(b)[2]))
01370 #define VectorAdvance(a,s,b,c) (((c)[0]=(a)[0] + s * ((b)[0] - (a)[0])),((c)[1]=(a)[1] + s * ((b)[1] - (a)[1])),((c)[2]=(a)[2] + s * ((b)[2] - (a)[2])))
01371 #define VectorAverage(a,b,c) (((c)[0]=((a)[0]+(b)[0])*0.5f),((c)[1]=((a)[1]+(b)[1])*0.5f),((c)[2]=((a)[2]+(b)[2])*0.5f))
01372 #define VectorScaleVector(a,b,c) (((c)[0]=(a)[0]*(b)[0]),((c)[1]=(a)[1]*(b)[1]),((c)[2]=(a)[2]*(b)[2]))
01373
01374 #else
01375
01376 #define DotProduct(x,y) _DotProduct(x,y)
01377 #define VectorSubtract(a,b,c) _VectorSubtract(a,b,c)
01378 #define VectorAdd(a,b,c) _VectorAdd(a,b,c)
01379 #define VectorCopy(a,b) _VectorCopy(a,b)
01380 #define VectorScale(v, s, o) _VectorScale(v,s,o)
01381 #define VectorMA(v, s, b, o) _VectorMA(v,s,b,o)
01382
01383 #endif
01384
01385 #ifdef __LCC__
01386 #ifdef VectorCopy
01387 #undef VectorCopy
01388
01389 typedef struct {
01390 float v[3];
01391 } vec3struct_t;
01392 #define VectorCopy(a,b) *(vec3struct_t *)b=*(vec3struct_t *)a;
01393 #define ID_INLINE static
01394 #endif
01395 #endif
01396
01397 #define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0)
01398 #define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2])
01399 #define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z))
01400 #define VectorSet5(v,x,y,z,a,b) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z), (v)[3]=(a), (v)[4]=(b)) //rwwRMG - added
01401 #define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
01402
01403 #ifdef __linux__
01404 #define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
01405 #else
01406 #ifndef __LCC__
01407
01408 static ID_INLINE void SnapVector( float *v )
01409 {
01410 static int i;
01411 static float f;
01412
01413 f = *v;
01414 __asm fld f;
01415 __asm fistp i;
01416 *v = i;
01417 v++;
01418 f = *v;
01419 __asm fld f;
01420 __asm fistp i;
01421 *v = i;
01422 v++;
01423 f = *v;
01424 __asm fld f;
01425 __asm fistp i;
01426 *v = i;
01427 }
01428 #else
01429 #define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
01430 #endif // __LCC__
01431 #endif // __linux__
01432
01433
01434 vec_t _DotProduct( const vec3_t v1, const vec3_t v2 );
01435 void _VectorSubtract( const vec3_t veca, const vec3_t vecb, vec3_t out );
01436 void _VectorAdd( const vec3_t veca, const vec3_t vecb, vec3_t out );
01437 void _VectorCopy( const vec3_t in, vec3_t out );
01438 void _VectorScale( const vec3_t in, float scale, vec3_t out );
01439 void _VectorMA( const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc );
01440
01441 unsigned ColorBytes3 (float r, float g, float b);
01442 unsigned ColorBytes4 (float r, float g, float b, float a);
01443
01444 float NormalizeColor( const vec3_t in, vec3_t out );
01445
01446 float RadiusFromBounds( const vec3_t mins, const vec3_t maxs );
01447 void ClearBounds( vec3_t mins, vec3_t maxs );
01448 vec_t DistanceHorizontal( const vec3_t p1, const vec3_t p2 );
01449 vec_t DistanceHorizontalSquared( const vec3_t p1, const vec3_t p2 );
01450 void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs );
01451
01452 #ifndef __LCC__
01453 static ID_INLINE int VectorCompare( const vec3_t v1, const vec3_t v2 ) {
01454 if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) {
01455 return 0;
01456 }
01457 return 1;
01458 }
01459
01460 static ID_INLINE vec_t VectorLength( const vec3_t v ) {
01461 #ifdef _XBOX
01462 float res;
01463
01464 __asm {
01465 mov edx, v
01466 movss xmm1, [edx]
01467 movhps xmm1, [edx+4]
01468
01469 movaps xmm2, xmm1
01470
01471 mulps xmm1, xmm2
01472
01473 movaps xmm0, xmm1
01474
01475 shufps xmm0, xmm0, 32h
01476 addps xmm1, xmm0
01477
01478 shufps xmm0, xmm0, 32h
01479 addps xmm1, xmm0
01480
01481 sqrtss xmm1, xmm1
01482 movss [res], xmm1
01483 }
01484
01485 return res;
01486 #else
01487 return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
01488 #endif
01489 }
01490
01491 static ID_INLINE vec_t VectorLengthSquared( const vec3_t v ) {
01492 #ifdef _XBOX
01493 float res;
01494 __asm {
01495 mov edx, v
01496 movss xmm1, [edx]
01497 movhps xmm1, [edx+4]
01498
01499 movaps xmm2, xmm1
01500
01501 mulps xmm1, xmm2
01502
01503 movaps xmm0, xmm1
01504
01505 shufps xmm0, xmm0, 32h
01506 addps xmm1, xmm0
01507
01508 shufps xmm0, xmm0, 32h
01509 addps xmm1, xmm0
01510
01511 movss [res], xmm1
01512 }
01513
01514 return res;
01515 #else
01516 return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
01517 #endif
01518 }
01519
01520 static ID_INLINE vec_t Distance( const vec3_t p1, const vec3_t p2 ) {
01521 vec3_t v;
01522
01523 VectorSubtract (p2, p1, v);
01524 return VectorLength( v );
01525 }
01526
01527 static ID_INLINE vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) {
01528 vec3_t v;
01529
01530 VectorSubtract (p2, p1, v);
01531 return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
01532 }
01533
01534
01535
01536 static ID_INLINE void VectorNormalizeFast( vec3_t v )
01537 {
01538 float ilength;
01539
01540 ilength = Q_rsqrt( DotProduct( v, v ) );
01541
01542 v[0] *= ilength;
01543 v[1] *= ilength;
01544 v[2] *= ilength;
01545 }
01546
01547 static ID_INLINE void VectorInverse( vec3_t v ){
01548 v[0] = -v[0];
01549 v[1] = -v[1];
01550 v[2] = -v[2];
01551 }
01552
01553 static ID_INLINE void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) {
01554 cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
01555 cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
01556 cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
01557 }
01558
01559 #else
01560 int VectorCompare( const vec3_t v1, const vec3_t v2 );
01561
01562 vec_t VectorLength( const vec3_t v );
01563
01564 vec_t VectorLengthSquared( const vec3_t v );
01565
01566 vec_t Distance( const vec3_t p1, const vec3_t p2 );
01567
01568 vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 );
01569
01570 void VectorNormalizeFast( vec3_t v );
01571
01572 void VectorInverse( vec3_t v );
01573
01574 void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross );
01575
01576 #endif
01577
01578 vec_t VectorNormalize (vec3_t v);
01579 vec_t VectorNormalize2( const vec3_t v, vec3_t out );
01580 void Vector4Scale( const vec4_t in, vec_t scale, vec4_t out );
01581 void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out );
01582 int Q_log2(int val);
01583
01584 float Q_acos(float c);
01585 float Q_asin(float c);
01586
01587 int Q_rand( int *seed );
01588 float Q_random( int *seed );
01589 float Q_crandom( int *seed );
01590
01591 #define random() ((rand () & 0x7fff) / ((float)0x7fff))
01592 #define crandom() (2.0 * (random() - 0.5))
01593
01594 void vectoangles( const vec3_t value1, vec3_t angles);
01595 void AnglesToAxis( const vec3_t angles, vec3_t axis[3] );
01596
01597 void AxisClear( vec3_t axis[3] );
01598 void AxisCopy( vec3_t in[3], vec3_t out[3] );
01599
01600 void SetPlaneSignbits( struct cplane_s *out );
01601 int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *plane);
01602
01603 double fmod( double x, double y );
01604 float AngleMod(float a);
01605 float LerpAngle (float from, float to, float frac);
01606 float AngleSubtract( float a1, float a2 );
01607 void AnglesSubtract( vec3_t v1, vec3_t v2, vec3_t v3 );
01608
01609 float AngleNormalize360 ( float angle );
01610 float AngleNormalize180 ( float angle );
01611 float AngleDelta ( float angle1, float angle2 );
01612
01613 qboolean PlaneFromPoints( vec4_t plane, const vec3_t a, const vec3_t b, const vec3_t c );
01614 void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal );
01615 void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees );
01616 void RotateAroundDirection( vec3_t axis[3], float yaw );
01617 void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up );
01618
01619
01620
01621
01622 void MatrixMultiply(float in1[3][3], float in2[3][3], float out[3][3]);
01623 void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
01624 void PerpendicularVector( vec3_t dst, const vec3_t src );
01625 void NormalToLatLong( const vec3_t normal, byte bytes[2] );
01626
01627
01628
01629 int Com_Clampi( int min, int max, int value );
01630 float Com_Clamp( float min, float max, float value );
01631
01632 char *COM_SkipPath( char *pathname );
01633 void COM_StripExtension( const char *in, char *out );
01634 void COM_DefaultExtension( char *path, int maxSize, const char *extension );
01635
01636 void COM_BeginParseSession( const char *name );
01637 int COM_GetCurrentParseLine( void );
01638 const char *SkipWhitespace( const char *data, qboolean *hasNewLines );
01639 char *COM_Parse( const char **data_p );
01640 char *COM_ParseExt( const char **data_p, qboolean allowLineBreak );
01641 int COM_Compress( char *data_p );
01642 void COM_ParseError( char *format, ... );
01643 void COM_ParseWarning( char *format, ... );
01644 qboolean COM_ParseString( const char **data, const char **s );
01645 qboolean COM_ParseInt( const char **data, int *i );
01646 qboolean COM_ParseFloat( const char **data, float *f );
01647 qboolean COM_ParseVec4( const char **buffer, vec4_t *c);
01648
01649
01650 #define MAX_TOKENLENGTH 1024
01651
01652 #ifndef TT_STRING
01653
01654 #define TT_STRING 1 // string
01655 #define TT_LITERAL 2 // literal
01656 #define TT_NUMBER 3 // number
01657 #define TT_NAME 4 // name
01658 #define TT_PUNCTUATION 5 // punctuation
01659 #endif
01660
01661 typedef struct pc_token_s
01662 {
01663 int type;
01664 int subtype;
01665 int intvalue;
01666 float floatvalue;
01667 char string[MAX_TOKENLENGTH];
01668 } pc_token_t;
01669
01670
01671
01672 void COM_MatchToken( const char**buf_p, char *match );
01673
01674 void SkipBracedSection (const char **program);
01675 void SkipRestOfLine ( const char **data );
01676
01677 void Parse1DMatrix (const char **buf_p, int x, float *m);
01678 void Parse2DMatrix (const char **buf_p, int y, int x, float *m);
01679 void Parse3DMatrix (const char **buf_p, int z, int y, int x, float *m);
01680
01681 void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...);
01682
01683
01684
01685 typedef enum {
01686 FS_READ,
01687 FS_WRITE,
01688 FS_APPEND,
01689 FS_APPEND_SYNC
01690 } fsMode_t;
01691
01692 typedef enum {
01693 FS_SEEK_CUR,
01694 FS_SEEK_END,
01695 FS_SEEK_SET
01696 } fsOrigin_t;
01697
01698
01699
01700 int Q_isprint( int c );
01701 int Q_islower( int c );
01702 int Q_isupper( int c );
01703 int Q_isalpha( int c );
01704
01705
01706 int Q_stricmp (const char *s1, const char *s2);
01707 int Q_strncmp (const char *s1, const char *s2, int n);
01708 int Q_stricmpn (const char *s1, const char *s2, int n);
01709 char *Q_strlwr( char *s1 );
01710 char *Q_strupr( char *s1 );
01711 char *Q_strrchr( const char* string, int c );
01712
01713
01714 void Q_strncpyz( char *dest, const char *src, int destsize );
01715 void Q_strcat( char *dest, int size, const char *src );
01716
01717
01718 int Q_PrintStrlen( const char *string );
01719
01720 char *Q_CleanStr( char *string );
01721
01722
01723
01724
01725
01726 typedef struct
01727 {
01728 byte b0;
01729 byte b1;
01730 byte b2;
01731 byte b3;
01732 byte b4;
01733 byte b5;
01734 byte b6;
01735 byte b7;
01736 } qint64;
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746
01747
01748
01749
01750
01751 char * QDECL va(const char *format, ...);
01752
01753
01754
01755
01756
01757
01758 char *Info_ValueForKey( const char *s, const char *key );
01759 void Info_RemoveKey( char *s, const char *key );
01760 void Info_RemoveKey_big( char *s, const char *key );
01761 void Info_SetValueForKey( char *s, const char *key, const char *value );
01762 void Info_SetValueForKey_Big( char *s, const char *key, const char *value );
01763 qboolean Info_Validate( const char *s );
01764 void Info_NextPair( const char **s, char *key, char *value );
01765
01766
01767 void QDECL Com_Error( int level, const char *error, ... );
01768 void QDECL Com_Printf( const char *msg, ... );
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782 #define CVAR_ARCHIVE 0x00000001 // set to cause it to be saved to vars.rc
01783
01784
01785 #define CVAR_USERINFO 0x00000002 // sent to server on connect or change
01786 #define CVAR_SERVERINFO 0x00000004 // sent in response to front end requests
01787 #define CVAR_SYSTEMINFO 0x00000008 // these cvars will be duplicated on all clients
01788 #define CVAR_INIT 0x00000010 // don't allow change from console at all,
01789
01790 #define CVAR_LATCH 0x00000020 // will only change when C code next does
01791
01792
01793
01794
01795 #define CVAR_ROM 0x00000040 // display only, cannot be set by user at all (can be set by code)
01796 #define CVAR_USER_CREATED 0x00000080 // created by a set command
01797 #define CVAR_TEMP 0x00000100 // can be set even when cheats are disabled, but is not archived
01798 #define CVAR_CHEAT 0x00000200 // can not be changed if cheats are disabled
01799 #define CVAR_NORESTART 0x00000400 // do not clear when a cvar_restart is issued
01800 #define CVAR_INTERNAL 0x00000800 // cvar won't be displayed, ever (for passwords and such)
01801 #define CVAR_PARENTAL 0x00001000 // lets cvar system know that parental stuff needs to be updated
01802
01803
01804 typedef struct cvar_s {
01805 char *name;
01806 char *string;
01807 char *resetString;
01808 char *latchedString;
01809 int flags;
01810 qboolean modified;
01811 int modificationCount;
01812 float value;
01813 int integer;
01814 struct cvar_s *next;
01815 struct cvar_s *hashNext;
01816 } cvar_t;
01817
01818 #define MAX_CVAR_VALUE_STRING 256
01819
01820 typedef int cvarHandle_t;
01821
01822
01823
01824 typedef struct {
01825 cvarHandle_t handle;
01826 int modificationCount;
01827 float value;
01828 int integer;
01829 char string[MAX_CVAR_VALUE_STRING];
01830 } vmCvar_t;
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840 #include "surfaceflags.h"
01841
01842
01843
01844 #define PLANE_X 0
01845 #define PLANE_Y 1
01846 #define PLANE_Z 2
01847 #define PLANE_NON_AXIAL 3
01848
01849
01850
01851
01852
01853
01854
01855
01856 #define PlaneTypeForNormal(x) (x[0] == 1.0 ? PLANE_X : (x[1] == 1.0 ? PLANE_Y : (x[2] == 1.0 ? PLANE_Z : PLANE_NON_AXIAL) ) )
01857
01858
01859
01860 typedef struct cplane_s {
01861 vec3_t normal;
01862 float dist;
01863 byte type;
01864 byte signbits;
01865 byte pad[2];
01866 } cplane_t;
01867
01868
01869
01870 typedef struct
01871 {
01872 float mDistance;
01873 int mEntityNum;
01874 int mModelIndex;
01875 int mPolyIndex;
01876 int mSurfaceIndex;
01877 vec3_t mCollisionPosition;
01878 vec3_t mCollisionNormal;
01879 int mFlags;
01880 int mMaterial;
01881 int mLocation;
01882 float mBarycentricI;
01883 float mBarycentricJ;
01884 }CollisionRecord_t;
01885
01886 #define MAX_G2_COLLISIONS 16
01887
01888 typedef CollisionRecord_t G2Trace_t[MAX_G2_COLLISIONS];
01889
01890
01891
01892
01893
01894 typedef struct {
01895 byte allsolid;
01896 byte startsolid;
01897 short entityNum;
01898
01899 float fraction;
01900 vec3_t endpos;
01901 cplane_t plane;
01902 int surfaceFlags;
01903 int contents;
01904
01905
01906
01907
01908
01909
01910
01911
01912 } trace_t;
01913
01914
01915
01916
01917
01918
01919 typedef struct {
01920 int firstPoint;
01921 int numPoints;
01922 } markFragment_t;
01923
01924
01925
01926 typedef struct {
01927 vec3_t origin;
01928 vec3_t axis[3];
01929 } orientation_t;
01930
01931
01932
01933
01934
01935
01936 #define KEYCATCH_CONSOLE 0x0001
01937 #define KEYCATCH_UI 0x0002
01938 #define KEYCATCH_MESSAGE 0x0004
01939 #define KEYCATCH_CGAME 0x0008
01940
01941
01942
01943
01944
01945 typedef enum {
01946 CHAN_AUTO,
01947 CHAN_LOCAL,
01948 CHAN_WEAPON,
01949 CHAN_VOICE,
01950 CHAN_VOICE_ATTEN,
01951 CHAN_ITEM,
01952 CHAN_BODY,
01953 CHAN_AMBIENT,
01954 CHAN_LOCAL_SOUND,
01955 CHAN_ANNOUNCER,
01956 CHAN_LESS_ATTEN,
01957 CHAN_MENU1,
01958 CHAN_VOICE_GLOBAL,
01959 CHAN_MUSIC,
01960 };
01961 typedef int soundChannel_t;
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972 #define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535)
01973 #define SHORT2ANGLE(x) ((x)*(360.0/65536))
01974
01975 #define SNAPFLAG_RATE_DELAYED 1
01976 #define SNAPFLAG_NOT_ACTIVE 2 // snapshot used during connection and for zombies
01977 #define SNAPFLAG_SERVERCOUNT 4 // toggled every map_restart so transitions can be detected
01978
01979
01980
01981
01982 #ifdef _XBOX
01983 #define MAX_CLIENTS 16
01984 #else
01985 #define MAX_CLIENTS 32 // absolute limit
01986 #endif
01987 #define MAX_RADAR_ENTITIES MAX_GENTITIES
01988 #define MAX_TERRAINS 1//32 //rwwRMG: inserted
01989 #define MAX_LOCATIONS 64
01990
01991 #ifdef _XBOX
01992 #define GENTITYNUM_BITS 9 // don't need to send any more
01993 #else
01994 #define GENTITYNUM_BITS 10 // don't need to send any more
01995 #endif
01996 #define MAX_GENTITIES (1<<GENTITYNUM_BITS)
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014 #define ENTITYNUM_NONE (MAX_GENTITIES-1)
02015 #define ENTITYNUM_WORLD (MAX_GENTITIES-2)
02016 #define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2)
02017
02018
02019
02020 #define MAX_MODELS 512 // these are sent over the net as -12 bits
02021 #define MAX_SOUNDS 256 // so they cannot be blindly increased
02022 #define MAX_ICONS 64 // max registered icons you can have per map
02023 #define MAX_FX 64 // max effects strings, I'm hoping that 64 will be plenty
02024
02025 #define MAX_SUB_BSP 32 //rwwRMG - added
02026
02027
02028
02029
02030 #define MAX_G2BONES 64 //rww - changed from MAX_CHARSKINS to MAX_G2BONES. value still equal.
02031
02032
02033
02034
02035 #define MAX_AMBIENT_SETS 256 //rww - ambient soundsets must be sent over in config strings.
02036
02037 #define MAX_CONFIGSTRINGS 1700 //this is getting pretty high. Try not to raise it anymore than it already is.
02038
02039
02040
02041 #define CS_SERVERINFO 0 // an info string with all the serverinfo cvars
02042 #define CS_SYSTEMINFO 1 // an info string for server system to client system configuration (timescale, etc)
02043
02044 #define RESERVED_CONFIGSTRINGS 2 // game can't modify below this, only the system can
02045
02046 #define MAX_GAMESTATE_CHARS 16000
02047 typedef struct {
02048 int stringOffsets[MAX_CONFIGSTRINGS];
02049 char stringData[MAX_GAMESTATE_CHARS];
02050 int dataCount;
02051 } gameState_t;
02052
02053
02054
02055
02056 typedef enum {
02057 TRACK_CHANNEL_NONE = 50,
02058 TRACK_CHANNEL_1,
02059 TRACK_CHANNEL_2,
02060 TRACK_CHANNEL_3,
02061 TRACK_CHANNEL_4,
02062 TRACK_CHANNEL_5,
02063 NUM_TRACK_CHANNELS
02064 } trackchan_t;
02065
02066 #define TRACK_CHANNEL_MAX (NUM_TRACK_CHANNELS-50)
02067
02068 typedef struct forcedata_s {
02069 int forcePowerDebounce[NUM_FORCE_POWERS];
02070 int forcePowersKnown;
02071 int forcePowersActive;
02072 int forcePowerSelected;
02073 int forceButtonNeedRelease;
02074 int forcePowerDuration[NUM_FORCE_POWERS];
02075 int forcePower;
02076 int forcePowerMax;
02077 int forcePowerRegenDebounceTime;
02078 int forcePowerLevel[NUM_FORCE_POWERS];
02079 int forcePowerBaseLevel[NUM_FORCE_POWERS];
02080 int forceUsingAdded;
02081 float forceJumpZStart;
02082 float forceJumpCharge;
02083 int forceJumpSound;
02084 int forceJumpAddTime;
02085 int forceGripEntityNum;
02086 int forceGripDamageDebounceTime;
02087 float forceGripBeingGripped;
02088 int forceGripCripple;
02089 int forceGripUseTime;
02090 float forceGripSoundTime;
02091 float forceGripStarted;
02092 int forceHealTime;
02093 int forceHealAmount;
02094
02095
02096 int forceMindtrickTargetIndex;
02097 int forceMindtrickTargetIndex2;
02098 int forceMindtrickTargetIndex3;
02099 int forceMindtrickTargetIndex4;
02100
02101 int forceRageRecoveryTime;
02102 int forceDrainEntNum;
02103 float forceDrainTime;
02104
02105 int forceDoInit;
02106
02107 int forceSide;
02108 int forceRank;
02109
02110 int forceDeactivateAll;
02111
02112 int killSoundEntIndex[TRACK_CHANNEL_MAX];
02113
02114 qboolean sentryDeployed;
02115
02116 int saberAnimLevelBase;
02117 int saberAnimLevel;
02118 int saberDrawAnimLevel;
02119
02120 int suicides;
02121
02122 int privateDuelTime;
02123 } forcedata_t;
02124
02125
02126 typedef enum {
02127 SENTRY_NOROOM = 1,
02128 SENTRY_ALREADYPLACED,
02129 SHIELD_NOROOM,
02130 SEEKER_ALREADYDEPLOYED
02131 } itemUseFail_t;
02132
02133
02134 #define MAX_STATS 16
02135 #define MAX_PERSISTANT 16
02136 #define MAX_POWERUPS 16
02137 #define MAX_WEAPONS 19
02138
02139 #define MAX_PS_EVENTS 2
02140
02141 #define PS_PMOVEFRAMECOUNTBITS 6
02142
02143 #define FORCE_LIGHTSIDE 1
02144 #define FORCE_DARKSIDE 2
02145
02146 #define MAX_FORCE_RANK 7
02147
02148 #define FALL_FADE_TIME 3000
02149
02150
02151
02152
02153
02154 #define _OPTIMIZED_VEHICLE_NETWORKING
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169 typedef struct playerState_s {
02170 int commandTime;
02171 int pm_type;
02172 int bobCycle;
02173 int pm_flags;
02174 int pm_time;
02175
02176 vec3_t origin;
02177 vec3_t velocity;
02178
02179 vec3_t moveDir;
02180
02181 int weaponTime;
02182 int weaponChargeTime;
02183 int weaponChargeSubtractTime;
02184 int gravity;
02185 float speed;
02186 int basespeed;
02187 int delta_angles[3];
02188
02189
02190 int slopeRecalcTime;
02191
02192 int useTime;
02193
02194 int groundEntityNum;
02195
02196 int legsTimer;
02197 int legsAnim;
02198
02199 int torsoTimer;
02200 int torsoAnim;
02201
02202 qboolean legsFlip;
02203 qboolean torsoFlip;
02204
02205 int movementDir;
02206
02207
02208
02209
02210 int eFlags;
02211 int eFlags2;
02212
02213 int eventSequence;
02214 int events[MAX_PS_EVENTS];
02215 int eventParms[MAX_PS_EVENTS];
02216
02217 int externalEvent;
02218 int externalEventParm;
02219 int externalEventTime;
02220
02221 int clientNum;
02222 int weapon;
02223 int weaponstate;
02224
02225 vec3_t viewangles;
02226 int viewheight;
02227
02228
02229 int damageEvent;
02230 int damageYaw;
02231 int damagePitch;
02232 int damageCount;
02233 int damageType;
02234
02235 int painTime;
02236 int painDirection;
02237 float yawAngle;
02238 qboolean yawing;
02239 float pitchAngle;
02240 qboolean pitching;
02241
02242 int stats[MAX_STATS];
02243 int persistant[MAX_PERSISTANT];
02244 int powerups[MAX_POWERUPS];
02245 int ammo[MAX_WEAPONS];
02246
02247 int generic1;
02248 int loopSound;
02249 int jumppad_ent;
02250
02251
02252 int ping;
02253 int pmove_framecount;
02254 int jumppad_frame;
02255 int entityEventSequence;
02256
02257 int lastOnGround;
02258
02259 qboolean saberInFlight;
02260
02261 int saberMove;
02262 int saberBlocking;
02263 int saberBlocked;
02264
02265 int saberLockTime;
02266 int saberLockEnemy;
02267 int saberLockFrame;
02268 int saberLockHits;
02269 int saberLockHitCheckTime;
02270 int saberLockHitIncrementTime;
02271 qboolean saberLockAdvance;
02272
02273 int saberEntityNum;
02274 float saberEntityDist;
02275 int saberEntityState;
02276 int saberThrowDelay;
02277 qboolean saberCanThrow;
02278 int saberDidThrowTime;
02279 int saberDamageDebounceTime;
02280 int saberHitWallSoundDebounceTime;
02281 int saberEventFlags;
02282
02283 int rocketLockIndex;
02284 float rocketLastValidTime;
02285 float rocketLockTime;
02286 float rocketTargetTime;
02287
02288 int emplacedIndex;
02289 float emplacedTime;
02290
02291 qboolean isJediMaster;
02292 qboolean forceRestricted;
02293 qboolean trueJedi;
02294 qboolean trueNonJedi;
02295 int saberIndex;
02296
02297 int genericEnemyIndex;
02298 float droneFireTime;
02299 float droneExistTime;
02300
02301 int activeForcePass;
02302
02303 qboolean hasDetPackPlanted;
02304
02305 float holocronsCarried[NUM_FORCE_POWERS];
02306 int holocronCantTouch;
02307 float holocronCantTouchTime;
02308 int holocronBits;
02309
02310 int electrifyTime;
02311
02312 int saberAttackSequence;
02313 int saberIdleWound;
02314 int saberAttackWound;
02315 int saberBlockTime;
02316
02317 int otherKiller;
02318 int otherKillerTime;
02319 int otherKillerDebounceTime;
02320
02321 forcedata_t fd;
02322 qboolean forceJumpFlip;
02323 int forceHandExtend;
02324 int forceHandExtendTime;
02325
02326 int forceRageDrainTime;
02327
02328 int forceDodgeAnim;
02329 qboolean quickerGetup;
02330
02331 int groundTime;
02332
02333 int footstepTime;
02334
02335 int otherSoundTime;
02336 float otherSoundLen;
02337
02338 int forceGripMoveInterval;
02339 int forceGripChangeMovetype;
02340
02341 int forceKickFlip;
02342
02343 int duelIndex;
02344 int duelTime;
02345 qboolean duelInProgress;
02346
02347 int saberAttackChainCount;
02348
02349 int saberHolstered;
02350
02351 int forceAllowDeactivateTime;
02352
02353
02354 int zoomMode;
02355 int zoomTime;
02356 qboolean zoomLocked;
02357 float zoomFov;
02358 int zoomLockTime;
02359
02360 int fallingToDeath;
02361
02362 int useDelay;
02363
02364 qboolean inAirAnim;
02365
02366 vec3_t lastHitLoc;
02367
02368 int heldByClient;
02369
02370 int ragAttach;
02371
02372 int iModelScale;
02373
02374 int brokenLimbs;
02375
02376
02377 qboolean hasLookTarget;
02378 int lookTarget;
02379
02380 int customRGBA[4];
02381
02382 int standheight;
02383 int crouchheight;
02384
02385
02386 int m_iVehicleNum;
02387
02388
02389 vec3_t vehOrientation;
02390 qboolean vehBoarding;
02391 int vehSurfaces;
02392
02393
02394 int vehTurnaroundIndex;
02395 int vehTurnaroundTime;
02396
02397
02398 qboolean vehWeaponsLinked;
02399
02400
02401 int hyperSpaceTime;
02402 vec3_t hyperSpaceAngles;
02403
02404
02405 int hackingTime;
02406
02407
02408
02409 int hackingBaseTime;
02410
02411
02412 int jetpackFuel;
02413
02414
02415 int cloakFuel;
02416
02417
02418
02419
02420 #ifndef _XBOX
02421 int userInt1;
02422 int userInt2;
02423 int userInt3;
02424 float userFloat1;
02425 float userFloat2;
02426 float userFloat3;
02427 vec3_t userVec1;
02428 vec3_t userVec2;
02429 #endif
02430
02431 #ifdef _ONEBIT_COMBO
02432 int deltaOneBits;
02433 int deltaNumBits;
02434 #endif
02435 } playerState_t;
02436
02437 typedef struct siegePers_s
02438 {
02439 qboolean beatingTime;
02440 int lastTeam;
02441 int lastTime;
02442 } siegePers_t;
02443
02444
02445
02446
02447
02448
02449
02450
02451 #define BUTTON_ATTACK 1
02452 #define BUTTON_TALK 2 // displays talk balloon and disables actions
02453 #define BUTTON_USE_HOLDABLE 4
02454 #define BUTTON_GESTURE 8
02455 #define BUTTON_WALKING 16 // walking can't just be infered from MOVE_RUN
02456
02457
02458
02459
02460 #define BUTTON_USE 32 // the ol' use key returns!
02461 #define BUTTON_FORCEGRIP 64 //
02462 #define BUTTON_ALT_ATTACK 128
02463
02464 #define BUTTON_ANY 256 // any key whatsoever
02465
02466 #define BUTTON_FORCEPOWER 512 // use the "active" force power
02467
02468 #define BUTTON_FORCE_LIGHTNING 1024
02469
02470 #define BUTTON_FORCE_DRAIN 2048
02471
02472
02473
02474
02475
02476
02477
02478
02479
02480
02481
02482
02483
02484
02485 #define MOVE_RUN 120 // if forwardmove or rightmove are >= MOVE_RUN,
02486
02487
02488 typedef enum
02489 {
02490 GENCMD_SABERSWITCH = 1,
02491 GENCMD_ENGAGE_DUEL,
02492 GENCMD_FORCE_HEAL,
02493 GENCMD_FORCE_SPEED,
02494 GENCMD_FORCE_THROW,
02495 GENCMD_FORCE_PULL,
02496 GENCMD_FORCE_DISTRACT,
02497 GENCMD_FORCE_RAGE,
02498 GENCMD_FORCE_PROTECT,
02499 GENCMD_FORCE_ABSORB,
02500 GENCMD_FORCE_HEALOTHER,
02501 GENCMD_FORCE_FORCEPOWEROTHER,
02502 GENCMD_FORCE_SEEING,
02503 GENCMD_USE_SEEKER,
02504 GENCMD_USE_FIELD,
02505 GENCMD_USE_BACTA,
02506 GENCMD_USE_ELECTROBINOCULARS,
02507 GENCMD_ZOOM,
02508 GENCMD_USE_SENTRY,
02509 GENCMD_USE_JETPACK,
02510 GENCMD_USE_BACTABIG,
02511 GENCMD_USE_HEALTHDISP,
02512 GENCMD_USE_AMMODISP,
02513 GENCMD_USE_EWEB,
02514 GENCMD_USE_CLOAK,
02515 GENCMD_SABERATTACKCYCLE,
02516 GENCMD_TAUNT,
02517 GENCMD_BOW,
02518 GENCMD_MEDITATE,
02519 GENCMD_FLOURISH,
02520 GENCMD_GLOAT
02521 } genCmds_t;
02522
02523
02524 typedef struct usercmd_s {
02525 int serverTime;
02526 int angles[3];
02527 int buttons;
02528 byte weapon;
02529 byte forcesel;
02530 byte invensel;
02531 byte generic_cmd;
02532 signed char forwardmove, rightmove, upmove;
02533 } usercmd_t;
02534
02535
02536
02537
02538 typedef struct addpolyArgStruct_s {
02539 vec3_t p[4];
02540 vec2_t ev[4];
02541 int numVerts;
02542 vec3_t vel;
02543 vec3_t accel;
02544 float alpha1;
02545 float alpha2;
02546 float alphaParm;
02547 vec3_t rgb1;
02548 vec3_t rgb2;
02549 float rgbParm;
02550 vec3_t rotationDelta;
02551 float bounce;
02552 int motionDelay;
02553 int killTime;
02554 qhandle_t shader;
02555 int flags;
02556 } addpolyArgStruct_t;
02557
02558 typedef struct addbezierArgStruct_s {
02559 vec3_t start;
02560 vec3_t end;
02561 vec3_t control1;
02562 vec3_t control1Vel;
02563 vec3_t control2;
02564 vec3_t control2Vel;
02565 float size1;
02566 float size2;
02567 float sizeParm;
02568 float alpha1;
02569 float alpha2;
02570 float alphaParm;
02571 vec3_t sRGB;
02572 vec3_t eRGB;
02573 float rgbParm;
02574 int killTime;
02575 qhandle_t shader;
02576 int flags;
02577 } addbezierArgStruct_t;
02578
02579 typedef struct addspriteArgStruct_s
02580 {
02581 vec3_t origin;
02582 vec3_t vel;
02583 vec3_t accel;
02584 float scale;
02585 float dscale;
02586 float sAlpha;
02587 float eAlpha;
02588 float rotation;
02589 float bounce;
02590 int life;
02591 qhandle_t shader;
02592 int flags;
02593 } addspriteArgStruct_t;
02594
02595 typedef struct
02596 {
02597 vec3_t origin;
02598
02599
02600 vec3_t rgb;
02601 vec3_t destrgb;
02602 vec3_t curRGB;
02603
02604 float alpha;
02605 float destAlpha;
02606 float curAlpha;
02607
02608
02609
02610 float ST[2];
02611 float destST[2];
02612 float curST[2];
02613 } effectTrailVertStruct_t;
02614
02615 typedef struct effectTrailArgStruct_s {
02616 effectTrailVertStruct_t mVerts[4];
02617 qhandle_t mShader;
02618 int mSetFlags;
02619 int mKillTime;
02620 } effectTrailArgStruct_t;
02621
02622 typedef struct
02623 {
02624 vec3_t start;
02625 vec3_t end;
02626 float size1;
02627 float size2;
02628 float sizeParm;
02629 float alpha1;
02630 float alpha2;
02631 float alphaParm;
02632 vec3_t sRGB;
02633 vec3_t eRGB;
02634 float rgbParm;
02635 float chaos;
02636 int killTime;
02637 qhandle_t shader;
02638 int flags;
02639 } addElectricityArgStruct_t;
02640
02641
02642 #define SOLID_BMODEL 0xffffff
02643
02644 typedef enum {
02645 TR_STATIONARY,
02646 TR_INTERPOLATE,
02647 TR_LINEAR,
02648 TR_LINEAR_STOP,
02649 TR_NONLINEAR_STOP,
02650 TR_SINE,
02651 TR_GRAVITY
02652 } trType_t;
02653
02654 typedef struct {
02655 trType_t trType;
02656 int trTime;
02657 int trDuration;
02658 vec3_t trBase;
02659 vec3_t trDelta;
02660 } trajectory_t;
02661
02662
02663
02664
02665
02666
02667
02668 #ifndef _XBOX // First, real version for the PC, with all members 32-bits
02669
02670 typedef struct entityState_s {
02671 int number;
02672 int eType;
02673 int eFlags;
02674 int eFlags2;
02675
02676 trajectory_t pos;
02677 trajectory_t apos;
02678
02679 int time;
02680 int time2;
02681
02682 vec3_t origin;
02683 vec3_t origin2;
02684
02685 vec3_t angles;
02686 vec3_t angles2;
02687
02688
02689
02690 int bolt1;
02691 int bolt2;
02692
02693
02694 int trickedentindex;
02695 int trickedentindex2;
02696 int trickedentindex3;
02697 int trickedentindex4;
02698
02699 float speed;
02700
02701 int fireflag;
02702
02703 int genericenemyindex;
02704
02705 int activeForcePass;
02706
02707 int emplacedOwner;
02708
02709 int otherEntityNum;
02710 int otherEntityNum2;
02711
02712 int groundEntityNum;
02713
02714 int constantLight;
02715 int loopSound;
02716 qboolean loopIsSoundset;
02717
02718 int soundSetIndex;
02719
02720 int modelGhoul2;
02721 int g2radius;
02722 int modelindex;
02723 int modelindex2;
02724 int clientNum;
02725 int frame;
02726
02727 qboolean saberInFlight;
02728 int saberEntityNum;
02729 int saberMove;
02730 int forcePowersActive;
02731 int saberHolstered;
02732
02733 qboolean isJediMaster;
02734
02735 qboolean isPortalEnt;
02736
02737 int solid;
02738
02739 int event;
02740 int eventParm;
02741
02742
02743 int owner;
02744 int teamowner;
02745 qboolean shouldtarget;
02746
02747
02748 int powerups;
02749 int weapon;
02750 int legsAnim;
02751 int torsoAnim;
02752
02753 qboolean legsFlip;
02754 qboolean torsoFlip;
02755
02756 int forceFrame;
02757
02758 int generic1;
02759
02760 int heldByClient;
02761
02762 int ragAttach;
02763
02764 int iModelScale;
02765
02766 int brokenLimbs;
02767
02768 int boltToPlayer;
02769
02770
02771 qboolean hasLookTarget;
02772 int lookTarget;
02773
02774 int customRGBA[4];
02775
02776
02777
02778 int health;
02779 int maxhealth;
02780
02781
02782
02783 int npcSaber1;
02784 int npcSaber2;
02785
02786
02787
02788 int csSounds_Std;
02789 int csSounds_Combat;
02790 int csSounds_Extra;
02791 int csSounds_Jedi;
02792
02793 int surfacesOn;
02794 int surfacesOff;
02795
02796
02797
02798
02799 int boneIndex1;
02800 int boneIndex2;
02801 int boneIndex3;
02802 int boneIndex4;
02803
02804
02805 int boneOrient;
02806
02807
02808
02809
02810
02811 vec3_t boneAngles1;
02812 vec3_t boneAngles2;
02813 vec3_t boneAngles3;
02814 vec3_t boneAngles4;
02815
02816 int NPC_class;
02817
02818
02819 int m_iVehicleNum;
02820
02821
02822
02823
02824 int userInt1;
02825 int userInt2;
02826 int userInt3;
02827 float userFloat1;
02828 float userFloat2;
02829 float userFloat3;
02830 vec3_t userVec1;
02831 vec3_t userVec2;
02832 } entityState_t;
02833
02834 #else
02835
02836
02837
02838
02839 #pragma pack(push, 1)
02840
02841 typedef struct entityState_s {
02842
02843
02844 int number;
02845 int eFlags;
02846
02847 trajectory_t pos;
02848 trajectory_t apos;
02849
02850 int time;
02851 int time2;
02852
02853 vec3_t origin;
02854 vec3_t origin2;
02855
02856 vec3_t angles;
02857 vec3_t angles2;
02858
02859 float speed;
02860
02861 int genericenemyindex;
02862
02863 int emplacedOwner;
02864
02865 int constantLight;
02866 int forcePowersActive;
02867
02868 int solid;
02869
02870 byte customRGBA[4];
02871
02872 int surfacesOn;
02873 int surfacesOff;
02874
02875
02876
02877
02878
02879 vec3_t boneAngles1;
02880 vec3_t boneAngles2;
02881 vec3_t boneAngles3;
02882 vec3_t boneAngles4;
02883
02884
02885
02886
02887
02888 word bolt2;
02889 word trickedentindex;
02890
02891 word trickedentindex2;
02892 word trickedentindex3;
02893
02894 word trickedentindex4;
02895 word otherEntityNum;
02896
02897 word otherEntityNum2;
02898 word groundEntityNum;
02899
02900 short modelindex;
02901 word clientNum;
02902
02903 word frame;
02904 word saberEntityNum;
02905
02906 word event;
02907 word owner;
02908
02909 word powerups;
02910 word legsAnim;
02911
02912 word torsoAnim;
02913 word forceFrame;
02914
02915 word ragAttach;
02916 short iModelScale;
02917
02918 word lookTarget;
02919 word health;
02920
02921 word maxhealth;
02922 word npcSaber1;
02923
02924 word npcSaber2;
02925 word boneOrient;
02926
02927
02928 word m_iVehicleNum;
02929
02930
02931
02932
02933
02934 byte eType;
02935 byte eFlags2;
02936
02937 byte bolt1;
02938 byte fireflag;
02939 byte activeForcePass;
02940 byte loopSound;
02941
02942 byte loopIsSoundset;
02943 byte soundSetIndex;
02944 byte modelGhoul2;
02945 byte g2radius;
02946
02947 byte modelindex2;
02948 byte saberInFlight;
02949 byte saberMove;
02950 byte isJediMaster;
02951 byte saberHolstered;
02952
02953 byte isPortalEnt;
02954 byte eventParm;
02955 byte teamowner;
02956 byte shouldtarget;
02957
02958 byte weapon;
02959 byte legsFlip;
02960 byte torsoFlip;
02961 byte generic1;
02962
02963 byte heldByClient;
02964 byte brokenLimbs;
02965 byte boltToPlayer;
02966 byte hasLookTarget;
02967
02968
02969
02970 byte csSounds_Std;
02971 byte csSounds_Combat;
02972 byte csSounds_Extra;
02973 byte csSounds_Jedi;
02974
02975
02976
02977
02978 byte boneIndex1;
02979 byte boneIndex2;
02980 byte boneIndex3;
02981 byte boneIndex4;
02982
02983 byte NPC_class;
02984 byte alignPad[3];
02985 } entityState_t;
02986
02987 #pragma pack(pop)
02988
02989 #endif
02990
02991 typedef enum {
02992 CA_UNINITIALIZED,
02993 CA_DISCONNECTED,
02994 CA_AUTHORIZING,
02995 CA_CONNECTING,
02996 CA_CHALLENGING,
02997 CA_CONNECTED,
02998 CA_LOADING,
02999 CA_PRIMED,
03000 CA_ACTIVE,
03001 CA_CINEMATIC
03002 } connstate_t;
03003
03004
03005 #define Square(x) ((x)*(x))
03006
03007
03008
03009
03010
03011 typedef struct qtime_s {
03012 int tm_sec;
03013 int tm_min;
03014 int tm_hour;
03015 int tm_mday;
03016 int tm_mon;
03017 int tm_year;
03018 int tm_wday;
03019 int tm_yday;
03020 int tm_isdst;
03021 } qtime_t;
03022
03023
03024
03025 #define AS_LOCAL 0
03026 #define AS_GLOBAL 1
03027 #define AS_FAVORITES 2
03028
03029 #define AS_MPLAYER 3 // (Obsolete)
03030
03031
03032 typedef enum {
03033 FMV_IDLE,
03034 FMV_PLAY,
03035 FMV_EOF,
03036 FMV_ID_BLT,
03037 FMV_ID_IDLE,
03038 FMV_LOOPED,
03039 FMV_ID_WAIT
03040 };
03041 typedef int e_status;
03042
03043 typedef enum _flag_status {
03044 FLAG_ATBASE = 0,
03045 FLAG_TAKEN,
03046 FLAG_TAKEN_RED,
03047 FLAG_TAKEN_BLUE,
03048 FLAG_DROPPED
03049 };
03050 typedef int flagStatus_t;
03051
03052
03053
03054 #ifdef _XBOX
03055 #define MAX_GLOBAL_SERVERS 50
03056 #define MAX_OTHER_SERVERS 16
03057 #else
03058 #define MAX_GLOBAL_SERVERS 2048
03059 #define MAX_OTHER_SERVERS 128
03060 #endif
03061 #define MAX_PINGREQUESTS 32
03062 #define MAX_SERVERSTATUSREQUESTS 16
03063
03064 #define SAY_ALL 0
03065 #define SAY_TEAM 1
03066 #define SAY_TELL 2
03067
03068 #define CDKEY_LEN 16
03069 #define CDCHKSUM_LEN 2
03070
03071 void Rand_Init(int seed);
03072 float flrand(float min, float max);
03073 int irand(int min, int max);
03074 int Q_irand(int value1, int value2);
03075
03076
03077
03078
03079
03080 typedef struct {
03081 float matrix[3][4];
03082 } mdxaBone_t;
03083
03084
03085
03086 typedef enum Eorientations
03087 {
03088 ORIGIN = 0,
03089 POSITIVE_X,
03090 POSITIVE_Z,
03091 POSITIVE_Y,
03092 NEGATIVE_X,
03093 NEGATIVE_Z,
03094 NEGATIVE_Y
03095 };
03096
03097
03098
03099
03100
03101
03102
03103 #define TAGDEF(blah) TAG_ ## blah
03104 typedef enum {
03105 #include "../qcommon/tags.h"
03106 };
03107 typedef char memtag_t;
03108
03109
03110 #define _G2_GORE
03111
03112 typedef struct SSkinGoreData_s
03113 {
03114 vec3_t angles;
03115 vec3_t position;
03116 int currentTime;
03117 int entNum;
03118 vec3_t rayDirection;
03119 vec3_t hitLocation;
03120 vec3_t scale;
03121 float SSize;
03122 float TSize;
03123 float theta;
03124
03125
03126 int growDuration;
03127 float goreScaleStartFraction;
03128
03129 qboolean frontFaces;
03130 qboolean backFaces;
03131 qboolean baseModelOnly;
03132 int lifeTime;
03133 int fadeOutTime;
03134 int shrinkOutTime;
03135 float alphaModulate;
03136 vec3_t tint;
03137 float impactStrength;
03138
03139 int shader;
03140
03141 int myIndex;
03142
03143 qboolean fadeRGB;
03144 } SSkinGoreData;
03145
03146
03147
03148
03149
03150
03151
03152
03153 #define ENUM2STRING(arg) #arg,arg
03154 typedef struct stringID_table_s
03155 {
03156 char *name;
03157 int id;
03158 } stringID_table_t;
03159
03160 int GetIDForString ( stringID_table_t *table, const char *string );
03161 const char *GetStringForID( stringID_table_t *table, int id );
03162
03163
03164
03165
03166 typedef enum
03167 {
03168 eForceReload_NOTHING,
03169
03170 eForceReload_MODELS,
03171 eForceReload_ALL
03172
03173 } ForceReload_e;
03174
03175
03176 enum {
03177 FONT_NONE,
03178 FONT_SMALL=1,
03179 FONT_MEDIUM,
03180 FONT_LARGE,
03181 FONT_SMALL2
03182 };
03183
03184
03185
03186 #endif // __Q_SHARED_H