codemp/game/be_aas.h

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Id Software, Inc.
00002 //
00003 
00004 /*****************************************************************************
00005  * name:                be_aas.h
00006  *
00007  * desc:                Area Awareness System, stuff exported to the AI
00008  *
00009  * $Archive: /source/code/botlib/be_aas.h $
00010  * $Author: osman $ 
00011  * $Revision: 1.4 $
00012  * $Modtime: 10/05/99 3:32p $
00013  * $Date: 2003/03/15 23:43:59 $
00014  *
00015  *****************************************************************************/
00016 
00017 #ifndef MAX_STRINGFIELD
00018 #define MAX_STRINGFIELD                         80
00019 #endif
00020 
00021 //travel flags
00022 #define TFL_INVALID                             0x00000001      //traveling temporary not possible
00023 #define TFL_WALK                                0x00000002      //walking
00024 #define TFL_CROUCH                              0x00000004      //crouching
00025 #define TFL_BARRIERJUMP                 0x00000008      //jumping onto a barrier
00026 #define TFL_JUMP                                0x00000010      //jumping
00027 #define TFL_LADDER                              0x00000020      //climbing a ladder
00028 #define TFL_WALKOFFLEDGE                0x00000080      //walking of a ledge
00029 #define TFL_SWIM                                0x00000100      //swimming
00030 #define TFL_WATERJUMP                   0x00000200      //jumping out of the water
00031 #define TFL_TELEPORT                    0x00000400      //teleporting
00032 #define TFL_ELEVATOR                    0x00000800      //elevator
00033 #define TFL_ROCKETJUMP                  0x00001000      //rocket jumping
00034 #define TFL_BFGJUMP                             0x00002000      //bfg jumping
00035 #define TFL_GRAPPLEHOOK                 0x00004000      //grappling hook
00036 #define TFL_DOUBLEJUMP                  0x00008000      //double jump
00037 #define TFL_RAMPJUMP                    0x00010000      //ramp jump
00038 #define TFL_STRAFEJUMP                  0x00020000      //strafe jump
00039 #define TFL_JUMPPAD                             0x00040000      //jump pad
00040 #define TFL_AIR                                 0x00080000      //travel through air
00041 #define TFL_WATER                               0x00100000      //travel through water
00042 #define TFL_SLIME                               0x00200000      //travel through slime
00043 #define TFL_LAVA                                0x00400000      //travel through lava
00044 #define TFL_DONOTENTER                  0x00800000      //travel through donotenter area
00045 #define TFL_FUNCBOB                             0x01000000      //func bobbing
00046 #define TFL_FLIGHT                              0x02000000      //flight
00047 #define TFL_BRIDGE                              0x04000000      //move over a bridge
00048 //
00049 #define TFL_NOTTEAM1                    0x08000000      //not team 1
00050 #define TFL_NOTTEAM2                    0x10000000      //not team 2
00051 
00052 //default travel flags
00053 #define TFL_DEFAULT     TFL_WALK|TFL_CROUCH|TFL_BARRIERJUMP|\
00054         TFL_JUMP|TFL_LADDER|\
00055         TFL_WALKOFFLEDGE|TFL_SWIM|TFL_WATERJUMP|\
00056         TFL_TELEPORT|TFL_ELEVATOR|\
00057         TFL_AIR|TFL_WATER|TFL_JUMPPAD|TFL_FUNCBOB
00058 
00059 typedef enum
00060 {
00061         SOLID_NOT,                      // no interaction with other objects
00062         SOLID_TRIGGER,          // only touch when inside, after moving
00063         SOLID_BBOX,                     // touch on edge
00064         SOLID_BSP                       // bsp clip, touch on edge
00065 } solid_t;
00066 
00067 //a trace is returned when a box is swept through the AAS world
00068 typedef struct aas_trace_s
00069 {
00070         qboolean        startsolid;     // if true, the initial point was in a solid area
00071         float           fraction;       // time completed, 1.0 = didn't hit anything
00072         vec3_t          endpos;         // final position
00073         int                     ent;            // entity blocking the trace
00074         int                     lastarea;       // last area the trace was in (zero if none)
00075         int                     area;           // area blocking the trace (zero if none)
00076         int                     planenum;       // number of the plane that was hit
00077 } aas_trace_t;
00078 
00079 /* Defined in botlib.h
00080 
00081 //bsp_trace_t hit surface
00082 typedef struct bsp_surface_s
00083 {
00084         char name[16];
00085         int flags;
00086         int value;
00087 } bsp_surface_t;
00088 
00089 //a trace is returned when a box is swept through the BSP world
00090 typedef struct bsp_trace_s
00091 {
00092         qboolean                allsolid;       // if true, plane is not valid
00093         qboolean                startsolid;     // if true, the initial point was in a solid area
00094         float                   fraction;       // time completed, 1.0 = didn't hit anything
00095         vec3_t                  endpos;         // final position
00096         cplane_t                plane;          // surface normal at impact
00097         float                   exp_dist;       // expanded plane distance
00098         int                             sidenum;        // number of the brush side hit
00099         bsp_surface_t   surface;        // hit surface
00100         int                             contents;       // contents on other side of surface hit
00101         int                             ent;            // number of entity hit
00102 } bsp_trace_t;
00103 //
00104 */
00105 
00106 //entity info
00107 typedef struct aas_entityinfo_s
00108 {
00109         int             valid;                  // true if updated this frame
00110         int             type;                   // entity type
00111         int             flags;                  // entity flags
00112         float   ltime;                  // local time
00113         float   update_time;    // time between last and current update
00114         int             number;                 // number of the entity
00115         vec3_t  origin;                 // origin of the entity
00116         vec3_t  angles;                 // angles of the model
00117         vec3_t  old_origin;             // for lerping
00118         vec3_t  lastvisorigin;  // last visible origin
00119         vec3_t  mins;                   // bounding box minimums
00120         vec3_t  maxs;                   // bounding box maximums
00121         int             groundent;              // ground entity
00122         int             solid;                  // solid type
00123         int             modelindex;             // model used
00124         int             modelindex2;    // weapons, CTF flags, etc
00125         int             frame;                  // model frame number
00126         int             event;                  // impulse events -- muzzle flashes, footsteps, etc
00127         int             eventParm;              // even parameter
00128         int             powerups;               // bit flags
00129         int             weapon;                 // determines weapon and flash model, etc
00130         int             legsAnim;               // current legs anim
00131         int             torsoAnim;              // current torso anim
00132 } aas_entityinfo_t;
00133 
00134 // area info
00135 typedef struct aas_areainfo_s
00136 {
00137         int contents;
00138         int flags;
00139         int presencetype;
00140         int cluster;
00141         vec3_t mins;
00142         vec3_t maxs;
00143         vec3_t center;
00144 } aas_areainfo_t;
00145 
00146 // client movement prediction stop events, stop as soon as:
00147 #define SE_NONE                                 0
00148 #define SE_HITGROUND                    1               // the ground is hit
00149 #define SE_LEAVEGROUND                  2               // there's no ground
00150 #define SE_ENTERWATER                   4               // water is entered
00151 #define SE_ENTERSLIME                   8               // slime is entered
00152 #define SE_ENTERLAVA                    16              // lava is entered
00153 #define SE_HITGROUNDDAMAGE              32              // the ground is hit with damage
00154 #define SE_GAP                                  64              // there's a gap
00155 #define SE_TOUCHJUMPPAD                 128             // touching a jump pad area
00156 #define SE_TOUCHTELEPORTER              256             // touching teleporter
00157 #define SE_ENTERAREA                    512             // the given stoparea is entered
00158 #define SE_HITGROUNDAREA                1024    // a ground face in the area is hit
00159 #define SE_HITBOUNDINGBOX               2048    // hit the specified bounding box
00160 #define SE_TOUCHCLUSTERPORTAL   4096    // touching a cluster portal
00161 
00162 typedef struct aas_clientmove_s
00163 {
00164         vec3_t endpos;                  //position at the end of movement prediction
00165         int endarea;                    //area at end of movement prediction
00166         vec3_t velocity;                //velocity at the end of movement prediction
00167         aas_trace_t trace;              //last trace
00168         int presencetype;               //presence type at end of movement prediction
00169         int stopevent;                  //event that made the prediction stop
00170         int endcontents;                //contents at the end of movement prediction
00171         float time;                             //time predicted ahead
00172         int frames;                             //number of frames predicted ahead
00173 } aas_clientmove_t;
00174 
00175 // alternate route goals
00176 #define ALTROUTEGOAL_ALL                                1
00177 #define ALTROUTEGOAL_CLUSTERPORTALS             2
00178 #define ALTROUTEGOAL_VIEWPORTALS                4
00179 
00180 typedef struct aas_altroutegoal_s
00181 {
00182         vec3_t origin;
00183         int areanum;
00184         unsigned short starttraveltime;
00185         unsigned short goaltraveltime;
00186         unsigned short extratraveltime;
00187 } aas_altroutegoal_t;
00188 
00189 // route prediction stop events
00190 #define RSE_NONE                                0
00191 #define RSE_NOROUTE                             1       //no route to goal
00192 #define RSE_USETRAVELTYPE               2       //stop as soon as on of the given travel types is used
00193 #define RSE_ENTERCONTENTS               4       //stop when entering the given contents
00194 #define RSE_ENTERAREA                   8       //stop when entering the given area
00195 
00196 typedef struct aas_predictroute_s
00197 {
00198         vec3_t endpos;                  //position at the end of movement prediction
00199         int endarea;                    //area at end of movement prediction
00200         int stopevent;                  //event that made the prediction stop
00201         int endcontents;                //contents at the end of movement prediction
00202         int endtravelflags;             //end travel flags
00203         int numareas;                   //number of areas predicted ahead
00204         int time;                               //time predicted ahead (in hundreth of a sec)
00205 } aas_predictroute_t;