1 /* 2 =========================================================================== 3 Copyright (C) 1999-2005 Id Software, Inc. 4 5 This file is part of Quake III Arena source code. 6 7 Quake III Arena source code is free software; you can redistribute it 8 and/or modify it under the terms of the GNU General Public License as 9 published by the Free Software Foundation; either version 2 of the License, 10 or (at your option) any later version. 11 12 Quake III Arena source code is distributed in the hope that it will be 13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with Quake III Arena source code; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 =========================================================================== 21 */ 22 // 23 24 /***************************************************************************** 25 * name: be_aas.h 26 * 27 * desc: Area Awareness System, stuff exported to the AI 28 * 29 * $Archive: /source/code/botlib/be_aas.h $ 30 * 31 *****************************************************************************/ 32 33 #ifndef MAX_STRINGFIELD 34 #define MAX_STRINGFIELD 80 35 #endif 36 37 //travel flags 38 #define TFL_INVALID 0x00000001 //traveling temporary not possible 39 #define TFL_WALK 0x00000002 //walking 40 #define TFL_CROUCH 0x00000004 //crouching 41 #define TFL_BARRIERJUMP 0x00000008 //jumping onto a barrier 42 #define TFL_JUMP 0x00000010 //jumping 43 #define TFL_LADDER 0x00000020 //climbing a ladder 44 #define TFL_WALKOFFLEDGE 0x00000080 //walking of a ledge 45 #define TFL_SWIM 0x00000100 //swimming 46 #define TFL_WATERJUMP 0x00000200 //jumping out of the water 47 #define TFL_TELEPORT 0x00000400 //teleporting 48 #define TFL_ELEVATOR 0x00000800 //elevator 49 #define TFL_ROCKETJUMP 0x00001000 //rocket jumping 50 #define TFL_BFGJUMP 0x00002000 //bfg jumping 51 #define TFL_GRAPPLEHOOK 0x00004000 //grappling hook 52 #define TFL_DOUBLEJUMP 0x00008000 //double jump 53 #define TFL_RAMPJUMP 0x00010000 //ramp jump 54 #define TFL_STRAFEJUMP 0x00020000 //strafe jump 55 #define TFL_JUMPPAD 0x00040000 //jump pad 56 #define TFL_AIR 0x00080000 //travel through air 57 #define TFL_WATER 0x00100000 //travel through water 58 #define TFL_SLIME 0x00200000 //travel through slime 59 #define TFL_LAVA 0x00400000 //travel through lava 60 #define TFL_DONOTENTER 0x00800000 //travel through donotenter area 61 #define TFL_FUNCBOB 0x01000000 //func bobbing 62 #define TFL_FLIGHT 0x02000000 //flight 63 #define TFL_BRIDGE 0x04000000 //move over a bridge 64 // 65 #define TFL_NOTTEAM1 0x08000000 //not team 1 66 #define TFL_NOTTEAM2 0x10000000 //not team 2 67 68 //default travel flags 69 #define TFL_DEFAULT TFL_WALK|TFL_CROUCH|TFL_BARRIERJUMP|\ 70 TFL_JUMP|TFL_LADDER|\ 71 TFL_WALKOFFLEDGE|TFL_SWIM|TFL_WATERJUMP|\ 72 TFL_TELEPORT|TFL_ELEVATOR|\ 73 TFL_AIR|TFL_WATER|TFL_JUMPPAD|TFL_FUNCBOB 74 75 typedef enum 76 { 77 SOLID_NOT, // no interaction with other objects 78 SOLID_TRIGGER, // only touch when inside, after moving 79 SOLID_BBOX, // touch on edge 80 SOLID_BSP // bsp clip, touch on edge 81 } solid_t; 82 83 //a trace is returned when a box is swept through the AAS world 84 typedef struct aas_trace_s 85 { 86 qboolean startsolid; // if true, the initial point was in a solid area 87 float fraction; // time completed, 1.0 = didn't hit anything 88 vec3_t endpos; // final position 89 int ent; // entity blocking the trace 90 int lastarea; // last area the trace was in (zero if none) 91 int area; // area blocking the trace (zero if none) 92 int planenum; // number of the plane that was hit 93 } aas_trace_t; 94 95 /* Defined in botlib.h 96 97 //bsp_trace_t hit surface 98 typedef struct bsp_surface_s 99 { 100 char name[16]; 101 int flags; 102 int value; 103 } bsp_surface_t; 104 105 //a trace is returned when a box is swept through the BSP world 106 typedef struct bsp_trace_s 107 { 108 qboolean allsolid; // if true, plane is not valid 109 qboolean startsolid; // if true, the initial point was in a solid area 110 float fraction; // time completed, 1.0 = didn't hit anything 111 vec3_t endpos; // final position 112 cplane_t plane; // surface normal at impact 113 float exp_dist; // expanded plane distance 114 int sidenum; // number of the brush side hit 115 bsp_surface_t surface; // hit surface 116 int contents; // contents on other side of surface hit 117 int ent; // number of entity hit 118 } bsp_trace_t; 119 // 120 */ 121 122 //entity info 123 typedef struct aas_entityinfo_s 124 { 125 int valid; // true if updated this frame 126 int type; // entity type 127 int flags; // entity flags 128 float ltime; // local time 129 float update_time; // time between last and current update 130 int number; // number of the entity 131 vec3_t origin; // origin of the entity 132 vec3_t angles; // angles of the model 133 vec3_t old_origin; // for lerping 134 vec3_t lastvisorigin; // last visible origin 135 vec3_t mins; // bounding box minimums 136 vec3_t maxs; // bounding box maximums 137 int groundent; // ground entity 138 int solid; // solid type 139 int modelindex; // model used 140 int modelindex2; // weapons, CTF flags, etc 141 int frame; // model frame number 142 int event; // impulse events -- muzzle flashes, footsteps, etc 143 int eventParm; // even parameter 144 int powerups; // bit flags 145 int weapon; // determines weapon and flash model, etc 146 int legsAnim; // mask off ANIM_TOGGLEBIT 147 int torsoAnim; // mask off ANIM_TOGGLEBIT 148 } aas_entityinfo_t; 149 150 // area info 151 typedef struct aas_areainfo_s 152 { 153 int contents; 154 int flags; 155 int presencetype; 156 int cluster; 157 vec3_t mins; 158 vec3_t maxs; 159 vec3_t center; 160 } aas_areainfo_t; 161 162 // client movement prediction stop events, stop as soon as: 163 #define SE_NONE 0 164 #define SE_HITGROUND 1 // the ground is hit 165 #define SE_LEAVEGROUND 2 // there's no ground 166 #define SE_ENTERWATER 4 // water is entered 167 #define SE_ENTERSLIME 8 // slime is entered 168 #define SE_ENTERLAVA 16 // lava is entered 169 #define SE_HITGROUNDDAMAGE 32 // the ground is hit with damage 170 #define SE_GAP 64 // there's a gap 171 #define SE_TOUCHJUMPPAD 128 // touching a jump pad area 172 #define SE_TOUCHTELEPORTER 256 // touching teleporter 173 #define SE_ENTERAREA 512 // the given stoparea is entered 174 #define SE_HITGROUNDAREA 1024 // a ground face in the area is hit 175 #define SE_HITBOUNDINGBOX 2048 // hit the specified bounding box 176 #define SE_TOUCHCLUSTERPORTAL 4096 // touching a cluster portal 177 178 typedef struct aas_clientmove_s 179 { 180 vec3_t endpos; //position at the end of movement prediction 181 int endarea; //area at end of movement prediction 182 vec3_t velocity; //velocity at the end of movement prediction 183 aas_trace_t trace; //last trace 184 int presencetype; //presence type at end of movement prediction 185 int stopevent; //event that made the prediction stop 186 int endcontents; //contents at the end of movement prediction 187 float time; //time predicted ahead 188 int frames; //number of frames predicted ahead 189 } aas_clientmove_t; 190 191 // alternate route goals 192 #define ALTROUTEGOAL_ALL 1 193 #define ALTROUTEGOAL_CLUSTERPORTALS 2 194 #define ALTROUTEGOAL_VIEWPORTALS 4 195 196 typedef struct aas_altroutegoal_s 197 { 198 vec3_t origin; 199 int areanum; 200 unsigned short starttraveltime; 201 unsigned short goaltraveltime; 202 unsigned short extratraveltime; 203 } aas_altroutegoal_t; 204 205 // route prediction stop events 206 #define RSE_NONE 0 207 #define RSE_NOROUTE 1 //no route to goal 208 #define RSE_USETRAVELTYPE 2 //stop as soon as on of the given travel types is used 209 #define RSE_ENTERCONTENTS 4 //stop when entering the given contents 210 #define RSE_ENTERAREA 8 //stop when entering the given area 211 212 typedef struct aas_predictroute_s 213 { 214 vec3_t endpos; //position at the end of movement prediction 215 int endarea; //area at end of movement prediction 216 int stopevent; //event that made the prediction stop 217 int endcontents; //contents at the end of movement prediction 218 int endtravelflags; //end travel flags 219 int numareas; //number of areas predicted ahead 220 int time; //time predicted ahead (in hundreth of a sec) 221 } aas_predictroute_t; 222