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