1 /* 2 =========================================================================== 3 Copyright (C) 1999 - 2005, Id Software, Inc. 4 Copyright (C) 2000 - 2013, Raven Software, Inc. 5 Copyright (C) 2001 - 2013, Activision, Inc. 6 Copyright (C) 2013 - 2015, OpenJK contributors 7 8 This file is part of the OpenJK source code. 9 10 OpenJK is free software; you can redistribute it and/or modify it 11 under the terms of the GNU General Public License version 2 as 12 published by the Free Software Foundation. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, see <http://www.gnu.org/licenses/>. 21 =========================================================================== 22 */ 23 24 #pragma once 25 26 // bg_public.h -- definitions shared by both the server game and client game modules 27 28 // because games can change separately from the main system version, we need a 29 // second version that must match between game and cgame 30 31 #include "bg_weapons.h" 32 #include "anims.h" 33 #include "bg_vehicles.h" 34 35 //these two defs are shared now because we do clientside ent parsing 36 #define MAX_SPAWN_VARS 64 37 #define MAX_SPAWN_VARS_CHARS 4096 38 39 40 #define GAME_VERSION "basejka-1" 41 42 #define DEFAULT_SABER "Kyle" 43 #define DEFAULT_SABER_STAFF "dual_1" 44 #define DEFAULT_SABER_MODEL "models/weapons2/saber/saber_w.glm" 45 #define DEFAULT_MODEL "kyle" 46 #define DEFAULT_MODEL_FEMALE "jan" 47 48 #define DEFAULT_REDTEAM_NAME "Empire" 49 #define DEFAULT_BLUETEAM_NAME "Rebellion" 50 51 #define STEPSIZE 18 52 53 #define DEFAULT_FORCEPOWERS "5-1-000000000000000000" 54 #define DEFAULT_FORCEPOWERS_LEN (22) // numPowers + rank + side + separators 55 //"rank-side-heal.lev.speed.push.pull.tele.grip.lightning.rage.protect.absorb.teamheal.teamforce.drain.see" 56 57 #define DEFAULT_GRAVITY 800 58 #define GIB_HEALTH -40 59 #define ARMOR_PROTECTION 0.50 // Shields only stop 50% of armor-piercing dmg 60 #define ARMOR_REDUCTION_FACTOR 0.50 // Certain damage doesn't take off armor as efficiently 61 62 #define JUMP_VELOCITY 225//270 63 64 #define MAX_ITEMS 256 65 66 #define RANK_TIED_FLAG 0x4000 67 68 #define ITEM_RADIUS 15 // item sizes are needed for client side pickup detection 69 70 #define SCORE_NOT_PRESENT -9999 // for the CS_SCORES[12] when only one player is present 71 72 #define VOTE_TIME 30000 // 30 seconds before vote times out 73 74 #define DEFAULT_MINS_2 -24 75 #define DEFAULT_MAXS_2 40 76 #define CROUCH_MAXS_2 16 77 #define STANDARD_VIEWHEIGHT_OFFSET -4 78 79 #define MINS_Z -24 80 #define DEFAULT_VIEWHEIGHT (DEFAULT_MAXS_2+STANDARD_VIEWHEIGHT_OFFSET)//26 81 #define CROUCH_VIEWHEIGHT (CROUCH_MAXS_2+STANDARD_VIEWHEIGHT_OFFSET)//12 82 #define DEAD_VIEWHEIGHT -16 83 84 #define MAX_CLIENT_SCORE_SEND 20 85 86 // 87 // config strings are a general means of communicating variable length strings 88 // from the server to all connected clients. 89 // 90 91 // CS_SERVERINFO and CS_SYSTEMINFO are defined in q_shared.h 92 #define CS_MUSIC 2 93 #define CS_MESSAGE 3 // from the map worldspawn's message field 94 #define CS_MOTD 4 // g_motd string for server message of the day 95 #define CS_WARMUP 5 // server time when the match will be restarted 96 #define CS_SCORES1 6 97 #define CS_SCORES2 7 98 #define CS_VOTE_TIME 8 99 #define CS_VOTE_STRING 9 100 #define CS_VOTE_YES 10 101 #define CS_VOTE_NO 11 102 103 #define CS_TEAMVOTE_TIME 12 104 #define CS_TEAMVOTE_STRING 14 105 #define CS_TEAMVOTE_YES 16 106 #define CS_TEAMVOTE_NO 18 107 108 #define CS_GAME_VERSION 20 109 #define CS_LEVEL_START_TIME 21 // so the timer only shows the current level 110 #define CS_INTERMISSION 22 // when 1, fraglimit/timelimit has been hit and intermission will start in a second or two 111 #define CS_FLAGSTATUS 23 // string indicating flag status in CTF 112 #define CS_SHADERSTATE 24 113 #define CS_BOTINFO 25 114 115 #define CS_ITEMS 27 // string of 0's and 1's that tell which items are present 116 117 #define CS_CLIENT_JEDIMASTER 28 // current jedi master 118 #define CS_CLIENT_DUELWINNER 29 // current duel round winner - needed for printing at top of scoreboard 119 #define CS_CLIENT_DUELISTS 30 // client numbers for both current duelists. Needed for a number of client-side things. 120 #define CS_CLIENT_DUELHEALTHS 31 // nmckenzie: DUEL_HEALTH. Hopefully adding this cs is safe and good? 121 #define CS_GLOBAL_AMBIENT_SET 32 122 123 #define CS_AMBIENT_SET 37 124 125 #define CS_SIEGE_STATE (CS_AMBIENT_SET+MAX_AMBIENT_SETS) 126 #define CS_SIEGE_OBJECTIVES (CS_SIEGE_STATE+1) 127 #define CS_SIEGE_TIMEOVERRIDE (CS_SIEGE_OBJECTIVES+1) 128 #define CS_SIEGE_WINTEAM (CS_SIEGE_TIMEOVERRIDE+1) 129 #define CS_SIEGE_ICONS (CS_SIEGE_WINTEAM+1) 130 131 #define CS_MODELS (CS_SIEGE_ICONS+1) 132 #define CS_SKYBOXORG (CS_MODELS+MAX_MODELS) //rww - skybox info 133 #define CS_SOUNDS (CS_SKYBOXORG+1) 134 #define CS_ICONS (CS_SOUNDS+MAX_SOUNDS) 135 #define CS_PLAYERS (CS_ICONS+MAX_ICONS) 136 /* 137 Ghoul2 Insert Start 138 */ 139 #define CS_G2BONES (CS_PLAYERS+MAX_CLIENTS) 140 //rww - used to be CS_CHARSKINS, but I have eliminated the need for that. 141 /* 142 Ghoul2 Insert End 143 */ 144 #define CS_LOCATIONS (CS_G2BONES+MAX_G2BONES) 145 #define CS_PARTICLES (CS_LOCATIONS+MAX_LOCATIONS) 146 #define CS_EFFECTS (CS_PARTICLES+MAX_LOCATIONS) 147 #define CS_LIGHT_STYLES (CS_EFFECTS + MAX_FX) 148 149 //rwwRMG - added: 150 #define CS_TERRAINS (CS_LIGHT_STYLES + (MAX_LIGHT_STYLES*3)) 151 #define CS_BSP_MODELS (CS_TERRAINS + MAX_TERRAINS) 152 153 #define CS_MAX (CS_BSP_MODELS + MAX_SUB_BSP) 154 155 #if (CS_MAX) > MAX_CONFIGSTRINGS 156 #error overflow: (CS_MAX) > MAX_CONFIGSTRINGS 157 #endif 158 159 typedef enum { 160 G2_MODELPART_HEAD = 10, 161 G2_MODELPART_WAIST, 162 G2_MODELPART_LARM, 163 G2_MODELPART_RARM, 164 G2_MODELPART_RHAND, 165 G2_MODELPART_LLEG, 166 G2_MODELPART_RLEG 167 } g2ModelParts_t; 168 169 #define G2_MODEL_PART 50 170 171 #define BG_NUM_TOGGLEABLE_SURFACES 31 172 173 #define MAX_CUSTOM_SIEGE_SOUNDS 30 174 175 extern const char *bg_customSiegeSoundNames[MAX_CUSTOM_SIEGE_SOUNDS]; 176 177 extern const char *bgToggleableSurfaces[BG_NUM_TOGGLEABLE_SURFACES]; 178 extern const int bgToggleableSurfaceDebris[BG_NUM_TOGGLEABLE_SURFACES]; 179 180 typedef enum { 181 HANDEXTEND_NONE = 0, 182 HANDEXTEND_FORCEPUSH, 183 HANDEXTEND_FORCEPULL, 184 HANDEXTEND_FORCE_HOLD, 185 HANDEXTEND_SABERPULL, 186 HANDEXTEND_CHOKE, //use handextend priorities to choke someone being gripped 187 HANDEXTEND_WEAPONREADY, 188 HANDEXTEND_DODGE, 189 HANDEXTEND_KNOCKDOWN, 190 HANDEXTEND_DUELCHALLENGE, 191 HANDEXTEND_TAUNT, 192 193 HANDEXTEND_PRETHROW, 194 HANDEXTEND_POSTTHROW, 195 HANDEXTEND_PRETHROWN, 196 HANDEXTEND_POSTTHROWN, 197 198 HANDEXTEND_DRAGGING, 199 200 HANDEXTEND_JEDITAUNT, 201 } forceHandAnims_t; 202 203 typedef enum 204 { 205 BROKENLIMB_NONE = 0, 206 BROKENLIMB_LARM, 207 BROKENLIMB_RARM, 208 NUM_BROKENLIMBS 209 } brokenLimb_t; 210 211 //for supplier class items 212 #define TOSS_DEBOUNCE_TIME 5000 213 214 typedef enum { 215 GT_FFA, // free for all 216 GT_HOLOCRON, // holocron ffa 217 GT_JEDIMASTER, // jedi master 218 GT_DUEL, // one on one tournament 219 GT_POWERDUEL, 220 GT_SINGLE_PLAYER, // single player ffa 221 222 //-- team games go after this -- 223 224 GT_TEAM, // team deathmatch 225 GT_SIEGE, // siege 226 GT_CTF, // capture the flag 227 GT_CTY, 228 GT_MAX_GAME_TYPE 229 } gametype_t; 230 231 // gametype bits 232 #define GTB_NONE 0x000 // invalid 233 #define GTB_FFA 0x001 // free for all 234 #define GTB_HOLOCRON 0x002 // holocron ffa 235 #define GTB_JEDIMASTER 0x004 // jedi master 236 #define GTB_DUEL 0x008 // one on one tournament 237 #define GTB_POWERDUEL 0x010 // two on one tournament 238 #define GTB_SINGLE_PLAYER 0x020 // single player ffa 239 #define GTB_NOTTEAM 0x03F // **SPECIAL: All of the above gametypes, i.e. not team-based 240 #define GTB_TEAM 0x040 // team deathmatch 241 #define GTB_SIEGE 0x080 // siege 242 #define GTB_CTF 0x100 // capture the flag 243 #define GTB_CTY 0x200 // capture the ysalimiri 244 #define GTB_ALL 0x1FF // all 245 246 typedef enum _flag_status { 247 FLAG_ATBASE = 0, 248 FLAG_TAKEN, // CTF 249 FLAG_TAKEN_RED, // One Flag CTF 250 FLAG_TAKEN_BLUE, // One Flag CTF 251 FLAG_DROPPED 252 } flagStatus_t; 253 254 typedef enum { GENDER_MALE, GENDER_FEMALE, GENDER_NEUTER } gender_t; 255 256 extern vec3_t WP_MuzzlePoint[WP_NUM_WEAPONS]; 257 258 extern int forcePowerSorted[NUM_FORCE_POWERS]; 259 260 typedef enum saberLockType_e 261 { 262 SABERLOCK_TOP, 263 SABERLOCK_SIDE, 264 SABERLOCK_LOCK, 265 SABERLOCK_BREAK, 266 SABERLOCK_SUPERBREAK, 267 SABERLOCK_WIN, 268 SABERLOCK_LOSE 269 } saberLockType_t; 270 271 typedef enum direction_e 272 { 273 DIR_RIGHT, 274 DIR_LEFT, 275 DIR_FRONT, 276 DIR_BACK 277 } direction_t; 278 279 /* 280 =================================================================================== 281 282 PMOVE MODULE 283 284 The pmove code takes a playerState_t and a usercmd_t and generates a new playerState_t 285 and some other output data. Used for local prediction on the client game and true 286 movement on the server game. 287 =================================================================================== 288 */ 289 290 291 #pragma pack(push, 1) 292 typedef struct animation_s { 293 unsigned short firstFrame; 294 unsigned short numFrames; 295 short frameLerp; // msec between frames 296 //initialLerp is abs(frameLerp) 297 signed char loopFrames; // 0 to numFrames 298 } animation_t; 299 #pragma pack(pop) 300 301 extern qboolean BGPAFtextLoaded; 302 extern animation_t bgHumanoidAnimations[MAX_TOTALANIMATIONS]; 303 304 #define MAX_ANIM_FILES 16 305 #define MAX_ANIM_EVENTS 300 306 307 typedef enum 308 { 309 FOOTSTEP_R, 310 FOOTSTEP_L, 311 FOOTSTEP_HEAVY_R, 312 FOOTSTEP_HEAVY_L, 313 NUM_FOOTSTEP_TYPES 314 } footstepType_t; 315 316 extern stringID_table_t animEventTypeTable[MAX_ANIM_EVENTS+1]; 317 extern stringID_table_t footstepTypeTable[NUM_FOOTSTEP_TYPES+1]; 318 319 //size of Anim eventData array... 320 #define MAX_RANDOM_ANIM_SOUNDS 4 321 #define AED_ARRAY_SIZE (MAX_RANDOM_ANIM_SOUNDS+3) 322 //indices for AEV_SOUND data 323 #define AED_SOUNDINDEX_START 0 324 #define AED_SOUNDINDEX_END (MAX_RANDOM_ANIM_SOUNDS-1) 325 #define AED_SOUND_NUMRANDOMSNDS (MAX_RANDOM_ANIM_SOUNDS) 326 #define AED_SOUND_PROBABILITY (MAX_RANDOM_ANIM_SOUNDS+1) 327 //indices for AEV_SOUNDCHAN data 328 #define AED_SOUNDCHANNEL (MAX_RANDOM_ANIM_SOUNDS+2) 329 //indices for AEV_FOOTSTEP data 330 #define AED_FOOTSTEP_TYPE 0 331 #define AED_FOOTSTEP_PROBABILITY 1 332 //indices for AEV_EFFECT data 333 #define AED_EFFECTINDEX 0 334 #define AED_BOLTINDEX 1 335 #define AED_EFFECT_PROBABILITY 2 336 #define AED_MODELINDEX 3 337 //indices for AEV_FIRE data 338 #define AED_FIRE_ALT 0 339 #define AED_FIRE_PROBABILITY 1 340 //indices for AEV_MOVE data 341 #define AED_MOVE_FWD 0 342 #define AED_MOVE_RT 1 343 #define AED_MOVE_UP 2 344 //indices for AEV_SABER_SWING data 345 #define AED_SABER_SWING_SABERNUM 0 346 #define AED_SABER_SWING_TYPE 1 347 #define AED_SABER_SWING_PROBABILITY 2 348 //indices for AEV_SABER_SPIN data 349 #define AED_SABER_SPIN_SABERNUM 0 350 #define AED_SABER_SPIN_TYPE 1 //0 = saberspinoff, 1 = saberspin, 2-4 = saberspin1-saberspin3 351 #define AED_SABER_SPIN_PROBABILITY 2 352 353 typedef enum 354 {//NOTENOTE: Be sure to update animEventTypeTable and ParseAnimationEvtBlock(...) if you change this enum list! 355 AEV_NONE, 356 AEV_SOUND, //# animID AEV_SOUND framenum soundpath randomlow randomhi chancetoplay 357 AEV_FOOTSTEP, //# animID AEV_FOOTSTEP framenum footstepType chancetoplay 358 AEV_EFFECT, //# animID AEV_EFFECT framenum effectpath boltName chancetoplay 359 AEV_FIRE, //# animID AEV_FIRE framenum altfire chancetofire 360 AEV_MOVE, //# animID AEV_MOVE framenum forwardpush rightpush uppush 361 AEV_SOUNDCHAN, //# animID AEV_SOUNDCHAN framenum CHANNEL soundpath randomlow randomhi chancetoplay 362 AEV_SABER_SWING, //# animID AEV_SABER_SWING framenum CHANNEL randomlow randomhi chancetoplay 363 AEV_SABER_SPIN, //# animID AEV_SABER_SPIN framenum CHANNEL chancetoplay 364 AEV_NUM_AEV 365 } animEventType_t; 366 367 typedef struct animevent_s 368 { 369 animEventType_t eventType; 370 unsigned short keyFrame; //Frame to play event on 371 signed short eventData[AED_ARRAY_SIZE]; //Unique IDs, can be soundIndex of sound file to play OR effect index or footstep type, etc. 372 char *stringData; //we allow storage of one string, temporarily (in case we have to look up an index later, then make sure to set stringData to NULL so we only do the look-up once) 373 } animevent_t; 374 375 typedef struct bgLoadedAnim_s { 376 char filename[MAX_QPATH]; 377 animation_t *anims; 378 // animsounds_t torsoAnimSnds[MAX_ANIM_SOUNDS]; 379 // animsounds_t legsAnimSnds[MAX_ANIM_SOUNDS]; 380 // qboolean soundsCached; 381 } bgLoadedAnim_t; 382 383 typedef struct bgLoadedEvents_s { 384 char filename[MAX_QPATH]; 385 animevent_t torsoAnimEvents[MAX_ANIM_EVENTS]; 386 animevent_t legsAnimEvents[MAX_ANIM_EVENTS]; 387 qboolean eventsParsed; 388 } bgLoadedEvents_t; 389 390 391 extern bgLoadedAnim_t bgAllAnims[MAX_ANIM_FILES]; 392 393 //In SP this is shared in with the anim stuff, and humanoid anim sets can be loaded 394 //multiple times just for the sake of sounds being different. We probably wouldn't 395 //care normally but since we're working in VMs we have to do everything possible to 396 //cut memory cost. 397 //On the bright side this also means we're cutting a rather large size out of 398 //required game-side memory. 399 #ifndef _GAME 400 extern bgLoadedEvents_t bgAllEvents[MAX_ANIM_FILES]; 401 extern int bgNumAnimEvents; 402 #endif 403 404 405 typedef enum { 406 PM_NORMAL, // can accelerate and turn 407 PM_JETPACK, // special jetpack movement 408 PM_FLOAT, // float with no gravity in general direction of velocity (intended for gripping) 409 PM_NOCLIP, // noclip movement 410 PM_SPECTATOR, // still run into walls 411 PM_DEAD, // no acceleration or turning, but free falling 412 PM_FREEZE, // stuck in place with no control 413 PM_INTERMISSION, // no movement or status bar 414 PM_SPINTERMISSION // no movement or status bar 415 } pmtype_t; 416 417 typedef enum { 418 WEAPON_READY, 419 WEAPON_RAISING, 420 WEAPON_DROPPING, 421 WEAPON_FIRING, 422 WEAPON_CHARGING, 423 WEAPON_CHARGING_ALT, 424 WEAPON_IDLE, //lowered // NOTENOTE Added with saber 425 } weaponstate_t; 426 427 428 typedef enum forceMasteries_e { 429 FORCE_MASTERY_UNINITIATED, 430 FORCE_MASTERY_INITIATE, 431 FORCE_MASTERY_PADAWAN, 432 FORCE_MASTERY_JEDI, 433 FORCE_MASTERY_JEDI_GUARDIAN, 434 FORCE_MASTERY_JEDI_ADEPT, 435 FORCE_MASTERY_JEDI_KNIGHT, 436 FORCE_MASTERY_JEDI_MASTER, 437 NUM_FORCE_MASTERY_LEVELS 438 } forceMasteries_t; 439 440 extern char *forceMasteryLevels[NUM_FORCE_MASTERY_LEVELS]; 441 extern int forceMasteryPoints[NUM_FORCE_MASTERY_LEVELS]; 442 443 extern int bgForcePowerCost[NUM_FORCE_POWERS][NUM_FORCE_POWER_LEVELS]; 444 445 // pmove->pm_flags 446 #define PMF_DUCKED 1 447 #define PMF_JUMP_HELD 2 448 #define PMF_ROLLING 4 449 #define PMF_BACKWARDS_JUMP 8 // go into backwards land 450 #define PMF_BACKWARDS_RUN 16 // coast down to backwards run 451 #define PMF_TIME_LAND 32 // pm_time is time before rejump 452 #define PMF_TIME_KNOCKBACK 64 // pm_time is an air-accelerate only time 453 #define PMF_FIX_MINS 128 // mins have been brought up, keep tracing down to fix them 454 #define PMF_TIME_WATERJUMP 256 // pm_time is waterjump 455 #define PMF_RESPAWNED 512 // clear after attack and jump buttons come up 456 #define PMF_USE_ITEM_HELD 1024 457 #define PMF_UPDATE_ANIM 2048 // The server updated the animation, the pmove should set the ghoul2 anim to match. 458 #define PMF_FOLLOW 4096 // spectate following another player 459 #define PMF_SCOREBOARD 8192 // spectate as a scoreboard 460 #define PMF_STUCK_TO_WALL 16384 // grabbing a wall 461 462 #define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK) 463 464 #define MAXTOUCH 32 465 466 typedef struct bgEntity_s 467 { 468 entityState_t s; 469 playerState_t *playerState; 470 Vehicle_t *m_pVehicle; //vehicle data 471 void *ghoul2; //g2 instance 472 int localAnimIndex; //index locally (game/cgame) to anim data for this skel 473 vec3_t modelScale; //needed for g2 collision 474 475 //Data type(s) must directly correspond to the head of the gentity and centity structures 476 #if defined(__GNUC__) || defined(__GCC__) || defined(MINGW32) || defined(MACOS_X) 477 } _bgEntity_t; 478 #else 479 } bgEntity_t; 480 #endif 481 482 typedef struct pmove_s { 483 // state (in / out) 484 playerState_t *ps; 485 486 //rww - shared ghoul2 stuff (not actually the same data, but hey) 487 void *ghoul2; 488 int g2Bolts_LFoot; 489 int g2Bolts_RFoot; 490 vec3_t modelScale; 491 492 //hacky bool so we know if we're dealing with a nonhumanoid (which is probably a rockettrooper) 493 qboolean nonHumanoid; 494 495 // command (in) 496 usercmd_t cmd; 497 int tracemask; // collide against these types of surfaces 498 int debugLevel; // if set, diagnostic output will be printed 499 qboolean noFootsteps; // if the game is setup for no footsteps by the server 500 qboolean gauntletHit; // true if a gauntlet attack would actually hit something 501 502 int framecount; 503 504 // results (out) 505 int numtouch; 506 int touchents[MAXTOUCH]; 507 508 int useEvent; 509 510 vec3_t mins, maxs; // bounding box size 511 512 int watertype; 513 int waterlevel; 514 515 int gametype; 516 517 int debugMelee; 518 int stepSlideFix; 519 int noSpecMove; 520 521 animation_t *animations; 522 523 float xyspeed; 524 525 // for fixed msec Pmove 526 int pmove_fixed; 527 int pmove_float; 528 int pmove_msec; 529 530 // callbacks to test the world 531 // these will be different functions during game and cgame 532 void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask ); 533 int (*pointcontents)( const vec3_t point, int passEntityNum ); 534 535 int checkDuelLoss; 536 537 //rww - bg entitystate access method 538 bgEntity_t *baseEnt; //base address of the entity array (g_entities or cg_entities) 539 int entSize; //size of the struct (gentity_t or centity_t) so things can be dynamic 540 } pmove_t; 541 542 543 extern pmove_t *pm; 544 545 #define SETANIM_TORSO 1 546 #define SETANIM_LEGS 2 547 #define SETANIM_BOTH SETANIM_TORSO|SETANIM_LEGS//3 548 549 #define SETANIM_FLAG_NORMAL 0//Only set if timer is 0 550 #define SETANIM_FLAG_OVERRIDE 1//Override previous 551 #define SETANIM_FLAG_HOLD 2//Set the new timer 552 #define SETANIM_FLAG_RESTART 4//Allow restarting the anim if playing the same one (weapon fires) 553 #define SETANIM_FLAG_HOLDLESS 8//Set the new timer 554 555 556 // if a full pmove isn't done on the client, you can just update the angles 557 void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ); 558 void Pmove (pmove_t *pmove); 559 560 561 //=================================================================================== 562 563 564 // playerState_t->stats[] indexes 565 // NOTE: may not have more than 16 566 typedef enum { 567 STAT_HEALTH, 568 STAT_HOLDABLE_ITEM, 569 STAT_HOLDABLE_ITEMS, 570 STAT_PERSISTANT_POWERUP, 571 //MAKE SURE STAT_WEAPONS REMAINS 4!!!! 572 //There is a hardcoded reference in msg.cpp to send it in 32 bits -rww 573 STAT_WEAPONS = 4, // 16 bit fields 574 STAT_ARMOR, 575 STAT_DEAD_YAW, // look this direction when dead (FIXME: get rid of?) 576 STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?) 577 STAT_MAX_HEALTH // health / armor limit, changable by handicap 578 } statIndex_t; 579 580 581 // playerState_t->persistant[] indexes 582 // these fields are the only part of playerState_t that isn't 583 // cleared on respawn 584 // NOTE: may not have more than 16 585 typedef enum { 586 PERS_SCORE, // !!! MUST NOT CHANGE, SERVER AND GAME BOTH REFERENCE !!! 587 PERS_HITS, // total points damage inflicted so damage beeps can sound on change 588 PERS_RANK, // player rank or team rank 589 PERS_TEAM, // player team 590 PERS_SPAWN_COUNT, // incremented every respawn 591 PERS_PLAYEREVENTS, // 16 bits that can be flipped for events 592 PERS_ATTACKER, // clientnum of last damage inflicter 593 PERS_ATTACKEE_ARMOR, // health/armor of last person we attacked 594 PERS_KILLED, // count of the number of times you died 595 // player awards tracking 596 PERS_IMPRESSIVE_COUNT, // two railgun hits in a row 597 PERS_EXCELLENT_COUNT, // two successive kills in a short amount of time 598 PERS_DEFEND_COUNT, // defend awards 599 PERS_ASSIST_COUNT, // assist awards 600 PERS_GAUNTLET_FRAG_COUNT, // kills with the gauntlet 601 PERS_CAPTURES // captures 602 } persEnum_t; 603 604 605 // entityState_t->eFlags 606 #define EF_G2ANIMATING (1<<0) //perform g2 bone anims based on torsoAnim and legsAnim, works for ET_GENERAL -rww 607 #define EF_DEAD (1<<1) // don't draw a foe marker over players with EF_DEAD 608 //#define EF_BOUNCE_SHRAPNEL (1<<2) // special shrapnel flag 609 //do not use eflags for server-only things, it wastes bandwidth -rww 610 #define EF_RADAROBJECT (1<<2) // display on team radar 611 612 #define EF_TELEPORT_BIT (1<<3) // toggled every time the origin abruptly changes 613 614 #define EF_SHADER_ANIM (1<<4) // Animating shader (by s.frame) 615 616 #define EF_PLAYER_EVENT (1<<5) 617 //#define EF_BOUNCE (1<<5) // for missiles 618 //#define EF_BOUNCE_HALF (1<<6) // for missiles 619 //these aren't even referenced in bg or client code and do not need to be eFlags, so I 620 //am using these flags for rag stuff -rww 621 622 #define EF_RAG (1<<6) //ragdoll him even if he's alive 623 624 625 #define EF_PERMANENT (1<<7) // rww - I am claiming this. (for permanent entities) 626 627 #define EF_NODRAW (1<<8) // may have an event, but no model (unspawned items) 628 #define EF_FIRING (1<<9) // for lightning gun 629 #define EF_ALT_FIRING (1<<10) // for alt-fires, mostly for lightning guns though 630 #define EF_JETPACK_ACTIVE (1<<11) //jetpack is activated 631 632 #define EF_NOT_USED_1 (1<<12) // not used 633 634 #define EF_TALK (1<<13) // draw a talk balloon 635 #define EF_CONNECTION (1<<14) // draw a connection trouble sprite 636 #define EF_NOT_USED_6 (1<<15) // not used 637 638 #define EF_NOT_USED_2 (1<<16) // not used 639 #define EF_NOT_USED_3 (1<<17) // not used 640 #define EF_NOT_USED_4 (1<<18) // not used 641 642 #define EF_BODYPUSH (1<<19) //rww - claiming this for fullbody push effect 643 644 #define EF_DOUBLE_AMMO (1<<20) // Hacky way to get around ammo max 645 #define EF_SEEKERDRONE (1<<21) // show seeker drone floating around head 646 #define EF_MISSILE_STICK (1<<22) // missiles that stick to the wall. 647 #define EF_ITEMPLACEHOLDER (1<<23) // item effect 648 #define EF_SOUNDTRACKER (1<<24) // sound position needs to be updated in relation to another entity 649 #define EF_DROPPEDWEAPON (1<<25) // it's a dropped weapon 650 #define EF_DISINTEGRATION (1<<26) // being disintegrated by the disruptor 651 #define EF_INVULNERABLE (1<<27) // just spawned in or whatever, so is protected 652 653 #define EF_CLIENTSMOOTH (1<<28) // standard lerporigin smooth override on client 654 655 #define EF_JETPACK (1<<29) //rww - wearing a jetpack 656 #define EF_JETPACK_FLAMING (1<<30) //rww - jetpack fire effect 657 658 #define EF_NOT_USED_5 (1<<31) // not used 659 660 //These new EF2_??? flags were added for NPCs, they really should not be used often. 661 //NOTE: we only allow 10 of these! 662 #define EF2_HELD_BY_MONSTER (1<<0) // Being held by something, like a Rancor or a Wampa 663 #define EF2_USE_ALT_ANIM (1<<1) // For certain special runs/stands for creatures like the Rancor and Wampa whose runs/stands are conditional 664 #define EF2_ALERTED (1<<2) // For certain special anims, for Rancor: means you've had an enemy, so use the more alert stand 665 #define EF2_GENERIC_NPC_FLAG (1<<3) // So far, used for Rancor... 666 #define EF2_FLYING (1<<4) // Flying FIXME: only used on NPCs doesn't *really* have to be passed over, does it? 667 #define EF2_HYPERSPACE (1<<5) // Used to both start the hyperspace effect on the predicted client and to let the vehicle know it can now jump into hyperspace (after turning to face the proper angle) 668 #define EF2_BRACKET_ENTITY (1<<6) // Draw as bracketed 669 #define EF2_SHIP_DEATH (1<<7) // "died in ship" mode 670 #define EF2_NOT_USED_1 (1<<8) // not used 671 672 673 typedef enum { 674 EFFECT_NONE = 0, 675 EFFECT_SMOKE, 676 EFFECT_EXPLOSION, 677 EFFECT_EXPLOSION_PAS, 678 EFFECT_SPARK_EXPLOSION, 679 EFFECT_EXPLOSION_TRIPMINE, 680 EFFECT_EXPLOSION_DETPACK, 681 EFFECT_EXPLOSION_FLECHETTE, 682 EFFECT_STUNHIT, 683 EFFECT_EXPLOSION_DEMP2ALT, 684 EFFECT_EXPLOSION_TURRET, 685 EFFECT_SPARKS, 686 EFFECT_WATER_SPLASH, 687 EFFECT_ACID_SPLASH, 688 EFFECT_LAVA_SPLASH, 689 EFFECT_LANDING_MUD, 690 EFFECT_LANDING_SAND, 691 EFFECT_LANDING_DIRT, 692 EFFECT_LANDING_SNOW, 693 EFFECT_LANDING_GRAVEL, 694 EFFECT_MAX 695 } effectTypes_t; 696 697 // NOTE: may not have more than 16 698 typedef enum { 699 PW_NONE, 700 701 #ifdef BASE_COMPAT 702 PW_QUAD, 703 PW_BATTLESUIT, 704 #endif // BASE_COMPAT 705 706 PW_PULL, 707 708 PW_REDFLAG, 709 PW_BLUEFLAG, 710 PW_NEUTRALFLAG, 711 712 PW_SHIELDHIT, 713 714 PW_SPEEDBURST, 715 PW_DISINT_4, 716 PW_SPEED, 717 PW_CLOAKED, 718 PW_FORCE_ENLIGHTENED_LIGHT, 719 PW_FORCE_ENLIGHTENED_DARK, 720 PW_FORCE_BOON, 721 PW_YSALAMIRI, 722 723 PW_NUM_POWERUPS 724 725 } powerup_t; 726 727 typedef enum { 728 HI_NONE, 729 730 HI_SEEKER, 731 HI_SHIELD, 732 HI_MEDPAC, 733 HI_MEDPAC_BIG, 734 HI_BINOCULARS, 735 HI_SENTRY_GUN, 736 HI_JETPACK, 737 738 HI_HEALTHDISP, 739 HI_AMMODISP, 740 HI_EWEB, 741 HI_CLOAK, 742 743 HI_NUM_HOLDABLE 744 } holdable_t; 745 746 747 typedef enum { 748 CTFMESSAGE_FRAGGED_FLAG_CARRIER, 749 CTFMESSAGE_FLAG_RETURNED, 750 CTFMESSAGE_PLAYER_RETURNED_FLAG, 751 CTFMESSAGE_PLAYER_CAPTURED_FLAG, 752 CTFMESSAGE_PLAYER_GOT_FLAG 753 } ctfMsg_t; 754 755 // reward sounds (stored in ps->persistant[PERS_PLAYEREVENTS]) 756 #define PLAYEREVENT_DENIEDREWARD 0x0001 757 #define PLAYEREVENT_GAUNTLETREWARD 0x0002 758 //OJKFIXME: add holy shit :D 759 #define PLAYEREVENT_HOLYSHIT 0x0004 760 761 // entityState_t->event values 762 // entity events are for effects that take place reletive 763 // to an existing entities origin. Very network efficient. 764 765 // two bits at the top of the entityState->event field 766 // will be incremented with each change in the event so 767 // that an identical event started twice in a row can 768 // be distinguished. And off the value with ~EV_EVENT_BITS 769 // to retrieve the actual event number 770 #define EV_EVENT_BIT1 0x00000100 771 #define EV_EVENT_BIT2 0x00000200 772 #define EV_EVENT_BITS (EV_EVENT_BIT1|EV_EVENT_BIT2) 773 774 #define EVENT_VALID_MSEC 300 775 776 typedef enum 777 { 778 PDSOUND_NONE, 779 PDSOUND_PROTECTHIT, 780 PDSOUND_PROTECT, 781 PDSOUND_ABSORBHIT, 782 PDSOUND_ABSORB, 783 PDSOUND_FORCEJUMP, 784 PDSOUND_FORCEGRIP 785 } pdSounds_t; 786 787 typedef enum { 788 EV_NONE, 789 790 EV_CLIENTJOIN, 791 792 EV_FOOTSTEP, 793 EV_FOOTSTEP_METAL, 794 EV_FOOTSPLASH, 795 EV_FOOTWADE, 796 EV_SWIM, 797 798 EV_STEP_4, 799 EV_STEP_8, 800 EV_STEP_12, 801 EV_STEP_16, 802 803 EV_FALL, 804 805 EV_JUMP_PAD, // boing sound at origin, jump sound on player 806 807 EV_GHOUL2_MARK, //create a projectile impact mark on something with a client-side g2 instance. 808 809 EV_GLOBAL_DUEL, 810 EV_PRIVATE_DUEL, 811 812 EV_JUMP, 813 EV_ROLL, 814 EV_WATER_TOUCH, // foot touches 815 EV_WATER_LEAVE, // foot leaves 816 EV_WATER_UNDER, // head touches 817 EV_WATER_CLEAR, // head leaves 818 819 EV_ITEM_PICKUP, // normal item pickups are predictable 820 EV_GLOBAL_ITEM_PICKUP, // powerup / team sounds are broadcast to everyone 821 822 EV_VEH_FIRE, 823 824 EV_NOAMMO, 825 EV_CHANGE_WEAPON, 826 EV_FIRE_WEAPON, 827 EV_ALT_FIRE, 828 EV_SABER_ATTACK, 829 EV_SABER_HIT, 830 EV_SABER_BLOCK, 831 EV_SABER_CLASHFLARE, 832 EV_SABER_UNHOLSTER, 833 EV_BECOME_JEDIMASTER, 834 EV_DISRUPTOR_MAIN_SHOT, 835 EV_DISRUPTOR_SNIPER_SHOT, 836 EV_DISRUPTOR_SNIPER_MISS, 837 EV_DISRUPTOR_HIT, 838 EV_DISRUPTOR_ZOOMSOUND, 839 840 EV_PREDEFSOUND, 841 842 EV_TEAM_POWER, 843 844 EV_SCREENSHAKE, 845 846 EV_LOCALTIMER, 847 848 EV_USE, // +Use key 849 850 EV_USE_ITEM0, 851 EV_USE_ITEM1, 852 EV_USE_ITEM2, 853 EV_USE_ITEM3, 854 EV_USE_ITEM4, 855 EV_USE_ITEM5, 856 EV_USE_ITEM6, 857 EV_USE_ITEM7, 858 EV_USE_ITEM8, 859 EV_USE_ITEM9, 860 EV_USE_ITEM10, 861 EV_USE_ITEM11, 862 EV_USE_ITEM12, 863 EV_USE_ITEM13, 864 EV_USE_ITEM14, 865 EV_USE_ITEM15, 866 867 EV_ITEMUSEFAIL, 868 869 EV_ITEM_RESPAWN, 870 EV_ITEM_POP, 871 EV_PLAYER_TELEPORT_IN, 872 EV_PLAYER_TELEPORT_OUT, 873 874 EV_GRENADE_BOUNCE, // eventParm will be the soundindex 875 EV_MISSILE_STICK, // eventParm will be the soundindex 876 877 EV_PLAY_EFFECT, 878 EV_PLAY_EFFECT_ID, 879 EV_PLAY_PORTAL_EFFECT_ID, 880 881 EV_PLAYDOORSOUND, 882 EV_PLAYDOORLOOPSOUND, 883 EV_BMODEL_SOUND, 884 885 EV_MUTE_SOUND, 886 EV_VOICECMD_SOUND, 887 EV_GENERAL_SOUND, 888 EV_GLOBAL_SOUND, // no attenuation 889 EV_GLOBAL_TEAM_SOUND, 890 EV_ENTITY_SOUND, 891 892 EV_PLAY_ROFF, 893 894 EV_GLASS_SHATTER, 895 EV_DEBRIS, 896 EV_MISC_MODEL_EXP, 897 898 EV_CONC_ALT_IMPACT, 899 900 EV_MISSILE_HIT, 901 EV_MISSILE_MISS, 902 EV_MISSILE_MISS_METAL, 903 EV_BULLET, // otherEntity is the shooter 904 905 EV_PAIN, 906 EV_DEATH1, 907 EV_DEATH2, 908 EV_DEATH3, 909 EV_OBITUARY, 910 911 #ifdef BASE_COMPAT 912 EV_POWERUP_QUAD, 913 EV_POWERUP_BATTLESUIT, 914 #endif // BASE_COMPAT 915 916 EV_FORCE_DRAINED, 917 918 EV_GIB_PLAYER, // gib a previously living player 919 EV_SCOREPLUM, // score plum 920 921 EV_CTFMESSAGE, 922 923 EV_BODYFADE, 924 925 EV_SIEGE_ROUNDOVER, 926 EV_SIEGE_OBJECTIVECOMPLETE, 927 928 EV_DESTROY_GHOUL2_INSTANCE, 929 930 EV_DESTROY_WEAPON_MODEL, 931 932 EV_GIVE_NEW_RANK, 933 EV_SET_FREE_SABER, 934 EV_SET_FORCE_DISABLE, 935 936 EV_WEAPON_CHARGE, 937 EV_WEAPON_CHARGE_ALT, 938 939 EV_SHIELD_HIT, 940 941 EV_DEBUG_LINE, 942 EV_TESTLINE, 943 EV_STOPLOOPINGSOUND, 944 EV_STARTLOOPINGSOUND, 945 EV_TAUNT, 946 947 //rww - Begin NPC sound events 948 EV_ANGER1, //Say when acquire an enemy when didn't have one before 949 EV_ANGER2, 950 EV_ANGER3, 951 952 EV_VICTORY1, //Say when killed an enemy 953 EV_VICTORY2, 954 EV_VICTORY3, 955 956 EV_CONFUSE1, //Say when confused 957 EV_CONFUSE2, 958 EV_CONFUSE3, 959 960 EV_PUSHED1, //Say when pushed 961 EV_PUSHED2, 962 EV_PUSHED3, 963 964 EV_CHOKE1, //Say when choking 965 EV_CHOKE2, 966 EV_CHOKE3, 967 968 EV_FFWARN, //ffire founds 969 EV_FFTURN, 970 //extra sounds for ST 971 EV_CHASE1, 972 EV_CHASE2, 973 EV_CHASE3, 974 EV_COVER1, 975 EV_COVER2, 976 EV_COVER3, 977 EV_COVER4, 978 EV_COVER5, 979 EV_DETECTED1, 980 EV_DETECTED2, 981 EV_DETECTED3, 982 EV_DETECTED4, 983 EV_DETECTED5, 984 EV_LOST1, 985 EV_OUTFLANK1, 986 EV_OUTFLANK2, 987 EV_ESCAPING1, 988 EV_ESCAPING2, 989 EV_ESCAPING3, 990 EV_GIVEUP1, 991 EV_GIVEUP2, 992 EV_GIVEUP3, 993 EV_GIVEUP4, 994 EV_LOOK1, 995 EV_LOOK2, 996 EV_SIGHT1, 997 EV_SIGHT2, 998 EV_SIGHT3, 999 EV_SOUND1, 1000 EV_SOUND2, 1001 EV_SOUND3, 1002 EV_SUSPICIOUS1, 1003 EV_SUSPICIOUS2, 1004 EV_SUSPICIOUS3, 1005 EV_SUSPICIOUS4, 1006 EV_SUSPICIOUS5, 1007 //extra sounds for Jedi 1008 EV_COMBAT1, 1009 EV_COMBAT2, 1010 EV_COMBAT3, 1011 EV_JDETECTED1, 1012 EV_JDETECTED2, 1013 EV_JDETECTED3, 1014 EV_TAUNT1, 1015 EV_TAUNT2, 1016 EV_TAUNT3, 1017 EV_JCHASE1, 1018 EV_JCHASE2, 1019 EV_JCHASE3, 1020 EV_JLOST1, 1021 EV_JLOST2, 1022 EV_JLOST3, 1023 EV_DEFLECT1, 1024 EV_DEFLECT2, 1025 EV_DEFLECT3, 1026 EV_GLOAT1, 1027 EV_GLOAT2, 1028 EV_GLOAT3, 1029 EV_PUSHFAIL, 1030 1031 EV_SIEGESPEC, 1032 1033 EV_NUM_ENTITY_EVENTS 1034 } entity_event_t; // There is a maximum of 256 events (8 bits transmission, 2 high bits for uniqueness) 1035 1036 1037 typedef enum { 1038 GTS_RED_CAPTURE, 1039 GTS_BLUE_CAPTURE, 1040 GTS_RED_RETURN, 1041 GTS_BLUE_RETURN, 1042 GTS_RED_TAKEN, 1043 GTS_BLUE_TAKEN, 1044 GTS_REDTEAM_SCORED, 1045 GTS_BLUETEAM_SCORED, 1046 GTS_REDTEAM_TOOK_LEAD, 1047 GTS_BLUETEAM_TOOK_LEAD, 1048 GTS_TEAMS_ARE_TIED 1049 } global_team_sound_t; 1050 1051 1052 1053 typedef enum { 1054 TEAM_FREE, 1055 TEAM_RED, 1056 TEAM_BLUE, 1057 TEAM_SPECTATOR, 1058 1059 TEAM_NUM_TEAMS 1060 } team_t; 1061 1062 typedef enum { 1063 DUELTEAM_FREE, 1064 DUELTEAM_LONE, 1065 DUELTEAM_DOUBLE, 1066 1067 DUELTEAM_SINGLE, // for regular duel matches (not power duel) 1068 } duelTeam_t; 1069 1070 // Time between location updates 1071 #define TEAM_LOCATION_UPDATE_TIME 1000 1072 1073 // How many players on the overlay 1074 #define TEAM_MAXOVERLAY 32 1075 1076 //team task 1077 typedef enum { 1078 TEAMTASK_NONE, 1079 TEAMTASK_OFFENSE, 1080 TEAMTASK_DEFENSE, 1081 TEAMTASK_PATROL, 1082 TEAMTASK_FOLLOW, 1083 TEAMTASK_RETRIEVE, 1084 TEAMTASK_ESCORT, 1085 TEAMTASK_CAMP 1086 } teamtask_t; 1087 1088 // means of death 1089 typedef enum { 1090 MOD_UNKNOWN, 1091 MOD_STUN_BATON, 1092 MOD_MELEE, 1093 MOD_SABER, 1094 MOD_BRYAR_PISTOL, 1095 MOD_BRYAR_PISTOL_ALT, 1096 MOD_BLASTER, 1097 MOD_TURBLAST, 1098 MOD_DISRUPTOR, 1099 MOD_DISRUPTOR_SPLASH, 1100 MOD_DISRUPTOR_SNIPER, 1101 MOD_BOWCASTER, 1102 MOD_REPEATER, 1103 MOD_REPEATER_ALT, 1104 MOD_REPEATER_ALT_SPLASH, 1105 MOD_DEMP2, 1106 MOD_DEMP2_ALT, 1107 MOD_FLECHETTE, 1108 MOD_FLECHETTE_ALT_SPLASH, 1109 MOD_ROCKET, 1110 MOD_ROCKET_SPLASH, 1111 MOD_ROCKET_HOMING, 1112 MOD_ROCKET_HOMING_SPLASH, 1113 MOD_THERMAL, 1114 MOD_THERMAL_SPLASH, 1115 MOD_TRIP_MINE_SPLASH, 1116 MOD_TIMED_MINE_SPLASH, 1117 MOD_DET_PACK_SPLASH, 1118 MOD_VEHICLE, 1119 MOD_CONC, 1120 MOD_CONC_ALT, 1121 MOD_FORCE_DARK, 1122 MOD_SENTRY, 1123 MOD_WATER, 1124 MOD_SLIME, 1125 MOD_LAVA, 1126 MOD_CRUSH, 1127 MOD_TELEFRAG, 1128 MOD_FALLING, 1129 MOD_SUICIDE, 1130 MOD_TARGET_LASER, 1131 MOD_TRIGGER_HURT, 1132 MOD_TEAM_CHANGE, 1133 //AURELIO: when/if you put this back in, remember to make a case for it in all the other places where 1134 //mod's are checked. Also, it probably isn't the most elegant solution for what you want - just add 1135 //a frag back to the player after you call the player_die (and keep a local of his pre-death score to 1136 //make sure he actually lost points, there may be cases where you don't lose points on changing teams 1137 //or suiciding, and so you would actually be giving him a point) -Rich 1138 // I put it back in for now, if it becomes a problem we'll work around it later (it shouldn't though)... 1139 MOD_MAX 1140 } meansOfDeath_t; 1141 1142 1143 //--------------------------------------------------------- 1144 1145 // gitem_t->type 1146 typedef enum { 1147 IT_BAD, 1148 IT_WEAPON, // EFX: rotate + upscale + minlight 1149 IT_AMMO, // EFX: rotate 1150 IT_ARMOR, // EFX: rotate + minlight 1151 IT_HEALTH, // EFX: static external sphere + rotating internal 1152 IT_POWERUP, // instant on, timer based 1153 // EFX: rotate + external ring that rotates 1154 IT_HOLDABLE, // single use, holdable item 1155 // EFX: rotate + bob 1156 IT_PERSISTANT_POWERUP, 1157 IT_TEAM 1158 } itemType_t; 1159 1160 #define MAX_ITEM_MODELS 4 1161 1162 typedef struct gitem_s { 1163 char *classname; // spawning name 1164 char *pickup_sound; 1165 char *world_model[MAX_ITEM_MODELS]; 1166 char *view_model; 1167 char *icon; 1168 // char *pickup_name; // for printing on pickup 1169 1170 int quantity; // for ammo how much, or duration of powerup 1171 itemType_t giType; // IT_* flags 1172 1173 int giTag; 1174 1175 char *precaches; // string of all models and images this item will use 1176 char *sounds; // string of all sounds this item will use 1177 char *description; 1178 } gitem_t; 1179 1180 // included in both the game dll and the client 1181 1182 extern gitem_t bg_itemlist[]; 1183 extern int bg_numItems; 1184 1185 float vectoyaw( const vec3_t vec ); 1186 1187 gitem_t *BG_FindItem( const char *classname ); 1188 gitem_t *BG_FindItemForWeapon( weapon_t weapon ); 1189 gitem_t *BG_FindItemForPowerup( powerup_t pw ); 1190 gitem_t *BG_FindItemForHoldable( holdable_t pw ); 1191 #define ITEM_INDEX(x) ((x)-bg_itemlist) 1192 1193 qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const playerState_t *ps ); 1194 1195 1196 1197 #define SABER_BLOCK_DUR 150 // number of milliseconds a block animation should take. 1198 1199 1200 1201 // g_dmflags->integer flags 1202 #define DF_NO_FALLING 8 1203 #define DF_FIXED_FOV 16 1204 #define DF_NO_FOOTSTEPS 32 1205 1206 //rwwRMG - added in CONTENTS_TERRAIN 1207 // content masks 1208 #define MASK_ALL (0xFFFFFFFFu) 1209 #define MASK_SOLID (CONTENTS_SOLID|CONTENTS_TERRAIN) 1210 #define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_BODY|CONTENTS_TERRAIN) 1211 #define MASK_NPCSOLID (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_BODY|CONTENTS_TERRAIN) 1212 #define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_TERRAIN) 1213 #define MASK_WATER (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME) 1214 #define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA|CONTENTS_TERRAIN) 1215 #define MASK_SHOT (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_CORPSE|CONTENTS_TERRAIN) 1216 1217 1218 // ET_FX States (stored in modelindex2) 1219 1220 #define FX_STATE_OFF 0 1221 #define FX_STATE_ONE_SHOT 1 1222 #define FX_STATE_ONE_SHOT_LIMIT 10 1223 #define FX_STATE_CONTINUOUS 20 1224 1225 // 1226 // entityState_t->eType 1227 // 1228 typedef enum { 1229 ET_GENERAL, 1230 ET_PLAYER, 1231 ET_ITEM, 1232 ET_MISSILE, 1233 ET_SPECIAL, // rww - force fields 1234 ET_HOLOCRON, // rww - holocron icon displays 1235 ET_MOVER, 1236 ET_BEAM, 1237 ET_PORTAL, 1238 ET_SPEAKER, 1239 ET_PUSH_TRIGGER, 1240 ET_TELEPORT_TRIGGER, 1241 ET_INVISIBLE, 1242 ET_NPC, // ghoul2 player-like entity 1243 ET_TEAM, 1244 ET_BODY, 1245 ET_TERRAIN, 1246 ET_FX, 1247 1248 ET_EVENTS // any of the EV_* events can be added freestanding 1249 // by setting eType to ET_EVENTS + eventNum 1250 // this avoids having to set eFlags and eventNum 1251 } entityType_t; 1252 1253 // Okay, here lies the much-dreaded Pat-created FSM movement chart... Heretic II strikes again! 1254 // Why am I inflicting this on you? Well, it's better than hardcoded states. 1255 // Ideally this will be replaced with an external file or more sophisticated move-picker 1256 // once the game gets out of prototype stage. 1257 1258 // rww - Moved all this to bg_public so that we can access the saberMoveData stuff on the cgame 1259 // which is currently used for determining if a saber trail should be rendered in a given frame 1260 #ifdef LS_NONE 1261 #undef LS_NONE 1262 #endif 1263 1264 typedef enum { 1265 //totally invalid 1266 LS_INVALID = -1, 1267 // Invalid, or saber not armed 1268 LS_NONE = 0, 1269 1270 // General movements with saber 1271 LS_READY, 1272 LS_DRAW, 1273 LS_PUTAWAY, 1274 1275 // Attacks 1276 LS_A_TL2BR,//4 1277 LS_A_L2R, 1278 LS_A_BL2TR, 1279 LS_A_BR2TL, 1280 LS_A_R2L, 1281 LS_A_TR2BL, 1282 LS_A_T2B, 1283 LS_A_BACKSTAB, 1284 LS_A_BACK, 1285 LS_A_BACK_CR, 1286 LS_ROLL_STAB, 1287 LS_A_LUNGE, 1288 LS_A_JUMP_T__B_, 1289 LS_A_FLIP_STAB, 1290 LS_A_FLIP_SLASH, 1291 LS_JUMPATTACK_DUAL, 1292 LS_JUMPATTACK_ARIAL_LEFT, 1293 LS_JUMPATTACK_ARIAL_RIGHT, 1294 LS_JUMPATTACK_CART_LEFT, 1295 LS_JUMPATTACK_CART_RIGHT, 1296 LS_JUMPATTACK_STAFF_LEFT, 1297 LS_JUMPATTACK_STAFF_RIGHT, 1298 LS_BUTTERFLY_LEFT, 1299 LS_BUTTERFLY_RIGHT, 1300 LS_A_BACKFLIP_ATK, 1301 LS_SPINATTACK_DUAL, 1302 LS_SPINATTACK, 1303 LS_LEAP_ATTACK, 1304 LS_SWOOP_ATTACK_RIGHT, 1305 LS_SWOOP_ATTACK_LEFT, 1306 LS_TAUNTAUN_ATTACK_RIGHT, 1307 LS_TAUNTAUN_ATTACK_LEFT, 1308 LS_KICK_F, 1309 LS_KICK_B, 1310 LS_KICK_R, 1311 LS_KICK_L, 1312 LS_KICK_S, 1313 LS_KICK_BF, 1314 LS_KICK_RL, 1315 LS_KICK_F_AIR, 1316 LS_KICK_B_AIR, 1317 LS_KICK_R_AIR, 1318 LS_KICK_L_AIR, 1319 LS_STABDOWN, 1320 LS_STABDOWN_STAFF, 1321 LS_STABDOWN_DUAL, 1322 LS_DUAL_SPIN_PROTECT, 1323 LS_STAFF_SOULCAL, 1324 LS_A1_SPECIAL, 1325 LS_A2_SPECIAL, 1326 LS_A3_SPECIAL, 1327 LS_UPSIDE_DOWN_ATTACK, 1328 LS_PULL_ATTACK_STAB, 1329 LS_PULL_ATTACK_SWING, 1330 LS_SPINATTACK_ALORA, 1331 LS_DUAL_FB, 1332 LS_DUAL_LR, 1333 LS_HILT_BASH, 1334 1335 //starts 1336 LS_S_TL2BR,//26 1337 LS_S_L2R, 1338 LS_S_BL2TR,//# Start of attack chaining to SLASH LR2UL 1339 LS_S_BR2TL,//# Start of attack chaining to SLASH LR2UL 1340 LS_S_R2L, 1341 LS_S_TR2BL, 1342 LS_S_T2B, 1343 1344 //returns 1345 LS_R_TL2BR,//33 1346 LS_R_L2R, 1347 LS_R_BL2TR, 1348 LS_R_BR2TL, 1349 LS_R_R2L, 1350 LS_R_TR2BL, 1351 LS_R_T2B, 1352 1353 //transitions 1354 LS_T1_BR__R,//40 1355 LS_T1_BR_TR, 1356 LS_T1_BR_T_, 1357 LS_T1_BR_TL, 1358 LS_T1_BR__L, 1359 LS_T1_BR_BL, 1360 LS_T1__R_BR,//46 1361 LS_T1__R_TR, 1362 LS_T1__R_T_, 1363 LS_T1__R_TL, 1364 LS_T1__R__L, 1365 LS_T1__R_BL, 1366 LS_T1_TR_BR,//52 1367 LS_T1_TR__R, 1368 LS_T1_TR_T_, 1369 LS_T1_TR_TL, 1370 LS_T1_TR__L, 1371 LS_T1_TR_BL, 1372 LS_T1_T__BR,//58 1373 LS_T1_T___R, 1374 LS_T1_T__TR, 1375 LS_T1_T__TL, 1376 LS_T1_T___L, 1377 LS_T1_T__BL, 1378 LS_T1_TL_BR,//64 1379 LS_T1_TL__R, 1380 LS_T1_TL_TR, 1381 LS_T1_TL_T_, 1382 LS_T1_TL__L, 1383 LS_T1_TL_BL, 1384 LS_T1__L_BR,//70 1385 LS_T1__L__R, 1386 LS_T1__L_TR, 1387 LS_T1__L_T_, 1388 LS_T1__L_TL, 1389 LS_T1__L_BL, 1390 LS_T1_BL_BR,//76 1391 LS_T1_BL__R, 1392 LS_T1_BL_TR, 1393 LS_T1_BL_T_, 1394 LS_T1_BL_TL, 1395 LS_T1_BL__L, 1396 1397 //Bounces 1398 LS_B1_BR, 1399 LS_B1__R, 1400 LS_B1_TR, 1401 LS_B1_T_, 1402 LS_B1_TL, 1403 LS_B1__L, 1404 LS_B1_BL, 1405 1406 //Deflected attacks 1407 LS_D1_BR, 1408 LS_D1__R, 1409 LS_D1_TR, 1410 LS_D1_T_, 1411 LS_D1_TL, 1412 LS_D1__L, 1413 LS_D1_BL, 1414 LS_D1_B_, 1415 1416 //Reflected attacks 1417 LS_V1_BR, 1418 LS_V1__R, 1419 LS_V1_TR, 1420 LS_V1_T_, 1421 LS_V1_TL, 1422 LS_V1__L, 1423 LS_V1_BL, 1424 LS_V1_B_, 1425 1426 // Broken parries 1427 LS_H1_T_,// 1428 LS_H1_TR, 1429 LS_H1_TL, 1430 LS_H1_BR, 1431 LS_H1_B_, 1432 LS_H1_BL, 1433 1434 // Knockaways 1435 LS_K1_T_,// 1436 LS_K1_TR, 1437 LS_K1_TL, 1438 LS_K1_BR, 1439 LS_K1_BL, 1440 1441 // Parries 1442 LS_PARRY_UP,// 1443 LS_PARRY_UR, 1444 LS_PARRY_UL, 1445 LS_PARRY_LR, 1446 LS_PARRY_LL, 1447 1448 // Projectile Reflections 1449 LS_REFLECT_UP,// 1450 LS_REFLECT_UR, 1451 LS_REFLECT_UL, 1452 LS_REFLECT_LR, 1453 LS_REFLECT_LL, 1454 1455 LS_MOVE_MAX// 1456 } saberMoveName_t; 1457 1458 typedef enum { 1459 Q_BR, 1460 Q_R, 1461 Q_TR, 1462 Q_T, 1463 Q_TL, 1464 Q_L, 1465 Q_BL, 1466 Q_B, 1467 Q_NUM_QUADS 1468 } saberQuadrant_t; 1469 1470 typedef struct saberMoveData_s { 1471 char *name; 1472 int animToUse; 1473 int startQuad; 1474 int endQuad; 1475 unsigned animSetFlags; 1476 int blendTime; 1477 int blocking; 1478 saberMoveName_t chain_idle; // What move to call if the attack button is not pressed at the end of this anim 1479 saberMoveName_t chain_attack; // What move to call if the attack button (and nothing else) is pressed 1480 qboolean trailLength; 1481 } saberMoveData_t; 1482 extern saberMoveData_t saberMoveData[LS_MOVE_MAX]; 1483 1484 1485 typedef enum saberType_e { 1486 SABER_NONE = 0, 1487 SABER_SINGLE, 1488 SABER_STAFF, 1489 SABER_DAGGER, 1490 SABER_BROAD, 1491 SABER_PRONG, 1492 SABER_ARC, 1493 SABER_SAI, 1494 SABER_CLAW, 1495 SABER_LANCE, 1496 SABER_STAR, 1497 SABER_TRIDENT, 1498 SABER_SITH_SWORD, 1499 NUM_SABERS 1500 } saberType_t; 1501 1502 typedef struct saberTrail_s { 1503 // Actual trail stuff 1504 int inAction; // controls whether should we even consider starting one 1505 int duration; // how long each trail seg stays in existence 1506 int lastTime; // time a saber segement was last stored 1507 vec3_t base, dualbase; 1508 vec3_t tip, dualtip; 1509 1510 // Marks stuff 1511 qboolean haveOldPos[2]; 1512 vec3_t oldPos[2]; 1513 vec3_t oldNormal[2]; // store this in case we don't have a connect-the-dots situation 1514 // ..then we'll need the normal to project a mark blob onto the impact point 1515 } saberTrail_t; 1516 1517 typedef struct bladeInfo_s { 1518 qboolean active; 1519 saber_colors_t color; 1520 float radius; 1521 float length, lengthMax, lengthOld; 1522 float desiredLength; 1523 vec3_t muzzlePoint, muzzlePointOld; 1524 vec3_t muzzleDir, muzzleDirOld; 1525 saberTrail_t trail; 1526 int hitWallDebounceTime; 1527 int storageTime; 1528 int extendDebounce; 1529 } bladeInfo_t; 1530 #define MAX_BLADES 8 1531 1532 typedef enum saber_styles_e { 1533 SS_NONE=0, 1534 SS_FAST, 1535 SS_MEDIUM, 1536 SS_STRONG, 1537 SS_DESANN, 1538 SS_TAVION, 1539 SS_DUAL, 1540 SS_STAFF, 1541 SS_NUM_SABER_STYLES 1542 } saber_styles_t; 1543 1544 //SABER FLAGS 1545 //Old bools converted to a flag now 1546 #define SFL_NOT_LOCKABLE (1<<0)//can't get into a saberlock 1547 #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? 1548 #define SFL_NOT_DISARMABLE (1<<2)//can't be dropped 1549 #define SFL_NOT_ACTIVE_BLOCKING (1<<3)//don't to try to block incoming shots with this saber 1550 #define SFL_TWO_HANDED (1<<4)//uses both hands 1551 #define SFL_SINGLE_BLADE_THROWABLE (1<<5)//can throw this saber if only the first blade is on 1552 #define SFL_RETURN_DAMAGE (1<<6)//when returning from a saber throw, it keeps spinning and doing damage 1553 //NEW FLAGS 1554 #define SFL_ON_IN_WATER (1<<7)//if set, weapon stays active even in water 1555 #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) 1556 #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. 1557 //#define SFL_STICK_ON_IMPACT (1<<?)//if set, the saber will stick in the wall when thrown and hits solid architecture (good for sabers that are meant to be thrown). 1558 //#define SFL_NO_ATTACK (1<<?)//if set, you cannot attack with the saber (for sabers/weapons that are meant to be thrown only, not used as melee weapons). 1559 //Move Restrictions 1560 #define SFL_NO_PULL_ATTACK (1<<10)//if set, cannot do pull+attack move (move not available in MP anyway) 1561 #define SFL_NO_BACK_ATTACK (1<<11)//if set, cannot do back-stab moves 1562 #define SFL_NO_STABDOWN (1<<12)//if set, cannot do stabdown move (when enemy is on ground) 1563 #define SFL_NO_WALL_RUNS (1<<13)//if set, cannot side-run or forward-run on walls 1564 #define SFL_NO_WALL_FLIPS (1<<14)//if set, cannot do backflip off wall or side-flips off walls 1565 #define SFL_NO_WALL_GRAB (1<<15)//if set, cannot grab wall & jump off 1566 #define SFL_NO_ROLLS (1<<16)//if set, cannot roll 1567 #define SFL_NO_FLIPS (1<<17)//if set, cannot do flips 1568 #define SFL_NO_CARTWHEELS (1<<18)//if set, cannot do cartwheels 1569 #define SFL_NO_KICKS (1<<19)//if set, cannot do kicks (can't do kicks anyway if using a throwable saber/sword) 1570 #define SFL_NO_MIRROR_ATTACKS (1<<20)//if set, cannot do the simultaneous attack left/right moves (only available in Dual Lightsaber Combat Style) 1571 #define SFL_NO_ROLL_STAB (1<<21)//if set, cannot do roll-stab move at end of roll 1572 //SABER FLAGS2 1573 //Primary Blade Style 1574 #define SFL2_NO_WALL_MARKS (1<<0)//if set, stops the saber from drawing marks on the world (good for real-sword type mods) 1575 #define SFL2_NO_DLIGHT (1<<1)//if set, stops the saber from drawing a dynamic light (good for real-sword type mods) 1576 #define SFL2_NO_BLADE (1<<2)//if set, stops the saber from drawing a blade (good for real-sword type mods) 1577 #define SFL2_NO_CLASH_FLARE (1<<3)//if set, the saber will not do the big, white clash flare with other sabers 1578 #define SFL2_NO_DISMEMBERMENT (1<<4)//if set, the saber never does dismemberment (good for pointed/blunt melee weapons) 1579 #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) 1580 #define SFL2_ALWAYS_BLOCK (1<<6)//if set, the blades will always be blocking (good for things like shields that should always block) 1581 #define SFL2_NO_MANUAL_DEACTIVATE (1<<7)//if set, the blades cannot manually be toggled on and off 1582 #define SFL2_TRANSITION_DAMAGE (1<<8)//if set, the blade does damage in start, transition and return anims (like strong style does) 1583 //Secondary Blade Style 1584 #define SFL2_NO_WALL_MARKS2 (1<<9)//if set, stops the saber from drawing marks on the world (good for real-sword type mods) 1585 #define SFL2_NO_DLIGHT2 (1<<10)//if set, stops the saber from drawing a dynamic light (good for real-sword type mods) 1586 #define SFL2_NO_BLADE2 (1<<11)//if set, stops the saber from drawing a blade (good for real-sword type mods) 1587 #define SFL2_NO_CLASH_FLARE2 (1<<12)//if set, the saber will not do the big, white clash flare with other sabers 1588 #define SFL2_NO_DISMEMBERMENT2 (1<<13)//if set, the saber never does dismemberment (good for pointed/blunt melee weapons) 1589 #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) 1590 #define SFL2_ALWAYS_BLOCK2 (1<<15)//if set, the blades will always be blocking (good for things like shields that should always block) 1591 #define SFL2_NO_MANUAL_DEACTIVATE2 (1<<16)//if set, the blades cannot manually be toggled on and off 1592 #define SFL2_TRANSITION_DAMAGE2 (1<<17)//if set, the blade does damage in start, transition and return anims (like strong style does) 1593 1594 #define SABER_NAME_LENGTH (64) 1595 typedef struct saberInfo_s { 1596 char name[SABER_NAME_LENGTH]; // entry in sabers.cfg, if any 1597 char fullName[SABER_NAME_LENGTH]; // the "Proper Name" of the saber, shown in UI 1598 saberType_t type; // none, single or staff 1599 char model[MAX_QPATH]; // hilt model 1600 qhandle_t skin; // registered skin id 1601 int soundOn; // game soundindex for turning on sound 1602 int soundLoop; // game soundindex for hum/loop sound 1603 int soundOff; // game soundindex for turning off sound 1604 int numBlades; 1605 bladeInfo_t blade[MAX_BLADES]; // blade info - like length, trail, origin, dir, etc. 1606 int stylesLearned; // styles you get when you get this saber, if any 1607 int stylesForbidden; // styles you cannot use with this saber, if any 1608 int maxChain; // how many moves can be chained in a row with this weapon (-1 is infinite, 0 is use default behavior) 1609 int forceRestrictions; // force powers that cannot be used while this saber is on (bitfield) - FIXME: maybe make this a limit on the max level, per force power, that can be used with this type? 1610 int lockBonus; // in saberlocks, this type of saber pushes harder or weaker 1611 int parryBonus; // added to strength of parry with this saber 1612 int breakParryBonus, breakParryBonus2; // added to strength when hit a parry 1613 int disarmBonus, disarmBonus2; // added to disarm chance when win saberlock or have a good parry (knockaway) 1614 saber_styles_t singleBladeStyle; // makes it so that you use a different style if you only have the first blade active 1615 1616 //these values are global to the saber, like all of the ones above 1617 int saberFlags, saberFlags2; // from SFL(2)_ list above 1618 1619 //done in cgame (client-side code) 1620 qhandle_t spinSound; // none - if set, plays this sound as it spins when thrown 1621 qhandle_t swingSound[3]; // none - if set, plays one of these 3 sounds when swung during an attack - NOTE: must provide all 3!!! 1622 1623 //done in game (server-side code) 1624 float moveSpeedScale; // 1.0 - you move faster/slower when using this saber 1625 float animSpeedScale; // 1.0 - plays normal attack animations faster/slower 1626 1627 //done in both cgame and game (BG code) 1628 int kataMove; // LS_INVALID - if set, player will execute this move when they press both attack buttons at the same time 1629 int lungeAtkMove; // LS_INVALID - if set, player will execute this move when they crouch+fwd+attack 1630 int jumpAtkUpMove; // LS_INVALID - if set, player will execute this move when they jump+attack 1631 int jumpAtkFwdMove; // LS_INVALID - if set, player will execute this move when they jump+fwd+attack 1632 int jumpAtkBackMove; // LS_INVALID - if set, player will execute this move when they jump+back+attack 1633 int jumpAtkRightMove; // LS_INVALID - if set, player will execute this move when they jump+rightattack 1634 int jumpAtkLeftMove; // LS_INVALID - if set, player will execute this move when they jump+left+attack 1635 int readyAnim; // -1 - anim to use when standing idle 1636 int drawAnim; // -1 - anim to use when drawing weapon 1637 int putawayAnim; // -1 - anim to use when putting weapon away 1638 int tauntAnim; // -1 - anim to use when hit "taunt" 1639 int bowAnim; // -1 - anim to use when hit "bow" 1640 int meditateAnim; // -1 - anim to use when hit "meditate" 1641 int flourishAnim; // -1 - anim to use when hit "flourish" 1642 int gloatAnim; // -1 - anim to use when hit "gloat" 1643 1644 //***NOTE: you can only have a maximum of 2 "styles" of blades, so this next value, "bladeStyle2Start" is the number of the first blade to use these value on... all blades before this use the normal values above, all blades at and after this number use the secondary values below*** 1645 int bladeStyle2Start; // 0 - if set, blades from this number and higher use the following values (otherwise, they use the normal values already set) 1646 1647 //***The following can be different for the extra blades - not setting them individually defaults them to the value for the whole saber (and first blade)*** 1648 1649 //done in cgame (client-side code) 1650 int trailStyle, trailStyle2; // 0 - default (0) is normal, 1 is a motion blur and 2 is no trail at all (good for real-sword type mods) 1651 int g2MarksShader, g2MarksShader2; // none - if set, the game will use this shader for marks on enemies instead of the default "gfx/damage/saberglowmark" 1652 int g2WeaponMarkShader, g2WeaponMarkShader2;// none - if set, the game will ry to project this shader onto the weapon when it damages a person (good for a blood splatter on the weapon) 1653 qhandle_t hitSound[3], hit2Sound[3]; // none - if set, plays one of these 3 sounds when saber hits a person - NOTE: must provide all 3!!! 1654 qhandle_t blockSound[3], block2Sound[3]; // none - if set, plays one of these 3 sounds when saber/sword hits another saber/sword - NOTE: must provide all 3!!! 1655 qhandle_t bounceSound[3], bounce2Sound[3]; // none - if set, plays one of these 3 sounds when saber/sword hits a wall and bounces off (must set bounceOnWall to 1 to use these sounds) - NOTE: must provide all 3!!! 1656 int blockEffect, blockEffect2; // none - if set, plays this effect when the saber/sword hits another saber/sword (instead of "saber/saber_block.efx") 1657 int hitPersonEffect, hitPersonEffect2; // none - if set, plays this effect when the saber/sword hits a person (instead of "saber/blood_sparks_mp.efx") 1658 int hitOtherEffect, hitOtherEffect2; // none - if set, plays this effect when the saber/sword hits something else damagable (instead of "saber/saber_cut.efx") 1659 int bladeEffect, bladeEffect2; // none - if set, plays this effect at the blade tag 1660 1661 //done in game (server-side code) 1662 float knockbackScale, knockbackScale2; // 0 - if non-zero, uses damage done to calculate an appropriate amount of knockback 1663 float damageScale, damageScale2; // 1 - scale up or down the damage done by the saber 1664 float splashRadius, splashRadius2; // 0 - radius of splashDamage 1665 int splashDamage, splashDamage2; // 0 - amount of splashDamage, 100% at a distance of 0, 0% at a distance = splashRadius 1666 float splashKnockback, splashKnockback2; // 0 - amount of splashKnockback, 100% at a distance of 0, 0% at a distance = splashRadius 1667 } saberInfo_t; 1668 #define MAX_SABERS 2 1669 1670 1671 bgEntity_t *PM_BGEntForNum( int num ); 1672 qboolean BG_KnockDownable(playerState_t *ps); 1673 qboolean BG_LegalizedForcePowers(char *powerOut, size_t powerOutSize, int maxRank, qboolean freeSaber, int teamForce, int gametype, int fpDisabled); 1674 1675 1676 // given a boltmatrix, return in vec a normalised vector for the axis requested in flags 1677 void BG_GiveMeVectorFromMatrix(mdxaBone_t *boltMatrix, int flags, vec3_t vec); 1678 1679 void BG_IK_MoveArm(void *ghoul2, int lHandBolt, int time, entityState_t *ent, int basePose, vec3_t desiredPos, qboolean *ikInProgress, 1680 vec3_t origin, vec3_t angles, vec3_t scale, int blendTime, qboolean forceHalt); 1681 1682 void BG_G2PlayerAngles(void *ghoul2, int motionBolt, entityState_t *cent, int time, vec3_t cent_lerpOrigin, 1683 vec3_t cent_lerpAngles, matrix3_t legs, vec3_t legsAngles, qboolean *tYawing, 1684 qboolean *tPitching, qboolean *lYawing, float *tYawAngle, float *tPitchAngle, 1685 float *lYawAngle, int frametime, vec3_t turAngles, vec3_t modelScale, int ciLegs, 1686 int ciTorso, int *corrTime, vec3_t lookAngles, vec3_t lastHeadAngles, int lookTime, 1687 entityState_t *emplaced, int *crazySmoothFactor); 1688 void BG_G2ATSTAngles(void *ghoul2, int time, vec3_t cent_lerpAngles ); 1689 1690 //BG anim utility functions: 1691 1692 int BG_AnimLength( int index, animNumber_t anim ); 1693 1694 qboolean BG_InSpecialJump( int anim ); 1695 qboolean BG_InSaberStandAnim( int anim ); 1696 qboolean BG_InReboundJump( int anim ); 1697 qboolean BG_InReboundHold( int anim ); 1698 qboolean BG_InReboundRelease( int anim ); 1699 qboolean BG_InBackFlip( int anim ); 1700 qboolean BG_DirectFlippingAnim( int anim ); 1701 qboolean BG_SaberInAttack( int move ); 1702 qboolean BG_SaberInSpecial( int move ); 1703 qboolean BG_KickMove( int move ); 1704 qboolean BG_SaberInIdle( int move ); 1705 qboolean BG_FlippingAnim( int anim ); 1706 qboolean BG_SpinningSaberAnim( int anim ); 1707 qboolean BG_SaberInSpecialAttack( int anim ); 1708 qboolean BG_SaberInKata( int saberMove ); 1709 qboolean BG_InKataAnim(int anim); 1710 qboolean BG_KickingAnim( int anim ); 1711 int BG_InGrappleMove(int anim); 1712 int BG_BrokenParryForAttack( int move ); 1713 int BG_BrokenParryForParry( int move ); 1714 int BG_KnockawayForParry( int move ); 1715 qboolean BG_InRoll( playerState_t *ps, int anim ); 1716 qboolean BG_InDeathAnim( int anim ); 1717 qboolean BG_InSaberLockOld( int anim ); 1718 qboolean BG_InSaberLock( int anim ); 1719 1720 void BG_SaberStartTransAnim( int clientNum, int saberAnimLevel, int weapon, int anim, float *animSpeed, int broken ); 1721 1722 void BG_ForcePowerDrain( playerState_t *ps, forcePowers_t forcePower, int overrideAmt ); 1723 1724 void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result ); 1725 void BG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result ); 1726 1727 void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerState_t *ps ); 1728 1729 void BG_TouchJumpPad( playerState_t *ps, entityState_t *jumppad ); 1730 1731 void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean snap ); 1732 void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s, int time, qboolean snap ); 1733 1734 qboolean BG_PlayerTouchesItem( playerState_t *ps, entityState_t *item, int atTime ); 1735 1736 void BG_InitAnimsets(void); 1737 void BG_ClearAnimsets(void); 1738 int BG_ParseAnimationFile(const char *filename, animation_t *animSet, qboolean isHumanoid); 1739 #ifndef _GAME 1740 int BG_ParseAnimationEvtFile( const char *as_filename, int animFileIndex, int eventFileIndex ); 1741 #endif 1742 1743 qboolean BG_HasAnimation(int animIndex, int animation); 1744 int BG_PickAnim( int animIndex, int minAnim, int maxAnim ); 1745 1746 int BG_GetItemIndexByTag(int tag, int type); 1747 1748 qboolean BG_IsItemSelectable(playerState_t *ps, int item); 1749 1750 qboolean BG_HasYsalamiri(int gametype, playerState_t *ps); 1751 qboolean BG_CanUseFPNow(int gametype, playerState_t *ps, int time, forcePowers_t power); 1752 1753 void *BG_Alloc ( int size ); 1754 void *BG_AllocUnaligned ( int size ); 1755 void *BG_TempAlloc( int size ); 1756 void BG_TempFree( int size ); 1757 char *BG_StringAlloc ( const char *source ); 1758 qboolean BG_OutOfMemory ( void ); 1759 1760 void BG_BLADE_ActivateTrail ( bladeInfo_t *blade, float duration ); 1761 void BG_BLADE_DeactivateTrail ( bladeInfo_t *blade, float duration ); 1762 void BG_SI_Activate( saberInfo_t *saber ); 1763 void BG_SI_Deactivate( saberInfo_t *saber ); 1764 void BG_SI_BladeActivate( saberInfo_t *saber, int iBlade, qboolean bActive ); 1765 qboolean BG_SI_Active(saberInfo_t *saber); 1766 void BG_SI_SetLength( saberInfo_t *saber, float length ); 1767 void BG_SI_SetDesiredLength(saberInfo_t *saber, float len, int bladeNum); 1768 void BG_SI_SetLengthGradual( saberInfo_t *saber, int time ); 1769 float BG_SI_Length(saberInfo_t *saber); 1770 float BG_SI_LengthMax(saberInfo_t *saber); 1771 void BG_SI_ActivateTrail ( saberInfo_t *saber, float duration ); 1772 void BG_SI_DeactivateTrail ( saberInfo_t *saber, float duration ); 1773 extern void BG_AttachToRancor( void *ghoul2,float rancYaw,vec3_t rancOrigin,int time,qhandle_t *modelList,vec3_t modelScale,qboolean inMouth,vec3_t out_origin,vec3_t out_angles,matrix3_t out_axis ); 1774 void BG_ClearRocketLock( playerState_t *ps ); 1775 1776 extern int WeaponReadyAnim[WP_NUM_WEAPONS]; 1777 extern int WeaponAttackAnim[WP_NUM_WEAPONS]; 1778 1779 extern int forcePowerDarkLight[NUM_FORCE_POWERS]; 1780 1781 1782 #define ARENAS_PER_TIER 4 1783 #define MAX_ARENAS 1024 1784 #define MAX_ARENAS_TEXT 8192 1785 1786 #define MAX_BOTS 1024 1787 #define MAX_BOTS_TEXT 8192 1788 1789 #define HYPERSPACE_TIME 4000 //For hyperspace triggers 1790 #define HYPERSPACE_TELEPORT_FRAC 0.75f 1791 #define HYPERSPACE_SPEED 10000.0f//was 30000 1792 #define HYPERSPACE_TURN_RATE 45.0f 1793 1794 extern const char *gametypeStringShort[GT_MAX_GAME_TYPE]; 1795 const char *BG_GetGametypeString( int gametype ); 1796 int BG_GetGametypeForString( const char *gametype ); 1797