|
|
1.1.1.2 ! root 1: /* ! 2: Copyright (C) 1997-2001 Id Software, Inc. ! 3: ! 4: This program is free software; you can redistribute it and/or ! 5: modify it under the terms of the GNU General Public License ! 6: as published by the Free Software Foundation; either version 2 ! 7: of the License, or (at your option) any later version. ! 8: ! 9: This program is distributed in the hope that it will be useful, ! 10: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! 12: ! 13: See the GNU General Public License for more details. ! 14: ! 15: You should have received a copy of the GNU General Public License ! 16: along with this program; if not, write to the Free Software ! 17: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! 18: ! 19: */ 1.1 root 20: // g_local.h -- local definitions for game module 21: 22: #include "q_shared.h" 23: 24: // define GAME_INCLUDE so that game.h does not define the 25: // short, server-visible gclient_t and edict_t structures, 26: // because we define the full size ones in this file 27: #define GAME_INCLUDE 28: #include "game.h" 29: 30: //ZOID 31: #include "p_menu.h" 32: //ZOID 33: 34: // the "gameversion" client command will print this plus compile date 35: #define GAMEVERSION "baseq2" 36: 37: // protocol bytes that can be directly added to messages 38: #define svc_muzzleflash 1 39: #define svc_muzzleflash2 2 40: #define svc_temp_entity 3 41: #define svc_layout 4 42: #define svc_inventory 5 43: 44: //================================================================== 45: 46: // view pitching times 47: #define DAMAGE_TIME 0.5 48: #define FALL_TIME 0.3 49: 50: 51: // edict->spawnflags 52: // these are set with checkboxes on each entity in the map editor 53: #define SPAWNFLAG_NOT_EASY 0x00000100 54: #define SPAWNFLAG_NOT_MEDIUM 0x00000200 55: #define SPAWNFLAG_NOT_HARD 0x00000400 56: #define SPAWNFLAG_NOT_DEATHMATCH 0x00000800 57: #define SPAWNFLAG_NOT_COOP 0x00001000 58: 59: // edict->flags 60: #define FL_FLY 0x00000001 61: #define FL_SWIM 0x00000002 // implied immunity to drowining 62: #define FL_IMMUNE_LASER 0x00000004 63: #define FL_INWATER 0x00000008 64: #define FL_GODMODE 0x00000010 65: #define FL_NOTARGET 0x00000020 66: #define FL_IMMUNE_SLIME 0x00000040 67: #define FL_IMMUNE_LAVA 0x00000080 68: #define FL_PARTIALGROUND 0x00000100 // not all corners are valid 69: #define FL_WATERJUMP 0x00000200 // player jumping out of water 70: #define FL_TEAMSLAVE 0x00000400 // not the first on the team 71: #define FL_NO_KNOCKBACK 0x00000800 72: #define FL_POWER_ARMOR 0x00001000 // power armor (if any) is active 73: #define FL_RESPAWN 0x80000000 // used for item respawning 74: 75: 76: #define FRAMETIME 0.1 77: 78: // memory tags to allow dynamic memory to be cleaned up 79: #define TAG_GAME 765 // clear when unloading the dll 80: #define TAG_LEVEL 766 // clear when loading a new level 81: 82: 83: #define MELEE_DISTANCE 80 84: 85: #define BODY_QUEUE_SIZE 8 86: 87: typedef enum 88: { 89: DAMAGE_NO, 90: DAMAGE_YES, // will take damage if hit 91: DAMAGE_AIM // auto targeting recognizes this 92: } damage_t; 93: 94: typedef enum 95: { 96: WEAPON_READY, 97: WEAPON_ACTIVATING, 98: WEAPON_DROPPING, 99: WEAPON_FIRING 100: } weaponstate_t; 101: 102: typedef enum 103: { 104: AMMO_BULLETS, 105: AMMO_SHELLS, 106: AMMO_ROCKETS, 107: AMMO_GRENADES, 108: AMMO_CELLS, 109: AMMO_SLUGS 110: } ammo_t; 111: 112: 113: //deadflag 114: #define DEAD_NO 0 115: #define DEAD_DYING 1 116: #define DEAD_DEAD 2 117: #define DEAD_RESPAWNABLE 3 118: 119: //range 120: #define RANGE_MELEE 0 121: #define RANGE_NEAR 1 122: #define RANGE_MID 2 123: #define RANGE_FAR 3 124: 125: //gib types 126: #define GIB_ORGANIC 0 127: #define GIB_METALLIC 1 128: 129: //monster ai flags 130: #define AI_STAND_GROUND 0x00000001 131: #define AI_TEMP_STAND_GROUND 0x00000002 132: #define AI_SOUND_TARGET 0x00000004 133: #define AI_LOST_SIGHT 0x00000008 134: #define AI_PURSUIT_LAST_SEEN 0x00000010 135: #define AI_PURSUE_NEXT 0x00000020 136: #define AI_PURSUE_TEMP 0x00000040 137: #define AI_HOLD_FRAME 0x00000080 138: #define AI_GOOD_GUY 0x00000100 139: #define AI_BRUTAL 0x00000200 140: #define AI_NOSTEP 0x00000400 141: #define AI_DUCKED 0x00000800 142: #define AI_COMBAT_POINT 0x00001000 143: #define AI_MEDIC 0x00002000 144: #define AI_RESURRECTING 0x00004000 145: 146: //monster attack state 147: #define AS_STRAIGHT 1 148: #define AS_SLIDING 2 149: #define AS_MELEE 3 150: #define AS_MISSILE 4 151: 152: // armor types 153: #define ARMOR_NONE 0 154: #define ARMOR_JACKET 1 155: #define ARMOR_COMBAT 2 156: #define ARMOR_BODY 3 157: #define ARMOR_SHARD 4 158: 159: // power armor types 160: #define POWER_ARMOR_NONE 0 161: #define POWER_ARMOR_SCREEN 1 162: #define POWER_ARMOR_SHIELD 2 163: 164: // handedness values 165: #define RIGHT_HANDED 0 166: #define LEFT_HANDED 1 167: #define CENTER_HANDED 2 168: 169: 170: // game.serverflags values 171: #define SFL_CROSS_TRIGGER_1 0x00000001 172: #define SFL_CROSS_TRIGGER_2 0x00000002 173: #define SFL_CROSS_TRIGGER_3 0x00000004 174: #define SFL_CROSS_TRIGGER_4 0x00000008 175: #define SFL_CROSS_TRIGGER_5 0x00000010 176: #define SFL_CROSS_TRIGGER_6 0x00000020 177: #define SFL_CROSS_TRIGGER_7 0x00000040 178: #define SFL_CROSS_TRIGGER_8 0x00000080 179: #define SFL_CROSS_TRIGGER_MASK 0x000000ff 180: 181: 182: // noise types for PlayerNoise 183: #define PNOISE_SELF 0 184: #define PNOISE_WEAPON 1 185: #define PNOISE_IMPACT 2 186: 187: 188: // edict->movetype values 189: typedef enum 190: { 191: MOVETYPE_NONE, // never moves 192: MOVETYPE_NOCLIP, // origin and angles change with no interaction 193: MOVETYPE_PUSH, // no clip to world, push on box contact 194: MOVETYPE_STOP, // no clip to world, stops on box contact 195: 196: MOVETYPE_WALK, // gravity 197: MOVETYPE_STEP, // gravity, special edge handling 198: MOVETYPE_FLY, 199: MOVETYPE_TOSS, // gravity 200: MOVETYPE_FLYMISSILE, // extra size to monsters 201: MOVETYPE_BOUNCE 202: } movetype_t; 203: 204: 205: 206: typedef struct 207: { 208: int base_count; 209: int max_count; 210: float normal_protection; 211: float energy_protection; 212: int armor; 213: } gitem_armor_t; 214: 215: 216: // gitem_t->flags 217: #define IT_WEAPON 1 // use makes active weapon 218: #define IT_AMMO 2 219: #define IT_ARMOR 4 220: #define IT_STAY_COOP 8 221: #define IT_KEY 16 222: #define IT_POWERUP 32 223: //ZOID 224: #define IT_TECH 64 225: //ZOID 226: 227: // gitem_t->weapmodel for weapons indicates model index 228: #define WEAP_BLASTER 1 229: #define WEAP_SHOTGUN 2 230: #define WEAP_SUPERSHOTGUN 3 231: #define WEAP_MACHINEGUN 4 232: #define WEAP_CHAINGUN 5 233: #define WEAP_GRENADES 6 234: #define WEAP_GRENADELAUNCHER 7 235: #define WEAP_ROCKETLAUNCHER 8 236: #define WEAP_HYPERBLASTER 9 237: #define WEAP_RAILGUN 10 238: #define WEAP_BFG 11 239: #define WEAP_GRAPPLE 12 240: 241: typedef struct gitem_s 242: { 243: char *classname; // spawning name 244: qboolean (*pickup)(struct edict_s *ent, struct edict_s *other); 245: void (*use)(struct edict_s *ent, struct gitem_s *item); 246: void (*drop)(struct edict_s *ent, struct gitem_s *item); 247: void (*weaponthink)(struct edict_s *ent); 248: char *pickup_sound; 249: char *world_model; 250: int world_model_flags; 251: char *view_model; 252: 253: // client side info 254: char *icon; 255: char *pickup_name; // for printing on pickup 256: int count_width; // number of digits to display by icon 257: 258: int quantity; // for ammo how much, for weapons how much is used per shot 259: char *ammo; // for weapons 260: int flags; // IT_* flags 261: 262: int weapmodel; // weapon model index (for weapons) 263: 264: void *info; 265: int tag; 266: 267: char *precaches; // string of all models, sounds, and images this item will use 268: } gitem_t; 269: 270: 271: 272: // 273: // this structure is left intact through an entire game 274: // it should be initialized at dll load time, and read/written to 275: // the server.ssv file for savegames 276: // 277: typedef struct 278: { 279: char helpmessage1[512]; 280: char helpmessage2[512]; 281: int helpchanged; // flash F1 icon if non 0, play sound 282: // and increment only if 1, 2, or 3 283: 284: gclient_t *clients; // [maxclients] 285: 286: // can't store spawnpoint in level, because 287: // it would get overwritten by the savegame restore 288: char spawnpoint[512]; // needed for coop respawns 289: 290: // store latched cvars here that we want to get at often 291: int maxclients; 292: int maxentities; 293: 294: // cross level triggers 295: int serverflags; 296: 297: // items 298: int num_items; 299: 300: qboolean autosaved; 301: } game_locals_t; 302: 303: 304: // 305: // this structure is cleared as each map is entered 306: // it is read/written to the level.sav file for savegames 307: // 308: typedef struct 309: { 310: int framenum; 311: float time; 312: 313: char level_name[MAX_QPATH]; // the descriptive name (Outer Base, etc) 314: char mapname[MAX_QPATH]; // the server name (base1, etc) 315: char nextmap[MAX_QPATH]; // go here when fraglimit is hit 316: char forcemap[MAX_QPATH]; // go here 317: 318: // intermission state 319: float intermissiontime; // time the intermission was started 320: char *changemap; 321: int exitintermission; 322: vec3_t intermission_origin; 323: vec3_t intermission_angle; 324: 325: edict_t *sight_client; // changed once each frame for coop games 326: 327: edict_t *sight_entity; 328: int sight_entity_framenum; 329: edict_t *sound_entity; 330: int sound_entity_framenum; 331: edict_t *sound2_entity; 332: int sound2_entity_framenum; 333: 334: int pic_health; 335: 336: int total_secrets; 337: int found_secrets; 338: 339: int total_goals; 340: int found_goals; 341: 342: int total_monsters; 343: int killed_monsters; 344: 345: edict_t *current_entity; // entity running from G_RunFrame 346: int body_que; // dead bodies 347: 348: int power_cubes; // ugly necessity for coop 349: } level_locals_t; 350: 351: 352: // spawn_temp_t is only used to hold entity field values that 353: // can be set from the editor, but aren't actualy present 354: // in edict_t during gameplay 355: typedef struct 356: { 357: // world vars 358: char *sky; 359: float skyrotate; 360: vec3_t skyaxis; 361: char *nextmap; 362: 363: int lip; 364: int distance; 365: int height; 366: char *noise; 367: float pausetime; 368: char *item; 369: char *gravity; 370: 371: float minyaw; 372: float maxyaw; 373: float minpitch; 374: float maxpitch; 375: } spawn_temp_t; 376: 377: 378: typedef struct 379: { 380: // fixed data 381: vec3_t start_origin; 382: vec3_t start_angles; 383: vec3_t end_origin; 384: vec3_t end_angles; 385: 386: int sound_start; 387: int sound_middle; 388: int sound_end; 389: 390: float accel; 391: float speed; 392: float decel; 393: float distance; 394: 395: float wait; 396: 397: // state data 398: int state; 399: vec3_t dir; 400: float current_speed; 401: float move_speed; 402: float next_speed; 403: float remaining_distance; 404: float decel_distance; 405: void (*endfunc)(edict_t *); 406: } moveinfo_t; 407: 408: 409: typedef struct 410: { 411: void (*aifunc)(edict_t *self, float dist); 412: float dist; 413: void (*thinkfunc)(edict_t *self); 414: } mframe_t; 415: 416: typedef struct 417: { 418: int firstframe; 419: int lastframe; 420: mframe_t *frame; 421: void (*endfunc)(edict_t *self); 422: } mmove_t; 423: 424: typedef struct 425: { 426: mmove_t *currentmove; 427: int aiflags; 428: int nextframe; 429: float scale; 430: 431: void (*stand)(edict_t *self); 432: void (*idle)(edict_t *self); 433: void (*search)(edict_t *self); 434: void (*walk)(edict_t *self); 435: void (*run)(edict_t *self); 436: void (*dodge)(edict_t *self, edict_t *other, float eta); 437: void (*attack)(edict_t *self); 438: void (*melee)(edict_t *self); 439: void (*sight)(edict_t *self, edict_t *other); 440: qboolean (*checkattack)(edict_t *self); 441: 442: float pausetime; 443: float attack_finished; 444: 445: vec3_t saved_goal; 446: float search_time; 447: float trail_time; 448: vec3_t last_sighting; 449: int attack_state; 450: int lefty; 451: float idle_time; 452: int linkcount; 453: 454: int power_armor_type; 455: int power_armor_power; 456: } monsterinfo_t; 457: 458: 459: 460: extern game_locals_t game; 461: extern level_locals_t level; 462: extern game_import_t gi; 463: extern game_export_t globals; 464: extern spawn_temp_t st; 465: 466: extern int sm_meat_index; 467: extern int snd_fry; 468: 469: extern int jacket_armor_index; 470: extern int combat_armor_index; 471: extern int body_armor_index; 472: 473: 474: // means of death 475: #define MOD_UNKNOWN 0 476: #define MOD_BLASTER 1 477: #define MOD_SHOTGUN 2 478: #define MOD_SSHOTGUN 3 479: #define MOD_MACHINEGUN 4 480: #define MOD_CHAINGUN 5 481: #define MOD_GRENADE 6 482: #define MOD_G_SPLASH 7 483: #define MOD_ROCKET 8 484: #define MOD_R_SPLASH 9 485: #define MOD_HYPERBLASTER 10 486: #define MOD_RAILGUN 11 487: #define MOD_BFG_LASER 12 488: #define MOD_BFG_BLAST 13 489: #define MOD_BFG_EFFECT 14 490: #define MOD_HANDGRENADE 15 491: #define MOD_HG_SPLASH 16 492: #define MOD_WATER 17 493: #define MOD_SLIME 18 494: #define MOD_LAVA 19 495: #define MOD_CRUSH 20 496: #define MOD_TELEFRAG 21 497: #define MOD_FALLING 22 498: #define MOD_SUICIDE 23 499: #define MOD_HELD_GRENADE 24 500: #define MOD_EXPLOSIVE 25 501: #define MOD_BARREL 26 502: #define MOD_BOMB 27 503: #define MOD_EXIT 28 504: #define MOD_SPLASH 29 505: #define MOD_TARGET_LASER 30 506: #define MOD_TRIGGER_HURT 31 507: #define MOD_HIT 32 508: #define MOD_TARGET_BLASTER 33 509: #define MOD_GRAPPLE 34 510: #define MOD_FRIENDLY_FIRE 0x8000000 511: 512: extern int meansOfDeath; 513: 514: 515: extern edict_t *g_edicts; 516: 517: #define FOFS(x) (int)&(((edict_t *)0)->x) 518: #define STOFS(x) (int)&(((spawn_temp_t *)0)->x) 519: #define LLOFS(x) (int)&(((level_locals_t *)0)->x) 520: #define CLOFS(x) (int)&(((gclient_t *)0)->x) 521: 522: #define random() ((rand () & 0x7fff) / ((float)0x7fff)) 523: #define crandom() (2.0 * (random() - 0.5)) 524: 525: extern cvar_t *maxentities; 526: extern cvar_t *deathmatch; 527: extern cvar_t *coop; 528: extern cvar_t *dmflags; 529: extern cvar_t *skill; 530: extern cvar_t *fraglimit; 531: extern cvar_t *timelimit; 532: //ZOID 533: extern cvar_t *capturelimit; 534: extern cvar_t *instantweap; 535: //ZOID 536: extern cvar_t *password; 537: extern cvar_t *g_select_empty; 538: extern cvar_t *dedicated; 539: 1.1.1.2 ! root 540: extern cvar_t *filterban; ! 541: 1.1 root 542: extern cvar_t *sv_gravity; 543: extern cvar_t *sv_maxvelocity; 544: 545: extern cvar_t *gun_x, *gun_y, *gun_z; 546: extern cvar_t *sv_rollspeed; 547: extern cvar_t *sv_rollangle; 548: 549: extern cvar_t *run_pitch; 550: extern cvar_t *run_roll; 551: extern cvar_t *bob_up; 552: extern cvar_t *bob_pitch; 553: extern cvar_t *bob_roll; 554: 555: extern cvar_t *sv_cheats; 556: extern cvar_t *maxclients; 557: 558: extern cvar_t *flood_msgs; 559: extern cvar_t *flood_persecond; 560: extern cvar_t *flood_waitdelay; 561: 562: extern cvar_t *sv_maplist; 563: 564: //ZOID 565: extern qboolean is_quad; 566: //ZOID 567: 568: #define world (&g_edicts[0]) 569: 570: // item spawnflags 571: #define ITEM_TRIGGER_SPAWN 0x00000001 572: #define ITEM_NO_TOUCH 0x00000002 573: // 6 bits reserved for editor flags 574: // 8 bits used as power cube id bits for coop games 575: #define DROPPED_ITEM 0x00010000 576: #define DROPPED_PLAYER_ITEM 0x00020000 577: #define ITEM_TARGETS_USED 0x00040000 578: 579: // 580: // fields are needed for spawning from the entity string 581: // and saving / loading games 582: // 583: #define FFL_SPAWNTEMP 1 584: 585: typedef enum { 586: F_INT, 587: F_FLOAT, 588: F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL 589: F_GSTRING, // string on disk, pointer in memory, TAG_GAME 590: F_VECTOR, 591: F_ANGLEHACK, 592: F_EDICT, // index on disk, pointer in memory 593: F_ITEM, // index on disk, pointer in memory 594: F_CLIENT, // index on disk, pointer in memory 595: F_IGNORE 596: } fieldtype_t; 597: 598: typedef struct 599: { 600: char *name; 601: int ofs; 602: fieldtype_t type; 603: int flags; 604: } field_t; 605: 606: 607: extern field_t fields[]; 608: extern gitem_t itemlist[]; 609: 610: 611: // 612: // g_cmds.c 613: // 614: qboolean CheckFlood(edict_t *ent); 615: void Cmd_Help_f (edict_t *ent); 616: void Cmd_Score_f (edict_t *ent); 617: 618: // 619: // g_items.c 620: // 621: void PrecacheItem (gitem_t *it); 622: void InitItems (void); 623: void SetItemNames (void); 624: gitem_t *FindItem (char *pickup_name); 625: gitem_t *FindItemByClassname (char *classname); 626: #define ITEM_INDEX(x) ((x)-itemlist) 627: edict_t *Drop_Item (edict_t *ent, gitem_t *item); 628: void SetRespawn (edict_t *ent, float delay); 629: void ChangeWeapon (edict_t *ent); 630: void SpawnItem (edict_t *ent, gitem_t *item); 631: void Think_Weapon (edict_t *ent); 632: int ArmorIndex (edict_t *ent); 633: int PowerArmorType (edict_t *ent); 634: gitem_t *GetItemByIndex (int index); 635: qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count); 636: void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf); 637: 638: // 639: // g_utils.c 640: // 641: qboolean KillBox (edict_t *ent); 642: void G_ProjectSource (vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result); 643: edict_t *G_Find (edict_t *from, int fieldofs, char *match); 644: edict_t *findradius (edict_t *from, vec3_t org, float rad); 645: edict_t *G_PickTarget (char *targetname); 646: void G_UseTargets (edict_t *ent, edict_t *activator); 647: void G_SetMovedir (vec3_t angles, vec3_t movedir); 648: 649: void G_InitEdict (edict_t *e); 650: edict_t *G_Spawn (void); 651: void G_FreeEdict (edict_t *e); 652: 653: void G_TouchTriggers (edict_t *ent); 654: void G_TouchSolids (edict_t *ent); 655: 656: char *G_CopyString (char *in); 657: 658: float *tv (float x, float y, float z); 659: char *vtos (vec3_t v); 660: 661: float vectoyaw (vec3_t vec); 662: void vectoangles (vec3_t vec, vec3_t angles); 663: 664: // 665: // g_combat.c 666: // 667: qboolean OnSameTeam (edict_t *ent1, edict_t *ent2); 668: qboolean CanDamage (edict_t *targ, edict_t *inflictor); 669: qboolean CheckTeamDamage (edict_t *targ, edict_t *attacker); 670: void T_Damage (edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, vec3_t point, vec3_t normal, int damage, int knockback, int dflags, int mod); 671: void T_RadiusDamage (edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod); 672: 673: // damage flags 674: #define DAMAGE_RADIUS 0x00000001 // damage was indirect 675: #define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage 676: #define DAMAGE_ENERGY 0x00000004 // damage is from an energy based weapon 677: #define DAMAGE_NO_KNOCKBACK 0x00000008 // do not affect velocity, just view angles 678: #define DAMAGE_BULLET 0x00000010 // damage is from a bullet (used for ricochets) 679: #define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect 680: 681: #define DEFAULT_BULLET_HSPREAD 300 682: #define DEFAULT_BULLET_VSPREAD 500 683: #define DEFAULT_SHOTGUN_HSPREAD 1000 684: #define DEFAULT_SHOTGUN_VSPREAD 500 685: #define DEFAULT_DEATHMATCH_SHOTGUN_COUNT 12 686: #define DEFAULT_SHOTGUN_COUNT 12 687: #define DEFAULT_SSHOTGUN_COUNT 20 688: 689: // 690: // g_monster.c 691: // 692: void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype); 693: void monster_fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype); 694: void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect); 695: void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype); 696: void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype); 697: void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype); 698: void monster_fire_bfg (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype); 699: void M_droptofloor (edict_t *ent); 700: void monster_think (edict_t *self); 701: void walkmonster_start (edict_t *self); 702: void swimmonster_start (edict_t *self); 703: void flymonster_start (edict_t *self); 704: void AttackFinished (edict_t *self, float time); 705: void monster_death_use (edict_t *self); 706: void M_CatagorizePosition (edict_t *ent); 707: qboolean M_CheckAttack (edict_t *self); 708: void M_FlyCheck (edict_t *self); 709: void M_CheckGround (edict_t *ent); 710: 711: // 712: // g_misc.c 713: // 714: void ThrowHead (edict_t *self, char *gibname, int damage, int type); 715: void ThrowClientHead (edict_t *self, int damage); 716: void ThrowGib (edict_t *self, char *gibname, int damage, int type); 717: void BecomeExplosion1(edict_t *self); 718: 719: // 720: // g_ai.c 721: // 722: void AI_SetSightClient (void); 723: 724: void ai_stand (edict_t *self, float dist); 725: void ai_move (edict_t *self, float dist); 726: void ai_walk (edict_t *self, float dist); 727: void ai_turn (edict_t *self, float dist); 728: void ai_run (edict_t *self, float dist); 729: void ai_charge (edict_t *self, float dist); 730: int range (edict_t *self, edict_t *other); 731: 732: void FoundTarget (edict_t *self); 733: qboolean infront (edict_t *self, edict_t *other); 734: qboolean visible (edict_t *self, edict_t *other); 735: qboolean FacingIdeal(edict_t *self); 736: 737: // 738: // g_weapon.c 739: // 740: void ThrowDebris (edict_t *self, char *modelname, float speed, vec3_t origin); 741: qboolean fire_hit (edict_t *self, vec3_t aim, int damage, int kick); 742: void fire_bullet (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int mod); 743: void fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int mod); 744: void fire_blaster (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int effect, qboolean hyper); 745: void fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius); 746: void fire_grenade2 (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held); 747: void fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage); 748: void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick); 749: void fire_bfg (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius); 750: 751: // 752: // g_ptrail.c 753: // 754: void PlayerTrail_Init (void); 755: void PlayerTrail_Add (vec3_t spot); 756: void PlayerTrail_New (vec3_t spot); 757: edict_t *PlayerTrail_PickFirst (edict_t *self); 758: edict_t *PlayerTrail_PickNext (edict_t *self); 759: edict_t *PlayerTrail_LastSpot (void); 760: 761: 762: // 763: // g_client.c 764: // 765: void respawn (edict_t *ent); 766: void BeginIntermission (edict_t *targ); 767: void PutClientInServer (edict_t *ent); 768: void InitClientPersistant (gclient_t *client); 769: void InitClientResp (gclient_t *client); 770: void InitBodyQue (void); 771: void ClientBeginServerFrame (edict_t *ent); 1.1.1.2 ! root 772: void ClientUserinfoChanged (edict_t *ent, char *userinfo); 1.1 root 773: 774: // 775: // g_player.c 776: // 777: void player_pain (edict_t *self, edict_t *other, float kick, int damage); 778: void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); 779: 780: // 781: // g_svcmds.c 782: // 783: void ServerCommand (void); 784: 785: // 786: // p_view.c 787: // 788: void ClientEndServerFrame (edict_t *ent); 789: 790: // 791: // p_hud.c 792: // 793: void MoveClientToIntermission (edict_t *client); 794: void G_SetStats (edict_t *ent); 795: void ValidateSelectedItem (edict_t *ent); 796: void DeathmatchScoreboardMessage (edict_t *client, edict_t *killer); 797: 798: // 799: // g_pweapon.c 800: // 801: void PlayerNoise(edict_t *who, vec3_t where, int type); 802: void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result); 803: void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent)); 804: 805: // 806: // m_move.c 807: // 808: qboolean M_CheckBottom (edict_t *ent); 809: qboolean M_walkmove (edict_t *ent, float yaw, float dist); 810: void M_MoveToGoal (edict_t *ent, float dist); 811: void M_ChangeYaw (edict_t *ent); 812: 813: // 814: // g_phys.c 815: // 816: void G_RunEntity (edict_t *ent); 817: 818: // 819: // g_main.c 820: // 821: void SaveClientData (void); 822: void FetchClientEntData (edict_t *ent); 823: void EndDMLevel (void); 824: 1.1.1.2 ! root 825: // ! 826: // g_svcmds.c ! 827: // ! 828: qboolean SV_FilterPacket (char *from); 1.1 root 829: 830: //============================================================================ 831: 832: // client_t->anim_priority 833: #define ANIM_BASIC 0 // stand / run 834: #define ANIM_WAVE 1 835: #define ANIM_JUMP 2 836: #define ANIM_PAIN 3 837: #define ANIM_ATTACK 4 838: #define ANIM_DEATH 5 839: #define ANIM_REVERSE 6 840: 841: 842: // client data that stays across multiple level loads 843: typedef struct 844: { 845: char userinfo[MAX_INFO_STRING]; 846: char netname[16]; 847: int hand; 848: 849: qboolean connected; // a loadgame will leave valid entities that 850: // just don't have a connection yet 851: 852: // values saved and restored from edicts when changing levels 853: int health; 854: int max_health; 1.1.1.2 ! root 855: int savedFlags; 1.1 root 856: 857: int selected_item; 858: int inventory[MAX_ITEMS]; 859: 860: // ammo capacities 861: int max_bullets; 862: int max_shells; 863: int max_rockets; 864: int max_grenades; 865: int max_cells; 866: int max_slugs; 867: 868: gitem_t *weapon; 869: gitem_t *lastweapon; 870: 871: int power_cubes; // used for tracking the cubes in coop games 872: int score; // for calculating total unit score in coop games 873: } client_persistant_t; 874: 875: // client data that stays across deathmatch respawns 876: typedef struct 877: { 878: client_persistant_t coop_respawn; // what to set client->pers to on a respawn 879: int enterframe; // level.framenum the client entered the game 880: int score; // frags, etc 881: //ZOID 882: int ctf_team; // CTF team 883: int ctf_state; 884: float ctf_lasthurtcarrier; 885: float ctf_lastreturnedflag; 886: float ctf_flagsince; 887: float ctf_lastfraggedcarrier; 888: qboolean id_state; 1.1.1.2 ! root 889: float lastidtime; 1.1 root 890: qboolean voted; // for elections 891: qboolean ready; 892: qboolean admin; 893: struct ghost_s *ghost; // for ghost codes 894: //ZOID 895: vec3_t cmd_angles; // angles sent over in the last command 896: int game_helpchanged; 897: int helpchanged; 898: } client_respawn_t; 899: 900: // this structure is cleared on each PutClientInServer(), 901: // except for 'client->pers' 902: struct gclient_s 903: { 904: // known to server 905: player_state_t ps; // communicated by server to clients 906: int ping; 907: 908: // private to game 909: client_persistant_t pers; 910: client_respawn_t resp; 911: pmove_state_t old_pmove; // for detecting out-of-pmove changes 912: 913: qboolean showscores; // set layout stat 914: //ZOID 915: qboolean inmenu; // in menu 916: pmenuhnd_t *menu; // current menu 917: //ZOID 918: qboolean showinventory; // set layout stat 919: qboolean showhelp; 920: qboolean showhelpicon; 921: 922: int ammo_index; 923: 924: int buttons; 925: int oldbuttons; 926: int latched_buttons; 927: 928: qboolean weapon_thunk; 929: 930: gitem_t *newweapon; 931: 932: // sum up damage over an entire frame, so 933: // shotgun blasts give a single big kick 934: int damage_armor; // damage absorbed by armor 935: int damage_parmor; // damage absorbed by power armor 936: int damage_blood; // damage taken out of health 937: int damage_knockback; // impact damage 938: vec3_t damage_from; // origin for vector calculation 939: 940: float killer_yaw; // when dead, look at killer 941: 942: weaponstate_t weaponstate; 943: vec3_t kick_angles; // weapon kicks 944: vec3_t kick_origin; 945: float v_dmg_roll, v_dmg_pitch, v_dmg_time; // damage kicks 946: float fall_time, fall_value; // for view drop on fall 947: float damage_alpha; 948: float bonus_alpha; 949: vec3_t damage_blend; 950: vec3_t v_angle; // aiming direction 951: float bobtime; // so off-ground doesn't change it 952: vec3_t oldviewangles; 953: vec3_t oldvelocity; 954: 955: float next_drown_time; 956: int old_waterlevel; 957: int breather_sound; 958: 959: int machinegun_shots; // for weapon raising 960: 961: // animation vars 962: int anim_end; 963: int anim_priority; 964: qboolean anim_duck; 965: qboolean anim_run; 966: 967: // powerup timers 968: float quad_framenum; 969: float invincible_framenum; 970: float breather_framenum; 971: float enviro_framenum; 972: 973: qboolean grenade_blew_up; 974: float grenade_time; 975: int silencer_shots; 976: int weapon_sound; 977: 978: float pickup_msg_time; 979: 980: float flood_locktill; // locked from talking 981: float flood_when[10]; // when messages were said 982: int flood_whenhead; // head pointer for when said 983: 984: float respawn_time; // can respawn when time > this 985: 986: //ZOID 987: void *ctf_grapple; // entity of grapple 988: int ctf_grapplestate; // true if pulling 989: float ctf_grapplereleasetime; // time of grapple release 990: float ctf_regentime; // regen tech 991: float ctf_techsndtime; 992: float ctf_lasttechmsg; 993: edict_t *chase_target; 994: qboolean update_chase; 995: float menutime; // time to update menu 996: qboolean menudirty; 997: //ZOID 998: }; 999: 1000: 1001: struct edict_s 1002: { 1003: entity_state_t s; 1004: struct gclient_s *client; // NULL if not a player 1005: // the server expects the first part 1006: // of gclient_s to be a player_state_t 1007: // but the rest of it is opaque 1008: 1009: qboolean inuse; 1010: int linkcount; 1011: 1012: // FIXME: move these fields to a server private sv_entity_t 1013: link_t area; // linked to a division node or leaf 1014: 1015: int num_clusters; // if -1, use headnode instead 1016: int clusternums[MAX_ENT_CLUSTERS]; 1017: int headnode; // unused if num_clusters != -1 1018: int areanum, areanum2; 1019: 1020: //================================ 1021: 1022: int svflags; 1023: vec3_t mins, maxs; 1024: vec3_t absmin, absmax, size; 1025: solid_t solid; 1026: int clipmask; 1027: edict_t *owner; 1028: 1029: 1030: // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER 1031: // EXPECTS THE FIELDS IN THAT ORDER! 1032: 1033: //================================ 1034: int movetype; 1035: int flags; 1036: 1037: char *model; 1038: float freetime; // sv.time when the object was freed 1039: 1040: // 1041: // only used locally in game, not by server 1042: // 1043: char *message; 1044: char *classname; 1045: int spawnflags; 1046: 1047: float timestamp; 1048: 1049: float angle; // set in qe3, -1 = up, -2 = down 1050: char *target; 1051: char *targetname; 1052: char *killtarget; 1053: char *team; 1054: char *pathtarget; 1055: char *deathtarget; 1056: char *combattarget; 1057: edict_t *target_ent; 1058: 1059: float speed, accel, decel; 1060: vec3_t movedir; 1061: vec3_t pos1, pos2; 1062: 1063: vec3_t velocity; 1064: vec3_t avelocity; 1065: int mass; 1066: float air_finished; 1067: float gravity; // per entity gravity multiplier (1.0 is normal) 1068: // use for lowgrav artifact, flares 1069: 1070: edict_t *goalentity; 1071: edict_t *movetarget; 1072: float yaw_speed; 1073: float ideal_yaw; 1074: 1075: float nextthink; 1076: void (*prethink) (edict_t *ent); 1077: void (*think)(edict_t *self); 1078: void (*blocked)(edict_t *self, edict_t *other); //move to moveinfo? 1079: void (*touch)(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf); 1080: void (*use)(edict_t *self, edict_t *other, edict_t *activator); 1081: void (*pain)(edict_t *self, edict_t *other, float kick, int damage); 1082: void (*die)(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point); 1083: 1084: float touch_debounce_time; // are all these legit? do we need more/less of them? 1085: float pain_debounce_time; 1086: float damage_debounce_time; 1087: float fly_sound_debounce_time; //move to clientinfo 1088: float last_move_time; 1089: 1090: int health; 1091: int max_health; 1092: int gib_health; 1093: int deadflag; 1094: qboolean show_hostile; 1095: 1096: float powerarmor_time; 1097: 1098: char *map; // target_changelevel 1099: 1100: int viewheight; // height above origin where eyesight is determined 1101: int takedamage; 1102: int dmg; 1103: int radius_dmg; 1104: float dmg_radius; 1105: int sounds; //make this a spawntemp var? 1106: int count; 1107: 1108: edict_t *chain; 1109: edict_t *enemy; 1110: edict_t *oldenemy; 1111: edict_t *activator; 1112: edict_t *groundentity; 1113: int groundentity_linkcount; 1114: edict_t *teamchain; 1115: edict_t *teammaster; 1116: 1117: edict_t *mynoise; // can go in client only 1118: edict_t *mynoise2; 1119: 1120: int noise_index; 1121: int noise_index2; 1122: float volume; 1123: float attenuation; 1124: 1125: // timing variables 1126: float wait; 1127: float delay; // before firing targets 1128: float random; 1129: 1130: float teleport_time; 1131: 1132: int watertype; 1133: int waterlevel; 1134: 1135: vec3_t move_origin; 1136: vec3_t move_angles; 1137: 1138: // move this to clientinfo? 1139: int light_level; 1140: 1141: int style; // also used as areaportal number 1142: 1143: gitem_t *item; // for bonus items 1144: 1145: // common data blocks 1146: moveinfo_t moveinfo; 1147: monsterinfo_t monsterinfo; 1148: }; 1149: 1150: //ZOID 1151: #include "g_ctf.h" 1152: //ZOID 1153:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.