Annotation of quake2/game/g_local.h, revision 1.1.1.2

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.