Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

aasfile.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 
00023 
00024 //NOTE: int =   default signed
00025 //              default long
00026 
00027 #define AASID                       (('S'<<24)+('A'<<16)+('A'<<8)+'E')
00028 #define AASVERSION_OLD              4
00029 #define AASVERSION                  5
00030 
00031 //presence types
00032 #define PRESENCE_NONE               1
00033 #define PRESENCE_NORMAL             2
00034 #define PRESENCE_CROUCH             4
00035 
00036 //travel types
00037 #define MAX_TRAVELTYPES             32
00038 #define TRAVEL_INVALID              1       //temporary not possible
00039 #define TRAVEL_WALK                 2       //walking
00040 #define TRAVEL_CROUCH               3       //crouching
00041 #define TRAVEL_BARRIERJUMP          4       //jumping onto a barrier
00042 #define TRAVEL_JUMP                 5       //jumping
00043 #define TRAVEL_LADDER               6       //climbing a ladder
00044 #define TRAVEL_WALKOFFLEDGE         7       //walking of a ledge
00045 #define TRAVEL_SWIM                 8       //swimming
00046 #define TRAVEL_WATERJUMP            9       //jump out of the water
00047 #define TRAVEL_TELEPORT             10      //teleportation
00048 #define TRAVEL_ELEVATOR             11      //travel by elevator
00049 #define TRAVEL_ROCKETJUMP           12      //rocket jumping required for travel
00050 #define TRAVEL_BFGJUMP              13      //bfg jumping required for travel
00051 #define TRAVEL_GRAPPLEHOOK          14      //grappling hook required for travel
00052 #define TRAVEL_DOUBLEJUMP           15      //double jump
00053 #define TRAVEL_RAMPJUMP             16      //ramp jump
00054 #define TRAVEL_STRAFEJUMP           17      //strafe jump
00055 #define TRAVEL_JUMPPAD              18      //jump pad
00056 #define TRAVEL_FUNCBOB              19      //func bob
00057 
00058 //additional travel flags
00059 #define TRAVELTYPE_MASK             0xFFFFFF
00060 #define TRAVELFLAG_NOTTEAM1         (1 << 24)
00061 #define TRAVELFLAG_NOTTEAM2         (2 << 24)
00062 
00063 //face flags
00064 #define FACE_SOLID                  1       //just solid at the other side
00065 #define FACE_LADDER                 2       //ladder
00066 #define FACE_GROUND                 4       //standing on ground when in this face
00067 #define FACE_GAP                    8       //gap in the ground
00068 #define FACE_LIQUID                 16      //face seperating two areas with liquid
00069 #define FACE_LIQUIDSURFACE          32      //face seperating liquid and air
00070 #define FACE_BRIDGE                 64      //can walk over this face if bridge is closed
00071 
00072 //area contents
00073 #define AREACONTENTS_WATER              1
00074 #define AREACONTENTS_LAVA               2
00075 #define AREACONTENTS_SLIME              4
00076 #define AREACONTENTS_CLUSTERPORTAL      8
00077 #define AREACONTENTS_TELEPORTAL         16
00078 #define AREACONTENTS_ROUTEPORTAL        32
00079 #define AREACONTENTS_TELEPORTER         64
00080 #define AREACONTENTS_JUMPPAD            128
00081 #define AREACONTENTS_DONOTENTER         256
00082 #define AREACONTENTS_VIEWPORTAL         512
00083 #define AREACONTENTS_MOVER              1024
00084 #define AREACONTENTS_NOTTEAM1           2048
00085 #define AREACONTENTS_NOTTEAM2           4096
00086 //number of model of the mover inside this area
00087 #define AREACONTENTS_MODELNUMSHIFT      24
00088 #define AREACONTENTS_MAXMODELNUM        0xFF
00089 #define AREACONTENTS_MODELNUM           (AREACONTENTS_MAXMODELNUM << AREACONTENTS_MODELNUMSHIFT)
00090 
00091 //area flags
00092 #define AREA_GROUNDED               1       //bot can stand on the ground
00093 #define AREA_LADDER                 2       //area contains one or more ladder faces
00094 #define AREA_LIQUID                 4       //area contains a liquid
00095 #define AREA_DISABLED               8       //area is disabled for routing when set
00096 #define AREA_BRIDGE                 16      //area ontop of a bridge
00097 
00098 //aas file header lumps
00099 #define AAS_LUMPS                   14
00100 #define AASLUMP_BBOXES              0
00101 #define AASLUMP_VERTEXES            1
00102 #define AASLUMP_PLANES              2
00103 #define AASLUMP_EDGES               3
00104 #define AASLUMP_EDGEINDEX           4
00105 #define AASLUMP_FACES               5
00106 #define AASLUMP_FACEINDEX           6
00107 #define AASLUMP_AREAS               7
00108 #define AASLUMP_AREASETTINGS        8
00109 #define AASLUMP_REACHABILITY        9
00110 #define AASLUMP_NODES               10
00111 #define AASLUMP_PORTALS             11
00112 #define AASLUMP_PORTALINDEX         12
00113 #define AASLUMP_CLUSTERS            13
00114 
00115 //========== bounding box =========
00116 
00117 //bounding box
00118 typedef struct aas_bbox_s
00119 {
00120     int presencetype;
00121     int flags;
00122     vec3_t mins, maxs;
00123 } aas_bbox_t;
00124 
00125 //============ settings ===========
00126 
00127 //reachability to another area
00128 typedef struct aas_reachability_s
00129 {
00130     int areanum;                        //number of the reachable area
00131     int facenum;                        //number of the face towards the other area
00132     int edgenum;                        //number of the edge towards the other area
00133     vec3_t start;                       //start point of inter area movement
00134     vec3_t end;                         //end point of inter area movement
00135     int traveltype;                 //type of travel required to get to the area
00136     unsigned short int traveltime;//travel time of the inter area movement
00137 } aas_reachability_t;
00138 
00139 //area settings
00140 typedef struct aas_areasettings_s
00141 {
00142     //could also add all kind of statistic fields
00143     int contents;                       //contents of the area
00144     int areaflags;                      //several area flags
00145     int presencetype;                   //how a bot can be present in this area
00146     int cluster;                        //cluster the area belongs to, if negative it's a portal
00147     int clusterareanum;             //number of the area in the cluster
00148     int numreachableareas;          //number of reachable areas from this one
00149     int firstreachablearea;         //first reachable area in the reachable area index
00150 } aas_areasettings_t;
00151 
00152 //cluster portal
00153 typedef struct aas_portal_s
00154 {
00155     int areanum;                        //area that is the actual portal
00156     int frontcluster;                   //cluster at front of portal
00157     int backcluster;                    //cluster at back of portal
00158     int clusterareanum[2];          //number of the area in the front and back cluster
00159 } aas_portal_t;
00160 
00161 //cluster portal index
00162 typedef int aas_portalindex_t;
00163 
00164 //cluster
00165 typedef struct aas_cluster_s
00166 {
00167     int numareas;                       //number of areas in the cluster
00168     int numreachabilityareas;           //number of areas with reachabilities
00169     int numportals;                     //number of cluster portals
00170     int firstportal;                    //first cluster portal in the index
00171 } aas_cluster_t;
00172 
00173 //============ 3d definition ============
00174 
00175 typedef vec3_t aas_vertex_t;
00176 
00177 //just a plane in the third dimension
00178 typedef struct aas_plane_s
00179 {
00180     vec3_t normal;                      //normal vector of the plane
00181     float dist;                         //distance of the plane (normal vector * distance = point in plane)
00182     int type;
00183 } aas_plane_t;
00184 
00185 //edge
00186 typedef struct aas_edge_s
00187 {
00188     int v[2];                           //numbers of the vertexes of this edge
00189 } aas_edge_t;
00190 
00191 //edge index, negative if vertexes are reversed
00192 typedef int aas_edgeindex_t;
00193 
00194 //a face bounds an area, often it will also seperate two areas
00195 typedef struct aas_face_s
00196 {
00197     int planenum;                       //number of the plane this face is in
00198     int faceflags;                      //face flags (no use to create face settings for just this field)
00199     int numedges;                       //number of edges in the boundary of the face
00200     int firstedge;                      //first edge in the edge index
00201     int frontarea;                      //area at the front of this face
00202     int backarea;                       //area at the back of this face
00203 } aas_face_t;
00204 
00205 //face index, stores a negative index if backside of face
00206 typedef int aas_faceindex_t;
00207 
00208 //area with a boundary of faces
00209 typedef struct aas_area_s
00210 {
00211     int areanum;                        //number of this area
00212     //3d definition
00213     int numfaces;                       //number of faces used for the boundary of the area
00214     int firstface;                      //first face in the face index used for the boundary of the area
00215     vec3_t mins;                        //mins of the area
00216     vec3_t maxs;                        //maxs of the area
00217     vec3_t center;                      //'center' of the area
00218 } aas_area_t;
00219 
00220 //nodes of the bsp tree
00221 typedef struct aas_node_s
00222 {
00223     int planenum;
00224     int children[2];                    //child nodes of this node, or areas as leaves when negative
00225                                         //when a child is zero it's a solid leaf
00226 } aas_node_t;
00227 
00228 //=========== aas file ===============
00229 
00230 //header lump
00231 typedef struct
00232 {
00233     int fileofs;
00234     int filelen;
00235 } aas_lump_t;
00236 
00237 //aas file header
00238 typedef struct aas_header_s
00239 {
00240     int ident;
00241     int version;
00242     int bspchecksum;
00243     //data entries
00244     aas_lump_t lumps[AAS_LUMPS];
00245 } aas_header_t;
00246 
00247 
00248 //====== additional information ======
00249 /*
00250 
00251 -   when a node child is a solid leaf the node child number is zero
00252 -   two adjacent areas (sharing a plane at opposite sides) share a face
00253     this face is a portal between the areas
00254 -   when an area uses a face from the faceindex with a positive index
00255     then the face plane normal points into the area
00256 -   the face edges are stored counter clockwise using the edgeindex
00257 -   two adjacent convex areas (sharing a face) only share One face
00258     this is a simple result of the areas being convex
00259 -   the areas can't have a mixture of ground and gap faces
00260     other mixtures of faces in one area are allowed
00261 -   areas with the AREACONTENTS_CLUSTERPORTAL in the settings have
00262     the cluster number set to the negative portal number
00263 -   edge zero is a dummy
00264 -   face zero is a dummy
00265 -   area zero is a dummy
00266 -   node zero is a dummy
00267 */

Generated on Thu Aug 25 12:37:08 2005 for Quake III Arena by  doxygen 1.3.9.1