home *** CD-ROM | disk | FTP | other *** search
/ Gambler 19 / GAMBLERCD19.BIN / UTILS / 3D / BRONIE / DUAL_LAU.ZIP / src / g_local.h < prev    next >
C/C++ Source or Header  |  1998-01-13  |  26KB  |  988 lines

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