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 //face flags
00059 #define FACE_SOLID                  1       //just solid at the other side
00060 #define FACE_LADDER                 2       //ladder
00061 #define FACE_GROUND                 4       //standing on ground when in this face
00062 #define FACE_GAP                    8       //gap in the ground
00063 #define FACE_LIQUID                 16
00064 #define FACE_LIQUIDSURFACE          32
00065 
00066 //area contents
00067 #define AREACONTENTS_WATER              1
00068 #define AREACONTENTS_LAVA               2
00069 #define AREACONTENTS_SLIME              4
00070 #define AREACONTENTS_CLUSTERPORTAL      8
00071 #define AREACONTENTS_TELEPORTAL         16
00072 #define AREACONTENTS_ROUTEPORTAL        32
00073 #define AREACONTENTS_TELEPORTER         64
00074 #define AREACONTENTS_JUMPPAD            128
00075 #define AREACONTENTS_DONOTENTER         256
00076 #define AREACONTENTS_VIEWPORTAL         512
00077 
00078 //area flags
00079 #define AREA_GROUNDED               1       //bot can stand on the ground
00080 #define AREA_LADDER                 2       //area contains one or more ladder faces
00081 #define AREA_LIQUID                 4       //area contains a liquid
00082 
00083 //aas file header lumps
00084 #define AAS_LUMPS                   14
00085 #define AASLUMP_BBOXES              0
00086 #define AASLUMP_VERTEXES            1
00087 #define AASLUMP_PLANES              2
00088 #define AASLUMP_EDGES               3
00089 #define AASLUMP_EDGEINDEX           4
00090 #define AASLUMP_FACES               5
00091 #define AASLUMP_FACEINDEX           6
00092 #define AASLUMP_AREAS               7
00093 #define AASLUMP_AREASETTINGS        8
00094 #define AASLUMP_REACHABILITY        9
00095 #define AASLUMP_NODES               10
00096 #define AASLUMP_PORTALS             11
00097 #define AASLUMP_PORTALINDEX         12
00098 #define AASLUMP_CLUSTERS            13
00099 
00100 //========== bounding box =========
00101 
00102 //bounding box
00103 typedef struct aas_bbox_s
00104 {
00105     int presencetype;
00106     int flags;
00107     vec3_t mins, maxs;
00108 } aas_bbox_t;
00109 
00110 //============ settings ===========
00111 
00112 //reachability to another area
00113 typedef struct aas_reachability_s
00114 {
00115     int areanum;                        //number of the reachable area
00116     int facenum;                        //number of the face towards the other area
00117     int edgenum;                        //number of the edge towards the other area
00118     vec3_t start;                       //start point of inter area movement
00119     vec3_t end;                         //end point of inter area movement
00120     int traveltype;                 //type of travel required to get to the area
00121     unsigned short int traveltime;//travel time of the inter area movement
00122 } aas_reachability_t;
00123 
00124 //area settings
00125 typedef struct aas_areasettings_s
00126 {
00127     //could also add all kind of statistic fields
00128     int contents;                       //contents of the convex area
00129     int areaflags;                      //several area flags
00130     int presencetype;                   //how a bot can be present in this convex area
00131     int cluster;                        //cluster the area belongs to, if negative it's a portal
00132     int clusterareanum;             //number of the area in the cluster
00133     int numreachableareas;          //number of reachable areas from this one
00134     int firstreachablearea;         //first reachable area in the reachable area index
00135 } aas_areasettings_t;
00136 
00137 //cluster portal
00138 typedef struct aas_portal_s
00139 {
00140     int areanum;                        //area that is the actual portal
00141     int frontcluster;                   //cluster at front of portal
00142     int backcluster;                    //cluster at back of portal
00143     int clusterareanum[2];          //number of the area in the front and back cluster
00144 } aas_portal_t;
00145 
00146 //cluster portal index
00147 typedef int aas_portalindex_t;
00148 
00149 //cluster
00150 typedef struct aas_cluster_s
00151 {
00152     int numareas;                       //number of areas in the cluster
00153     int numreachabilityareas;           //number of areas with reachabilities
00154     int numportals;                     //number of cluster portals
00155     int firstportal;                    //first cluster portal in the index
00156 } aas_cluster_t;
00157 
00158 //============ 3d definition ============
00159 
00160 typedef vec3_t aas_vertex_t;
00161 
00162 //just a plane in the third dimension
00163 typedef struct aas_plane_s
00164 {
00165     vec3_t normal;                      //normal vector of the plane
00166     float dist;                         //distance of the plane (normal vector * distance = point in plane)
00167     int type;
00168 } aas_plane_t;
00169 
00170 //edge
00171 typedef struct aas_edge_s
00172 {
00173     int v[2];                           //numbers of the vertexes of this edge
00174 } aas_edge_t;
00175 
00176 //edge index, negative if vertexes are reversed
00177 typedef int aas_edgeindex_t;
00178 
00179 //a face bounds a convex area, often it will also seperate two convex areas
00180 typedef struct aas_face_s
00181 {
00182     int planenum;                       //number of the plane this face is in
00183     int faceflags;                      //face flags (no use to create face settings for just this field)
00184     int numedges;                       //number of edges in the boundary of the face
00185     int firstedge;                      //first edge in the edge index
00186     int frontarea;                      //convex area at the front of this face
00187     int backarea;                       //convex area at the back of this face
00188 } aas_face_t;
00189 
00190 //face index, stores a negative index if backside of face
00191 typedef int aas_faceindex_t;
00192 
00193 //convex area with a boundary of faces
00194 typedef struct aas_area_s
00195 {
00196     int areanum;                        //number of this area
00197     //3d definition
00198     int numfaces;                       //number of faces used for the boundary of the convex area
00199     int firstface;                      //first face in the face index used for the boundary of the convex area
00200     vec3_t mins;                        //mins of the convex area
00201     vec3_t maxs;                        //maxs of the convex area
00202     vec3_t center;                      //'center' of the convex area
00203 } aas_area_t;
00204 
00205 //nodes of the bsp tree
00206 typedef struct aas_node_s
00207 {
00208     int planenum;
00209     int children[2];                    //child nodes of this node, or convex areas as leaves when negative
00210                                         //when a child is zero it's a solid leaf
00211 } aas_node_t;
00212 
00213 //=========== aas file ===============
00214 
00215 //header lump
00216 typedef struct
00217 {
00218     int fileofs;
00219     int filelen;
00220 } aas_lump_t;
00221 
00222 //aas file header
00223 typedef struct aas_header_s
00224 {
00225     int ident;
00226     int version;
00227     int bspchecksum;
00228     //data entries
00229     aas_lump_t lumps[AAS_LUMPS];
00230 } aas_header_t;
00231 
00232 
00233 //====== additional information ======
00234 /*
00235 
00236 -   when a node child is a solid leaf the node child number is zero
00237 -   two adjacent areas (sharing a plane at opposite sides) share a face
00238     this face is a portal between the areas
00239 -   when an area uses a face from the faceindex with a positive index
00240     then the face plane normal points into the area
00241 -   the face edges are stored counter clockwise using the edgeindex
00242 -   two adjacent convex areas (sharing a face) only share One face
00243     this is a simple result of the areas being convex
00244 -   the convex areas can't have a mixture of ground and gap faces
00245     other mixtures of faces in one area are allowed
00246 -   areas with the AREACONTENTS_CLUSTERPORTAL in the settings have
00247     cluster number zero
00248 -   edge zero is a dummy
00249 -   face zero is a dummy
00250 -   area zero is a dummy
00251 -   node zero is a dummy
00252 */

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