1 /* 2 Copyright (C) 1997-2001 Id Software, Inc. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 */ 20 21 // q_shared.h -- included first by ALL program modules 22 23 #ifdef _WIN32 24 // unknown pragmas are SUPPOSED to be ignored, but.... 25 #pragma warning(disable : 4244) // MIPS 26 #pragma warning(disable : 4136) // X86 27 #pragma warning(disable : 4051) // ALPHA 28 29 #pragma warning(disable : 4018) // signed/unsigned mismatch 30 #pragma warning(disable : 4305) // truncation from const double to float 31 32 #define vsnprintf _vsnprintf 33 #endif 34 35 #include <assert.h> 36 #include <math.h> 37 #include <stdio.h> 38 #include <stdarg.h> 39 #include <string.h> 40 #include <stdlib.h> 41 #include <time.h> 42 43 #if (defined _M_IX86 || defined __i386__) && !defined C_ONLY && !defined __sun__ 44 #define id386 1 45 #else 46 #define id386 0 47 #endif 48 49 #if defined _M_ALPHA && !defined C_ONLY 50 #define idaxp 1 51 #else 52 #define idaxp 0 53 #endif 54 55 typedef unsigned char byte; 56 typedef enum {false, true} qboolean; 57 58 59 #ifndef NULL 60 #define NULL ((void *)0) 61 #endif 62 63 64 // angle indexes 65 #define PITCH 0 // up / down 66 #define YAW 1 // left / right 67 #define ROLL 2 // fall over 68 69 #define MAX_STRING_CHARS 1024 // max length of a string passed to Cmd_TokenizeString 70 #define MAX_STRING_TOKENS 80 // max tokens resulting from Cmd_TokenizeString 71 #define MAX_TOKEN_CHARS 128 // max length of an individual token 72 73 #define MAX_QPATH 64 // max length of a quake game pathname 74 #define MAX_OSPATH 128 // max length of a filesystem pathname 75 76 // 77 // per-level limits 78 // 79 #define MAX_CLIENTS 256 // absolute limit 80 #define MAX_EDICTS 1024 // must change protocol to increase more 81 #define MAX_LIGHTSTYLES 256 82 #define MAX_MODELS 256 // these are sent over the net as bytes 83 #define MAX_SOUNDS 256 // so they cannot be blindly increased 84 #define MAX_IMAGES 256 85 #define MAX_ITEMS 256 86 #define MAX_GENERAL (MAX_CLIENTS*2) // general config strings 87 88 89 // game print flags 90 #define PRINT_LOW 0 // pickup messages 91 #define PRINT_MEDIUM 1 // death messages 92 #define PRINT_HIGH 2 // critical messages 93 #define PRINT_CHAT 3 // chat messages 94 95 96 97 #define ERR_FATAL 0 // exit the entire game with a popup window 98 #define ERR_DROP 1 // print to console and disconnect from game 99 #define ERR_DISCONNECT 2 // don't kill server 100 101 #define PRINT_ALL 0 102 #define PRINT_DEVELOPER 1 // only print when "developer 1" 103 #define PRINT_ALERT 2 104 105 106 // destination class for gi.multicast() 107 typedef enum 108 { 109 MULTICAST_ALL, 110 MULTICAST_PHS, 111 MULTICAST_PVS, 112 MULTICAST_ALL_R, 113 MULTICAST_PHS_R, 114 MULTICAST_PVS_R 115 } multicast_t; 116 117 118 /* 119 ============================================================== 120 121 MATHLIB 122 123 ============================================================== 124 */ 125 126 typedef float vec_t; 127 typedef vec_t vec3_t[3]; 128 typedef vec_t vec5_t[5]; 129 130 typedef int fixed4_t; 131 typedef int fixed8_t; 132 typedef int fixed16_t; 133 134 #ifndef M_PI 135 #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h 136 #endif 137 138 struct cplane_s; 139 140 extern vec3_t vec3_origin; 141 142 #define nanmask (255<<23) 143 144 #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) 145 146 // microsoft's fabs seems to be ungodly slow... 147 //float Q_fabs (float f); 148 //#define fabs(f) Q_fabs(f) 149 #if defined _WIN32 && !defined C_ONLY 150 extern long Q_ftol( float f ); 151 #else 152 #define Q_ftol( f ) ( long ) (f) 153 #endif 154 155 #define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) 156 #define VectorSubtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2]) 157 #define VectorAdd(a,b,c) (c[0]=a[0]+b[0],c[1]=a[1]+b[1],c[2]=a[2]+b[2]) 158 #define VectorCopy(a,b) (b[0]=a[0],b[1]=a[1],b[2]=a[2]) 159 #define VectorClear(a) (a[0]=a[1]=a[2]=0) 160 #define VectorNegate(a,b) (b[0]=-a[0],b[1]=-a[1],b[2]=-a[2]) 161 #define VectorSet(v, x, y, z) (v[0]=(x), v[1]=(y), v[2]=(z)) 162 163 void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc); 164 165 // just in case you do't want to use the macros 166 vec_t _DotProduct (vec3_t v1, vec3_t v2); 167 void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); 168 void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); 169 void _VectorCopy (vec3_t in, vec3_t out); 170 171 void ClearBounds (vec3_t mins, vec3_t maxs); 172 void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs); 173 int VectorCompare (vec3_t v1, vec3_t v2); 174 vec_t VectorLength (vec3_t v); 175 void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross); 176 vec_t VectorNormalize (vec3_t v); // returns vector length 177 vec_t VectorNormalize2 (vec3_t v, vec3_t out); 178 void VectorInverse (vec3_t v); 179 void VectorScale (vec3_t in, vec_t scale, vec3_t out); 180 int Q_log2(int val); 181 182 void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); 183 void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); 184 185 void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 186 int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *plane); 187 float anglemod(float a); 188 float LerpAngle (float a1, float a2, float frac); 189 190 #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ 191 (((p)->type < 3)? \ 192 ( \ 193 ((p)->dist <= (emins)[(p)->type])? \ 194 1 \ 195 : \ 196 ( \ 197 ((p)->dist >= (emaxs)[(p)->type])?\ 198 2 \ 199 : \ 200 3 \ 201 ) \ 202 ) \ 203 : \ 204 BoxOnPlaneSide( (emins), (emaxs), (p))) 205 206 void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ); 207 void PerpendicularVector( vec3_t dst, const vec3_t src ); 208 void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ); 209 210 211 //============================================= 212 213 char *COM_SkipPath (char *pathname); 214 void COM_StripExtension (char *in, char *out); 215 void COM_FileBase (char *in, char *out); 216 void COM_FilePath (char *in, char *out); 217 void COM_DefaultExtension (char *path, char *extension); 218 219 char *COM_Parse (char **data_p); 220 // data is an in/out parm, returns a parsed out token 221 222 void Com_sprintf (char *dest, int size, char *fmt, ...); 223 224 void Com_PageInMemory (byte *buffer, int size); 225 226 //============================================= 227 228 // portable case insensitive compare 229 int Q_stricmp (char *s1, char *s2); 230 int Q_strcasecmp (char *s1, char *s2); 231 int Q_strncasecmp (char *s1, char *s2, int n); 232 233 //============================================= 234 235 short BigShort(short l); 236 short LittleShort(short l); 237 int BigLong (int l); 238 int LittleLong (int l); 239 float BigFloat (float l); 240 float LittleFloat (float l); 241 242 void Swap_Init (void); 243 char *va(char *format, ...); 244 245 //============================================= 246 247 // 248 // key / value info strings 249 // 250 #define MAX_INFO_KEY 64 251 #define MAX_INFO_VALUE 64 252 #define MAX_INFO_STRING 512 253 254 char *Info_ValueForKey (char *s, char *key); 255 void Info_RemoveKey (char *s, char *key); 256 void Info_SetValueForKey (char *s, char *key, char *value); 257 qboolean Info_Validate (char *s); 258 259 /* 260 ============================================================== 261 262 SYSTEM SPECIFIC 263 264 ============================================================== 265 */ 266 267 extern int curtime; // time returned by last Sys_Milliseconds 268 269 int Sys_Milliseconds (void); 270 void Sys_Mkdir (char *path); 271 272 // large block stack allocation routines 273 void *Hunk_Begin (int maxsize); 274 void *Hunk_Alloc (int size); 275 void Hunk_Free (void *buf); 276 int Hunk_End (void); 277 278 // directory searching 279 #define SFF_ARCH 0x01 280 #define SFF_HIDDEN 0x02 281 #define SFF_RDONLY 0x04 282 #define SFF_SUBDIR 0x08 283 #define SFF_SYSTEM 0x10 284 285 /* 286 ** pass in an attribute mask of things you wish to REJECT 287 */ 288 char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave ); 289 char *Sys_FindNext ( unsigned musthave, unsigned canthave ); 290 void Sys_FindClose (void); 291 292 293 // this is only here so the functions in q_shared.c and q_shwin.c can link 294 void Sys_Error (char *error, ...); 295 void Com_Printf (char *msg, ...); 296 297 298 /* 299 ========================================================== 300 301 CVARS (console variables) 302 303 ========================================================== 304 */ 305 306 #ifndef CVAR 307 #define CVAR 308 309 #define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc 310 #define CVAR_USERINFO 2 // added to userinfo when changed 311 #define CVAR_SERVERINFO 4 // added to serverinfo when changed 312 #define CVAR_NOSET 8 // don't allow change from console at all, 313 // but can be set from the command line 314 #define CVAR_LATCH 16 // save changes until server restart 315 316 // nothing outside the Cvar_*() functions should modify these fields! 317 typedef struct cvar_s 318 { 319 char *name; 320 char *string; 321 char *latched_string; // for CVAR_LATCH vars 322 int flags; 323 qboolean modified; // set each time the cvar is changed 324 float value; 325 struct cvar_s *next; 326 } cvar_t; 327 328 #endif // CVAR 329 330 /* 331 ============================================================== 332 333 COLLISION DETECTION 334 335 ============================================================== 336 */ 337 338 // lower bits are stronger, and will eat weaker brushes completely 339 #define CONTENTS_SOLID 1 // an eye is never valid in a solid 340 #define CONTENTS_WINDOW 2 // translucent, but not watery 341 #define CONTENTS_AUX 4 342 #define CONTENTS_LAVA 8 343 #define CONTENTS_SLIME 16 344 #define CONTENTS_WATER 32 345 #define CONTENTS_MIST 64 346 #define LAST_VISIBLE_CONTENTS 64 347 348 // remaining contents are non-visible, and don't eat brushes 349 350 #define CONTENTS_AREAPORTAL 0x8000 351 352 #define CONTENTS_PLAYERCLIP 0x10000 353 #define CONTENTS_MONSTERCLIP 0x20000 354 355 // currents can be added to any other contents, and may be mixed 356 #define CONTENTS_CURRENT_0 0x40000 357 #define CONTENTS_CURRENT_90 0x80000 358 #define CONTENTS_CURRENT_180 0x100000 359 #define CONTENTS_CURRENT_270 0x200000 360 #define CONTENTS_CURRENT_UP 0x400000 361 #define CONTENTS_CURRENT_DOWN 0x800000 362 363 #define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity 364 365 #define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game 366 #define CONTENTS_DEADMONSTER 0x4000000 367 #define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs 368 #define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans 369 #define CONTENTS_LADDER 0x20000000 370 371 372 373 #define SURF_LIGHT 0x1 // value will hold the light strength 374 375 #define SURF_SLICK 0x2 // effects game physics 376 377 #define SURF_SKY 0x4 // don't draw, but add to skybox 378 #define SURF_WARP 0x8 // turbulent water warp 379 #define SURF_TRANS33 0x10 380 #define SURF_TRANS66 0x20 381 #define SURF_FLOWING 0x40 // scroll towards angle 382 #define SURF_NODRAW 0x80 // don't bother referencing the texture 383 384 #ifdef QMAX 385 #define SURF_WAVES_1 0x100 386 #define SURF_WAVES_2 0x200 387 #endif 388 389 // content masks 390 #define MASK_ALL (-1) 391 #define MASK_SOLID (CONTENTS_SOLID|CONTENTS_WINDOW) 392 #define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER) 393 #define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW) 394 #define MASK_MONSTERSOLID (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER) 395 #define MASK_WATER (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME) 396 #define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA) 397 #define MASK_SHOT (CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEADMONSTER) 398 #define MASK_CURRENT (CONTENTS_CURRENT_0|CONTENTS_CURRENT_90|CONTENTS_CURRENT_180|CONTENTS_CURRENT_270|CONTENTS_CURRENT_UP|CONTENTS_CURRENT_DOWN) 399 400 401 // gi.BoxEdicts() can return a list of either solid or trigger entities 402 // FIXME: eliminate AREA_ distinction? 403 #define AREA_SOLID 1 404 #define AREA_TRIGGERS 2 405 406 407 // plane_t structure 408 // !!! if this is changed, it must be changed in asm code too !!! 409 typedef struct cplane_s 410 { 411 vec3_t normal; 412 float dist; 413 byte type; // for fast side tests 414 byte signbits; // signx + (signy<<1) + (signz<<1) 415 byte pad[2]; 416 } cplane_t; 417 418 // structure offset for asm code 419 #define CPLANE_NORMAL_X 0 420 #define CPLANE_NORMAL_Y 4 421 #define CPLANE_NORMAL_Z 8 422 #define CPLANE_DIST 12 423 #define CPLANE_TYPE 16 424 #define CPLANE_SIGNBITS 17 425 #define CPLANE_PAD0 18 426 #define CPLANE_PAD1 19 427 428 typedef struct cmodel_s 429 { 430 vec3_t mins, maxs; 431 vec3_t origin; // for sounds or lights 432 int headnode; 433 } cmodel_t; 434 435 typedef struct csurface_s 436 { 437 char name[16]; 438 int flags; 439 int value; 440 } csurface_t; 441 442 typedef struct mapsurface_s // used internally due to name len probs //ZOID 443 { 444 csurface_t c; 445 char rname[32]; 446 } mapsurface_t; 447 448 // a trace is returned when a box is swept through the world 449 typedef struct 450 { 451 qboolean allsolid; // if true, plane is not valid 452 qboolean startsolid; // if true, the initial point was in a solid area 453 float fraction; // time completed, 1.0 = didn't hit anything 454 vec3_t endpos; // final position 455 cplane_t plane; // surface normal at impact 456 csurface_t *surface; // surface hit 457 int contents; // contents on other side of surface hit 458 struct edict_s *ent; // not set by CM_*() functions 459 } trace_t; 460 461 462 463 // pmove_state_t is the information necessary for client side movement 464 // prediction 465 typedef enum 466 { 467 // can accelerate and turn 468 PM_NORMAL, 469 PM_SPECTATOR, 470 // no acceleration or turning 471 PM_DEAD, 472 PM_GIB, // different bounding box 473 PM_FREEZE 474 } pmtype_t; 475 476 // pmove->pm_flags 477 #define PMF_DUCKED 1 478 #define PMF_JUMP_HELD 2 479 #define PMF_ON_GROUND 4 480 #define PMF_TIME_WATERJUMP 8 // pm_time is waterjump 481 #define PMF_TIME_LAND 16 // pm_time is time before rejump 482 #define PMF_TIME_TELEPORT 32 // pm_time is non-moving time 483 #define PMF_NO_PREDICTION 64 // temporarily disables prediction (used for grappling hook) 484 485 // this structure needs to be communicated bit-accurate 486 // from the server to the client to guarantee that 487 // prediction stays in sync, so no floats are used. 488 // if any part of the game code modifies this struct, it 489 // will result in a prediction error of some degree. 490 typedef struct 491 { 492 pmtype_t pm_type; 493 494 short origin[3]; // 12.3 495 short velocity[3]; // 12.3 496 byte pm_flags; // ducked, jump_held, etc 497 byte pm_time; // each unit = 8 ms 498 short gravity; 499 short delta_angles[3]; // add to command angles to get view direction 500 // changed by spawns, rotating objects, and teleporters 501 } pmove_state_t; 502 503 504 // 505 // button bits 506 // 507 #define BUTTON_ATTACK 1 508 #define BUTTON_USE 2 509 #define BUTTON_ANY 128 // any key whatsoever 510 511 512 // usercmd_t is sent to the server each client frame 513 typedef struct usercmd_s 514 { 515 byte msec; 516 byte buttons; 517 short angles[3]; 518 short forwardmove, sidemove, upmove; 519 byte impulse; // remove? 520 byte lightlevel; // light level the player is standing on 521 } usercmd_t; 522 523 524 #define MAXTOUCH 32 525 typedef struct 526 { 527 // state (in / out) 528 pmove_state_t s; 529 530 // command (in) 531 usercmd_t cmd; 532 qboolean snapinitial; // if s has been changed outside pmove 533 534 // results (out) 535 int numtouch; 536 struct edict_s *touchents[MAXTOUCH]; 537 538 vec3_t viewangles; // clamped 539 float viewheight; 540 541 vec3_t mins, maxs; // bounding box size 542 543 struct edict_s *groundentity; 544 int watertype; 545 int waterlevel; 546 547 // callbacks to test the world 548 trace_t (*trace) (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end); 549 int (*pointcontents) (vec3_t point); 550 } pmove_t; 551 552 553 // entity_state_t->effects 554 // Effects are things handled on the client side (lights, particles, frame animations) 555 // that happen constantly on the given entity. 556 // An entity that has effects will be sent to the client 557 // even if it has a zero index model. 558 #define EF_ROTATE 0x00000001 // rotate (bonus items) 559 #define EF_GIB 0x00000002 // leave a trail 560 #define EF_BLASTER 0x00000008 // redlight + trail 561 #define EF_ROCKET 0x00000010 // redlight + trail 562 #define EF_GRENADE 0x00000020 563 #define EF_HYPERBLASTER 0x00000040 564 #define EF_BFG 0x00000080 565 #define EF_COLOR_SHELL 0x00000100 566 #define EF_POWERSCREEN 0x00000200 567 #define EF_ANIM01 0x00000400 // automatically cycle between frames 0 and 1 at 2 hz 568 #define EF_ANIM23 0x00000800 // automatically cycle between frames 2 and 3 at 2 hz 569 #define EF_ANIM_ALL 0x00001000 // automatically cycle through all frames at 2hz 570 #define EF_ANIM_ALLFAST 0x00002000 // automatically cycle through all frames at 10hz 571 #define EF_FLIES 0x00004000 572 #define EF_QUAD 0x00008000 573 #define EF_PENT 0x00010000 574 #define EF_TELEPORTER 0x00020000 // particle fountain 575 #define EF_FLAG1 0x00040000 576 #define EF_FLAG2 0x00080000 577 // RAFAEL 578 #define EF_IONRIPPER 0x00100000 579 #define EF_GREENGIB 0x00200000 580 #define EF_BLUEHYPERBLASTER 0x00400000 581 #define EF_SPINNINGLIGHTS 0x00800000 582 #define EF_PLASMA 0x01000000 583 #define EF_TRAP 0x02000000 584 585 //ROGUE 586 #define EF_TRACKER 0x04000000 587 #define EF_DOUBLE 0x08000000 588 #define EF_SPHERETRANS 0x10000000 589 #define EF_TAGTRAIL 0x20000000 590 #define EF_HALF_DAMAGE 0x40000000 591 #define EF_TRACKERTRAIL 0x80000000 592 //ROGUE 593 594 #ifdef QMAX 595 #define PART_GRAVITY 1 596 #define PART_SPARK 2 597 #define PART_ANGLED 4 598 #define PART_DIRECTION 8 599 #define PART_TRANS 16 600 #define PART_SHADED 32 601 #define PART_LIGHTNING 64 602 #define PART_BEAM 128 603 #define PART_LENSFLARE 256 604 #define PART_DEPTHHACK_SHORT 512 605 #define PART_DEPTHHACK_MID 1024 606 #define PART_DEPTHHACK_LONG 2048 607 608 //combo flags 609 #define PART_DEPTHHACK (PART_DEPTHHACK_SHORT|PART_DEPTHHACK_MID|PART_DEPTHHACK_LONG) 610 #endif 611 612 // entity_state_t->renderfx flags 613 #define RF_MINLIGHT 1 // allways have some light (viewmodel) 614 #define RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors 615 #define RF_WEAPONMODEL 4 // only draw through eyes 616 #define RF_FULLBRIGHT 8 // allways draw full intensity 617 #define RF_DEPTHHACK 16 // for view weapon Z crunching 618 #define RF_TRANSLUCENT 32 619 #define RF_FRAMELERP 64 620 #define RF_BEAM 128 621 #define RF_CUSTOMSKIN 256 // skin is an index in image_precache 622 #define RF_GLOW 512 // pulse lighting for bonus items 623 #define RF_SHELL_RED 1024 624 #define RF_SHELL_GREEN 2048 625 #define RF_SHELL_BLUE 4096 626 #define RF_NOSHADOW 8192 /* don't draw a shadow */ 627 628 //ROGUE 629 #define RF_IR_VISIBLE 0x00008000 // 32768 630 #define RF_SHELL_DOUBLE 0x00010000 // 65536 631 #define RF_SHELL_HALF_DAM 0x00020000 632 #define RF_USE_DISGUISE 0x00040000 633 //ROGUE 634 635 #ifdef QMAX 636 #define RF_TRANS_ADDITIVE 8192 637 #define RF_MIRRORMODEL 0x00004000 638 639 #define RF2_NOSHADOW 0x00000001 //no shadow.. 640 #define RF2_FORCE_SHADOW 0x00000002 //forced shadow... 641 #define RF2_CAMERAMODEL 0x00000004 642 #endif 643 644 // player_state_t->refdef flags 645 #define RDF_UNDERWATER 1 // warp the screen as apropriate 646 #define RDF_NOWORLDMODEL 2 // used for player configuration screen 647 648 //ROGUE 649 #define RDF_IRGOGGLES 4 650 #define RDF_UVGOGGLES 8 651 //ROGUE 652 653 // 654 // muzzle flashes / player effects 655 // 656 #define MZ_BLASTER 0 657 #define MZ_MACHINEGUN 1 658 #define MZ_SHOTGUN 2 659 #define MZ_CHAINGUN1 3 660 #define MZ_CHAINGUN2 4 661 #define MZ_CHAINGUN3 5 662 #define MZ_RAILGUN 6 663 #define MZ_ROCKET 7 664 #define MZ_GRENADE 8 665 #define MZ_LOGIN 9 666 #define MZ_LOGOUT 10 667 #define MZ_RESPAWN 11 668 #define MZ_BFG 12 669 #define MZ_SSHOTGUN 13 670 #define MZ_HYPERBLASTER 14 671 #define MZ_ITEMRESPAWN 15 672 // RAFAEL 673 #define MZ_IONRIPPER 16 674 #define MZ_BLUEHYPERBLASTER 17 675 #define MZ_PHALANX 18 676 #define MZ_SILENCED 128 // bit flag ORed with one of the above numbers 677 678 //ROGUE 679 #define MZ_ETF_RIFLE 30 680 #define MZ_UNUSED 31 681 #define MZ_SHOTGUN2 32 682 #define MZ_HEATBEAM 33 683 #define MZ_BLASTER2 34 684 #define MZ_TRACKER 35 685 #define MZ_NUKE1 36 686 #define MZ_NUKE2 37 687 #define MZ_NUKE4 38 688 #define MZ_NUKE8 39 689 //ROGUE 690 691 // 692 // monster muzzle flashes 693 // 694 #define MZ2_TANK_BLASTER_1 1 695 #define MZ2_TANK_BLASTER_2 2 696 #define MZ2_TANK_BLASTER_3 3 697 #define MZ2_TANK_MACHINEGUN_1 4 698 #define MZ2_TANK_MACHINEGUN_2 5 699 #define MZ2_TANK_MACHINEGUN_3 6 700 #define MZ2_TANK_MACHINEGUN_4 7 701 #define MZ2_TANK_MACHINEGUN_5 8 702 #define MZ2_TANK_MACHINEGUN_6 9 703 #define MZ2_TANK_MACHINEGUN_7 10 704 #define MZ2_TANK_MACHINEGUN_8 11 705 #define MZ2_TANK_MACHINEGUN_9 12 706 #define MZ2_TANK_MACHINEGUN_10 13 707 #define MZ2_TANK_MACHINEGUN_11 14 708 #define MZ2_TANK_MACHINEGUN_12 15 709 #define MZ2_TANK_MACHINEGUN_13 16 710 #define MZ2_TANK_MACHINEGUN_14 17 711 #define MZ2_TANK_MACHINEGUN_15 18 712 #define MZ2_TANK_MACHINEGUN_16 19 713 #define MZ2_TANK_MACHINEGUN_17 20 714 #define MZ2_TANK_MACHINEGUN_18 21 715 #define MZ2_TANK_MACHINEGUN_19 22 716 #define MZ2_TANK_ROCKET_1 23 717 #define MZ2_TANK_ROCKET_2 24 718 #define MZ2_TANK_ROCKET_3 25 719 720 #define MZ2_INFANTRY_MACHINEGUN_1 26 721 #define MZ2_INFANTRY_MACHINEGUN_2 27 722 #define MZ2_INFANTRY_MACHINEGUN_3 28 723 #define MZ2_INFANTRY_MACHINEGUN_4 29 724 #define MZ2_INFANTRY_MACHINEGUN_5 30 725 #define MZ2_INFANTRY_MACHINEGUN_6 31 726 #define MZ2_INFANTRY_MACHINEGUN_7 32 727 #define MZ2_INFANTRY_MACHINEGUN_8 33 728 #define MZ2_INFANTRY_MACHINEGUN_9 34 729 #define MZ2_INFANTRY_MACHINEGUN_10 35 730 #define MZ2_INFANTRY_MACHINEGUN_11 36 731 #define MZ2_INFANTRY_MACHINEGUN_12 37 732 #define MZ2_INFANTRY_MACHINEGUN_13 38 733 734 #define MZ2_SOLDIER_BLASTER_1 39 735 #define MZ2_SOLDIER_BLASTER_2 40 736 #define MZ2_SOLDIER_SHOTGUN_1 41 737 #define MZ2_SOLDIER_SHOTGUN_2 42 738 #define MZ2_SOLDIER_MACHINEGUN_1 43 739 #define MZ2_SOLDIER_MACHINEGUN_2 44 740 741 #define MZ2_GUNNER_MACHINEGUN_1 45 742 #define MZ2_GUNNER_MACHINEGUN_2 46 743 #define MZ2_GUNNER_MACHINEGUN_3 47 744 #define MZ2_GUNNER_MACHINEGUN_4 48 745 #define MZ2_GUNNER_MACHINEGUN_5 49 746 #define MZ2_GUNNER_MACHINEGUN_6 50 747 #define MZ2_GUNNER_MACHINEGUN_7 51 748 #define MZ2_GUNNER_MACHINEGUN_8 52 749 #define MZ2_GUNNER_GRENADE_1 53 750 #define MZ2_GUNNER_GRENADE_2 54 751 #define MZ2_GUNNER_GRENADE_3 55 752 #define MZ2_GUNNER_GRENADE_4 56 753 754 #define MZ2_CHICK_ROCKET_1 57 755 756 #define MZ2_FLYER_BLASTER_1 58 757 #define MZ2_FLYER_BLASTER_2 59 758 759 #define MZ2_MEDIC_BLASTER_1 60 760 761 #define MZ2_GLADIATOR_RAILGUN_1 61 762 763 #define MZ2_HOVER_BLASTER_1 62 764 765 #define MZ2_ACTOR_MACHINEGUN_1 63 766 767 #define MZ2_SUPERTANK_MACHINEGUN_1 64 768 #define MZ2_SUPERTANK_MACHINEGUN_2 65 769 #define MZ2_SUPERTANK_MACHINEGUN_3 66 770 #define MZ2_SUPERTANK_MACHINEGUN_4 67 771 #define MZ2_SUPERTANK_MACHINEGUN_5 68 772 #define MZ2_SUPERTANK_MACHINEGUN_6 69 773 #define MZ2_SUPERTANK_ROCKET_1 70 774 #define MZ2_SUPERTANK_ROCKET_2 71 775 #define MZ2_SUPERTANK_ROCKET_3 72 776 777 #define MZ2_BOSS2_MACHINEGUN_L1 73 778 #define MZ2_BOSS2_MACHINEGUN_L2 74 779 #define MZ2_BOSS2_MACHINEGUN_L3 75 780 #define MZ2_BOSS2_MACHINEGUN_L4 76 781 #define MZ2_BOSS2_MACHINEGUN_L5 77 782 #define MZ2_BOSS2_ROCKET_1 78 783 #define MZ2_BOSS2_ROCKET_2 79 784 #define MZ2_BOSS2_ROCKET_3 80 785 #define MZ2_BOSS2_ROCKET_4 81 786 787 #define MZ2_FLOAT_BLASTER_1 82 788 789 #define MZ2_SOLDIER_BLASTER_3 83 790 #define MZ2_SOLDIER_SHOTGUN_3 84 791 #define MZ2_SOLDIER_MACHINEGUN_3 85 792 #define MZ2_SOLDIER_BLASTER_4 86 793 #define MZ2_SOLDIER_SHOTGUN_4 87 794 #define MZ2_SOLDIER_MACHINEGUN_4 88 795 #define MZ2_SOLDIER_BLASTER_5 89 796 #define MZ2_SOLDIER_SHOTGUN_5 90 797 #define MZ2_SOLDIER_MACHINEGUN_5 91 798 #define MZ2_SOLDIER_BLASTER_6 92 799 #define MZ2_SOLDIER_SHOTGUN_6 93 800 #define MZ2_SOLDIER_MACHINEGUN_6 94 801 #define MZ2_SOLDIER_BLASTER_7 95 802 #define MZ2_SOLDIER_SHOTGUN_7 96 803 #define MZ2_SOLDIER_MACHINEGUN_7 97 804 #define MZ2_SOLDIER_BLASTER_8 98 805 #define MZ2_SOLDIER_SHOTGUN_8 99 806 #define MZ2_SOLDIER_MACHINEGUN_8 100 807 808 // --- Xian shit below --- 809 #define MZ2_MAKRON_BFG 101 810 #define MZ2_MAKRON_BLASTER_1 102 811 #define MZ2_MAKRON_BLASTER_2 103 812 #define MZ2_MAKRON_BLASTER_3 104 813 #define MZ2_MAKRON_BLASTER_4 105 814 #define MZ2_MAKRON_BLASTER_5 106 815 #define MZ2_MAKRON_BLASTER_6 107 816 #define MZ2_MAKRON_BLASTER_7 108 817 #define MZ2_MAKRON_BLASTER_8 109 818 #define MZ2_MAKRON_BLASTER_9 110 819 #define MZ2_MAKRON_BLASTER_10 111 820 #define MZ2_MAKRON_BLASTER_11 112 821 #define MZ2_MAKRON_BLASTER_12 113 822 #define MZ2_MAKRON_BLASTER_13 114 823 #define MZ2_MAKRON_BLASTER_14 115 824 #define MZ2_MAKRON_BLASTER_15 116 825 #define MZ2_MAKRON_BLASTER_16 117 826 #define MZ2_MAKRON_BLASTER_17 118 827 #define MZ2_MAKRON_RAILGUN_1 119 828 #define MZ2_JORG_MACHINEGUN_L1 120 829 #define MZ2_JORG_MACHINEGUN_L2 121 830 #define MZ2_JORG_MACHINEGUN_L3 122 831 #define MZ2_JORG_MACHINEGUN_L4 123 832 #define MZ2_JORG_MACHINEGUN_L5 124 833 #define MZ2_JORG_MACHINEGUN_L6 125 834 #define MZ2_JORG_MACHINEGUN_R1 126 835 #define MZ2_JORG_MACHINEGUN_R2 127 836 #define MZ2_JORG_MACHINEGUN_R3 128 837 #define MZ2_JORG_MACHINEGUN_R4 129 838 #define MZ2_JORG_MACHINEGUN_R5 130 839 #define MZ2_JORG_MACHINEGUN_R6 131 840 #define MZ2_JORG_BFG_1 132 841 #define MZ2_BOSS2_MACHINEGUN_R1 133 842 #define MZ2_BOSS2_MACHINEGUN_R2 134 843 #define MZ2_BOSS2_MACHINEGUN_R3 135 844 #define MZ2_BOSS2_MACHINEGUN_R4 136 845 #define MZ2_BOSS2_MACHINEGUN_R5 137 846 847 //ROGUE 848 #define MZ2_CARRIER_MACHINEGUN_L1 138 849 #define MZ2_CARRIER_MACHINEGUN_R1 139 850 #define MZ2_CARRIER_GRENADE 140 851 #define MZ2_TURRET_MACHINEGUN 141 852 #define MZ2_TURRET_ROCKET 142 853 #define MZ2_TURRET_BLASTER 143 854 #define MZ2_STALKER_BLASTER 144 855 #define MZ2_DAEDALUS_BLASTER 145 856 #define MZ2_MEDIC_BLASTER_2 146 857 #define MZ2_CARRIER_RAILGUN 147 858 #define MZ2_WIDOW_DISRUPTOR 148 859 #define MZ2_WIDOW_BLASTER 149 860 #define MZ2_WIDOW_RAIL 150 861 #define MZ2_WIDOW_PLASMABEAM 151 // PMM - not used 862 #define MZ2_CARRIER_MACHINEGUN_L2 152 863 #define MZ2_CARRIER_MACHINEGUN_R2 153 864 #define MZ2_WIDOW_RAIL_LEFT 154 865 #define MZ2_WIDOW_RAIL_RIGHT 155 866 #define MZ2_WIDOW_BLASTER_SWEEP1 156 867 #define MZ2_WIDOW_BLASTER_SWEEP2 157 868 #define MZ2_WIDOW_BLASTER_SWEEP3 158 869 #define MZ2_WIDOW_BLASTER_SWEEP4 159 870 #define MZ2_WIDOW_BLASTER_SWEEP5 160 871 #define MZ2_WIDOW_BLASTER_SWEEP6 161 872 #define MZ2_WIDOW_BLASTER_SWEEP7 162 873 #define MZ2_WIDOW_BLASTER_SWEEP8 163 874 #define MZ2_WIDOW_BLASTER_SWEEP9 164 875 #define MZ2_WIDOW_BLASTER_100 165 876 #define MZ2_WIDOW_BLASTER_90 166 877 #define MZ2_WIDOW_BLASTER_80 167 878 #define MZ2_WIDOW_BLASTER_70 168 879 #define MZ2_WIDOW_BLASTER_60 169 880 #define MZ2_WIDOW_BLASTER_50 170 881 #define MZ2_WIDOW_BLASTER_40 171 882 #define MZ2_WIDOW_BLASTER_30 172 883 #define MZ2_WIDOW_BLASTER_20 173 884 #define MZ2_WIDOW_BLASTER_10 174 885 #define MZ2_WIDOW_BLASTER_0 175 886 #define MZ2_WIDOW_BLASTER_10L 176 887 #define MZ2_WIDOW_BLASTER_20L 177 888 #define MZ2_WIDOW_BLASTER_30L 178 889 #define MZ2_WIDOW_BLASTER_40L 179 890 #define MZ2_WIDOW_BLASTER_50L 180 891 #define MZ2_WIDOW_BLASTER_60L 181 892 #define MZ2_WIDOW_BLASTER_70L 182 893 #define MZ2_WIDOW_RUN_1 183 894 #define MZ2_WIDOW_RUN_2 184 895 #define MZ2_WIDOW_RUN_3 185 896 #define MZ2_WIDOW_RUN_4 186 897 #define MZ2_WIDOW_RUN_5 187 898 #define MZ2_WIDOW_RUN_6 188 899 #define MZ2_WIDOW_RUN_7 189 900 #define MZ2_WIDOW_RUN_8 190 901 #define MZ2_CARRIER_ROCKET_1 191 902 #define MZ2_CARRIER_ROCKET_2 192 903 #define MZ2_CARRIER_ROCKET_3 193 904 #define MZ2_CARRIER_ROCKET_4 194 905 #define MZ2_WIDOW2_BEAMER_1 195 906 #define MZ2_WIDOW2_BEAMER_2 196 907 #define MZ2_WIDOW2_BEAMER_3 197 908 #define MZ2_WIDOW2_BEAMER_4 198 909 #define MZ2_WIDOW2_BEAMER_5 199 910 #define MZ2_WIDOW2_BEAM_SWEEP_1 200 911 #define MZ2_WIDOW2_BEAM_SWEEP_2 201 912 #define MZ2_WIDOW2_BEAM_SWEEP_3 202 913 #define MZ2_WIDOW2_BEAM_SWEEP_4 203 914 #define MZ2_WIDOW2_BEAM_SWEEP_5 204 915 #define MZ2_WIDOW2_BEAM_SWEEP_6 205 916 #define MZ2_WIDOW2_BEAM_SWEEP_7 206 917 #define MZ2_WIDOW2_BEAM_SWEEP_8 207 918 #define MZ2_WIDOW2_BEAM_SWEEP_9 208 919 #define MZ2_WIDOW2_BEAM_SWEEP_10 209 920 #define MZ2_WIDOW2_BEAM_SWEEP_11 210 921 922 // ROGUE 923 924 extern vec3_t monster_flash_offset []; 925 926 927 // temp entity events 928 // 929 // Temp entity events are for things that happen 930 // at a location seperate from any existing entity. 931 // Temporary entity messages are explicitly constructed 932 // and broadcast. 933 typedef enum 934 { 935 TE_GUNSHOT, 936 TE_BLOOD, 937 TE_BLASTER, 938 TE_RAILTRAIL, 939 TE_SHOTGUN, 940 TE_EXPLOSION1, 941 TE_EXPLOSION2, 942 TE_ROCKET_EXPLOSION, 943 TE_GRENADE_EXPLOSION, 944 TE_SPARKS, 945 TE_SPLASH, 946 TE_BUBBLETRAIL, 947 TE_SCREEN_SPARKS, 948 TE_SHIELD_SPARKS, 949 TE_BULLET_SPARKS, 950 TE_LASER_SPARKS, 951 TE_PARASITE_ATTACK, 952 TE_ROCKET_EXPLOSION_WATER, 953 TE_GRENADE_EXPLOSION_WATER, 954 TE_MEDIC_CABLE_ATTACK, 955 TE_BFG_EXPLOSION, 956 TE_BFG_BIGEXPLOSION, 957 TE_BOSSTPORT, // used as '22' in a map, so DON'T RENUMBER!!! 958 TE_BFG_LASER, 959 TE_GRAPPLE_CABLE, 960 TE_WELDING_SPARKS, 961 TE_GREENBLOOD, 962 TE_BLUEHYPERBLASTER, 963 TE_PLASMA_EXPLOSION, 964 TE_TUNNEL_SPARKS, 965 //ROGUE 966 TE_BLASTER2, 967 TE_RAILTRAIL2, 968 TE_FLAME, 969 TE_LIGHTNING, 970 TE_DEBUGTRAIL, 971 TE_PLAIN_EXPLOSION, 972 TE_FLASHLIGHT, 973 TE_FORCEWALL, 974 TE_HEATBEAM, 975 TE_MONSTER_HEATBEAM, 976 TE_STEAM, 977 TE_BUBBLETRAIL2, 978 TE_MOREBLOOD, 979 TE_HEATBEAM_SPARKS, 980 TE_HEATBEAM_STEAM, 981 TE_CHAINFIST_SMOKE, 982 TE_ELECTRIC_SPARKS, 983 TE_TRACKER_EXPLOSION, 984 TE_TELEPORT_EFFECT, 985 TE_DBALL_GOAL, 986 TE_WIDOWBEAMOUT, 987 TE_NUKEBLAST, 988 TE_WIDOWSPLASH, 989 TE_EXPLOSION1_BIG, 990 TE_EXPLOSION1_NP, 991 TE_FLECHETTE 992 //ROGUE 993 } temp_event_t; 994 995 #define SPLASH_UNKNOWN 0 996 #define SPLASH_SPARKS 1 997 #define SPLASH_BLUE_WATER 2 998 #define SPLASH_BROWN_WATER 3 999 #define SPLASH_SLIME 4 1000 #define SPLASH_LAVA 5 1001 #define SPLASH_BLOOD 6 1002 1003 1004 // sound channels 1005 // channel 0 never willingly overrides 1006 // other channels (1-7) allways override a playing sound on that channel 1007 #define CHAN_AUTO 0 1008 #define CHAN_WEAPON 1 1009 #define CHAN_VOICE 2 1010 #define CHAN_ITEM 3 1011 #define CHAN_BODY 4 1012 // modifier flags 1013 #define CHAN_NO_PHS_ADD 8 // send to all clients, not just ones in PHS (ATTN 0 will also do this) 1014 #define CHAN_RELIABLE 16 // send by reliable message, not datagram 1015 1016 1017 // sound attenuation values 1018 #define ATTN_NONE 0 // full volume the entire level 1019 #define ATTN_NORM 1 1020 #define ATTN_IDLE 2 1021 #define ATTN_STATIC 3 // diminish very rapidly with distance 1022 1023 1024 // player_state->stats[] indexes 1025 #define STAT_HEALTH_ICON 0 1026 #define STAT_HEALTH 1 1027 #define STAT_AMMO_ICON 2 1028 #define STAT_AMMO 3 1029 #define STAT_ARMOR_ICON 4 1030 #define STAT_ARMOR 5 1031 #define STAT_SELECTED_ICON 6 1032 #define STAT_PICKUP_ICON 7 1033 #define STAT_PICKUP_STRING 8 1034 #define STAT_TIMER_ICON 9 1035 #define STAT_TIMER 10 1036 #define STAT_HELPICON 11 1037 #define STAT_SELECTED_ITEM 12 1038 #define STAT_LAYOUTS 13 1039 #define STAT_FRAGS 14 1040 #define STAT_FLASHES 15 // cleared each frame, 1 = health, 2 = armor 1041 #define STAT_CHASE 16 1042 #define STAT_SPECTATOR 17 1043 // C14 Start of New Code 1044 #define STAT_FAST_PREV5 20 1045 #define STAT_FAST_PREV4 21 1046 #define STAT_FAST_PREV3 22 1047 #define STAT_FAST_PREV2 23 1048 #define STAT_FAST_PREV1 24 1049 #define STAT_FAST 25 1050 #define STAT_FAST_NEXT1 26 1051 #define STAT_FAST_NEXT2 27 1052 #define STAT_FAST_NEXT3 28 1053 #define STAT_FAST_NEXT4 29 1054 #define STAT_FAST_NEXT5 30 1055 #define STAT_FAST_NAME 31 1056 // C14 End of New Code 1057 #define MAX_STATS 32 1058 1059 1060 // dmflags->value flags 1061 #define DF_NO_HEALTH 0x00000001 // 1 1062 #define DF_NO_ITEMS 0x00000002 // 2 1063 #define DF_WEAPONS_STAY 0x00000004 // 4 1064 #define DF_NO_FALLING 0x00000008 // 8 1065 #define DF_INSTANT_ITEMS 0x00000010 // 16 1066 #define DF_SAME_LEVEL 0x00000020 // 32 1067 #define DF_SKINTEAMS 0x00000040 // 64 1068 #define DF_MODELTEAMS 0x00000080 // 128 1069 #define DF_NO_FRIENDLY_FIRE 0x00000100 // 256 1070 #define DF_SPAWN_FARTHEST 0x00000200 // 512 1071 #define DF_FORCE_RESPAWN 0x00000400 // 1024 1072 #define DF_NO_ARMOR 0x00000800 // 2048 1073 #define DF_ALLOW_EXIT 0x00001000 // 4096 1074 #define DF_INFINITE_AMMO 0x00002000 // 8192 1075 #define DF_QUAD_DROP 0x00004000 // 16384 1076 #define DF_FIXED_FOV 0x00008000 // 32768 1077 1078 // RAFAEL 1079 #define DF_QUADFIRE_DROP 0x00010000 // 65536 1080 1081 //ROGUE 1082 #define DF_NO_MINES 0x00020000 1083 #define DF_NO_STACK_DOUBLE 0x00040000 1084 #define DF_NO_NUKES 0x00080000 1085 #define DF_NO_SPHERES 0x00100000 1086 //ROGUE 1087 1088 /* 1089 ROGUE - VERSIONS 1090 1234 08/13/1998 Activision 1091 1235 08/14/1998 Id Software 1092 1236 08/15/1998 Steve Tietze 1093 1237 08/15/1998 Phil Dobranski 1094 1238 08/15/1998 John Sheley 1095 1239 08/17/1998 Barrett Alexander 1096 1230 08/17/1998 Brandon Fish 1097 1245 08/17/1998 Don MacAskill 1098 1246 08/17/1998 David "Zoid" Kirsch 1099 1247 08/17/1998 Manu Smith 1100 1248 08/17/1998 Geoff Scully 1101 1249 08/17/1998 Andy Van Fossen 1102 1240 08/20/1998 Activision Build 2 1103 1256 08/20/1998 Ranger Clan 1104 1257 08/20/1998 Ensemble Studios 1105 1258 08/21/1998 Robert Duffy 1106 1259 08/21/1998 Stephen Seachord 1107 1250 08/21/1998 Stephen Heaslip 1108 1267 08/21/1998 Samir Sandesara 1109 1268 08/21/1998 Oliver Wyman 1110 1269 08/21/1998 Steven Marchegiano 1111 1260 08/21/1998 Build #2 for Nihilistic 1112 1278 08/21/1998 Build #2 for Ensemble 1113 1114 9999 08/20/1998 Internal Use 1115 */ 1116 #define ROGUE_VERSION_ID 1278 1117 1118 #define ROGUE_VERSION_STRING "08/21/1998 Beta 2 for Ensemble" 1119 1120 // ROGUE 1121 /* 1122 ========================================================== 1123 1124 ELEMENTS COMMUNICATED ACROSS THE NET 1125 1126 ========================================================== 1127 */ 1128 1129 #define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535) 1130 #define SHORT2ANGLE(x) ((x)*(360.0/65536)) 1131 1132 1133 // 1134 // config strings are a general means of communication from 1135 // the server to all connected clients. 1136 // Each config string can be at most MAX_QPATH characters. 1137 // 1138 #define CS_NAME 0 1139 #define CS_CDTRACK 1 1140 #define CS_SKY 2 1141 #define CS_SKYAXIS 3 // %f %f %f format 1142 #define CS_SKYROTATE 4 1143 #define CS_STATUSBAR 5 // display program string 1144 1145 #define CS_AIRACCEL 29 // air acceleration control 1146 #define CS_MAXCLIENTS 30 1147 #define CS_MAPCHECKSUM 31 // for catching cheater maps 1148 1149 #define CS_MODELS 32 1150 #define CS_SOUNDS (CS_MODELS+MAX_MODELS) 1151 #define CS_IMAGES (CS_SOUNDS+MAX_SOUNDS) 1152 #define CS_LIGHTS (CS_IMAGES+MAX_IMAGES) 1153 #define CS_ITEMS (CS_LIGHTS+MAX_LIGHTSTYLES) 1154 #define CS_PLAYERSKINS (CS_ITEMS+MAX_ITEMS) 1155 #define CS_GENERAL (CS_PLAYERSKINS+MAX_CLIENTS) 1156 #define MAX_CONFIGSTRINGS (CS_GENERAL+MAX_GENERAL) 1157 1158 1159 //============================================== 1160 1161 1162 // entity_state_t->event values 1163 // ertity events are for effects that take place reletive 1164 // to an existing entities origin. Very network efficient. 1165 // All muzzle flashes really should be converted to events... 1166 typedef enum 1167 { 1168 EV_NONE, 1169 EV_ITEM_RESPAWN, 1170 EV_FOOTSTEP, 1171 EV_FALLSHORT, 1172 EV_FALL, 1173 EV_FALLFAR, 1174 EV_PLAYER_TELEPORT, 1175 EV_OTHER_TELEPORT 1176 } entity_event_t; 1177 1178 1179 // entity_state_t is the information conveyed from the server 1180 // in an update message about entities that the client will 1181 // need to render in some way 1182 typedef struct entity_state_s 1183 { 1184 int number; // edict index 1185 1186 vec3_t origin; 1187 vec3_t angles; 1188 vec3_t old_origin; // for lerping 1189 int modelindex; 1190 int modelindex2, modelindex3, modelindex4; // weapons, CTF flags, etc 1191 int frame; 1192 int skinnum; 1193 unsigned int effects; // PGM - we're filling it, so it needs to be unsigned 1194 int renderfx; 1195 int solid; // for client side prediction, 8*(bits 0-4) is x/y radius 1196 // 8*(bits 5-9) is z down distance, 8(bits10-15) is z up 1197 // gi.linkentity sets this properly 1198 int sound; // for looping sounds, to guarantee shutoff 1199 int event; // impulse events -- muzzle flashes, footsteps, etc 1200 // events only go out for a single frame, they 1201 // are automatically cleared each frame 1202 } entity_state_t; 1203 1204 //============================================== 1205 1206 1207 // player_state_t is the information needed in addition to pmove_state_t 1208 // to rendered a view. There will only be 10 player_state_t sent each second, 1209 // but the number of pmove_state_t changes will be reletive to client 1210 // frame rates 1211 typedef struct 1212 { 1213 pmove_state_t pmove; // for prediction 1214 1215 // these fields do not need to be communicated bit-precise 1216 1217 vec3_t viewangles; // for fixed views 1218 vec3_t viewoffset; // add to pmovestate->origin 1219 vec3_t kick_angles; // add to view direction to get render angles 1220 // set by weapon kicks, pain effects, etc 1221 1222 vec3_t gunangles; 1223 vec3_t gunoffset; 1224 int gunindex; 1225 int gunframe; 1226 1227 float blend[4]; // rgba full screen effect 1228 1229 float fov; // horizontal field of view 1230 1231 int rdflags; // refdef flags 1232 1233 short stats[MAX_STATS]; // fast status bar updates 1234 } player_state_t; 1235 1236 1237 // ================== 1238 // PGM 1239 #define VIDREF_GL 1 1240 #define VIDREF_SOFT 2 1241 #define VIDREF_OTHER 3 1242 1243 extern int vidref_val; 1244 // PGM 1245 // ================== 1246 1247 1248 /* 1249 * PATCH: eliasm 1250 * 1251 * Error-safe versions of fread and fwrite 1252 */ 1253 size_t verify_fread( void *, size_t, size_t, FILE * ); 1254 size_t verify_fwrite( void *, size_t, size_t, FILE * ); 1255 1256 #define stricmp strcasecmp 1257 #define _stricmp strcasecmp 1258 #define _strnicmp strncasecmp 1259