Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

aas_create.h (4533B)


      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 Foobar; if not, write to the Free Software
     19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20 ===========================================================================
     21 */
     22 
     23 #define AREA_PORTAL			1
     24 
     25 //temporary AAS face
     26 typedef struct tmp_face_s
     27 {
     28 	int num;						//face number
     29 	int planenum;					//number of the plane the face is in
     30 	winding_t *winding;				//winding of the face
     31 	struct tmp_area_s *frontarea;	//area at the front of the face
     32 	struct tmp_area_s *backarea;	//area at the back of the face
     33 	int faceflags;					//flags of this face
     34 	int aasfacenum;					//the number of the aas face used for this face
     35 	//double link list pointers for front and back area
     36 	struct tmp_face_s *prev[2], *next[2];
     37 	//links in the list with faces
     38 	struct tmp_face_s *l_prev, *l_next;
     39 } tmp_face_t;
     40 
     41 //temporary AAS area settings
     42 typedef struct tmp_areasettings_s
     43 {
     44 	//could also add all kind of statistic fields
     45 	int contents;					//contents of the area
     46 	int modelnum;					//bsp model inside this area
     47 	int areaflags;					//area flags
     48 	int presencetype;				//how a bot can be present in this area
     49 	int numreachableareas;			//number of reachable areas from this one
     50 	int firstreachablearea;			//first reachable area in the reachable area index
     51 } tmp_areasettings_t;
     52 
     53 //temporary AAS area
     54 typedef struct tmp_area_s
     55 {
     56 	int areanum;						//number of the area
     57 	struct tmp_face_s *tmpfaces;		//the faces of the area
     58 	int presencetype;					//presence type of the area
     59 	int contents;						//area contents
     60 	int modelnum;						//bsp model inside this area
     61 	int invalid;						//true if the area is invalid
     62 	tmp_areasettings_t *settings;		//area settings
     63 	struct tmp_area_s *mergedarea;		//points to the new area after merging
     64 										//when mergedarea != 0 the area has only the
     65 										//seperating face of the merged areas
     66 	int aasareanum;						//number of the aas area created for this tmp area
     67 	//links in the list with areas
     68 	struct tmp_area_s *l_prev, *l_next;
     69 } tmp_area_t;
     70 
     71 //temporary AAS node
     72 typedef struct tmp_node_s
     73 {
     74 	int planenum;					//node plane number
     75 	struct tmp_area_s *tmparea;		//points to an area if this node is an area
     76 	struct tmp_node_s *children[2];	//child nodes of this node
     77 } tmp_node_t;
     78 
     79 #define NODEBUF_SIZE			128
     80 //node buffer
     81 typedef struct tmp_nodebuf_s
     82 {
     83 	int numnodes;
     84 	struct tmp_nodebuf_s *next;
     85 	tmp_node_t nodes[NODEBUF_SIZE];
     86 } tmp_nodebuf_t;
     87 
     88 //the whole temorary AAS
     89 typedef struct tmp_aas_s
     90 {
     91 	//faces
     92 	int numfaces;
     93 	int facenum;
     94 	tmp_face_t *faces;
     95 	//areas
     96 	int numareas;
     97 	int areanum;
     98 	tmp_area_t *areas;
     99 	//area settings
    100 	int numareasettings;
    101 	tmp_areasettings_t *areasettings;
    102 	//nodes
    103 	int numnodes;
    104 	tmp_node_t *nodes;
    105 	//node buffer
    106 	tmp_nodebuf_t *nodebuffer;
    107 } tmp_aas_t;
    108 
    109 extern tmp_aas_t tmpaasworld;
    110 
    111 //creates a .AAS file with the given name from an already loaded map
    112 void AAS_Create(char *aasfile);
    113 //adds a face side to an area
    114 void AAS_AddFaceSideToArea(tmp_face_t *tmpface, int side, tmp_area_t *tmparea);
    115 //remvoes a face from an area
    116 void AAS_RemoveFaceFromArea(tmp_face_t *tmpface, tmp_area_t *tmparea);
    117 //allocate a tmp face
    118 tmp_face_t *AAS_AllocTmpFace(void);
    119 //free the tmp face
    120 void AAS_FreeTmpFace(tmp_face_t *tmpface);
    121 //allocate a tmp area
    122 tmp_area_t *AAS_AllocTmpArea(void);
    123 //free a tmp area
    124 void AAS_FreeTmpArea(tmp_area_t *tmparea);
    125 //allocate a tmp node
    126 tmp_node_t *AAS_AllocTmpNode(void);
    127 //free a tmp node
    128 void AAS_FreeTmpNode(tmp_node_t *node);
    129 //checks if an area is ok
    130 void AAS_CheckArea(tmp_area_t *tmparea);
    131 //flips the area faces where needed
    132 void AAS_FlipAreaFaces(tmp_area_t *tmparea);
    133 //returns true if the face is a gap seen from the given side
    134 int AAS_GapFace(tmp_face_t *tmpface, int side);
    135 //returns true if the face is a ground face
    136 int AAS_GroundFace(tmp_face_t *tmpface);