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