1 /* 2 =========================================================================== 3 Copyright (C) 1999-2005 Id Software, Inc. 4 Copyright (C) 2000-2006 Tim Angus 5 6 This file is part of Tremulous. 7 8 Tremulous is free software; you can redistribute it 9 and/or modify it under the terms of the GNU General Public License as 10 published by the Free Software Foundation; either version 2 of the License, 11 or (at your option) any later version. 12 13 Tremulous is distributed in the hope that it will be 14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with Tremulous; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 =========================================================================== 22 */ 23 24 // bg_public.h -- definitions shared by both the server game and client game modules 25 26 //tremulous balance header 27 #include "tremulous.h" 28 29 // because games can change separately from the main system version, we need a 30 // second version that must match between game and cgame 31 #define GAME_VERSION "base" 32 33 #define DEFAULT_GRAVITY 800 34 35 #define SCORE_NOT_PRESENT -9999 // for the CS_SCORES[12] when only one player is present 36 37 #define VOTE_TIME 30000 // 30 seconds before vote times out 38 39 #define MINS_Z -24 40 #define DEFAULT_VIEWHEIGHT 26 41 #define CROUCH_VIEWHEIGHT 12 42 #define DEAD_VIEWHEIGHT -14 //TA: watch for mins[ 2 ] less than this causing 43 44 // 45 // config strings are a general means of communicating variable length strings 46 // from the server to all connected clients. 47 // 48 49 // CS_SERVERINFO and CS_SYSTEMINFO are defined in q_shared.h 50 #define CS_MUSIC 2 51 #define CS_MESSAGE 3 // from the map worldspawn's message field 52 #define CS_MOTD 4 // g_motd string for server message of the day 53 #define CS_WARMUP 5 // server time when the match will be restarted 54 #define CS_SCORES1 6 55 #define CS_SCORES2 7 56 #define CS_VOTE_TIME 8 57 #define CS_VOTE_STRING 9 58 #define CS_VOTE_YES 10 59 #define CS_VOTE_NO 11 60 61 #define CS_TEAMVOTE_TIME 12 62 #define CS_TEAMVOTE_STRING 14 63 #define CS_TEAMVOTE_YES 16 64 #define CS_TEAMVOTE_NO 18 65 66 #define CS_GAME_VERSION 20 67 #define CS_LEVEL_START_TIME 21 // so the timer only shows the current level 68 #define CS_INTERMISSION 22 // when 1, fraglimit/timelimit has been hit and intermission will start in a second or two 69 #define CS_FLAGSTATUS 23 // string indicating flag status in CTF 70 #define CS_SHADERSTATE 24 71 #define CS_BOTINFO 25 72 #define CS_CLIENTS_READY 26 //TA: following suggestion in STAT_ enum STAT_CLIENTS_READY becomes a configstring 73 74 //TA: extra stuff: 75 #define CS_BUILDPOINTS 28 76 #define CS_STAGES 29 77 #define CS_SPAWNS 30 78 79 #define CS_MODELS 33 80 #define CS_SOUNDS (CS_MODELS+MAX_MODELS) 81 #define CS_SHADERS (CS_SOUNDS+MAX_SOUNDS) 82 #define CS_PARTICLE_SYSTEMS (CS_SHADERS+MAX_GAME_SHADERS) 83 #define CS_PLAYERS (CS_PARTICLE_SYSTEMS+MAX_GAME_PARTICLE_SYSTEMS) 84 #define CS_PRECACHES (CS_PLAYERS+MAX_CLIENTS) 85 #define CS_LOCATIONS (CS_PRECACHES+MAX_CLIENTS) 86 87 #define CS_MAX (CS_LOCATIONS+MAX_LOCATIONS) 88 89 #if (CS_MAX) > MAX_CONFIGSTRINGS 90 #error overflow: (CS_MAX) > MAX_CONFIGSTRINGS 91 #endif 92 93 typedef enum 94 { 95 GENDER_MALE, 96 GENDER_FEMALE, 97 GENDER_NEUTER 98 } gender_t; 99 100 /* 101 =================================================================================== 102 103 PMOVE MODULE 104 105 The pmove code takes a player_state_t and a usercmd_t and generates a new player_state_t 106 and some other output data. Used for local prediction on the client game and true 107 movement on the server game. 108 =================================================================================== 109 */ 110 111 typedef enum 112 { 113 PM_NORMAL, // can accelerate and turn 114 PM_NOCLIP, // noclip movement 115 PM_SPECTATOR, // still run into walls 116 PM_JETPACK, // jetpack physics 117 PM_GRABBED, // like dead, but for when the player is still live 118 PM_DEAD, // no acceleration or turning, but free falling 119 PM_FREEZE, // stuck in place with no control 120 PM_INTERMISSION, // no movement or status bar 121 PM_SPINTERMISSION // no movement or status bar 122 } pmtype_t; 123 124 typedef enum 125 { 126 WEAPON_READY, 127 WEAPON_RAISING, 128 WEAPON_DROPPING, 129 WEAPON_FIRING, 130 WEAPON_RELOADING 131 } weaponstate_t; 132 133 // pmove->pm_flags 134 #define PMF_DUCKED 1 135 #define PMF_JUMP_HELD 2 136 #define PMF_CROUCH_HELD 4 137 #define PMF_BACKWARDS_JUMP 8 // go into backwards land 138 #define PMF_BACKWARDS_RUN 16 // coast down to backwards run 139 #define PMF_TIME_LAND 32 // pm_time is time before rejump 140 #define PMF_TIME_KNOCKBACK 64 // pm_time is an air-accelerate only time 141 #define PMF_TIME_WATERJUMP 256 // pm_time is waterjump 142 #define PMF_RESPAWNED 512 // clear after attack and jump buttons come up 143 #define PMF_USE_ITEM_HELD 1024 144 #define PMF_WEAPON_RELOAD 2048 //TA: force a weapon switch 145 #define PMF_FOLLOW 4096 // spectate following another player 146 #define PMF_QUEUED 8192 //TA: player is queued 147 #define PMF_TIME_WALLJUMP 16384 //TA: for limiting wall jumping 148 #define PMF_CHARGE 32768 //TA: keep track of pouncing 149 #define PMF_WEAPON_SWITCH 65536 //TA: force a weapon switch 150 151 152 #define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK|PMF_TIME_WALLJUMP) 153 154 #define MAXTOUCH 32 155 typedef struct 156 { 157 // state (in / out) 158 playerState_t *ps; 159 160 // command (in) 161 usercmd_t cmd; 162 int tracemask; // collide against these types of surfaces 163 int debugLevel; // if set, diagnostic output will be printed 164 qboolean noFootsteps; // if the game is setup for no footsteps by the server 165 qboolean autoWeaponHit[ 32 ]; //FIXME: TA: remind myself later this might be a problem 166 167 int framecount; 168 169 // results (out) 170 int numtouch; 171 int touchents[ MAXTOUCH ]; 172 173 vec3_t mins, maxs; // bounding box size 174 175 int watertype; 176 int waterlevel; 177 178 float xyspeed; 179 180 // for fixed msec Pmove 181 int pmove_fixed; 182 int pmove_msec; 183 184 // callbacks to test the world 185 // these will be different functions during game and cgame 186 /*void (*trace)( trace_t *results, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask );*/ 187 void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, 188 const vec3_t end, int passEntityNum, int contentMask ); 189 190 191 int (*pointcontents)( const vec3_t point, int passEntityNum ); 192 } pmove_t; 193 194 // if a full pmove isn't done on the client, you can just update the angles 195 void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ); 196 void Pmove( pmove_t *pmove ); 197 198 //=================================================================================== 199 200 201 // player_state->stats[] indexes 202 typedef enum 203 { 204 STAT_HEALTH, 205 STAT_ITEMS, 206 STAT_SLOTS, //TA: tracks the amount of stuff human players are carrying 207 STAT_ACTIVEITEMS, 208 STAT_WEAPONS, // 16 bit fields 209 STAT_WEAPONS2, //TA: another 16 bits to push the max weapon count up 210 STAT_MAX_HEALTH, // health / armor limit, changable by handicap 211 STAT_PCLASS, //TA: player class (for aliens AND humans) 212 STAT_PTEAM, //TA: player team 213 STAT_STAMINA, //TA: stamina (human only) 214 STAT_STATE, //TA: client states e.g. wall climbing 215 STAT_MISC, //TA: for uh...misc stuff 216 STAT_BUILDABLE, //TA: which ghost model to display for building 217 STAT_BOOSTTIME, //TA: time left for boost (alien only) 218 STAT_FALLDIST, //TA: the distance the player fell 219 STAT_VIEWLOCK //TA: direction to lock the view in 220 } statIndex_t; 221 222 #define SCA_WALLCLIMBER 0x00000001 223 #define SCA_TAKESFALLDAMAGE 0x00000002 224 #define SCA_CANZOOM 0x00000004 225 #define SCA_NOWEAPONDRIFT 0x00000008 226 #define SCA_FOVWARPS 0x00000010 227 #define SCA_ALIENSENSE 0x00000020 228 #define SCA_CANUSELADDERS 0x00000040 229 #define SCA_WALLJUMPER 0x00000080 230 231 #define SS_WALLCLIMBING 0x00000001 232 #define SS_WALLCLIMBINGCEILING 0x00000002 233 #define SS_CREEPSLOWED 0x00000004 234 #define SS_SPEEDBOOST 0x00000008 235 #define SS_INFESTING 0x00000010 236 #define SS_GRABBED 0x00000020 237 #define SS_BLOBLOCKED 0x00000040 238 #define SS_POISONED 0x00000080 239 #define SS_HOVELING 0x00000100 240 #define SS_BOOSTED 0x00000200 241 #define SS_SLOWLOCKED 0x00000400 242 #define SS_POISONCLOUDED 0x00000800 243 #define SS_MEDKIT_ACTIVE 0x00001000 244 #define SS_CHARGING 0x00002000 245 246 #define SB_VALID_TOGGLEBIT 0x00004000 247 248 #define MAX_STAMINA 1000 249 250 // player_state->persistant[] indexes 251 // these fields are the only part of player_state that isn't 252 // cleared on respawn 253 typedef enum 254 { 255 PERS_SCORE, // !!! MUST NOT CHANGE, SERVER AND GAME BOTH REFERENCE !!! 256 PERS_HITS, // total points damage inflicted so damage beeps can sound on change 257 PERS_RANK, 258 PERS_TEAM, 259 PERS_SPAWN_COUNT, // incremented every respawn 260 PERS_ATTACKER, // clientnum of last damage inflicter 261 PERS_KILLED, // count of the number of times you died 262 263 //TA: 264 PERS_STATE, 265 PERS_CREDIT, // human credit 266 PERS_BANK, // human credit in the bank 267 PERS_QUEUEPOS, // position in the spawn queue 268 PERS_NEWWEAPON // weapon to switch to 269 } persEnum_t; 270 271 #define PS_WALLCLIMBINGFOLLOW 0x00000001 272 #define PS_WALLCLIMBINGTOGGLE 0x00000002 273 #define PS_NONSEGMODEL 0x00000004 274 275 // entityState_t->eFlags 276 #define EF_DEAD 0x00000001 // don't draw a foe marker over players with EF_DEAD 277 #define EF_TELEPORT_BIT 0x00000002 // toggled every time the origin abruptly changes 278 #define EF_PLAYER_EVENT 0x00000004 279 #define EF_BOUNCE 0x00000008 // for missiles 280 #define EF_BOUNCE_HALF 0x00000010 // for missiles 281 #define EF_NO_BOUNCE_SOUND 0x00000020 // for missiles 282 #define EF_WALLCLIMB 0x00000040 // TA: wall walking 283 #define EF_WALLCLIMBCEILING 0x00000080 // TA: wall walking ceiling hack 284 #define EF_NODRAW 0x00000100 // may have an event, but no model (unspawned items) 285 #define EF_FIRING 0x00000200 // for lightning gun 286 #define EF_FIRING2 0x00000400 // alt fire 287 #define EF_FIRING3 0x00000800 // third fire 288 #define EF_MOVER_STOP 0x00001000 // will push otherwise 289 #define EF_TALK 0x00002000 // draw a talk balloon 290 #define EF_CONNECTION 0x00004000 // draw a connection trouble sprite 291 #define EF_VOTED 0x00008000 // already cast a vote 292 #define EF_TEAMVOTED 0x00010000 // already cast a vote 293 #define EF_BLOBLOCKED 0x00020000 // TA: caught by a trapper 294 #define EF_REAL_LIGHT 0x00040000 // TA: light sprites according to ambient light 295 296 typedef enum 297 { 298 PW_NONE, 299 300 PW_QUAD, 301 PW_BATTLESUIT, 302 PW_HASTE, 303 PW_INVIS, 304 PW_REGEN, 305 PW_FLIGHT, 306 307 PW_REDFLAG, 308 PW_BLUEFLAG, 309 PW_BALL, 310 311 PW_NUM_POWERUPS 312 } powerup_t; 313 314 typedef enum 315 { 316 HI_NONE, 317 318 HI_TELEPORTER, 319 HI_MEDKIT, 320 321 HI_NUM_HOLDABLE 322 } holdable_t; 323 324 typedef enum 325 { 326 WPM_NONE, 327 328 WPM_PRIMARY, 329 WPM_SECONDARY, 330 WPM_TERTIARY, 331 332 WPM_NOTFIRING, 333 334 WPM_NUM_WEAPONMODES 335 } weaponMode_t; 336 337 typedef enum 338 { 339 WP_NONE, 340 341 WP_ALEVEL0, 342 WP_ALEVEL1, 343 WP_ALEVEL1_UPG, 344 WP_ALEVEL2, 345 WP_ALEVEL2_UPG, 346 WP_ALEVEL3, 347 WP_ALEVEL3_UPG, 348 WP_ALEVEL4, 349 350 WP_BLASTER, 351 WP_MACHINEGUN, 352 WP_PAIN_SAW, 353 WP_SHOTGUN, 354 WP_LAS_GUN, 355 WP_MASS_DRIVER, 356 WP_CHAINGUN, 357 WP_PULSE_RIFLE, 358 WP_FLAMER, 359 WP_LUCIFER_CANNON, 360 WP_GRENADE, 361 362 WP_LOCKBLOB_LAUNCHER, 363 WP_HIVE, 364 WP_TESLAGEN, 365 WP_MGTURRET, 366 367 //build weapons must remain in a block 368 WP_ABUILD, 369 WP_ABUILD2, 370 WP_HBUILD2, 371 WP_HBUILD, 372 //ok? 373 374 WP_NUM_WEAPONS 375 } weapon_t; 376 377 typedef enum 378 { 379 UP_NONE, 380 381 UP_LIGHTARMOUR, 382 UP_HELMET, 383 UP_MEDKIT, 384 UP_BATTPACK, 385 UP_JETPACK, 386 UP_BATTLESUIT, 387 UP_GRENADE, 388 389 UP_AMMO, 390 391 UP_NUM_UPGRADES 392 } upgrade_t; 393 394 typedef enum 395 { 396 WUT_NONE, 397 398 WUT_ALIENS, 399 WUT_HUMANS, 400 401 WUT_NUM_TEAMS 402 } WUTeam_t; 403 404 //TA: bitmasks for upgrade slots 405 #define SLOT_NONE 0x00000000 406 #define SLOT_HEAD 0x00000001 407 #define SLOT_TORSO 0x00000002 408 #define SLOT_ARMS 0x00000004 409 #define SLOT_LEGS 0x00000008 410 #define SLOT_BACKPACK 0x00000010 411 #define SLOT_WEAPON 0x00000020 412 #define SLOT_SIDEARM 0x00000040 413 414 typedef enum 415 { 416 BA_NONE, 417 418 BA_A_SPAWN, 419 BA_A_OVERMIND, 420 421 BA_A_BARRICADE, 422 BA_A_ACIDTUBE, 423 BA_A_TRAPPER, 424 BA_A_BOOSTER, 425 BA_A_HIVE, 426 427 BA_A_HOVEL, 428 429 BA_H_SPAWN, 430 431 BA_H_MGTURRET, 432 BA_H_TESLAGEN, 433 434 BA_H_ARMOURY, 435 BA_H_DCC, 436 BA_H_MEDISTAT, 437 438 BA_H_REACTOR, 439 BA_H_REPEATER, 440 441 BA_NUM_BUILDABLES 442 } buildable_t; 443 444 typedef enum 445 { 446 BIT_NONE, 447 448 BIT_ALIENS, 449 BIT_HUMANS, 450 451 BIT_NUM_TEAMS 452 } buildableTeam_t; 453 454 #define B_HEALTH_BITS 5 455 #define B_HEALTH_SCALE (float)((1<<B_HEALTH_BITS)-1) 456 457 #define B_SPAWNED_TOGGLEBIT 0x00000020 458 #define B_POWERED_TOGGLEBIT 0x00000040 459 #define B_DCCED_TOGGLEBIT 0x00000080 460 461 462 // reward sounds (stored in ps->persistant[PERS_PLAYEREVENTS]) 463 #define PLAYEREVENT_DENIEDREWARD 0x0001 464 #define PLAYEREVENT_GAUNTLETREWARD 0x0002 465 #define PLAYEREVENT_HOLYSHIT 0x0004 466 467 // entityState_t->event values 468 // entity events are for effects that take place reletive 469 // to an existing entities origin. Very network efficient. 470 471 // two bits at the top of the entityState->event field 472 // will be incremented with each change in the event so 473 // that an identical event started twice in a row can 474 // be distinguished. And off the value with ~EV_EVENT_BITS 475 // to retrieve the actual event number 476 #define EV_EVENT_BIT1 0x00000100 477 #define EV_EVENT_BIT2 0x00000200 478 #define EV_EVENT_BITS (EV_EVENT_BIT1|EV_EVENT_BIT2) 479 480 #define EVENT_VALID_MSEC 300 481 482 typedef enum 483 { 484 EV_NONE, 485 486 EV_FOOTSTEP, 487 EV_FOOTSTEP_METAL, 488 EV_FOOTSTEP_SQUELCH, 489 EV_FOOTSPLASH, 490 EV_FOOTWADE, 491 EV_SWIM, 492 493 EV_STEP_4, 494 EV_STEP_8, 495 EV_STEP_12, 496 EV_STEP_16, 497 498 EV_STEPDN_4, 499 EV_STEPDN_8, 500 EV_STEPDN_12, 501 EV_STEPDN_16, 502 503 EV_FALL_SHORT, 504 EV_FALL_MEDIUM, 505 EV_FALL_FAR, 506 EV_FALLING, 507 508 EV_JUMP, 509 EV_WATER_TOUCH, // foot touches 510 EV_WATER_LEAVE, // foot leaves 511 EV_WATER_UNDER, // head touches 512 EV_WATER_CLEAR, // head leaves 513 514 EV_NOAMMO, 515 EV_CHANGE_WEAPON, 516 EV_FIRE_WEAPON, 517 EV_FIRE_WEAPON2, 518 EV_FIRE_WEAPON3, 519 520 EV_PLAYER_RESPAWN, //TA: for fovwarp effects 521 EV_PLAYER_TELEPORT_IN, 522 EV_PLAYER_TELEPORT_OUT, 523 524 EV_GRENADE_BOUNCE, // eventParm will be the soundindex 525 526 EV_GENERAL_SOUND, 527 EV_GLOBAL_SOUND, // no attenuation 528 529 EV_BULLET_HIT_FLESH, 530 EV_BULLET_HIT_WALL, 531 532 EV_SHOTGUN, 533 534 EV_MISSILE_HIT, 535 EV_MISSILE_MISS, 536 EV_MISSILE_MISS_METAL, 537 EV_TESLATRAIL, 538 EV_BULLET, // otherEntity is the shooter 539 540 EV_LEV1_GRAB, 541 EV_LEV4_CHARGE_PREPARE, 542 EV_LEV4_CHARGE_START, 543 544 EV_PAIN, 545 EV_DEATH1, 546 EV_DEATH2, 547 EV_DEATH3, 548 EV_OBITUARY, 549 550 EV_GIB_PLAYER, // gib a previously living player 551 552 EV_BUILD_CONSTRUCT, //TA 553 EV_BUILD_DESTROY, //TA 554 EV_BUILD_DELAY, //TA: can't build yet 555 EV_BUILD_REPAIR, //TA: repairing buildable 556 EV_BUILD_REPAIRED, //TA: buildable has full health 557 EV_HUMAN_BUILDABLE_EXPLOSION, 558 EV_ALIEN_BUILDABLE_EXPLOSION, 559 EV_ALIEN_ACIDTUBE, 560 561 EV_MEDKIT_USED, 562 563 EV_ALIEN_EVOLVE, 564 EV_ALIEN_EVOLVE_FAILED, 565 566 EV_DEBUG_LINE, 567 EV_STOPLOOPINGSOUND, 568 EV_TAUNT, 569 570 EV_OVERMIND_ATTACK, //TA: overmind under attack 571 EV_OVERMIND_DYING, //TA: overmind close to death 572 EV_OVERMIND_SPAWNS, //TA: overmind needs spawns 573 574 EV_DCC_ATTACK, //TA: dcc under attack 575 576 EV_RPTUSE_SOUND //TA: trigger a sound 577 } entity_event_t; 578 579 typedef enum 580 { 581 MN_TEAM, 582 MN_A_TEAMFULL, 583 MN_H_TEAMFULL, 584 585 //alien stuff 586 MN_A_CLASS, 587 MN_A_BUILD, 588 MN_A_INFEST, 589 MN_A_HOVEL_OCCUPIED, 590 MN_A_HOVEL_BLOCKED, 591 MN_A_NOEROOM, 592 MN_A_TOOCLOSE, 593 MN_A_NOOVMND_EVOLVE, 594 595 //alien build 596 MN_A_SPWNWARN, 597 MN_A_OVERMIND, 598 MN_A_NOASSERT, 599 MN_A_NOCREEP, 600 MN_A_NOOVMND, 601 MN_A_NOROOM, 602 MN_A_NORMAL, 603 MN_A_HOVEL, 604 MN_A_HOVEL_EXIT, 605 606 //human stuff 607 MN_H_SPAWN, 608 MN_H_BUILD, 609 MN_H_ARMOURY, 610 MN_H_NOSLOTS, 611 MN_H_NOFUNDS, 612 MN_H_ITEMHELD, 613 614 //human build 615 MN_H_REPEATER, 616 MN_H_NOPOWER, 617 MN_H_NOTPOWERED, 618 MN_H_NODCC, 619 MN_H_REACTOR, 620 MN_H_NOROOM, 621 MN_H_NORMAL, 622 MN_H_TNODEWARN, 623 MN_H_RPTWARN, 624 MN_H_RPTWARN2 625 } dynMenu_t; 626 627 // animations 628 typedef enum 629 { 630 BOTH_DEATH1, 631 BOTH_DEAD1, 632 BOTH_DEATH2, 633 BOTH_DEAD2, 634 BOTH_DEATH3, 635 BOTH_DEAD3, 636 637 TORSO_GESTURE, 638 639 TORSO_ATTACK, 640 TORSO_ATTACK2, 641 642 TORSO_DROP, 643 TORSO_RAISE, 644 645 TORSO_STAND, 646 TORSO_STAND2, 647 648 LEGS_WALKCR, 649 LEGS_WALK, 650 LEGS_RUN, 651 LEGS_BACK, 652 LEGS_SWIM, 653 654 LEGS_JUMP, 655 LEGS_LAND, 656 657 LEGS_JUMPB, 658 LEGS_LANDB, 659 660 LEGS_IDLE, 661 LEGS_IDLECR, 662 663 LEGS_TURN, 664 665 TORSO_GETFLAG, 666 TORSO_GUARDBASE, 667 TORSO_PATROL, 668 TORSO_FOLLOWME, 669 TORSO_AFFIRMATIVE, 670 TORSO_NEGATIVE, 671 672 MAX_PLAYER_ANIMATIONS, 673 674 LEGS_BACKCR, 675 LEGS_BACKWALK, 676 FLAG_RUN, 677 FLAG_STAND, 678 FLAG_STAND2RUN, 679 680 MAX_PLAYER_TOTALANIMATIONS 681 } playerAnimNumber_t; 682 683 // nonsegmented animations 684 typedef enum 685 { 686 NSPA_STAND, 687 688 NSPA_GESTURE, 689 690 NSPA_WALK, 691 NSPA_RUN, 692 NSPA_RUNBACK, 693 NSPA_CHARGE, 694 695 NSPA_RUNLEFT, 696 NSPA_WALKLEFT, 697 NSPA_RUNRIGHT, 698 NSPA_WALKRIGHT, 699 700 NSPA_SWIM, 701 702 NSPA_JUMP, 703 NSPA_LAND, 704 NSPA_JUMPBACK, 705 NSPA_LANDBACK, 706 707 NSPA_TURN, 708 709 NSPA_ATTACK1, 710 NSPA_ATTACK2, 711 NSPA_ATTACK3, 712 713 NSPA_PAIN1, 714 NSPA_PAIN2, 715 716 NSPA_DEATH1, 717 NSPA_DEAD1, 718 NSPA_DEATH2, 719 NSPA_DEAD2, 720 NSPA_DEATH3, 721 NSPA_DEAD3, 722 723 MAX_NONSEG_PLAYER_ANIMATIONS, 724 725 NSPA_WALKBACK, 726 727 MAX_NONSEG_PLAYER_TOTALANIMATIONS 728 } nonSegPlayerAnimNumber_t; 729 730 //TA: for buildable animations 731 typedef enum 732 { 733 BANIM_NONE, 734 735 BANIM_CONSTRUCT1, 736 BANIM_CONSTRUCT2, 737 738 BANIM_IDLE1, 739 BANIM_IDLE2, 740 BANIM_IDLE3, 741 742 BANIM_ATTACK1, 743 BANIM_ATTACK2, 744 745 BANIM_SPAWN1, 746 BANIM_SPAWN2, 747 748 BANIM_PAIN1, 749 BANIM_PAIN2, 750 751 BANIM_DESTROY1, 752 BANIM_DESTROY2, 753 BANIM_DESTROYED, 754 755 MAX_BUILDABLE_ANIMATIONS 756 } buildableAnimNumber_t; 757 758 typedef struct animation_s 759 { 760 int firstFrame; 761 int numFrames; 762 int loopFrames; // 0 to numFrames 763 int frameLerp; // msec between frames 764 int initialLerp; // msec to get to first frame 765 int reversed; // true if animation is reversed 766 int flipflop; // true if animation should flipflop back to base 767 } animation_t; 768 769 770 // flip the togglebit every time an animation 771 // changes so a restart of the same anim can be detected 772 #define ANIM_TOGGLEBIT 0x80 773 #define ANIM_FORCEBIT 0x40 774 775 776 typedef enum 777 { 778 TEAM_FREE, 779 TEAM_SPECTATOR, 780 781 TEAM_NUM_TEAMS 782 } team_t; 783 784 // Time between location updates 785 #define TEAM_LOCATION_UPDATE_TIME 1000 786 787 // How many players on the overlay 788 #define TEAM_MAXOVERLAY 32 789 790 //TA: player classes 791 typedef enum 792 { 793 PCL_NONE, 794 795 //builder classes 796 PCL_ALIEN_BUILDER0, 797 PCL_ALIEN_BUILDER0_UPG, 798 799 //offensive classes 800 PCL_ALIEN_LEVEL0, 801 PCL_ALIEN_LEVEL1, 802 PCL_ALIEN_LEVEL1_UPG, 803 PCL_ALIEN_LEVEL2, 804 PCL_ALIEN_LEVEL2_UPG, 805 PCL_ALIEN_LEVEL3, 806 PCL_ALIEN_LEVEL3_UPG, 807 PCL_ALIEN_LEVEL4, 808 809 //human class 810 PCL_HUMAN, 811 PCL_HUMAN_BSUIT, 812 813 PCL_NUM_CLASSES 814 } pClass_t; 815 816 817 //TA: player teams 818 typedef enum 819 { 820 PTE_NONE, 821 PTE_ALIENS, 822 PTE_HUMANS, 823 824 PTE_NUM_TEAMS 825 } pTeam_t; 826 827 828 // means of death 829 typedef enum 830 { 831 MOD_UNKNOWN, 832 MOD_SHOTGUN, 833 MOD_BLASTER, 834 MOD_PAINSAW, 835 MOD_MACHINEGUN, 836 MOD_CHAINGUN, 837 MOD_PRIFLE, 838 MOD_MDRIVER, 839 MOD_LASGUN, 840 MOD_LCANNON, 841 MOD_LCANNON_SPLASH, 842 MOD_FLAMER, 843 MOD_FLAMER_SPLASH, 844 MOD_GRENADE, 845 MOD_WATER, 846 MOD_SLIME, 847 MOD_LAVA, 848 MOD_CRUSH, 849 MOD_TELEFRAG, 850 MOD_FALLING, 851 MOD_SUICIDE, 852 MOD_TARGET_LASER, 853 MOD_TRIGGER_HURT, 854 855 MOD_ABUILDER_CLAW, 856 MOD_LEVEL0_BITE, 857 MOD_LEVEL1_CLAW, 858 MOD_LEVEL1_PCLOUD, 859 MOD_LEVEL3_CLAW, 860 MOD_LEVEL3_POUNCE, 861 MOD_LEVEL3_BOUNCEBALL, 862 MOD_LEVEL2_CLAW, 863 MOD_LEVEL2_ZAP, 864 MOD_LEVEL4_CLAW, 865 MOD_LEVEL4_CHARGE, 866 867 MOD_SLOWBLOB, 868 MOD_POISON, 869 MOD_SWARM, 870 871 MOD_HSPAWN, 872 MOD_TESLAGEN, 873 MOD_MGTURRET, 874 MOD_REACTOR, 875 876 MOD_ASPAWN, 877 MOD_ATUBE, 878 MOD_OVERMIND 879 } meansOfDeath_t; 880 881 882 //--------------------------------------------------------- 883 884 //TA: player class record 885 typedef struct 886 { 887 int classNum; 888 889 char *className; 890 char *humanName; 891 892 char *modelName; 893 float modelScale; 894 char *skinName; 895 float shadowScale; 896 897 char *hudName; 898 899 int stages; 900 901 vec3_t mins; 902 vec3_t maxs; 903 vec3_t crouchMaxs; 904 vec3_t deadMins; 905 vec3_t deadMaxs; 906 float zOffset; 907 908 int viewheight; 909 int crouchViewheight; 910 911 int health; 912 float fallDamage; 913 int regenRate; 914 915 int abilities; 916 917 weapon_t startWeapon; 918 919 float buildDist; 920 921 int fov; 922 float bob; 923 float bobCycle; 924 int steptime; 925 926 float speed; 927 float acceleration; 928 float airAcceleration; 929 float friction; 930 float stopSpeed; 931 float jumpMagnitude; 932 float knockbackScale; 933 934 int children[ 3 ]; 935 int cost; 936 int value; 937 } classAttributes_t; 938 939 typedef struct 940 { 941 char modelName[ MAX_QPATH ]; 942 float modelScale; 943 char skinName[ MAX_QPATH ]; 944 float shadowScale; 945 char hudName[ MAX_QPATH ]; 946 char humanName[ MAX_STRING_CHARS ]; 947 948 vec3_t mins; 949 vec3_t maxs; 950 vec3_t crouchMaxs; 951 vec3_t deadMins; 952 vec3_t deadMaxs; 953 float zOffset; 954 } classAttributeOverrides_t; 955 956 //stages 957 typedef enum 958 { 959 S1, 960 S2, 961 S3 962 } stage_t; 963 964 #define MAX_BUILDABLE_MODELS 4 965 966 //TA: buildable item record 967 typedef struct 968 { 969 int buildNum; 970 971 char *buildName; 972 char *humanName; 973 char *entityName; 974 975 char *models[ MAX_BUILDABLE_MODELS ]; 976 float modelScale; 977 978 vec3_t mins; 979 vec3_t maxs; 980 float zOffset; 981 982 trType_t traj; 983 float bounce; 984 985 int buildPoints; 986 int stages; 987 988 int health; 989 int regenRate; 990 991 int splashDamage; 992 int splashRadius; 993 994 int meansOfDeath; 995 996 int team; 997 weapon_t buildWeapon; 998 999 int idleAnim; 1000 1001 int nextthink; 1002 int buildTime; 1003 qboolean usable; 1004 1005 int turretRange; 1006 int turretFireSpeed; 1007 weapon_t turretProjType; 1008 1009 float minNormal; 1010 qboolean invertNormal; 1011 1012 qboolean creepTest; 1013 int creepSize; 1014 1015 qboolean dccTest; 1016 qboolean reactorTest; 1017 } buildableAttributes_t; 1018 1019 typedef struct 1020 { 1021 char models[ MAX_BUILDABLE_MODELS ][ MAX_QPATH ]; 1022 1023 float modelScale; 1024 vec3_t mins; 1025 vec3_t maxs; 1026 float zOffset; 1027 } buildableAttributeOverrides_t; 1028 1029 //TA: weapon record 1030 typedef struct 1031 { 1032 int weaponNum; 1033 1034 int price; 1035 int stages; 1036 1037 int slots; 1038 1039 char *weaponName; 1040 char *weaponHumanName; 1041 1042 int maxAmmo; 1043 int maxClips; 1044 qboolean infiniteAmmo; 1045 qboolean usesEnergy; 1046 1047 int repeatRate1; 1048 int repeatRate2; 1049 int repeatRate3; 1050 int reloadTime; 1051 1052 qboolean hasAltMode; 1053 qboolean hasThirdMode; 1054 1055 qboolean canZoom; 1056 float zoomFov; 1057 1058 qboolean purchasable; 1059 1060 int buildDelay; 1061 1062 WUTeam_t team; 1063 } weaponAttributes_t; 1064 1065 //TA: upgrade record 1066 typedef struct 1067 { 1068 int upgradeNum; 1069 1070 int price; 1071 int stages; 1072 1073 int slots; 1074 1075 char *upgradeName; 1076 char *upgradeHumanName; 1077 1078 char *icon; 1079 1080 qboolean purchasable; 1081 qboolean usable; 1082 1083 WUTeam_t team; 1084 } upgradeAttributes_t; 1085 1086 1087 //TA: 1088 void BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, int *clips ); 1089 void BG_PackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int ammo, int clips ); 1090 qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int psAmmo[ ], int psAmmo2[ ] ); 1091 void BG_AddWeaponToInventory( int weapon, int stats[ ] ); 1092 void BG_RemoveWeaponFromInventory( int weapon, int stats[ ] ); 1093 qboolean BG_InventoryContainsWeapon( int weapon, int stats[ ] ); 1094 void BG_AddUpgradeToInventory( int item, int stats[ ] ); 1095 void BG_RemoveUpgradeFromInventory( int item, int stats[ ] ); 1096 qboolean BG_InventoryContainsUpgrade( int item, int stats[ ] ); 1097 void BG_ActivateUpgrade( int item, int stats[ ] ); 1098 void BG_DeactivateUpgrade( int item, int stats[ ] ); 1099 qboolean BG_UpgradeIsActive( int item, int stats[ ] ); 1100 qboolean BG_RotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], 1101 vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ); 1102 void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, 1103 const vec3_t mins, const vec3_t maxs, 1104 void (*trace)( trace_t *, const vec3_t, const vec3_t, 1105 const vec3_t, const vec3_t, int, int ), 1106 vec3_t outOrigin, vec3_t outAngles, trace_t *tr ); 1107 int BG_GetValueOfHuman( playerState_t *ps ); 1108 1109 int BG_FindBuildNumForName( char *name ); 1110 int BG_FindBuildNumForEntityName( char *name ); 1111 char *BG_FindNameForBuildable( int bclass ); 1112 char *BG_FindHumanNameForBuildable( int bclass ); 1113 char *BG_FindEntityNameForBuildable( int bclass ); 1114 char *BG_FindModelsForBuildable( int bclass, int modelNum ); 1115 float BG_FindModelScaleForBuildable( int bclass ); 1116 void BG_FindBBoxForBuildable( int bclass, vec3_t mins, vec3_t maxs ); 1117 float BG_FindZOffsetForBuildable( int pclass ); 1118 int BG_FindHealthForBuildable( int bclass ); 1119 int BG_FindRegenRateForBuildable( int bclass ); 1120 trType_t BG_FindTrajectoryForBuildable( int bclass ); 1121 float BG_FindBounceForBuildable( int bclass ); 1122 int BG_FindBuildPointsForBuildable( int bclass ); 1123 qboolean BG_FindStagesForBuildable( int bclass, stage_t stage ); 1124 int BG_FindSplashDamageForBuildable( int bclass ); 1125 int BG_FindSplashRadiusForBuildable( int bclass ); 1126 int BG_FindMODForBuildable( int bclass ); 1127 int BG_FindTeamForBuildable( int bclass ); 1128 weapon_t BG_FindBuildWeaponForBuildable( int bclass ); 1129 int BG_FindAnimForBuildable( int bclass ); 1130 int BG_FindNextThinkForBuildable( int bclass ); 1131 int BG_FindBuildTimeForBuildable( int bclass ); 1132 qboolean BG_FindUsableForBuildable( int bclass ); 1133 int BG_FindRangeForBuildable( int bclass ); 1134 int BG_FindFireSpeedForBuildable( int bclass ); 1135 weapon_t BG_FindProjTypeForBuildable( int bclass ); 1136 float BG_FindMinNormalForBuildable( int bclass ); 1137 qboolean BG_FindInvertNormalForBuildable( int bclass ); 1138 int BG_FindCreepTestForBuildable( int bclass ); 1139 int BG_FindCreepSizeForBuildable( int bclass ); 1140 int BG_FindDCCTestForBuildable( int bclass ); 1141 int BG_FindUniqueTestForBuildable( int bclass ); 1142 void BG_InitBuildableOverrides( void ); 1143 1144 int BG_FindClassNumForName( char *name ); 1145 char *BG_FindNameForClassNum( int pclass ); 1146 char *BG_FindHumanNameForClassNum( int pclass ); 1147 char *BG_FindModelNameForClass( int pclass ); 1148 float BG_FindModelScaleForClass( int pclass ); 1149 char *BG_FindSkinNameForClass( int pclass ); 1150 float BG_FindShadowScaleForClass( int pclass ); 1151 char *BG_FindHudNameForClass( int pclass ); 1152 qboolean BG_FindStagesForClass( int pclass, stage_t stage ); 1153 void BG_FindBBoxForClass( int pclass, vec3_t mins, vec3_t maxs, vec3_t cmaxs, vec3_t dmins, vec3_t dmaxs ); 1154 float BG_FindZOffsetForClass( int pclass ); 1155 void BG_FindViewheightForClass( int pclass, int *viewheight, int *cViewheight ); 1156 int BG_FindHealthForClass( int pclass ); 1157 float BG_FindFallDamageForClass( int pclass ); 1158 int BG_FindRegenRateForClass( int pclass ); 1159 int BG_FindFovForClass( int pclass ); 1160 float BG_FindBobForClass( int pclass ); 1161 float BG_FindBobCycleForClass( int pclass ); 1162 float BG_FindSpeedForClass( int pclass ); 1163 float BG_FindAccelerationForClass( int pclass ); 1164 float BG_FindAirAccelerationForClass( int pclass ); 1165 float BG_FindFrictionForClass( int pclass ); 1166 float BG_FindStopSpeedForClass( int pclass ); 1167 float BG_FindJumpMagnitudeForClass( int pclass ); 1168 float BG_FindKnockbackScaleForClass( int pclass ); 1169 int BG_FindSteptimeForClass( int pclass ); 1170 qboolean BG_ClassHasAbility( int pclass, int ability ); 1171 weapon_t BG_FindStartWeaponForClass( int pclass ); 1172 float BG_FindBuildDistForClass( int pclass ); 1173 int BG_ClassCanEvolveFromTo( int fclass, int tclass, int credits, int num ); 1174 int BG_FindCostOfClass( int pclass ); 1175 int BG_FindValueOfClass( int pclass ); 1176 void BG_InitClassOverrides( void ); 1177 1178 int BG_FindPriceForWeapon( int weapon ); 1179 qboolean BG_FindStagesForWeapon( int weapon, stage_t stage ); 1180 int BG_FindSlotsForWeapon( int weapon ); 1181 char *BG_FindNameForWeapon( int weapon ); 1182 int BG_FindWeaponNumForName( char *name ); 1183 char *BG_FindHumanNameForWeapon( int weapon ); 1184 char *BG_FindModelsForWeapon( int weapon, int modelNum ); 1185 char *BG_FindIconForWeapon( int weapon ); 1186 char *BG_FindCrosshairForWeapon( int weapon ); 1187 int BG_FindCrosshairSizeForWeapon( int weapon ); 1188 void BG_FindAmmoForWeapon( int weapon, int *maxAmmo, int *maxClips ); 1189 qboolean BG_FindInfinteAmmoForWeapon( int weapon ); 1190 qboolean BG_FindUsesEnergyForWeapon( int weapon ); 1191 int BG_FindRepeatRate1ForWeapon( int weapon ); 1192 int BG_FindRepeatRate2ForWeapon( int weapon ); 1193 int BG_FindRepeatRate3ForWeapon( int weapon ); 1194 int BG_FindReloadTimeForWeapon( int weapon ); 1195 qboolean BG_WeaponHasAltMode( int weapon ); 1196 qboolean BG_WeaponHasThirdMode( int weapon ); 1197 qboolean BG_WeaponCanZoom( int weapon ); 1198 float BG_FindZoomFovForWeapon( int weapon ); 1199 qboolean BG_FindPurchasableForWeapon( int weapon ); 1200 int BG_FindBuildDelayForWeapon( int weapon ); 1201 WUTeam_t BG_FindTeamForWeapon( int weapon ); 1202 1203 int BG_FindPriceForUpgrade( int upgrade ); 1204 qboolean BG_FindStagesForUpgrade( int upgrade, stage_t stage ); 1205 int BG_FindSlotsForUpgrade( int upgrade ); 1206 char *BG_FindNameForUpgrade( int upgrade ); 1207 int BG_FindUpgradeNumForName( char *name ); 1208 char *BG_FindHumanNameForUpgrade( int upgrade ); 1209 char *BG_FindIconForUpgrade( int upgrade ); 1210 qboolean BG_FindPurchasableForUpgrade( int upgrade ); 1211 qboolean BG_FindUsableForUpgrade( int upgrade ); 1212 WUTeam_t BG_FindTeamForUpgrade( int upgrade ); 1213 1214 // content masks 1215 #define MASK_ALL (-1) 1216 #define MASK_SOLID (CONTENTS_SOLID) 1217 #define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY) 1218 #define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP) 1219 #define MASK_WATER (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME) 1220 #define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA) 1221 #define MASK_SHOT (CONTENTS_SOLID|CONTENTS_BODY) 1222 1223 1224 // 1225 // entityState_t->eType 1226 // 1227 typedef enum 1228 { 1229 ET_GENERAL, 1230 ET_PLAYER, 1231 ET_ITEM, 1232 1233 ET_BUILDABLE, //TA: buildable type 1234 1235 ET_MISSILE, 1236 ET_MOVER, 1237 ET_BEAM, 1238 ET_PORTAL, 1239 ET_SPEAKER, 1240 ET_PUSH_TRIGGER, 1241 ET_TELEPORT_TRIGGER, 1242 ET_INVISIBLE, 1243 ET_GRAPPLE, // grapple hooked on wall 1244 1245 ET_CORPSE, 1246 ET_PARTICLE_SYSTEM, 1247 ET_ANIMMAPOBJ, 1248 ET_MODELDOOR, 1249 ET_LIGHTFLARE, 1250 ET_LEV2_ZAP_CHAIN, 1251 1252 ET_EVENTS // any of the EV_* events can be added freestanding 1253 // by setting eType to ET_EVENTS + eventNum 1254 // this avoids having to set eFlags and eventNum 1255 } entityType_t; 1256 1257 void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result ); 1258 void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result ); 1259 1260 void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerState_t *ps ); 1261 1262 void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap ); 1263 void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s, int time, qboolean snap ); 1264 1265 qboolean BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime ); 1266 1267 #define ARENAS_PER_TIER 4 1268 #define MAX_ARENAS 1024 1269 #define MAX_ARENAS_TEXT 8192 1270 1271 #define MAX_BOTS 1024 1272 #define MAX_BOTS_TEXT 8192 1273 1274 float atof_neg( char *token, qboolean allowNegative ); 1275 int atoi_neg( char *token, qboolean allowNegative ); 1276 1277 void BG_ParseCSVEquipmentList( const char *string, weapon_t *weapons, int weaponsSize, 1278 upgrade_t *upgrades, int upgradesSize ); 1279 void BG_ParseCSVClassList( const char *string, pClass_t *classes, int classesSize ); 1280 void BG_ParseCSVBuildableList( const char *string, buildable_t *buildables, int buildablesSize ); 1281 void BG_InitAllowedGameElements( void ); 1282 qboolean BG_WeaponIsAllowed( weapon_t weapon ); 1283 qboolean BG_UpgradeIsAllowed( upgrade_t upgrade ); 1284 qboolean BG_ClassIsAllowed( pClass_t class ); 1285 qboolean BG_BuildableIsAllowed( buildable_t buildable ); 1286 qboolean BG_UpgradeClassAvailable( playerState_t *ps ); 1287