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) 2005 - 2015, ioquake3 contributors 7 Copyright (C) 2013 - 2015, OpenJK contributors 8 9 This file is part of the OpenJK source code. 10 11 OpenJK is free software; you can redistribute it and/or modify it 12 under the terms of the GNU General Public License version 2 as 13 published by the Free Software Foundation. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, see <http://www.gnu.org/licenses/>. 22 =========================================================================== 23 */ 24 25 #pragma once 26 27 // g_local.h -- local definitions for game module 28 29 #include "qcommon/q_shared.h" 30 #include "bg_public.h" 31 #include "bg_vehicles.h" 32 #include "g_public.h" 33 34 typedef struct gentity_s gentity_t; 35 typedef struct gclient_s gclient_t; 36 37 //npc stuff 38 #include "b_public.h" 39 40 extern int gPainMOD; 41 extern int gPainHitLoc; 42 extern vec3_t gPainPoint; 43 44 //================================================================== 45 46 // the "gameversion" client command will print this plus compile date 47 #define GAMEVERSION "OpenJK" 48 49 #define SECURITY_LOG "security.log" 50 51 #define BODY_QUEUE_SIZE 8 52 53 #ifndef INFINITE 54 #define INFINITE 1000000 55 #endif 56 57 #define FRAMETIME 100 // msec 58 #define CARNAGE_REWARD_TIME 3000 59 #define REWARD_SPRITE_TIME 2000 60 61 #define INTERMISSION_DELAY_TIME 1000 62 #define SP_INTERMISSION_DELAY_TIME 5000 63 64 //primarily used by NPCs 65 #define START_TIME_LINK_ENTS FRAMETIME*1 // time-delay after map start at which all ents have been spawned, so can link them 66 #define START_TIME_FIND_LINKS FRAMETIME*2 // time-delay after map start at which you can find linked entities 67 #define START_TIME_MOVERS_SPAWNED FRAMETIME*2 // time-delay after map start at which all movers should be spawned 68 #define START_TIME_REMOVE_ENTS FRAMETIME*3 // time-delay after map start to remove temporary ents 69 #define START_TIME_NAV_CALC FRAMETIME*4 // time-delay after map start to connect waypoints and calc routes 70 #define START_TIME_FIND_WAYPOINT FRAMETIME*5 // time-delay after map start after which it's okay to try to find your best waypoint 71 72 // gentity->flags 73 #define FL_GODMODE 0x00000010 74 #define FL_NOTARGET 0x00000020 75 #define FL_TEAMSLAVE 0x00000400 // not the first on the team 76 #define FL_NO_KNOCKBACK 0x00000800 77 #define FL_DROPPED_ITEM 0x00001000 78 #define FL_NO_BOTS 0x00002000 // spawn point not for bot use 79 #define FL_NO_HUMANS 0x00004000 // spawn point just for bots 80 #define FL_FORCE_GESTURE 0x00008000 // force gesture on client 81 #define FL_INACTIVE 0x00010000 // inactive 82 #define FL_NAVGOAL 0x00020000 // for npc nav stuff 83 #define FL_DONT_SHOOT 0x00040000 84 #define FL_SHIELDED 0x00080000 85 #define FL_UNDYING 0x00100000 // takes damage down to 1, but never dies 86 87 //ex-eFlags -rww 88 #define FL_BOUNCE 0x00100000 // for missiles 89 #define FL_BOUNCE_HALF 0x00200000 // for missiles 90 #define FL_BOUNCE_SHRAPNEL 0x00400000 // special shrapnel flag 91 92 //vehicle game-local stuff -rww 93 #define FL_VEH_BOARDING 0x00800000 // special shrapnel flag 94 95 //breakable flags -rww 96 #define FL_DMG_BY_SABER_ONLY 0x01000000 //only take dmg from saber 97 #define FL_DMG_BY_HEAVY_WEAP_ONLY 0x02000000 //only take dmg from explosives 98 99 #define FL_BBRUSH 0x04000000 //I am a breakable brush 100 101 #ifndef FINAL_BUILD 102 #define DEBUG_SABER_BOX 103 #endif 104 105 // make sure this matches game/match.h for botlibs 106 #define EC "\x19" 107 108 #define MAX_G_SHARED_BUFFER_SIZE 8192 109 // used for communication with the engine 110 typedef union sharedBuffer_u { 111 char raw[MAX_G_SHARED_BUFFER_SIZE]; 112 T_G_ICARUS_PLAYSOUND playSound; 113 T_G_ICARUS_SET set; 114 T_G_ICARUS_LERP2POS lerp2Pos; 115 T_G_ICARUS_LERP2ORIGIN lerp2Origin; 116 T_G_ICARUS_LERP2ANGLES lerp2Angles; 117 T_G_ICARUS_GETTAG getTag; 118 T_G_ICARUS_LERP2START lerp2Start; 119 T_G_ICARUS_LERP2END lerp2End; 120 T_G_ICARUS_USE use; 121 T_G_ICARUS_KILL kill; 122 T_G_ICARUS_REMOVE remove; 123 T_G_ICARUS_PLAY play; 124 T_G_ICARUS_GETFLOAT getFloat; 125 T_G_ICARUS_GETVECTOR getVector; 126 T_G_ICARUS_GETSTRING getString; 127 T_G_ICARUS_SOUNDINDEX soundIndex; 128 T_G_ICARUS_GETSETIDFORSTRING getSetIDForString; 129 } sharedBuffer_t; 130 extern sharedBuffer_t gSharedBuffer; 131 132 // movers are things like doors, plats, buttons, etc 133 typedef enum { 134 MOVER_POS1, 135 MOVER_POS2, 136 MOVER_1TO2, 137 MOVER_2TO1 138 } moverState_t; 139 140 #define SP_PODIUM_MODEL "models/mapobjects/podium/podium4.md3" 141 142 typedef enum 143 { 144 HL_NONE = 0, 145 HL_FOOT_RT, 146 HL_FOOT_LT, 147 HL_LEG_RT, 148 HL_LEG_LT, 149 HL_WAIST, 150 HL_BACK_RT, 151 HL_BACK_LT, 152 HL_BACK, 153 HL_CHEST_RT, 154 HL_CHEST_LT, 155 HL_CHEST, 156 HL_ARM_RT, 157 HL_ARM_LT, 158 HL_HAND_RT, 159 HL_HAND_LT, 160 HL_HEAD, 161 HL_GENERIC1, 162 HL_GENERIC2, 163 HL_GENERIC3, 164 HL_GENERIC4, 165 HL_GENERIC5, 166 HL_GENERIC6, 167 HL_MAX 168 } hitLocation_t; 169 170 //============================================================================ 171 extern void *precachedKyle; 172 extern void *g2SaberInstance; 173 174 extern qboolean gEscaping; 175 extern int gEscapeTime; 176 177 struct gentity_s { 178 //rww - entstate must be first, to correspond with the bg shared entity structure 179 entityState_t s; // communicated by server to clients 180 playerState_t *playerState; //ptr to playerstate if applicable (for bg ents) 181 Vehicle_t *m_pVehicle; //vehicle data 182 void *ghoul2; //g2 instance 183 int localAnimIndex; //index locally (game/cgame) to anim data for this skel 184 vec3_t modelScale; //needed for g2 collision 185 186 //From here up must be the same as centity_t/bgEntity_t 187 188 entityShared_t r; // shared by both the server system and game 189 190 //rww - these are shared icarus things. They must be in this order as well in relation to the entityshared structure. 191 int taskID[NUM_TIDS]; 192 parms_t *parms; 193 char *behaviorSet[NUM_BSETS]; 194 char *script_targetname; 195 int delayScriptTime; 196 char *fullName; 197 198 //rww - targetname and classname are now shared as well. ICARUS needs access to them. 199 char *targetname; 200 char *classname; // set in QuakeEd 201 202 //rww - and yet more things to share. This is because the nav code is in the exe because it's all C++. 203 int waypoint; //Set once per frame, if you've moved, and if someone asks 204 int lastWaypoint; //To make sure you don't double-back 205 int lastValidWaypoint; //ALWAYS valid -used for tracking someone you lost 206 int noWaypointTime; //Debouncer - so don't keep checking every waypoint in existance every frame that you can't find one 207 int combatPoint; 208 int failedWaypoints[MAX_FAILED_NODES]; 209 int failedWaypointCheckTime; 210 211 int next_roff_time; //rww - npc's need to know when they're getting roff'd 212 213 // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER 214 // EXPECTS THE FIELDS IN THAT ORDER! 215 //================================ 216 217 struct gclient_s *client; // NULL if not a client 218 219 gNPC_t *NPC;//Only allocated if the entity becomes an NPC 220 int cantHitEnemyCounter;//HACK - Makes them look for another enemy on the same team if the one they're after can't be hit 221 222 qboolean noLumbar; //see note in cg_local.h 223 224 qboolean inuse; 225 226 int lockCount; //used by NPCs 227 228 int spawnflags; // set in QuakeEd 229 230 int teamnodmg; // damage will be ignored if it comes from this team 231 232 char *roffname; // set in QuakeEd 233 char *rofftarget; // set in QuakeEd 234 235 char *healingclass; //set in quakeed 236 char *healingsound; //set in quakeed 237 int healingrate; //set in quakeed 238 int healingDebounce; //debounce for generic object healing shiz 239 240 char *ownername; 241 242 int objective; 243 int side; 244 245 int passThroughNum; // set to index to pass through (+1) for missiles 246 247 int aimDebounceTime; 248 int painDebounceTime; 249 int attackDebounceTime; 250 int alliedTeam; // only useable by this team, never target this team 251 252 int roffid; // if roffname != NULL then set on spawn 253 254 qboolean neverFree; // if true, FreeEntity will only unlink 255 // bodyque uses this 256 257 int flags; // FL_* variables 258 259 char *model; 260 char *model2; 261 int freetime; // level.time when the object was freed 262 263 int eventTime; // events will be cleared EVENT_VALID_MSEC after set 264 qboolean freeAfterEvent; 265 qboolean unlinkAfterEvent; 266 267 qboolean physicsObject; // if true, it can be pushed by movers and fall off edges 268 // all game items are physicsObjects, 269 float physicsBounce; // 1.0 = continuous bounce, 0.0 = no bounce 270 int clipmask; // brushes with this content value will be collided against 271 // when moving. items and corpses do not collide against 272 // players, for instance 273 274 //Only used by NPC_spawners 275 char *NPC_type; 276 char *NPC_targetname; 277 char *NPC_target; 278 279 // movers 280 moverState_t moverState; 281 int soundPos1; 282 int sound1to2; 283 int sound2to1; 284 int soundPos2; 285 int soundLoop; 286 gentity_t *parent; 287 gentity_t *nextTrain; 288 gentity_t *prevTrain; 289 vec3_t pos1, pos2; 290 291 //for npc's 292 vec3_t pos3; 293 294 char *message; 295 296 int timestamp; // body queue sinking, etc 297 298 float angle; // set in editor, -1 = up, -2 = down 299 char *target; 300 char *target2; 301 char *target3; //For multiple targets, not used for firing/triggering/using, though, only for path branches 302 char *target4; //For multiple targets, not used for firing/triggering/using, though, only for path branches 303 char *target5; //mainly added for siege items 304 char *target6; //mainly added for siege items 305 306 char *team; 307 char *targetShaderName; 308 char *targetShaderNewName; 309 gentity_t *target_ent; 310 311 char *closetarget; 312 char *opentarget; 313 char *paintarget; 314 315 char *goaltarget; 316 char *idealclass; 317 318 float radius; 319 320 int maxHealth; //used as a base for crosshair health display 321 322 float speed; 323 vec3_t movedir; 324 float mass; 325 int setTime; 326 327 //Think Functions 328 int nextthink; 329 void (*think)(gentity_t *self); 330 void (*reached)(gentity_t *self); // movers call this when hitting endpoint 331 void (*blocked)(gentity_t *self, gentity_t *other); 332 void (*touch)(gentity_t *self, gentity_t *other, trace_t *trace); 333 void (*use)(gentity_t *self, gentity_t *other, gentity_t *activator); 334 void (*pain)(gentity_t *self, gentity_t *attacker, int damage); 335 void (*die)(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod); 336 337 int pain_debounce_time; 338 int fly_sound_debounce_time; // wind tunnel 339 int last_move_time; 340 341 //Health and damage fields 342 int health; 343 qboolean takedamage; 344 material_t material; 345 346 int damage; 347 int dflags; 348 int splashDamage; // quad will increase this without increasing radius 349 int splashRadius; 350 int methodOfDeath; 351 int splashMethodOfDeath; 352 353 int locationDamage[HL_MAX]; // Damage accumulated on different body locations 354 355 int count; 356 int bounceCount; 357 qboolean alt_fire; 358 359 gentity_t *chain; 360 gentity_t *enemy; 361 gentity_t *lastEnemy; 362 gentity_t *activator; 363 gentity_t *teamchain; // next entity in team 364 gentity_t *teammaster; // master of the team 365 366 int watertype; 367 int waterlevel; 368 369 int noise_index; 370 371 // timing variables 372 float wait; 373 float random; 374 int delay; 375 376 //generic values used by various entities for different purposes. 377 int genericValue1; 378 int genericValue2; 379 int genericValue3; 380 int genericValue4; 381 int genericValue5; 382 int genericValue6; 383 int genericValue7; 384 int genericValue8; 385 int genericValue9; 386 int genericValue10; 387 int genericValue11; 388 int genericValue12; 389 int genericValue13; 390 int genericValue14; 391 int genericValue15; 392 393 char *soundSet; 394 395 qboolean isSaberEntity; 396 397 int damageRedirect; //if entity takes damage, redirect to.. 398 int damageRedirectTo; //this entity number 399 400 vec3_t epVelocity; 401 float epGravFactor; 402 403 gitem_t *item; // for bonus items 404 405 // OpenJK add 406 int useDebounceTime; // for cultist_destroyer 407 }; 408 409 #define DAMAGEREDIRECT_HEAD 1 410 #define DAMAGEREDIRECT_RLEG 2 411 #define DAMAGEREDIRECT_LLEG 3 412 413 typedef enum { 414 CON_DISCONNECTED, 415 CON_CONNECTING, 416 CON_CONNECTED 417 } clientConnected_t; 418 419 typedef enum { 420 SPECTATOR_NOT, 421 SPECTATOR_FREE, 422 SPECTATOR_FOLLOW, 423 SPECTATOR_SCOREBOARD 424 } spectatorState_t; 425 426 typedef enum { 427 TEAM_BEGIN, // Beginning a team game, spawn at base 428 TEAM_ACTIVE // Now actively playing 429 } playerTeamStateState_t; 430 431 typedef struct playerTeamState_s { 432 playerTeamStateState_t state; 433 434 int location; 435 436 int captures; 437 int basedefense; 438 int carrierdefense; 439 int flagrecovery; 440 int fragcarrier; 441 int assists; 442 443 float lasthurtcarrier; 444 float lastreturnedflag; 445 float flagsince; 446 float lastfraggedcarrier; 447 } playerTeamState_t; 448 449 // the auto following clients don't follow a specific client 450 // number, but instead follow the first two active players 451 #define FOLLOW_ACTIVE1 -1 452 #define FOLLOW_ACTIVE2 -2 453 454 // client data that stays across multiple levels or tournament restarts 455 // this is achieved by writing all the data to cvar strings at game shutdown 456 // time and reading them back at connection time. Anything added here 457 // MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData() 458 typedef struct clientSession_s { 459 team_t sessionTeam; 460 int spectatorNum; // for determining next-in-line to play 461 spectatorState_t spectatorState; 462 int spectatorClient; // for chasecam and follow mode 463 int wins, losses; // tournament stats 464 int selectedFP; // check against this, if doesn't match value in playerstate then update userinfo 465 int saberLevel; // similar to above method, but for current saber attack level 466 int setForce; // set to true once player is given the chance to set force powers 467 int updateUITime; // only update userinfo for FP/SL if < level.time 468 qboolean teamLeader; // true when this client is a team leader 469 char siegeClass[64]; 470 int duelTeam; 471 int siegeDesiredTeam; 472 473 char IP[NET_ADDRSTRMAXLEN]; 474 } clientSession_t; 475 476 // playerstate mGameFlags 477 #define PSG_VOTED (1<<0) // already cast a vote 478 #define PSG_TEAMVOTED (1<<1) // already cast a team vote 479 480 // 481 #define MAX_NETNAME 36 482 #define MAX_VOTE_COUNT 3 483 484 // client data that stays across multiple respawns, but is cleared 485 // on each level change or team change at ClientBegin() 486 typedef struct clientPersistant_s { 487 clientConnected_t connected; 488 usercmd_t cmd; // we would lose angles if not persistant 489 qboolean localClient; // true if "ip" info key is "localhost" 490 qboolean initialSpawn; // the first spawn should be at a cool location 491 qboolean predictItemPickup; // based on cg_predictItems userinfo 492 qboolean pmoveFixed; // 493 char netname[MAX_NETNAME]; 494 char netname_nocolor[MAX_NETNAME]; 495 int netnameTime; // Last time the name was changed 496 int maxHealth; // for handicapping 497 int enterTime; // level.time the client entered the game 498 playerTeamState_t teamState; // status in teamplay games 499 qboolean teamInfo; // send team overlay updates? 500 501 int connectTime; 502 503 char saber1[MAX_QPATH], saber2[MAX_QPATH]; 504 505 int vote, teamvote; // 0 = none, 1 = yes, 2 = no 506 507 char guid[33]; 508 } clientPersistant_t; 509 510 typedef struct renderInfo_s 511 { 512 //In whole degrees, How far to let the different model parts yaw and pitch 513 int headYawRangeLeft; 514 int headYawRangeRight; 515 int headPitchRangeUp; 516 int headPitchRangeDown; 517 518 int torsoYawRangeLeft; 519 int torsoYawRangeRight; 520 int torsoPitchRangeUp; 521 int torsoPitchRangeDown; 522 523 int legsFrame; 524 int torsoFrame; 525 526 float legsFpsMod; 527 float torsoFpsMod; 528 529 //Fields to apply to entire model set, individual model's equivalents will modify this value 530 vec3_t customRGB;//Red Green Blue, 0 = don't apply 531 int customAlpha;//Alpha to apply, 0 = none? 532 533 //RF? 534 int renderFlags; 535 536 // 537 vec3_t muzzlePoint; 538 vec3_t muzzleDir; 539 vec3_t muzzlePointOld; 540 vec3_t muzzleDirOld; 541 //vec3_t muzzlePointNext; // Muzzle point one server frame in the future! 542 //vec3_t muzzleDirNext; 543 int mPCalcTime;//Last time muzzle point was calced 544 545 // 546 float lockYaw;// 547 548 // 549 vec3_t headPoint;//Where your tag_head is 550 vec3_t headAngles;//where the tag_head in the torso is pointing 551 vec3_t handRPoint;//where your right hand is 552 vec3_t handLPoint;//where your left hand is 553 vec3_t crotchPoint;//Where your crotch is 554 vec3_t footRPoint;//where your right hand is 555 vec3_t footLPoint;//where your left hand is 556 vec3_t torsoPoint;//Where your chest is 557 vec3_t torsoAngles;//Where the chest is pointing 558 vec3_t eyePoint;//Where your eyes are 559 vec3_t eyeAngles;//Where your eyes face 560 int lookTarget;//Which ent to look at with lookAngles 561 lookMode_t lookMode; 562 int lookTargetClearTime;//Time to clear the lookTarget 563 int lastVoiceVolume;//Last frame's voice volume 564 vec3_t lastHeadAngles;//Last headAngles, NOT actual facing of head model 565 vec3_t headBobAngles;//headAngle offsets 566 vec3_t targetHeadBobAngles;//head bob angles will try to get to targetHeadBobAngles 567 int lookingDebounceTime;//When we can stop using head looking angle behavior 568 float legsYaw;//yaw angle your legs are actually rendering at 569 570 //for tracking legitimate bolt indecies 571 void *lastG2; //if it doesn't match ent->ghoul2, the bolts are considered invalid. 572 int headBolt; 573 int handRBolt; 574 int handLBolt; 575 int torsoBolt; 576 int crotchBolt; 577 int footRBolt; 578 int footLBolt; 579 int motionBolt; 580 581 int boltValidityTime; 582 } renderInfo_t; 583 584 // this structure is cleared on each ClientSpawn(), 585 // except for 'client->pers' and 'client->sess' 586 struct gclient_s { 587 // ps MUST be the first element, because the server expects it 588 playerState_t ps; // communicated by server to clients 589 590 // the rest of the structure is private to game 591 clientPersistant_t pers; 592 clientSession_t sess; 593 594 saberInfo_t saber[MAX_SABERS]; 595 void *weaponGhoul2[MAX_SABERS]; 596 597 int tossableItemDebounce; 598 599 int bodyGrabTime; 600 int bodyGrabIndex; 601 602 int pushEffectTime; 603 604 int invulnerableTimer; 605 606 int saberCycleQueue; 607 608 int legsAnimExecute; 609 int torsoAnimExecute; 610 qboolean legsLastFlip; 611 qboolean torsoLastFlip; 612 613 qboolean readyToExit; // wishes to leave the intermission 614 615 qboolean noclip; 616 617 int lastCmdTime; // level.time of last usercmd_t, for EF_CONNECTION 618 // we can't just use pers.lastCommand.time, because 619 // of the g_sycronousclients case 620 int buttons; 621 int oldbuttons; 622 int latched_buttons; 623 624 vec3_t oldOrigin; 625 626 // sum up damage over an entire frame, so 627 // shotgun blasts give a single big kick 628 int damage_armor; // damage absorbed by armor 629 int damage_blood; // damage taken out of health 630 int damage_knockback; // impact damage 631 vec3_t damage_from; // origin for vector calculation 632 qboolean damage_fromWorld; // if true, don't use the damage_from vector 633 634 int damageBoxHandle_Head; //entity number of head damage box 635 int damageBoxHandle_RLeg; //entity number of right leg damage box 636 int damageBoxHandle_LLeg; //entity number of left leg damage box 637 638 int accurateCount; // for "impressive" reward sound 639 640 int accuracy_shots; // total number of shots 641 int accuracy_hits; // total number of hits 642 643 // 644 int lastkilled_client; // last client that this client killed 645 int lasthurt_client; // last client that damaged this client 646 int lasthurt_mod; // type of damage the client did 647 648 // timers 649 int respawnTime; // can respawn when time > this, force after g_forcerespwan 650 int inactivityTime; // kick players when time > this 651 qboolean inactivityWarning; // qtrue if the five seoond warning has been given 652 int rewardTime; // clear the EF_AWARD_IMPRESSIVE, etc when time > this 653 654 int airOutTime; 655 656 int lastKillTime; // for multiple kill rewards 657 658 qboolean fireHeld; // used for hook 659 gentity_t *hook; // grapple hook if out 660 661 int switchTeamTime; // time the player switched teams 662 663 int switchDuelTeamTime; // time the player switched duel teams 664 665 int switchClassTime; // class changed debounce timer 666 667 // timeResidual is used to handle events that happen every second 668 // like health / armor countdowns and regeneration 669 int timeResidual; 670 671 char *areabits; 672 673 int g2LastSurfaceHit; //index of surface hit during the most recent ghoul2 collision performed on this client. 674 int g2LastSurfaceTime; //time when the surface index was set (to make sure it's up to date) 675 676 int corrTime; 677 678 vec3_t lastHeadAngles; 679 int lookTime; 680 681 int brokenLimbs; 682 683 qboolean noCorpse; //don't leave a corpse on respawn this time. 684 685 int jetPackTime; 686 687 qboolean jetPackOn; 688 int jetPackToggleTime; 689 int jetPackDebRecharge; 690 int jetPackDebReduce; 691 692 int cloakToggleTime; 693 int cloakDebRecharge; 694 int cloakDebReduce; 695 696 int saberStoredIndex; //stores saberEntityNum from playerstate for when it's set to 0 (indicating saber was knocked out of the air) 697 698 int saberKnockedTime; //if saber gets knocked away, can't pull it back until this value is < level.time 699 700 vec3_t olderSaberBase; //Set before lastSaberBase_Always, to whatever lastSaberBase_Always was previously 701 qboolean olderIsValid; //is it valid? 702 703 vec3_t lastSaberDir_Always; //every getboltmatrix, set to saber dir 704 vec3_t lastSaberBase_Always; //every getboltmatrix, set to saber base 705 int lastSaberStorageTime; //server time that the above two values were updated (for making sure they aren't out of date) 706 707 qboolean hasCurrentPosition; //are lastSaberTip and lastSaberBase valid? 708 709 int dangerTime; // level.time when last attack occured 710 711 int idleTime; //keep track of when to play an idle anim on the client. 712 713 int idleHealth; //stop idling if health decreases 714 vec3_t idleViewAngles; //stop idling if viewangles change 715 716 int forcePowerSoundDebounce; //if > level.time, don't do certain sound events again (drain sound, absorb sound, etc) 717 718 char modelname[MAX_QPATH]; 719 720 qboolean fjDidJump; 721 722 qboolean ikStatus; 723 724 int throwingIndex; 725 int beingThrown; 726 int doingThrow; 727 728 float hiddenDist;//How close ents have to be to pick you up as an enemy 729 vec3_t hiddenDir;//Normalized direction in which NPCs can't see you (you are hidden) 730 731 renderInfo_t renderInfo; 732 733 //mostly NPC stuff: 734 npcteam_t playerTeam; 735 npcteam_t enemyTeam; 736 char *squadname; 737 gentity_t *team_leader; 738 gentity_t *leader; 739 gentity_t *follower; 740 int numFollowers; 741 gentity_t *formationGoal; 742 int nextFormGoal; 743 class_t NPC_class; 744 745 vec3_t pushVec; 746 int pushVecTime; 747 748 int siegeClass; 749 int holdingObjectiveItem; 750 751 //time values for when being healed/supplied by supplier class 752 int isMedHealed; 753 int isMedSupplied; 754 755 //seperate debounce time for refilling someone's ammo as a supplier 756 int medSupplyDebounce; 757 758 //used in conjunction with ps.hackingTime 759 int isHacking; 760 vec3_t hackingAngles; 761 762 //debounce time for sending extended siege data to certain classes 763 int siegeEDataSend; 764 765 int ewebIndex; //index of e-web gun if spawned 766 int ewebTime; //e-web use debounce 767 int ewebHealth; //health of e-web (to keep track between deployments) 768 769 int inSpaceIndex; //ent index of space trigger if inside one 770 int inSpaceSuffocation; //suffocation timer 771 772 int tempSpectate; //time to force spectator mode 773 774 //keep track of last person kicked and the time so we don't hit multiple times per kick 775 int jediKickIndex; 776 int jediKickTime; 777 778 //special moves (designed for kyle boss npc, but useable by players in mp) 779 int grappleIndex; 780 int grappleState; 781 782 int solidHack; 783 784 int noLightningTime; 785 786 unsigned mGameFlags; 787 788 //fallen duelist 789 qboolean iAmALoser; 790 791 int lastGenCmd; 792 int lastGenCmdTime; 793 794 struct force { 795 int regenDebounce; 796 int drainDebounce; 797 int lightningDebounce; 798 } force; 799 }; 800 801 //Interest points 802 803 #define MAX_INTEREST_POINTS 64 804 805 typedef struct 806 { 807 vec3_t origin; 808 char *target; 809 } interestPoint_t; 810 811 //Combat points 812 813 #define MAX_COMBAT_POINTS 512 814 815 typedef struct 816 { 817 vec3_t origin; 818 int flags; 819 // char *NPC_targetname; 820 // team_t team; 821 qboolean occupied; 822 int waypoint; 823 int dangerTime; 824 } combatPoint_t; 825 826 // Alert events 827 828 #define MAX_ALERT_EVENTS 32 829 830 typedef enum 831 { 832 AET_SIGHT, 833 AET_SOUND, 834 } alertEventType_e; 835 836 typedef enum 837 { 838 AEL_MINOR, //Enemy responds to the sound, but only by looking 839 AEL_SUSPICIOUS, //Enemy looks at the sound, and will also investigate it 840 AEL_DISCOVERED, //Enemy knows the player is around, and will actively hunt 841 AEL_DANGER, //Enemy should try to find cover 842 AEL_DANGER_GREAT, //Enemy should run like hell! 843 } alertEventLevel_e; 844 845 typedef struct alertEvent_s 846 { 847 vec3_t position; //Where the event is located 848 float radius; //Consideration radius 849 alertEventLevel_e level; //Priority level of the event 850 alertEventType_e type; //Event type (sound,sight) 851 gentity_t *owner; //Who made the sound 852 float light; //ambient light level at point 853 float addLight; //additional light- makes it more noticable, even in darkness 854 int ID; //unique... if get a ridiculous number, this will repeat, but should not be a problem as it's just comparing it to your lastAlertID 855 int timestamp; //when it was created 856 } alertEvent_t; 857 858 // 859 // this structure is cleared as each map is entered 860 // 861 typedef struct waypointData_s { 862 char targetname[MAX_QPATH]; 863 char target[MAX_QPATH]; 864 char target2[MAX_QPATH]; 865 char target3[MAX_QPATH]; 866 char target4[MAX_QPATH]; 867 int nodeID; 868 } waypointData_t; 869 870 typedef struct { 871 char message[MAX_SPAWN_VARS_CHARS]; 872 int count; 873 int cs_index; 874 vec3_t origin; 875 } locationData_t; 876 877 typedef struct level_locals_s { 878 struct gclient_s *clients; // [maxclients] 879 880 struct gentity_s *gentities; 881 int gentitySize; 882 int num_entities; // current number, <= MAX_GENTITIES 883 884 int warmupTime; // restart match at this time 885 886 fileHandle_t logFile; 887 888 // store latched cvars here that we want to get at often 889 int maxclients; 890 891 int framenum; 892 int time; // in msec 893 int previousTime; // so movers can back up when blocked 894 895 int startTime; // level.time the map was started 896 897 int teamScores[TEAM_NUM_TEAMS]; 898 int lastTeamLocationTime; // last time of client team location update 899 900 qboolean newSession; // don't use any old session data, because 901 // we changed gametype 902 903 qboolean restarted; // waiting for a map_restart to fire 904 905 int numConnectedClients; 906 int numNonSpectatorClients; // includes connecting clients 907 int numPlayingClients; // connected, non-spectators 908 int sortedClients[MAX_CLIENTS]; // sorted by score 909 int follow1, follow2; // clientNums for auto-follow spectators 910 911 int snd_fry; // sound index for standing in lava 912 913 int snd_hack; //hacking loop sound 914 int snd_medHealed; //being healed by supply class 915 int snd_medSupplied; //being supplied by supply class 916 917 // voting state 918 char voteString[MAX_STRING_CHARS]; 919 char voteStringClean[MAX_STRING_CHARS]; 920 char voteDisplayString[MAX_STRING_CHARS]; 921 int voteTime; // level.time vote was called 922 int voteExecuteTime; // time the vote is executed 923 int voteExecuteDelay; // set per-vote 924 int voteYes; 925 int voteNo; 926 int numVotingClients; // set by CalculateRanks 927 928 qboolean votingGametype; 929 int votingGametypeTo; 930 931 // team voting state 932 char teamVoteString[2][MAX_STRING_CHARS]; 933 char teamVoteStringClean[2][MAX_STRING_CHARS]; 934 char teamVoteDisplayString[2][MAX_STRING_CHARS]; 935 int teamVoteTime[2]; // level.time vote was called 936 int teamVoteExecuteTime[2]; // time the vote is executed 937 int teamVoteYes[2]; 938 int teamVoteNo[2]; 939 int numteamVotingClients[2];// set by CalculateRanks 940 941 // spawn variables 942 qboolean spawning; // the G_Spawn*() functions are valid 943 int numSpawnVars; 944 char *spawnVars[MAX_SPAWN_VARS][2]; // key / value pairs 945 int numSpawnVarChars; 946 char spawnVarChars[MAX_SPAWN_VARS_CHARS]; 947 948 // intermission state 949 int intermissionQueued; // intermission was qualified, but 950 // wait INTERMISSION_DELAY_TIME before 951 // actually going there so the last 952 // frag can be watched. Disable future 953 // kills during this delay 954 int intermissiontime; // time the intermission was started 955 char *changemap; 956 qboolean readyToExit; // at least one client wants to exit 957 int exitTime; 958 vec3_t intermission_origin; // also used for spectator spawns 959 vec3_t intermission_angle; 960 961 int bodyQueIndex; // dead bodies 962 gentity_t *bodyQue[BODY_QUEUE_SIZE]; 963 int portalSequence; 964 965 alertEvent_t alertEvents[ MAX_ALERT_EVENTS ]; 966 int numAlertEvents; 967 int curAlertID; 968 969 AIGroupInfo_t groups[MAX_FRAME_GROUPS]; 970 971 //Interest points- squadmates automatically look at these if standing around and close to them 972 interestPoint_t interestPoints[MAX_INTEREST_POINTS]; 973 int numInterestPoints; 974 975 //Combat points- NPCs in bState BS_COMBAT_POINT will find their closest empty combat_point 976 combatPoint_t combatPoints[MAX_COMBAT_POINTS]; 977 int numCombatPoints; 978 979 //rwwRMG - added: 980 int mNumBSPInstances; 981 int mBSPInstanceDepth; 982 vec3_t mOriginAdjust; 983 float mRotationAdjust; 984 char *mTargetAdjust; 985 986 char mTeamFilter[MAX_QPATH]; 987 988 struct { 989 fileHandle_t log; 990 } security; 991 992 struct { 993 int num; 994 char *infos[MAX_BOTS]; 995 } bots; 996 997 struct { 998 int num; 999 char *infos[MAX_ARENAS]; 1000 } arenas; 1001 1002 struct { 1003 int num; 1004 qboolean linked; 1005 locationData_t data[MAX_LOCATIONS]; 1006 } locations; 1007 1008 gametype_t gametype; 1009 char mapname[MAX_QPATH]; 1010 char rawmapname[MAX_QPATH]; 1011 } level_locals_t; 1012 1013 1014 // 1015 // g_spawn.c 1016 // 1017 qboolean G_SpawnString( const char *key, const char *defaultString, char **out ); 1018 // spawn string returns a temporary reference, you must CopyString() if you want to keep it 1019 qboolean G_SpawnFloat( const char *key, const char *defaultString, float *out ); 1020 qboolean G_SpawnInt( const char *key, const char *defaultString, int *out ); 1021 qboolean G_SpawnVector( const char *key, const char *defaultString, float *out ); 1022 qboolean G_SpawnBoolean( const char *key, const char *defaultString, qboolean *out ); 1023 void G_SpawnEntitiesFromString( qboolean inSubBSP ); 1024 char *G_NewString( const char *string ); 1025 1026 // 1027 // g_cmds.c 1028 // 1029 void Cmd_Score_f (gentity_t *ent); 1030 void StopFollowing( gentity_t *ent ); 1031 void BroadcastTeamChange( gclient_t *client, int oldTeam ); 1032 void SetTeam( gentity_t *ent, char *s ); 1033 void Cmd_FollowCycle_f( gentity_t *ent, int dir ); 1034 void Cmd_SaberAttackCycle_f(gentity_t *ent); 1035 int G_ItemUsable(playerState_t *ps, int forcedUse); 1036 void Cmd_ToggleSaber_f(gentity_t *ent); 1037 void Cmd_EngageDuel_f(gentity_t *ent); 1038 1039 // 1040 // g_items.c 1041 // 1042 void ItemUse_Binoculars(gentity_t *ent); 1043 void ItemUse_Shield(gentity_t *ent); 1044 void ItemUse_Sentry(gentity_t *ent); 1045 1046 void Jetpack_Off(gentity_t *ent); 1047 void Jetpack_On(gentity_t *ent); 1048 void ItemUse_Jetpack(gentity_t *ent); 1049 void ItemUse_UseCloak( gentity_t *ent ); 1050 void ItemUse_UseDisp(gentity_t *ent, int type); 1051 void ItemUse_UseEWeb(gentity_t *ent); 1052 void G_PrecacheDispensers(void); 1053 1054 void ItemUse_Seeker(gentity_t *ent); 1055 void ItemUse_MedPack(gentity_t *ent); 1056 void ItemUse_MedPack_Big(gentity_t *ent); 1057 1058 void G_CheckTeamItems( void ); 1059 void G_RunItem( gentity_t *ent ); 1060 void RespawnItem( gentity_t *ent ); 1061 1062 gentity_t *Drop_Item( gentity_t *ent, gitem_t *item, float angle ); 1063 gentity_t *LaunchItem( gitem_t *item, vec3_t origin, vec3_t velocity ); 1064 void G_SpawnItem (gentity_t *ent, gitem_t *item); 1065 void FinishSpawningItem( gentity_t *ent ); 1066 void Add_Ammo (gentity_t *ent, int weapon, int count); 1067 void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace); 1068 1069 void ClearRegisteredItems( void ); 1070 void RegisterItem( gitem_t *item ); 1071 void SaveRegisteredItems( void ); 1072 1073 // 1074 // g_utils.c 1075 // 1076 int G_ModelIndex( const char *name ); 1077 int G_SoundIndex( const char *name ); 1078 int G_SoundSetIndex(const char *name); 1079 int G_EffectIndex( const char *name ); 1080 int G_BSPIndex( const char *name ); 1081 int G_IconIndex( const char* name ); 1082 1083 qboolean G_PlayerHasCustomSkeleton(gentity_t *ent); 1084 1085 void G_TeamCommand( team_t team, char *cmd ); 1086 void G_ScaleNetHealth(gentity_t *self); 1087 void G_KillBox (gentity_t *ent); 1088 gentity_t *G_Find (gentity_t *from, int fieldofs, const char *match); 1089 int G_RadiusList ( vec3_t origin, float radius, gentity_t *ignore, qboolean takeDamage, gentity_t *ent_list[MAX_GENTITIES]); 1090 1091 void G_Throw( gentity_t *targ, vec3_t newDir, float push ); 1092 1093 void G_FreeFakeClient(gclient_t **cl); 1094 void G_CreateFakeClient(int entNum, gclient_t **cl); 1095 void G_CleanAllFakeClients(void); 1096 1097 void G_SetAnim(gentity_t *ent, usercmd_t *ucmd, int setAnimParts, int anim, int setAnimFlags, int blendTime); 1098 gentity_t *G_PickTarget (char *targetname); 1099 void GlobalUse(gentity_t *self, gentity_t *other, gentity_t *activator); 1100 void G_UseTargets2( gentity_t *ent, gentity_t *activator, const char *string ); 1101 void G_UseTargets (gentity_t *ent, gentity_t *activator); 1102 void G_SetMovedir ( vec3_t angles, vec3_t movedir); 1103 void G_SetAngles( gentity_t *ent, vec3_t angles ); 1104 1105 void G_InitGentity( gentity_t *e ); 1106 gentity_t *G_Spawn (void); 1107 gentity_t *G_TempEntity( vec3_t origin, int event ); 1108 gentity_t *G_PlayEffect(int fxID, vec3_t org, vec3_t ang); 1109 gentity_t *G_PlayEffectID(const int fxID, vec3_t org, vec3_t ang); 1110 gentity_t *G_ScreenShake(vec3_t org, gentity_t *target, float intensity, int duration, qboolean global); 1111 void G_MuteSound( int entnum, int channel ); 1112 void G_Sound( gentity_t *ent, int channel, int soundIndex ); 1113 void G_SoundAtLoc( vec3_t loc, int channel, int soundIndex ); 1114 void G_EntitySound( gentity_t *ent, int channel, int soundIndex ); 1115 void TryUse( gentity_t *ent ); 1116 void G_SendG2KillQueue(void); 1117 void G_KillG2Queue(int entNum); 1118 void G_FreeEntity( gentity_t *e ); 1119 qboolean G_EntitiesFree( void ); 1120 1121 qboolean G_ActivateBehavior (gentity_t *self, int bset ); 1122 1123 void G_TouchTriggers (gentity_t *ent); 1124 void G_TouchSolids (gentity_t *ent); 1125 void GetAnglesForDirection( const vec3_t p1, const vec3_t p2, vec3_t out ); 1126 1127 // 1128 // g_object.c 1129 // 1130 1131 extern void G_RunObject ( gentity_t *ent ); 1132 1133 1134 float *tv (float x, float y, float z); 1135 char *vtos( const vec3_t v ); 1136 1137 void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm ); 1138 void G_AddEvent( gentity_t *ent, int event, int eventParm ); 1139 void G_SetOrigin( gentity_t *ent, vec3_t origin ); 1140 qboolean G_CheckInSolid (gentity_t *self, qboolean fix); 1141 void AddRemap(const char *oldShader, const char *newShader, float timeOffset); 1142 const char *BuildShaderStateConfig(void); 1143 /* 1144 Ghoul2 Insert Start 1145 */ 1146 int G_BoneIndex( const char *name ); 1147 1148 /* 1149 Ghoul2 Insert End 1150 */ 1151 1152 // 1153 // g_combat.c 1154 // 1155 qboolean CanDamage (gentity_t *targ, vec3_t origin); 1156 void G_Damage (gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod); 1157 qboolean G_RadiusDamage (vec3_t origin, gentity_t *attacker, float damage, float radius, gentity_t *ignore, gentity_t *missile, int mod); 1158 void body_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ); 1159 void TossClientWeapon(gentity_t *self, vec3_t direction, float speed); 1160 void TossClientItems( gentity_t *self ); 1161 void TossClientCubes( gentity_t *self ); 1162 void ExplodeDeath( gentity_t *self ); 1163 void G_CheckForDismemberment(gentity_t *ent, gentity_t *enemy, vec3_t point, int damage, int deathAnim, qboolean postDeath); 1164 extern int gGAvoidDismember; 1165 1166 1167 // damage flags 1168 #define DAMAGE_NORMAL 0x00000000 // No flags set. 1169 #define DAMAGE_RADIUS 0x00000001 // damage was indirect 1170 #define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage 1171 #define DAMAGE_NO_KNOCKBACK 0x00000004 // do not affect velocity, just view angles 1172 #define DAMAGE_NO_PROTECTION 0x00000008 // armor, shields, invulnerability, and godmode have no effect 1173 #define DAMAGE_NO_TEAM_PROTECTION 0x00000010 // armor, shields, invulnerability, and godmode have no effect 1174 //JK2 flags 1175 #define DAMAGE_EXTRA_KNOCKBACK 0x00000040 // add extra knockback to this damage 1176 #define DAMAGE_DEATH_KNOCKBACK 0x00000080 // only does knockback on death of target 1177 #define DAMAGE_IGNORE_TEAM 0x00000100 // damage is always done, regardless of teams 1178 #define DAMAGE_NO_DAMAGE 0x00000200 // do no actual damage but react as if damage was taken 1179 #define DAMAGE_HALF_ABSORB 0x00000400 // half shields, half health 1180 #define DAMAGE_HALF_ARMOR_REDUCTION 0x00000800 // This damage doesn't whittle down armor as efficiently. 1181 #define DAMAGE_HEAVY_WEAP_CLASS 0x00001000 // Heavy damage 1182 #define DAMAGE_NO_HIT_LOC 0x00002000 // No hit location 1183 #define DAMAGE_NO_SELF_PROTECTION 0x00004000 // Dont apply half damage to self attacks 1184 #define DAMAGE_NO_DISMEMBER 0x00008000 // Dont do dismemberment 1185 #define DAMAGE_SABER_KNOCKBACK1 0x00010000 // Check the attacker's first saber for a knockbackScale 1186 #define DAMAGE_SABER_KNOCKBACK2 0x00020000 // Check the attacker's second saber for a knockbackScale 1187 #define DAMAGE_SABER_KNOCKBACK1_B2 0x00040000 // Check the attacker's first saber for a knockbackScale2 1188 #define DAMAGE_SABER_KNOCKBACK2_B2 0x00080000 // Check the attacker's second saber for a knockbackScale2 1189 // 1190 // g_exphysics.c 1191 // 1192 void G_RunExPhys(gentity_t *ent, float gravity, float mass, float bounce, qboolean autoKill, int *g2Bolts, int numG2Bolts); 1193 1194 // 1195 // g_missile.c 1196 // 1197 void G_ReflectMissile( gentity_t *ent, gentity_t *missile, vec3_t forward ); 1198 1199 void G_RunMissile( gentity_t *ent ); 1200 1201 gentity_t *CreateMissile( vec3_t org, vec3_t dir, float vel, int life, 1202 gentity_t *owner, qboolean altFire); 1203 void G_BounceProjectile( vec3_t start, vec3_t impact, vec3_t dir, vec3_t endout ); 1204 void G_ExplodeMissile( gentity_t *ent ); 1205 1206 void WP_FireBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire ); 1207 1208 1209 // 1210 // g_mover.c 1211 // 1212 extern int BMS_START; 1213 extern int BMS_MID; 1214 extern int BMS_END; 1215 1216 #define SPF_BUTTON_USABLE 1 1217 #define SPF_BUTTON_FPUSHABLE 2 1218 void G_PlayDoorLoopSound( gentity_t *ent ); 1219 void G_PlayDoorSound( gentity_t *ent, int type ); 1220 void G_RunMover( gentity_t *ent ); 1221 void Touch_DoorTrigger( gentity_t *ent, gentity_t *other, trace_t *trace ); 1222 1223 // 1224 // g_trigger.c 1225 // 1226 void trigger_teleporter_touch (gentity_t *self, gentity_t *other, trace_t *trace ); 1227 1228 1229 // 1230 // g_misc.c 1231 // 1232 #define MAX_REFNAME 32 1233 #define START_TIME_LINK_ENTS FRAMETIME*1 1234 1235 #define RTF_NONE 0 1236 #define RTF_NAVGOAL 0x00000001 1237 1238 typedef struct reference_tag_s 1239 { 1240 char name[MAX_REFNAME]; 1241 vec3_t origin; 1242 vec3_t angles; 1243 int flags; //Just in case 1244 int radius; //For nav goals 1245 qboolean inuse; 1246 } reference_tag_t; 1247 1248 void TAG_Init( void ); 1249 reference_tag_t *TAG_Find( const char *owner, const char *name ); 1250 reference_tag_t *TAG_Add( const char *name, const char *owner, vec3_t origin, vec3_t angles, int radius, int flags ); 1251 int TAG_GetOrigin( const char *owner, const char *name, vec3_t origin ); 1252 int TAG_GetOrigin2( const char *owner, const char *name, vec3_t origin ); 1253 int TAG_GetAngles( const char *owner, const char *name, vec3_t angles ); 1254 int TAG_GetRadius( const char *owner, const char *name ); 1255 int TAG_GetFlags( const char *owner, const char *name ); 1256 1257 void TeleportPlayer( gentity_t *player, vec3_t origin, vec3_t angles ); 1258 1259 // 1260 // g_weapon.c 1261 // 1262 void WP_FireTurretMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire, int damage, int velocity, int mod, gentity_t *ignore ); 1263 void WP_FireGenericBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qboolean altFire, int damage, int velocity, int mod ); 1264 qboolean LogAccuracyHit( gentity_t *target, gentity_t *attacker ); 1265 void CalcMuzzlePoint ( gentity_t *ent, const vec3_t inForward, const vec3_t inRight, const vec3_t inUp, vec3_t muzzlePoint ); 1266 void SnapVectorTowards( vec3_t v, vec3_t to ); 1267 qboolean CheckGauntletAttack( gentity_t *ent ); 1268 1269 1270 // 1271 // g_client.c 1272 // 1273 int TeamCount( int ignoreClientNum, team_t team ); 1274 int TeamLeader( int team ); 1275 team_t PickTeam( int ignoreClientNum ); 1276 void SetClientViewAngle( gentity_t *ent, vec3_t angle ); 1277 gentity_t *SelectSpawnPoint ( vec3_t avoidPoint, vec3_t origin, vec3_t angles, team_t team, qboolean isbot ); 1278 void MaintainBodyQueue(gentity_t *ent); 1279 void ClientRespawn (gentity_t *ent); 1280 void BeginIntermission (void); 1281 void InitBodyQue (void); 1282 void ClientSpawn( gentity_t *ent ); 1283 void player_die (gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod); 1284 void AddScore( gentity_t *ent, vec3_t origin, int score ); 1285 void CalculateRanks( void ); 1286 qboolean SpotWouldTelefrag( gentity_t *spot ); 1287 1288 extern gentity_t *gJMSaberEnt; 1289 1290 // 1291 // g_svcmds.c 1292 // 1293 qboolean ConsoleCommand( void ); 1294 void G_ProcessIPBans(void); 1295 qboolean G_FilterPacket (char *from); 1296 1297 // 1298 // g_weapon.c 1299 // 1300 void FireWeapon( gentity_t *ent, qboolean altFire ); 1301 void BlowDetpacks(gentity_t *ent); 1302 void RemoveDetpacks(gentity_t *ent); 1303 1304 // 1305 // p_hud.c 1306 // 1307 void MoveClientToIntermission (gentity_t *client); 1308 void G_SetStats (gentity_t *ent); 1309 void DeathmatchScoreboardMessage (gentity_t *client); 1310 1311 // 1312 // g_cmds.c 1313 // 1314 1315 // 1316 // g_pweapon.c 1317 // 1318 1319 1320 // 1321 // g_main.c 1322 // 1323 extern vmCvar_t g_ff_objectives; 1324 extern qboolean gDoSlowMoDuel; 1325 extern int gSlowMoDuelTime; 1326 1327 void G_PowerDuelCount(int *loners, int *doubles, qboolean countSpec); 1328 1329 void FindIntermissionPoint( void ); 1330 void SetLeader(int team, int client); 1331 void CheckTeamLeader( int team ); 1332 void G_RunThink (gentity_t *ent); 1333 void AddTournamentQueue(gclient_t *client); 1334 void QDECL G_LogPrintf( const char *fmt, ... ); 1335 void QDECL G_SecurityLogPrintf( const char *fmt, ... ); 1336 void SendScoreboardMessageToAllClients( void ); 1337 const char *G_GetStringEdString(char *refSection, char *refName); 1338 1339 // 1340 // g_client.c 1341 // 1342 char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ); 1343 qboolean ClientUserinfoChanged( int clientNum ); 1344 void ClientDisconnect( int clientNum ); 1345 void ClientBegin( int clientNum, qboolean allowTeamReset ); 1346 void G_BreakArm(gentity_t *ent, int arm); 1347 void G_UpdateClientAnims(gentity_t *self, float animSpeedScale); 1348 void ClientCommand( int clientNum ); 1349 void G_ClearVote( gentity_t *ent ); 1350 void G_ClearTeamVote( gentity_t *ent, int team ); 1351 1352 // 1353 // g_active.c 1354 // 1355 void G_CheckClientTimeouts ( gentity_t *ent ); 1356 void ClientThink ( int clientNum, usercmd_t *ucmd ); 1357 void ClientEndFrame ( gentity_t *ent ); 1358 void G_RunClient ( gentity_t *ent ); 1359 1360 // 1361 // g_team.c 1362 // 1363 qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 ); 1364 void Team_CheckDroppedItem( gentity_t *dropped ); 1365 1366 // 1367 // g_mem.c 1368 // 1369 void *G_Alloc( int size ); 1370 void G_InitMemory( void ); 1371 void Svcmd_GameMem_f( void ); 1372 1373 // 1374 // g_session.c 1375 // 1376 void G_ReadSessionData( gclient_t *client ); 1377 void G_InitSessionData( gclient_t *client, char *userinfo, qboolean isBot ); 1378 1379 void G_InitWorldSession( void ); 1380 void G_WriteSessionData( void ); 1381 1382 // 1383 // NPC_senses.cpp 1384 // 1385 extern void AddSightEvent( gentity_t *owner, vec3_t position, float radius, alertEventLevel_e alertLevel, float addLight ); //addLight = 0.0f 1386 extern void AddSoundEvent( gentity_t *owner, vec3_t position, float radius, alertEventLevel_e alertLevel, qboolean needLOS ); //needLOS = qfalse 1387 extern qboolean G_CheckForDanger( gentity_t *self, int alertEvent ); 1388 extern int G_CheckAlertEvents( gentity_t *self, qboolean checkSight, qboolean checkSound, float maxSeeDist, float maxHearDist, int ignoreAlert, qboolean mustHaveOwner, int minAlertLevel ); //ignoreAlert = -1, mustHaveOwner = qfalse, minAlertLevel = AEL_MINOR 1389 extern qboolean G_CheckForDanger( gentity_t *self, int alertEvent ); 1390 extern qboolean G_ClearLOS( gentity_t *self, const vec3_t start, const vec3_t end ); 1391 extern qboolean G_ClearLOS2( gentity_t *self, gentity_t *ent, const vec3_t end ); 1392 extern qboolean G_ClearLOS3( gentity_t *self, const vec3_t start, gentity_t *ent ); 1393 extern qboolean G_ClearLOS4( gentity_t *self, gentity_t *ent ); 1394 extern qboolean G_ClearLOS5( gentity_t *self, const vec3_t end ); 1395 1396 // 1397 // g_bot.c 1398 // 1399 void G_InitBots( void ); 1400 char *G_GetBotInfoByNumber( int num ); 1401 char *G_GetBotInfoByName( const char *name ); 1402 void G_CheckBotSpawn( void ); 1403 void G_RemoveQueuedBotBegin( int clientNum ); 1404 qboolean G_BotConnect( int clientNum, qboolean restart ); 1405 void Svcmd_AddBot_f( void ); 1406 void Svcmd_BotList_f( void ); 1407 void BotInterbreedEndMatch( void ); 1408 qboolean G_DoesMapSupportGametype(const char *mapname, int gametype); 1409 const char *G_RefreshNextMap(int gametype, qboolean forced); 1410 void G_LoadArenas( void ); 1411 1412 // w_force.c / w_saber.c 1413 gentity_t *G_PreDefSound(vec3_t org, int pdSound); 1414 qboolean HasSetSaberOnly(void); 1415 void WP_ForcePowerStop( gentity_t *self, forcePowers_t forcePower ); 1416 void WP_SaberPositionUpdate( gentity_t *self, usercmd_t *ucmd ); 1417 int WP_SaberCanBlock(gentity_t *self, vec3_t point, int dflags, int mod, qboolean projectile, int attackStr); 1418 void WP_SaberInitBladeData( gentity_t *ent ); 1419 void WP_InitForcePowers( gentity_t *ent ); 1420 void WP_SpawnInitForcePowers( gentity_t *ent ); 1421 void WP_ForcePowersUpdate( gentity_t *self, usercmd_t *ucmd ); 1422 int ForcePowerUsableOn(gentity_t *attacker, gentity_t *other, forcePowers_t forcePower); 1423 void ForceHeal( gentity_t *self ); 1424 void ForceSpeed( gentity_t *self, int forceDuration ); 1425 void ForceRage( gentity_t *self ); 1426 void ForceGrip( gentity_t *self ); 1427 void ForceProtect( gentity_t *self ); 1428 void ForceAbsorb( gentity_t *self ); 1429 void ForceTeamHeal( gentity_t *self ); 1430 void ForceTeamForceReplenish( gentity_t *self ); 1431 void ForceSeeing( gentity_t *self ); 1432 void ForceThrow( gentity_t *self, qboolean pull ); 1433 void ForceTelepathy(gentity_t *self); 1434 qboolean Jedi_DodgeEvasion( gentity_t *self, gentity_t *shooter, trace_t *tr, int hitLoc ); 1435 1436 // g_log.c 1437 void QDECL G_LogWeaponPickup(int client, int weaponid); 1438 void QDECL G_LogWeaponFire(int client, int weaponid); 1439 void QDECL G_LogWeaponDamage(int client, int mod, int amount); 1440 void QDECL G_LogWeaponKill(int client, int mod); 1441 void QDECL G_LogWeaponDeath(int client, int weaponid); 1442 void QDECL G_LogWeaponFrag(int attacker, int deadguy); 1443 void QDECL G_LogWeaponPowerup(int client, int powerupid); 1444 void QDECL G_LogWeaponItem(int client, int itemid); 1445 void QDECL G_LogWeaponInit(void); 1446 void QDECL G_LogWeaponOutput(void); 1447 void QDECL G_LogExit( const char *string ); 1448 void QDECL G_ClearClientLog(int client); 1449 1450 // g_siege.c 1451 void InitSiegeMode(void); 1452 void G_SiegeClientExData(gentity_t *msgTarg); 1453 1454 // g_timer 1455 //Timing information 1456 void TIMER_Clear( void ); 1457 void TIMER_Clear2( gentity_t *ent ); 1458 void TIMER_Set( gentity_t *ent, const char *identifier, int duration ); 1459 int TIMER_Get( gentity_t *ent, const char *identifier ); 1460 qboolean TIMER_Done( gentity_t *ent, const char *identifier ); 1461 qboolean TIMER_Start( gentity_t *self, const char *identifier, int duration ); 1462 qboolean TIMER_Done2( gentity_t *ent, const char *identifier, qboolean remove ); 1463 qboolean TIMER_Exists( gentity_t *ent, const char *identifier ); 1464 void TIMER_Remove( gentity_t *ent, const char *identifier ); 1465 1466 float NPC_GetHFOVPercentage( vec3_t spot, vec3_t from, vec3_t facing, float hFOV ); 1467 float NPC_GetVFOVPercentage( vec3_t spot, vec3_t from, vec3_t facing, float vFOV ); 1468 1469 1470 extern void G_SetEnemy (gentity_t *self, gentity_t *enemy); 1471 qboolean InFront( vec3_t spot, vec3_t from, vec3_t fromAngles, float threshHold ); 1472 1473 // ai_main.c 1474 #define MAX_FILEPATH 144 1475 1476 int OrgVisible ( vec3_t org1, vec3_t org2, int ignore); 1477 void BotOrder ( gentity_t *ent, int clientnum, int ordernum); 1478 int InFieldOfVision ( vec3_t viewangles, float fov, vec3_t angles); 1479 1480 // ai_util.c 1481 void B_InitAlloc(void); 1482 void B_CleanupAlloc(void); 1483 1484 //bot settings 1485 typedef struct bot_settings_s 1486 { 1487 char personalityfile[MAX_FILEPATH]; 1488 float skill; 1489 char team[MAX_FILEPATH]; 1490 } bot_settings_t; 1491 1492 int BotAISetup( int restart ); 1493 int BotAIShutdown( int restart ); 1494 int BotAILoadMap( int restart ); 1495 int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean restart); 1496 int BotAIShutdownClient( int client, qboolean restart ); 1497 int BotAIStartFrame( int time ); 1498 1499 #include "g_team.h" // teamplay specific stuff 1500 1501 1502 extern level_locals_t level; 1503 extern gentity_t g_entities[MAX_GENTITIES]; 1504 1505 #define FOFS(x) offsetof(gentity_t, x) 1506 1507 // userinfo validation bitflags 1508 // default is all except extended ascii 1509 // numUserinfoFields + USERINFO_VALIDATION_MAX should not exceed 31 1510 typedef enum userinfoValidationBits_e { 1511 // validation & (1<<(numUserinfoFields+USERINFO_VALIDATION_BLAH)) 1512 USERINFO_VALIDATION_SIZE=0, 1513 USERINFO_VALIDATION_SLASH, 1514 USERINFO_VALIDATION_EXTASCII, 1515 USERINFO_VALIDATION_CONTROLCHARS, 1516 USERINFO_VALIDATION_MAX 1517 } userinfoValidationBits_t; 1518 1519 void Svcmd_ToggleUserinfoValidation_f( void ); 1520 void Svcmd_ToggleAllowVote_f( void ); 1521 1522 // g_cvar.c 1523 #define XCVAR_PROTO 1524 #include "g_xcvar.h" 1525 #undef XCVAR_PROTO 1526 void G_RegisterCvars( void ); 1527 void G_UpdateCvars( void ); 1528 1529 extern gameImport_t *trap; 1530