29 #include "../../../idlib/precompiled.h"
238 if ( token ==
"}" ) {
271 if ( token ==
"}" ) {
275 if ( token ==
"bboxes" ) {
278 else if ( token ==
"usePatches" ) {
281 else if ( token ==
"writeBrushMap" ) {
284 else if ( token ==
"playerFlood" ) {
287 else if ( token ==
"allowSwimReachabilities" ) {
290 else if ( token ==
"allowFlyReachabilities" ) {
293 else if ( token ==
"fileExtension" ) {
298 else if ( token ==
"gravity" ) {
304 else if ( token ==
"maxStepHeight" ) {
307 else if ( token ==
"maxBarrierHeight" ) {
310 else if ( token ==
"maxWaterJumpHeight" ) {
313 else if ( token ==
"maxFallHeight" ) {
316 else if ( token ==
"minFloorCos" ) {
319 else if ( token ==
"tt_barrierJump" ) {
322 else if ( token ==
"tt_startCrouching" ) {
325 else if ( token ==
"tt_waterJump" ) {
328 else if ( token ==
"tt_startWalkOffLedge" ) {
332 src.
Error(
"invalid token '%s'", token.
c_str() );
337 src.
Error(
"no valid bounding box" );
382 if ( !dict->
GetVector(
"mins",
"0 0 0", bounds[ 0 ] ) ) {
383 common->
Error(
"Missing 'mins' in entityDef '%s'", name );
385 if ( !dict->
GetVector(
"maxs",
"0 0 0", bounds[ 1 ] ) ) {
386 common->
Error(
"Missing 'maxs' in entityDef '%s'", name );
393 common->
Error(
"Missing 'usePatches' in entityDef '%s'", name );
397 common->
Error(
"Missing 'writeBrushMap' in entityDef '%s'", name );
401 common->
Error(
"Missing 'playerFlood' in entityDef '%s'", name );
405 common->
Error(
"Missing 'allowSwimReachabilities' in entityDef '%s'", name );
409 common->
Error(
"Missing 'allowFlyReachabilities' in entityDef '%s'", name );
413 common->
Error(
"Missing 'fileExtension' in entityDef '%s'", name );
417 common->
Error(
"Missing 'gravity' in entityDef '%s'", name );
424 common->
Error(
"Missing 'maxStepHeight' in entityDef '%s'", name );
428 common->
Error(
"Missing 'maxBarrierHeight' in entityDef '%s'", name );
432 common->
Error(
"Missing 'maxWaterJumpHeight' in entityDef '%s'", name );
436 common->
Error(
"Missing 'maxFallHeight' in entityDef '%s'", name );
440 common->
Error(
"Missing 'minFloorCos' in entityDef '%s'", name );
444 common->
Error(
"Missing 'tt_barrierJump' in entityDef '%s'", name );
448 common->
Error(
"Missing 'tt_startCrouching' in entityDef '%s'", name );
452 common->
Error(
"Missing 'tt_waterJump' in entityDef '%s'", name );
456 common->
Error(
"Missing 'tt_startWalkOffLedge' in entityDef '%s'", name );
506 for ( i = 0; i < 3; i++ ) {
528 if ( !
strcmp( classname,
"info_player_start" ) || !
strcmp( classname ,
"info_player_deathmatch" ) || !
strcmp( classname,
"func_teleporter" ) ) {
538 bounds[ 0 ].Set( size.
x * -0.5f, size.
y * -0.5f, 0.0f );
539 bounds[ 1 ].Set( size.
x * 0.5f, size.
y * 0.5f, size.
z );
561 #define AAS_LIST_GRANULARITY 1024
562 #define AAS_INDEX_GRANULARITY 4096
563 #define AAS_PLANE_GRANULARITY 4096
564 #define AAS_VERTEX_GRANULARITY 4096
565 #define AAS_EDGE_GRANULARITY 4096
595 for ( i = 0; i <
areas.Num(); i++ ) {
596 for ( reach =
areas[i].reach; reach; reach = next ) {
661 for ( i = 0; i <
vertices.Num(); i++ ) {
668 for ( i = 0; i <
edges.Num(); i++ ) {
682 for ( i = 0; i <
faces.Num(); i++ ) {
697 for ( i = 0; i <
areas.Num(); i++ ) {
698 for ( num = 0, reach =
areas[i].reach; reach; reach = reach->
next ) {
703 for ( reach =
areas[i].reach; reach; reach = reach->
next ) {
718 for ( i = 0; i <
nodes.Num(); i++ ) {
725 for ( i = 0; i <
portals.Num(); i++ ) {
740 for ( i = 0; i <
clusters.Num(); i++ ) {
764 indexes.
Resize( numIndexes );
768 for ( i = 0; i < numIndexes; i++ ) {
796 for ( i = 0; i < numPlanes; i++ ) {
825 for ( i = 0; i < numVertices; i++ ) {
848 edges.Resize( numEdges );
852 for ( i = 0; i < numEdges; i++ ) {
858 edges.Append( edge );
876 faces.Resize( numFaces );
880 for ( i = 0; i < numFaces; i++ ) {
890 faces.Append( face );
909 area = &
areas[areaNum];
916 for ( j = 0; j <
num; j++ ) {
930 area->
reach = newReach;
946 for ( i = 0; i <
areas.Num(); i++ ) {
947 for ( reach =
areas[i].reach; reach; reach = reach->
next ) {
964 areas.Resize( numAreas );
968 for ( i = 0; i < numAreas; i++ ) {
978 areas.Append( area );
1000 nodes.Resize( numNodes );
1004 for ( i = 0; i < numNodes; i++ ) {
1011 nodes.Append( node );
1033 for ( i = 0; i < numPortals; i++ ) {
1064 for ( i = 0; i < numClusters; i++ ) {
1088 for ( i = 0; i <
areas.Num(); i++ ) {
1131 if ( mapFileCRC && c != mapFileCRC ) {
1145 if ( token ==
"settings" ) {
1148 else if ( token ==
"planes" ) {
1151 else if ( token ==
"vertices" ) {
1154 else if ( token ==
"edges" ) {
1157 else if ( token ==
"edgeIndex" ) {
1160 else if ( token ==
"faces" ) {
1163 else if ( token ==
"faceIndex" ) {
1166 else if ( token ==
"areas" ) {
1169 else if ( token ==
"nodes" ) {
1172 else if ( token ==
"portals" ) {
1175 else if ( token ==
"portalIndex" ) {
1178 else if ( token ==
"clusters" ) {
1182 src.
Error(
"idAASFileLocal::Load: bad token \"%s\"", token.
c_str() );
1191 src.
Error(
"idAASFileLocal::Load: tree depth = %d", depth );
1209 size +=
edges.Size();
1211 size +=
faces.Size();
1213 size +=
areas.Size();
1214 size +=
nodes.Size();
1245 for ( i = 0; i <
areas.Num(); i++ ) {
1246 for ( reach =
areas[i].reach; reach; reach = reach->
next ) {
1259 int numReachableAreas, total,
i,
n;
1261 numReachableAreas = 0;
1263 for ( i = 0; i <
clusters.Num(); i++ ) {
1265 numReachableAreas +=
n;
1268 total += numReachableAreas *
portals.Num();
1270 common->
Printf(
"%6d reachable areas\n", numReachableAreas );
1272 common->
Printf(
"%6d KB max routing cache\n", ( total * 3 ) >> 10 );
1284 for ( i = 0; i <
areas.Num(); i++ ) {
1285 for ( reach =
areas[i].reach; reach; reach = nextReach ) {
1286 nextReach = reach->
next;
1308 memset( &portal, 0,
sizeof( portal ) );
1312 memset( &cluster, 0,
sizeof( portal ) );
bool ParseReachabilities(idLexer &src, int areaNum)
float GetFloat(const char *key, const char *defaultString="0") const
GLsizei const GLfloat * value
#define AAS_EDGE_GRANULARITY
int GetInt(const char *key, const char *defaultString="0") const
bool ParseInt(idLexer &src, int &i)
bool Reachability_Write(idFile *fp, idReachability *reach)
void CopyBase(idReachability &reach)
virtual ~idAASFileLocal(void)
idReachability * rev_next
bool ValidForBounds(const idBounds &bounds) const
int MaxTreeDepth(void) const
const idStr & GetKey(void) const
virtual void PrintInfo(void) const
#define AAS_INDEX_GRANULARITY
bool ParseIndex(idLexer &src, idList< aasIndex_t > &indexes)
bool Reachability_Special_Read(idLexer &src, idReachability_Special *reach)
bool ParseBBoxes(idLexer &src)
const float * ToFloatPtr(void) const
bool ValidEntity(const char *classname) const
idList< aasNode_t > nodes
bool allowSwimReachabilities
int Parse1DMatrix(int x, float *m)
idVec3 AreaReachableGoal(int areaNum) const
idList< aasCluster_t > clusters
idFileSystem * fileSystem
bool ParseVertices(idLexer &src)
void SetGranularity(int newgranularity)
int AreaContentsTravelFlags(int areaNum) const
unsigned long GetUnsignedLongValue(void)
GLint GLint GLsizei GLsizei GLsizei depth
bool ParsePlanes(idLexer &src)
#define AAS_PLANE_GRANULARITY
float ParseFloat(bool *errorFlag=NULL)
void SetNormal(const idVec3 &normal)
void Set(const char *key, const char *value)
bool ParseBool(idLexer &src, bool &b)
bool FromDict(const char *name, const idDict *dict)
bool Reachability_Special_Write(idFile *fp, idReachability_Special *reach)
idBounds boundingBoxes[MAX_AAS_BOUNDING_BOXES]
idList< aasIndex_t > faceIndex
bool ParseFloat(idLexer &src, float &f)
int Icmp(const char *text) const
idList< aasIndex_t > edgeIndex
void Error(const char *str,...) id_attribute((format(printf
bool Write(const idStr &fileName, unsigned int mapFileCRC)
bool ParseVector(idLexer &src, idVec3 &vec)
int ExpectTokenType(int type, int subtype, idToken *token)
unsigned short travelTime
const char * GetString(const char *key, const char *defaultString="") const
void SetDist(const float dist)
idList< aasFace_t > faces
idList< aasPortal_t > portals
bool FromFile(const idStr &fileName)
bool GetBool(const char *key, const char *defaultString="0") const
#define AAS_VERTEX_GRANULARITY
int NumReachabilities(void) const
virtual const idDecl * FindType(declType_t type, const char *name, bool makeDefault=true)=0
bool allowFlyReachabilities
idVec3 GetVector(const char *key, const char *defaultString=NULL) const
bool ParseClusters(idLexer &src)
bool Load(const idStr &fileName, unsigned int mapFileCRC)
virtual idFile * OpenFileWrite(const char *relativePath, const char *basePath="fs_savepath")=0
void LinkReversedReachability(void)
bool ParseFaces(idLexer &src)
const idStr & GetValue(void) const
virtual int WriteFloatString(const char *fmt,...) id_attribute((format(printf
void UnreadToken(const idToken *token)
void DeleteClusters(void)
virtual void Printf(const char *fmt,...) id_attribute((format(printf
bool FromParser(idLexer &src)
const float * ToFloatPtr(void) const
idDeclManager * declManager
int ExpectTokenString(const char *string)
bool ParseAreas(idLexer &src)
int Append(const type &obj)
idList< aasEdge_t > edges
idList< aasVertex_t > vertices
idReachability * rev_reach
bool ParseEdges(idLexer &src)
bool ParseNodes(idLexer &src)
idList< aasArea_t > areas
bool WriteToFile(idFile *fp) const
const char * c_str(void) const
idList< aasIndex_t > portalIndex
const idKeyValue * GetKeyVal(int index) const
const idVec3 & ToVec3(void) const
bool Reachability_Read(idLexer &src, idReachability *reach)
void ReportRoutingEfficiency(void) const
#define AAS_LIST_GRANULARITY
virtual void CloseFile(idFile *f)=0
virtual void Error(const char *fmt,...) id_attribute((format(printf
bool ParsePortals(idLexer &src)
int GetNumKeyVals(void) const
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
int MemorySize(void) const
int ReadToken(idToken *token)
void DeleteReachabilities(void)
#define MAX_AAS_TREE_DEPTH
int LoadFile(const char *filename, bool OSPath=false)
virtual idBounds AreaBounds(int areaNum) const