Removed legacy AAS from Doom, cleaned up naming.

This commit is contained in:
Justin Marshall
2026-05-22 22:26:19 -07:00
parent b0788b922e
commit 164a6e1f48
53 changed files with 912 additions and 613 deletions
+15 -15
View File
@@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms
- assumes the AI lives inside a bounding box aligned with the gravity direction
- obstacles in proximity of the AI are gathered
- if obstacles are found the AAS walls are also considered as obstacles
- if obstacles are found the NAV walls are also considered as obstacles
- every obstacle is represented by an oriented bounding box (OBB)
- an OBB is projected onto a 2D plane orthogonal to AI's gravity direction
- the 2D windings of the projections are expanded for the AI bbox
@@ -52,7 +52,7 @@ If you have questions concerning this license or the applicable additional terms
const float MAX_OBSTACLE_RADIUS = 256.0f;
const float PUSH_OUTSIDE_OBSTACLES = 0.5f;
const float CLIP_BOUNDS_EPSILON = 10.0f;
const int MAX_AAS_WALL_EDGES = 256;
const int MAX_NAV_WALL_EDGES = 256;
const int MAX_OBSTACLES = 256;
const int MAX_PATH_NODES = 256;
const int MAX_OBSTACLE_PATH = 64;
@@ -306,9 +306,9 @@ bool GetFirstBlockingObstacle( const obstacle_t *obstacles, int numObstacles, in
GetObstacles
============
*/
int GetObstacles( const idPhysics *physics, const idAAS *aas, const idEntity *ignore, int areaNum, const idVec3 &startPos, const idVec3 &seekPos, obstacle_t *obstacles, int maxObstacles, idBounds &clipBounds ) {
int GetObstacles( const idPhysics *physics, const idNAV *aas, const idEntity *ignore, int areaNum, const idVec3 &startPos, const idVec3 &seekPos, obstacle_t *obstacles, int maxObstacles, idBounds &clipBounds ) {
int i, j, numListedClipModels, numObstacles, numVerts, clipMask, blockingObstacle, blockingEdgeNum;
int wallEdges[MAX_AAS_WALL_EDGES], numWallEdges, verts[2], lastVerts[2], nextVerts[2];
int wallEdges[MAX_NAV_WALL_EDGES], numWallEdges, verts[2], lastVerts[2], nextVerts[2];
float stepHeight, headHeight, blockingScale, min, max;
idVec3 seekDelta, silVerts[32], start, end, nextStart, nextEnd;
idVec2 expBounds[2], edgeDir, edgeNormal, nextEdgeDir, nextEdgeNormal, lastEdgeNormal;
@@ -402,23 +402,23 @@ int GetObstacles( const idPhysics *physics, const idAAS *aas, const idEntity *ig
obstacle.entity = obEnt;
}
// if there are no dynamic obstacles the path should be through valid AAS space
// if there are no dynamic obstacles the path should be through valid NAV space
if ( numObstacles == 0 ) {
return 0;
}
// if the current path doesn't intersect any dynamic obstacles the path should be through valid AAS space
// if the current path doesn't intersect any dynamic obstacles the path should be through valid NAV space
if ( PointInsideObstacle( obstacles, numObstacles, startPos.ToVec2() ) == -1 ) {
if ( !GetFirstBlockingObstacle( obstacles, numObstacles, -1, startPos.ToVec2(), seekDelta.ToVec2(), blockingScale, blockingObstacle, blockingEdgeNum ) ) {
return 0;
}
}
// create obstacles for AAS walls
// create obstacles for NAV walls
if ( aas ) {
float halfBoundsSize = ( expBounds[ 1 ].x - expBounds[ 0 ].x ) * 0.5f;
numWallEdges = aas->GetWallEdges( areaNum, clipBounds, TFL_WALK, wallEdges, MAX_AAS_WALL_EDGES );
numWallEdges = aas->GetWallEdges( areaNum, clipBounds, TFL_WALK, wallEdges, MAX_NAV_WALL_EDGES );
aas->SortWallEdges( wallEdges, numWallEdges );
lastVerts[0] = lastVerts[1] = 0;
@@ -921,7 +921,7 @@ idAI::FindPathAroundObstacles
Finds a path around dynamic obstacles using a path tree with clockwise and counter clockwise edge walks.
============
*/
bool idAI::FindPathAroundObstacles( const idPhysics *physics, const idAAS *aas, const idEntity *ignore, const idVec3 &startPos, const idVec3 &seekPos, obstaclePath_t &path ) {
bool idAI::FindPathAroundObstacles( const idPhysics *physics, const idNAV *aas, const idEntity *ignore, const idVec3 &startPos, const idVec3 &seekPos, obstaclePath_t &path ) {
int numObstacles, areaNum, insideObstacle;
obstacle_t obstacles[MAX_OBSTACLES];
idBounds clipBounds;
@@ -944,7 +944,7 @@ bool idAI::FindPathAroundObstacles( const idPhysics *physics, const idAAS *aas,
bounds[0] = -bounds[1];
bounds[1].z = 32.0f;
// get the AAS area number and a valid point inside that area
// get the NAV area number and a valid point inside that area
areaNum = aas->PointReachableAreaNum( path.startPosOutsideObstacles, bounds, (AREA_REACHABLE_WALK|AREA_REACHABLE_FLY) );
aas->PushPointIntoAreaNum( areaNum, path.startPosOutsideObstacles );
@@ -1005,7 +1005,7 @@ void idAI::FreeObstacleAvoidanceNodes( void ) {
Path Prediction
Uses the AAS to quickly and accurately predict a path for a certain
Uses the NAV to quickly and accurately predict a path for a certain
period of time based on an initial position and velocity.
===============================================================================
@@ -1028,7 +1028,7 @@ PathTrace
Returns true if a stop event was triggered.
============
*/
bool PathTrace( const idEntity *ent, const idAAS *aas, const idVec3 &start, const idVec3 &end, int stopEvent, struct pathTrace_s &trace, predictedPath_t &path ) {
bool PathTrace( const idEntity *ent, const idNAV *aas, const idVec3 &start, const idVec3 &end, int stopEvent, struct pathTrace_s &trace, predictedPath_t &path ) {
trace_t clipTrace;
aasTrace_t aasTrace;
@@ -1039,7 +1039,7 @@ bool PathTrace( const idEntity *ent, const idAAS *aas, const idVec3 &start, cons
gameLocal.clip.Translation( clipTrace, start, end, ent->GetPhysics()->GetClipModel(),
ent->GetPhysics()->GetClipModel()->GetAxis(), MASK_MONSTERSOLID, ent );
// NOTE: could do (expensive) ledge detection here for when there is no AAS file
// NOTE: could do (expensive) ledge detection here for when there is no NAV file
trace.fraction = clipTrace.fraction;
trace.endPos = clipTrace.endpos;
@@ -1113,10 +1113,10 @@ bool PathTrace( const idEntity *ent, const idAAS *aas, const idVec3 &start, cons
============
idAI::PredictPath
Can also be used when there is no AAS file available however ledges are not detected.
Can also be used when there is no NAV file available however ledges are not detected.
============
*/
bool idAI::PredictPath( const idEntity *ent, const idAAS *aas, const idVec3 &start, const idVec3 &velocity, int totalTime, int frameTime, int stopEvent, predictedPath_t &path ) {
bool idAI::PredictPath( const idEntity *ent, const idNAV *aas, const idVec3 &start, const idVec3 &velocity, int totalTime, int frameTime, int stopEvent, predictedPath_t &path ) {
int i, j, step, numFrames, curFrameTime;
idVec3 delta, curStart, curEnd, curVelocity, lastEnd, stepUp, tmpStart;
idVec3 gravity, gravityDir, invGravityDir;