mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-14 10:11:51 +02:00
Removed legacy AAS from Doom, cleaned up naming.
This commit is contained in:
+15
-15
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug with inlines and memory log|x64">
|
||||
@@ -338,14 +338,14 @@ typeinfo.exe</Command>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="game\ai\AAS.cpp" />
|
||||
<ClCompile Include="game\ai\AASCallback_AvoidLocation.cpp" />
|
||||
<ClCompile Include="game\ai\AASCallback_FindAreaOutOfRange.cpp" />
|
||||
<ClCompile Include="game\ai\AASCallback_FindAttackPosition.cpp" />
|
||||
<ClCompile Include="game\ai\AASCallback_FindCoverArea.cpp" />
|
||||
<ClCompile Include="game\ai\AAS_debug.cpp" />
|
||||
<ClCompile Include="game\ai\AAS_pathing.cpp" />
|
||||
<ClCompile Include="game\ai\AAS_routing.cpp" />
|
||||
<ClCompile Include="game\ai\NAV.cpp" />
|
||||
<ClCompile Include="game\ai\NAVCallback_AvoidLocation.cpp" />
|
||||
<ClCompile Include="game\ai\NAVCallback_FindAreaOutOfRange.cpp" />
|
||||
<ClCompile Include="game\ai\NAVCallback_FindAttackPosition.cpp" />
|
||||
<ClCompile Include="game\ai\NAVCallback_FindCoverArea.cpp" />
|
||||
<ClCompile Include="game\ai\NAV_debug.cpp" />
|
||||
<ClCompile Include="game\ai\NAV_pathing.cpp" />
|
||||
<ClCompile Include="game\ai\NAV_routing.cpp" />
|
||||
<ClCompile Include="game\ai\RecastNavMesh.cpp" />
|
||||
<ClCompile Include="game\ai\AI.cpp" />
|
||||
<ClCompile Include="game\ai\AI_events.cpp" />
|
||||
@@ -456,12 +456,12 @@ typeinfo.exe</Command>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="game\ai\AAS.h" />
|
||||
<ClInclude Include="game\ai\AASCallback_AvoidLocation.h" />
|
||||
<ClInclude Include="game\ai\AASCallback_FindAreaOutOfRange.h" />
|
||||
<ClInclude Include="game\ai\AASCallback_FindAttackPosition.h" />
|
||||
<ClInclude Include="game\ai\AASCallback_FindCoverArea.h" />
|
||||
<ClInclude Include="game\ai\AAS_local.h" />
|
||||
<ClInclude Include="game\ai\NAV.h" />
|
||||
<ClInclude Include="game\ai\NAVCallback_AvoidLocation.h" />
|
||||
<ClInclude Include="game\ai\NAVCallback_FindAreaOutOfRange.h" />
|
||||
<ClInclude Include="game\ai\NAVCallback_FindAttackPosition.h" />
|
||||
<ClInclude Include="game\ai\NAVCallback_FindCoverArea.h" />
|
||||
<ClInclude Include="game\ai\NAV_local.h" />
|
||||
<ClInclude Include="game\ai\RecastNavMesh.h" />
|
||||
<ClInclude Include="game\ai\AI.h" />
|
||||
<ClInclude Include="game\anim\Anim.h" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="AI">
|
||||
@@ -24,16 +24,16 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="game\ai\AAS.cpp">
|
||||
<ClCompile Include="game\ai\NAV.cpp">
|
||||
<Filter>AI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="game\ai\AAS_debug.cpp">
|
||||
<ClCompile Include="game\ai\NAV_debug.cpp">
|
||||
<Filter>AI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="game\ai\AAS_pathing.cpp">
|
||||
<ClCompile Include="game\ai\NAV_pathing.cpp">
|
||||
<Filter>AI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="game\ai\AAS_routing.cpp">
|
||||
<ClCompile Include="game\ai\NAV_routing.cpp">
|
||||
<Filter>AI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="game\ai\RecastNavMesh.cpp">
|
||||
@@ -270,24 +270,24 @@
|
||||
<ClCompile Include="game\bots\BotAI_SeekLTG.cpp">
|
||||
<Filter>Bots</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="game\ai\AASCallback_FindCoverArea.cpp">
|
||||
<ClCompile Include="game\ai\NAVCallback_FindCoverArea.cpp">
|
||||
<Filter>AI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="game\ai\AASCallback_AvoidLocation.cpp">
|
||||
<ClCompile Include="game\ai\NAVCallback_AvoidLocation.cpp">
|
||||
<Filter>AI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="game\ai\AASCallback_FindAreaOutOfRange.cpp">
|
||||
<ClCompile Include="game\ai\NAVCallback_FindAreaOutOfRange.cpp">
|
||||
<Filter>AI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="game\ai\AASCallback_FindAttackPosition.cpp">
|
||||
<ClCompile Include="game\ai\NAVCallback_FindAttackPosition.cpp">
|
||||
<Filter>AI</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="game\ai\AAS.h">
|
||||
<ClInclude Include="game\ai\NAV.h">
|
||||
<Filter>AI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="game\ai\AAS_local.h">
|
||||
<ClInclude Include="game\ai\NAV_local.h">
|
||||
<Filter>AI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="game\ai\RecastNavMesh.h">
|
||||
@@ -482,16 +482,16 @@
|
||||
<ClInclude Include="game\bots\Bot_weights.h">
|
||||
<Filter>Bots</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="game\ai\AASCallback_FindCoverArea.h">
|
||||
<ClInclude Include="game\ai\NAVCallback_FindCoverArea.h">
|
||||
<Filter>AI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="game\ai\AASCallback_AvoidLocation.h">
|
||||
<ClInclude Include="game\ai\NAVCallback_AvoidLocation.h">
|
||||
<Filter>AI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="game\ai\AASCallback_FindAreaOutOfRange.h">
|
||||
<ClInclude Include="game\ai\NAVCallback_FindAreaOutOfRange.h">
|
||||
<Filter>AI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="game\ai\AASCallback_FindAttackPosition.h">
|
||||
<ClInclude Include="game\ai\NAVCallback_FindAttackPosition.h">
|
||||
<Filter>AI</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1851,10 +1851,10 @@ bool idActor::OnLadder( void ) const {
|
||||
|
||||
/*
|
||||
==============
|
||||
idActor::GetAASLocation
|
||||
idActor::GetNAVLocation
|
||||
==============
|
||||
*/
|
||||
void idActor::GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const {
|
||||
void idActor::GetNAVLocation( idNAV *aas, idVec3 &pos, int &areaNum ) const {
|
||||
idVec3 size;
|
||||
idBounds bounds;
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
|
||||
virtual bool OnLadder( void ) const;
|
||||
|
||||
virtual void GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const;
|
||||
virtual void GetNAVLocation( idNAV *aas, idVec3 &pos, int &areaNum ) const;
|
||||
|
||||
void Attach( idEntity *ent );
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ typedef struct {
|
||||
idRenderModelManager * renderModelManager; // render model manager
|
||||
idUserInterfaceManager * uiManager; // user interface manager
|
||||
idDeclManager * declManager; // declaration manager
|
||||
idAASFileManager * AASFileManager; // AAS file manager
|
||||
idAASFileManager * AASFileManager; // NAV file manager
|
||||
idRecastNavigationManager * RecastNavigationManager; // Recast/Detour navigation manager
|
||||
idCollisionModelManager * collisionModelManager; // collision model manager
|
||||
|
||||
|
||||
@@ -214,8 +214,8 @@ void idGameLocal::Clear( void ) {
|
||||
spawnCount = INITIAL_SPAWN_COUNT;
|
||||
mapSpawnCount = 0;
|
||||
camera = NULL;
|
||||
aasList.Clear();
|
||||
aasNames.Clear();
|
||||
navList.Clear();
|
||||
navNames.Clear();
|
||||
lastAIAlertEntity = NULL;
|
||||
lastAIAlertTime = 0;
|
||||
spawnArgs.Clear();
|
||||
@@ -260,7 +260,7 @@ idGameLocal::Init
|
||||
*/
|
||||
void idGameLocal::Init( void ) {
|
||||
const idDict *dict;
|
||||
idAAS *aas;
|
||||
idNAV *aas;
|
||||
|
||||
#ifndef GAME_DLL
|
||||
|
||||
@@ -318,9 +318,9 @@ void idGameLocal::Init( void ) {
|
||||
// allocate space for the aas
|
||||
const idKeyValue *kv = dict->MatchPrefix( "type" );
|
||||
while( kv != NULL ) {
|
||||
aas = idAAS::Alloc();
|
||||
aasList.Append( aas );
|
||||
aasNames.Append( kv->GetValue() );
|
||||
aas = idNAV::Alloc();
|
||||
navList.Append( aas );
|
||||
navNames.Append( kv->GetValue() );
|
||||
kv = dict->MatchPrefix( "type", kv );
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ void idGameLocal::Init( void ) {
|
||||
|
||||
gamestate = GAMESTATE_NOMAP;
|
||||
|
||||
Printf( "...%d aas types\n", aasList.Num() );
|
||||
Printf( "...%d aas types\n", navList.Num() );
|
||||
Printf( "game initialized.\n" );
|
||||
Printf( "--------------------------------------\n" );
|
||||
}
|
||||
@@ -363,8 +363,8 @@ void idGameLocal::Shutdown( void ) {
|
||||
|
||||
MapShutdown();
|
||||
|
||||
aasList.DeleteContents( true );
|
||||
aasNames.Clear();
|
||||
navList.DeleteContents( true );
|
||||
navNames.Clear();
|
||||
|
||||
idAI::FreeObstacleAvoidanceNodes();
|
||||
|
||||
@@ -941,12 +941,12 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) {
|
||||
|
||||
spawnArgs.Clear();
|
||||
|
||||
for (int i = 0; i < aasNames.Num(); i++)
|
||||
for (int i = 0; i < navNames.Num(); i++)
|
||||
{
|
||||
aasList[i]->Init(idStr(mapFileName).SetFileExtension(aasNames[i]).c_str(), mapFile->GetGeometryCRC());
|
||||
navList[i]->Init(idStr(mapFileName).SetFileExtension(navNames[i]).c_str(), mapFile->GetGeometryCRC());
|
||||
}
|
||||
|
||||
bot_aas = GetAAS("aas48");
|
||||
bot_nav = GetNAV("aas48");
|
||||
|
||||
skipCinematic = false;
|
||||
inCinematic = false;
|
||||
@@ -960,8 +960,8 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) {
|
||||
playerConnectedAreas.i = -1;
|
||||
|
||||
// load navigation system for all the different monster sizes
|
||||
for( i = 0; i < aasNames.Num(); i++ ) {
|
||||
aasList[ i ]->Init( idStr( mapFileName ).SetFileExtension( aasNames[ i ] ).c_str(), mapFile->GetGeometryCRC() );
|
||||
for( i = 0; i < navNames.Num(); i++ ) {
|
||||
navList[ i ]->Init( idStr( mapFileName ).SetFileExtension( navNames[ i ] ).c_str(), mapFile->GetGeometryCRC() );
|
||||
}
|
||||
|
||||
// clear the smoke particle free list
|
||||
@@ -2810,8 +2810,8 @@ void idGameLocal::RunDebugInfo( void ) {
|
||||
pvs.DrawPVS( origin, ( g_showPVS.GetInteger() == 2 ) ? PVS_ALL_PORTALS_OPEN : PVS_NORMAL );
|
||||
}
|
||||
|
||||
if ( aas_test.GetInteger() >= 0 ) {
|
||||
idAAS *aas = GetAAS( aas_test.GetInteger() );
|
||||
if ( nav_test.GetInteger() >= 0 ) {
|
||||
idNAV *aas = GetNAV( nav_test.GetInteger() );
|
||||
if ( aas ) {
|
||||
aas->Test( origin );
|
||||
if ( ai_testPredictPath.GetBool() ) {
|
||||
@@ -2827,7 +2827,7 @@ void idGameLocal::RunDebugInfo( void ) {
|
||||
}
|
||||
|
||||
if ( ai_showObstacleAvoidance.GetInteger() == 2 ) {
|
||||
idAAS *aas = GetAAS( 0 );
|
||||
idNAV *aas = GetNAV( 0 );
|
||||
if ( aas ) {
|
||||
idVec3 seekPos;
|
||||
obstaclePath_t path;
|
||||
@@ -2843,22 +2843,22 @@ void idGameLocal::RunDebugInfo( void ) {
|
||||
|
||||
/*
|
||||
==================
|
||||
idGameLocal::NumAAS
|
||||
idGameLocal::NumNAV
|
||||
==================
|
||||
*/
|
||||
int idGameLocal::NumAAS( void ) const {
|
||||
return aasList.Num();
|
||||
int idGameLocal::NumNAV( void ) const {
|
||||
return navList.Num();
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idGameLocal::GetAAS
|
||||
idGameLocal::GetNAV
|
||||
==================
|
||||
*/
|
||||
idAAS *idGameLocal::GetAAS( int num ) const {
|
||||
if ( ( num >= 0 ) && ( num < aasList.Num() ) ) {
|
||||
if ( aasList[ num ] && aasList[ num ]->GetSettings() ) {
|
||||
return aasList[ num ];
|
||||
idNAV *idGameLocal::GetNAV( int num ) const {
|
||||
if ( ( num >= 0 ) && ( num < navList.Num() ) ) {
|
||||
if ( navList[ num ] && navList[ num ]->GetSettings() ) {
|
||||
return navList[ num ];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -2866,18 +2866,18 @@ idAAS *idGameLocal::GetAAS( int num ) const {
|
||||
|
||||
/*
|
||||
==================
|
||||
idGameLocal::GetAAS
|
||||
idGameLocal::GetNAV
|
||||
==================
|
||||
*/
|
||||
idAAS *idGameLocal::GetAAS( const char *name ) const {
|
||||
idNAV *idGameLocal::GetNAV( const char *name ) const {
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < aasNames.Num(); i++ ) {
|
||||
if ( aasNames[ i ] == name ) {
|
||||
if ( !aasList[ i ]->GetSettings() ) {
|
||||
for ( i = 0; i < navNames.Num(); i++ ) {
|
||||
if ( navNames[ i ] == name ) {
|
||||
if ( !navList[ i ]->GetSettings() ) {
|
||||
return NULL;
|
||||
} else {
|
||||
return aasList[ i ];
|
||||
return navList[ i ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2886,34 +2886,34 @@ idAAS *idGameLocal::GetAAS( const char *name ) const {
|
||||
|
||||
/*
|
||||
==================
|
||||
idGameLocal::SetAASAreaState
|
||||
idGameLocal::SetNAVAreaState
|
||||
==================
|
||||
*/
|
||||
void idGameLocal::SetAASAreaState( const idBounds &bounds, const int areaContents, bool closed ) {
|
||||
void idGameLocal::SetNAVAreaState( const idBounds &bounds, const int areaContents, bool closed ) {
|
||||
int i;
|
||||
|
||||
for( i = 0; i < aasList.Num(); i++ ) {
|
||||
aasList[ i ]->SetAreaState( bounds, areaContents, closed );
|
||||
for( i = 0; i < navList.Num(); i++ ) {
|
||||
navList[ i ]->SetAreaState( bounds, areaContents, closed );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idGameLocal::AddAASObstacle
|
||||
idGameLocal::AddNAVObstacle
|
||||
==================
|
||||
*/
|
||||
aasHandle_t idGameLocal::AddAASObstacle( const idBounds &bounds ) {
|
||||
aasHandle_t idGameLocal::AddNAVObstacle( const idBounds &bounds ) {
|
||||
int i;
|
||||
aasHandle_t obstacle;
|
||||
aasHandle_t check;
|
||||
|
||||
if ( !aasList.Num() ) {
|
||||
if ( !navList.Num() ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
obstacle = aasList[ 0 ]->AddObstacle( bounds );
|
||||
for( i = 1; i < aasList.Num(); i++ ) {
|
||||
check = aasList[ i ]->AddObstacle( bounds );
|
||||
obstacle = navList[ 0 ]->AddObstacle( bounds );
|
||||
for( i = 1; i < navList.Num(); i++ ) {
|
||||
check = navList[ i ]->AddObstacle( bounds );
|
||||
assert( check == obstacle );
|
||||
}
|
||||
|
||||
@@ -2922,27 +2922,27 @@ aasHandle_t idGameLocal::AddAASObstacle( const idBounds &bounds ) {
|
||||
|
||||
/*
|
||||
==================
|
||||
idGameLocal::RemoveAASObstacle
|
||||
idGameLocal::RemoveNAVObstacle
|
||||
==================
|
||||
*/
|
||||
void idGameLocal::RemoveAASObstacle( const aasHandle_t handle ) {
|
||||
void idGameLocal::RemoveNAVObstacle( const aasHandle_t handle ) {
|
||||
int i;
|
||||
|
||||
for( i = 0; i < aasList.Num(); i++ ) {
|
||||
aasList[ i ]->RemoveObstacle( handle );
|
||||
for( i = 0; i < navList.Num(); i++ ) {
|
||||
navList[ i ]->RemoveObstacle( handle );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idGameLocal::RemoveAllAASObstacles
|
||||
idGameLocal::RemoveAllNAVObstacles
|
||||
==================
|
||||
*/
|
||||
void idGameLocal::RemoveAllAASObstacles( void ) {
|
||||
void idGameLocal::RemoveAllNAVObstacles( void ) {
|
||||
int i;
|
||||
|
||||
for( i = 0; i < aasList.Num(); i++ ) {
|
||||
aasList[ i ]->RemoveAllObstacles();
|
||||
for( i = 0; i < navList.Num(); i++ ) {
|
||||
navList[ i ]->RemoveAllObstacles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -69,7 +69,7 @@ class idPlayer;
|
||||
class idCamera;
|
||||
class idWorldspawn;
|
||||
class idTestModel;
|
||||
class idAAS;
|
||||
class idNAV;
|
||||
class idAI;
|
||||
class idSmokeParticles;
|
||||
class idEntityFx;
|
||||
@@ -102,7 +102,7 @@ void gameError( const char *fmt, ... );
|
||||
|
||||
#include "anim/Anim.h"
|
||||
|
||||
#include "ai/AAS.h"
|
||||
#include "ai/NAV.h"
|
||||
|
||||
#include "physics/Clip.h"
|
||||
#include "physics/Push.h"
|
||||
@@ -395,9 +395,9 @@ public:
|
||||
return MS2SEC(time - previousTime);
|
||||
}
|
||||
|
||||
idAAS* GetBotAAS(void)
|
||||
idNAV* GetBotNAV(void)
|
||||
{
|
||||
return bot_aas;
|
||||
return bot_nav;
|
||||
}
|
||||
|
||||
int TravelTimeToGoal(const idVec3& origin, const idVec3& goal);
|
||||
@@ -413,13 +413,13 @@ public:
|
||||
|
||||
idEntity* Spawn(const char* classname);
|
||||
|
||||
int NumAAS( void ) const;
|
||||
idAAS * GetAAS( int num ) const;
|
||||
idAAS * GetAAS( const char *name ) const;
|
||||
void SetAASAreaState( const idBounds &bounds, const int areaContents, bool closed );
|
||||
aasHandle_t AddAASObstacle( const idBounds &bounds );
|
||||
void RemoveAASObstacle( const aasHandle_t handle );
|
||||
void RemoveAllAASObstacles( void );
|
||||
int NumNAV( void ) const;
|
||||
idNAV * GetNAV( int num ) const;
|
||||
idNAV * GetNAV( const char *name ) const;
|
||||
void SetNAVAreaState( const idBounds &bounds, const int areaContents, bool closed );
|
||||
aasHandle_t AddNAVObstacle( const idBounds &bounds );
|
||||
void RemoveNAVObstacle( const aasHandle_t handle );
|
||||
void RemoveAllNAVObstacles( void );
|
||||
|
||||
bool CheatsOk( bool requirePlayer = true );
|
||||
void SetSkill( int value );
|
||||
@@ -520,8 +520,8 @@ private:
|
||||
idCamera * camera;
|
||||
const idMaterial * globalMaterial; // for overriding everything
|
||||
|
||||
idList<idAAS *> aasList; // area system
|
||||
idStrList aasNames;
|
||||
idList<idNAV *> navList; // area system
|
||||
idStrList navNames;
|
||||
|
||||
idEntityPtr<idActor> lastAIAlertEntity;
|
||||
int lastAIAlertTime;
|
||||
@@ -612,7 +612,7 @@ private:
|
||||
|
||||
idList<rvmGameDelayRemoveEntry_t> delayRemoveEntities;
|
||||
const idDeclEntityDef* botItemTable;
|
||||
idAAS* bot_aas;
|
||||
idNAV* bot_nav;
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
|
||||
@@ -1809,8 +1809,8 @@ idGameLocal::AddBot
|
||||
void idGameLocal::AddBot(void) {
|
||||
int clientNum;
|
||||
|
||||
if (aasList.Num() == 0) {
|
||||
common->Warning("idGameLocal::AddBot: No AAS file loaded for map\n");
|
||||
if (navList.Num() == 0) {
|
||||
common->Warning("idGameLocal::AddBot: No NAV file loaded for map\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1830,11 +1830,11 @@ idGameLocal::TravelTimeToGoal
|
||||
*/
|
||||
int idGameLocal::TravelTimeToGoal(const idVec3& origin, const idVec3& goal)
|
||||
{
|
||||
idAAS* aas = bot_aas;
|
||||
idNAV* aas = bot_nav;
|
||||
|
||||
if (aas == NULL)
|
||||
{
|
||||
gameLocal.Error("idGameLocal::TraveTimeToGoal: No AAS loaded...\n");
|
||||
gameLocal.Error("idGameLocal::TraveTimeToGoal: No NAV loaded...\n");
|
||||
return NULL;
|
||||
}
|
||||
//int originArea = aas->PointAreaNum(origin);
|
||||
|
||||
@@ -2707,7 +2707,7 @@ idFuncAASPortal::Restore
|
||||
*/
|
||||
void idFuncAASPortal::Restore( idRestoreGame *savefile ) {
|
||||
savefile->ReadBool( state );
|
||||
gameLocal.SetAASAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_CLUSTERPORTAL, state );
|
||||
gameLocal.SetNAVAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_CLUSTERPORTAL, state );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2717,7 +2717,7 @@ idFuncAASPortal::Spawn
|
||||
*/
|
||||
void idFuncAASPortal::Spawn( void ) {
|
||||
state = spawnArgs.GetBool( "start_on" );
|
||||
gameLocal.SetAASAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_CLUSTERPORTAL, state );
|
||||
gameLocal.SetNAVAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_CLUSTERPORTAL, state );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2727,7 +2727,7 @@ idFuncAASPortal::Event_Activate
|
||||
*/
|
||||
void idFuncAASPortal::Event_Activate( idEntity *activator ) {
|
||||
state ^= 1;
|
||||
gameLocal.SetAASAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_CLUSTERPORTAL, state );
|
||||
gameLocal.SetNAVAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_CLUSTERPORTAL, state );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2767,7 +2767,7 @@ idFuncAASObstacle::Restore
|
||||
*/
|
||||
void idFuncAASObstacle::Restore( idRestoreGame *savefile ) {
|
||||
savefile->ReadBool( state );
|
||||
gameLocal.SetAASAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_OBSTACLE, state );
|
||||
gameLocal.SetNAVAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_OBSTACLE, state );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2777,7 +2777,7 @@ idFuncAASObstacle::Spawn
|
||||
*/
|
||||
void idFuncAASObstacle::Spawn( void ) {
|
||||
state = spawnArgs.GetBool( "start_on" );
|
||||
gameLocal.SetAASAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_OBSTACLE, state );
|
||||
gameLocal.SetNAVAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_OBSTACLE, state );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2787,7 +2787,7 @@ idFuncAASObstacle::Event_Activate
|
||||
*/
|
||||
void idFuncAASObstacle::Event_Activate( idEntity *activator ) {
|
||||
state ^= 1;
|
||||
gameLocal.SetAASAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_OBSTACLE, state );
|
||||
gameLocal.SetNAVAreaState( GetPhysics()->GetAbsBounds(), AREACONTENTS_OBSTACLE, state );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+13
-13
@@ -3121,7 +3121,7 @@ idDoor::idDoor( void ) {
|
||||
triggersize = 1.0f;
|
||||
crusher = false;
|
||||
noTouch = false;
|
||||
aas_area_closed = false;
|
||||
nav_area_closed = false;
|
||||
buddyStr.Clear();
|
||||
trigger = NULL;
|
||||
sndTrigger = NULL;
|
||||
@@ -3159,7 +3159,7 @@ void idDoor::Save( idSaveGame *savefile ) const {
|
||||
savefile->WriteFloat( triggersize );
|
||||
savefile->WriteBool( crusher );
|
||||
savefile->WriteBool( noTouch );
|
||||
savefile->WriteBool( aas_area_closed );
|
||||
savefile->WriteBool( nav_area_closed );
|
||||
savefile->WriteString( buddyStr );
|
||||
savefile->WriteInt( nextSndTriggerTime );
|
||||
|
||||
@@ -3187,8 +3187,8 @@ void idDoor::Restore( idRestoreGame *savefile ) {
|
||||
savefile->ReadFloat( triggersize );
|
||||
savefile->ReadBool( crusher );
|
||||
savefile->ReadBool( noTouch );
|
||||
savefile->ReadBool( aas_area_closed );
|
||||
SetAASAreaState( aas_area_closed );
|
||||
savefile->ReadBool( nav_area_closed );
|
||||
SetNAVAreaState( nav_area_closed );
|
||||
savefile->ReadString( buddyStr );
|
||||
savefile->ReadInt( nextSndTriggerTime );
|
||||
|
||||
@@ -3373,12 +3373,12 @@ void idDoor::PostBind( void ) {
|
||||
|
||||
/*
|
||||
================
|
||||
idDoor::SetAASAreaState
|
||||
idDoor::SetNAVAreaState
|
||||
================
|
||||
*/
|
||||
void idDoor::SetAASAreaState( bool closed ) {
|
||||
aas_area_closed = closed;
|
||||
gameLocal.SetAASAreaState( physicsObj.GetAbsBounds(), AREACONTENTS_CLUSTERPORTAL|AREACONTENTS_OBSTACLE, closed );
|
||||
void idDoor::SetNAVAreaState( bool closed ) {
|
||||
nav_area_closed = closed;
|
||||
gameLocal.SetNAVAreaState( physicsObj.GetAbsBounds(), AREACONTENTS_CLUSTERPORTAL|AREACONTENTS_OBSTACLE, closed );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3412,7 +3412,7 @@ void idDoor::Hide( void ) {
|
||||
if ( slaveDoor->areaPortal ) {
|
||||
slaveDoor->SetPortalState( true );
|
||||
}
|
||||
slaveDoor->SetAASAreaState( false );
|
||||
slaveDoor->SetNAVAreaState( false );
|
||||
}
|
||||
slave->GetPhysics()->GetClipModel()->Disable();
|
||||
slave->idMover_Binary::Hide();
|
||||
@@ -3451,7 +3451,7 @@ void idDoor::Show( void ) {
|
||||
if ( slaveDoor->areaPortal && ( slaveDoor->moverState == MOVER_POS1 ) ) {
|
||||
slaveDoor->SetPortalState( false );
|
||||
}
|
||||
slaveDoor->SetAASAreaState( IsLocked() || IsNoTouch() );
|
||||
slaveDoor->SetNAVAreaState( IsLocked() || IsNoTouch() );
|
||||
}
|
||||
slave->GetPhysics()->GetClipModel()->Enable();
|
||||
slave->idMover_Binary::Show();
|
||||
@@ -3541,7 +3541,7 @@ void idDoor::Lock( int f ) {
|
||||
}
|
||||
door->spawnArgs.SetInt( "locked", f );
|
||||
if ( ( f == 0 ) || ( !IsHidden() && ( door->moverState == MOVER_POS1 ) ) ) {
|
||||
door->SetAASAreaState( f != 0 );
|
||||
door->SetNAVAreaState( f != 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3959,7 +3959,7 @@ void idDoor::Event_OpenPortal( void ) {
|
||||
if ( slaveDoor->areaPortal ) {
|
||||
slaveDoor->SetPortalState( true );
|
||||
}
|
||||
slaveDoor->SetAASAreaState( false );
|
||||
slaveDoor->SetNAVAreaState( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3982,7 +3982,7 @@ void idDoor::Event_ClosePortal( void ) {
|
||||
if ( slaveDoor->areaPortal ) {
|
||||
slaveDoor->SetPortalState( false );
|
||||
}
|
||||
slaveDoor->SetAASAreaState( IsLocked() || IsNoTouch() );
|
||||
slaveDoor->SetNAVAreaState( IsLocked() || IsNoTouch() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ private:
|
||||
float triggersize;
|
||||
bool crusher;
|
||||
bool noTouch;
|
||||
bool aas_area_closed;
|
||||
bool nav_area_closed;
|
||||
idStr buddyStr;
|
||||
idClipModel * trigger;
|
||||
idClipModel * sndTrigger;
|
||||
@@ -409,7 +409,7 @@ private:
|
||||
int normalAxisIndex; // door faces X or Y for spectator teleports
|
||||
idDoor * companionDoor;
|
||||
|
||||
void SetAASAreaState( bool closed );
|
||||
void SetNAVAreaState( bool closed );
|
||||
|
||||
void GetLocalTriggerPosition( const idClipModel *trigger );
|
||||
void CalcTriggerBounds( float size, idBounds &bounds );
|
||||
|
||||
+15
-15
@@ -1433,7 +1433,7 @@ void idPlayer::Spawn( void ) {
|
||||
physicsObj.SetContents( CONTENTS_BODY );
|
||||
physicsObj.SetClipMask( MASK_PLAYERSOLID );
|
||||
SetPhysics( &physicsObj );
|
||||
InitAASLocation();
|
||||
InitNAVLocation();
|
||||
|
||||
skin = renderEntity.customSkin;
|
||||
|
||||
@@ -5821,26 +5821,26 @@ void idPlayer::AdjustBodyAngles( void ) {
|
||||
|
||||
/*
|
||||
==============
|
||||
idPlayer::InitAASLocation
|
||||
idPlayer::InitNAVLocation
|
||||
==============
|
||||
*/
|
||||
void idPlayer::InitAASLocation( void ) {
|
||||
void idPlayer::InitNAVLocation( void ) {
|
||||
int i;
|
||||
int num;
|
||||
idVec3 size;
|
||||
idBounds bounds;
|
||||
idAAS *aas;
|
||||
idNAV *aas;
|
||||
idVec3 origin;
|
||||
|
||||
GetFloorPos( 64.0f, origin );
|
||||
|
||||
num = gameLocal.NumAAS();
|
||||
num = gameLocal.NumNAV();
|
||||
aasLocation.SetGranularity( 1 );
|
||||
aasLocation.SetNum( num );
|
||||
for( i = 0; i < aasLocation.Num(); i++ ) {
|
||||
aasLocation[ i ].areaNum = 0;
|
||||
aasLocation[ i ].pos = origin;
|
||||
aas = gameLocal.GetAAS( i );
|
||||
aas = gameLocal.GetNAV( i );
|
||||
if ( aas && aas->GetSettings() ) {
|
||||
size = aas->GetSettings()->boundingBoxes[0][1];
|
||||
bounds[0] = -size;
|
||||
@@ -5854,15 +5854,15 @@ void idPlayer::InitAASLocation( void ) {
|
||||
|
||||
/*
|
||||
==============
|
||||
idPlayer::SetAASLocation
|
||||
idPlayer::SetNAVLocation
|
||||
==============
|
||||
*/
|
||||
void idPlayer::SetAASLocation( void ) {
|
||||
void idPlayer::SetNAVLocation( void ) {
|
||||
int i;
|
||||
int areaNum;
|
||||
idVec3 size;
|
||||
idBounds bounds;
|
||||
idAAS *aas;
|
||||
idNAV *aas;
|
||||
idVec3 origin;
|
||||
|
||||
if ( !GetFloorPos( 64.0f, origin ) ) {
|
||||
@@ -5870,7 +5870,7 @@ void idPlayer::SetAASLocation( void ) {
|
||||
}
|
||||
|
||||
for( i = 0; i < aasLocation.Num(); i++ ) {
|
||||
aas = gameLocal.GetAAS( i );
|
||||
aas = gameLocal.GetNAV( i );
|
||||
if ( !aas ) {
|
||||
continue;
|
||||
}
|
||||
@@ -5890,15 +5890,15 @@ void idPlayer::SetAASLocation( void ) {
|
||||
|
||||
/*
|
||||
==============
|
||||
idPlayer::GetAASLocation
|
||||
idPlayer::GetNAVLocation
|
||||
==============
|
||||
*/
|
||||
void idPlayer::GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const {
|
||||
void idPlayer::GetNAVLocation( idNAV *aas, idVec3 &pos, int &areaNum ) const {
|
||||
int i;
|
||||
|
||||
if ( aas != NULL ) {
|
||||
for( i = 0; i < aasLocation.Num(); i++ ) {
|
||||
if ( aas == gameLocal.GetAAS( i ) ) {
|
||||
if ( aas == gameLocal.GetNAV( i ) ) {
|
||||
areaNum = aasLocation[ i ].areaNum;
|
||||
pos = aasLocation[ i ].pos;
|
||||
return;
|
||||
@@ -5962,8 +5962,8 @@ void idPlayer::Move( void ) {
|
||||
BecomeActive( TH_PHYSICS );
|
||||
RunPhysics();
|
||||
|
||||
// update our last valid AAS location for the AI
|
||||
SetAASLocation();
|
||||
// update our last valid NAV location for the AI
|
||||
SetNAVLocation();
|
||||
|
||||
if ( spectating ) {
|
||||
newEyeOffset = 0.0f;
|
||||
|
||||
@@ -364,7 +364,7 @@ public:
|
||||
|
||||
virtual bool Collide( const trace_t &collision, const idVec3 &velocity );
|
||||
|
||||
virtual void GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const;
|
||||
virtual void GetNAVLocation( idNAV *aas, idVec3 &pos, int &areaNum ) const;
|
||||
virtual void GetAIAimTargets( const idVec3 &lastSightPos, idVec3 &headPos, idVec3 &chestPos );
|
||||
virtual void DamageFeedback( idEntity *victim, idEntity *inflictor, int &damage );
|
||||
void CalcDamagePoints( idEntity *inflictor, idEntity *attacker, const idDict *damageDef,
|
||||
@@ -658,8 +658,8 @@ private:
|
||||
void EvaluateControls( void );
|
||||
void AdjustSpeed( void );
|
||||
void AdjustBodyAngles( void );
|
||||
void InitAASLocation( void );
|
||||
void SetAASLocation( void );
|
||||
void InitNAVLocation( void );
|
||||
void SetNAVLocation( void );
|
||||
void Move( void );
|
||||
void UpdatePowerUps( void );
|
||||
void UpdateDeathSkin( bool state_hitch );
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
// Copyright (C) 2007 Id Software, Inc.
|
||||
//
|
||||
|
||||
#ifndef __AASCALLBACK_FINDAREAOUTOFRANGE_H__
|
||||
#define __AASCALLBACK_FINDAREAOUTOFRANGE_H__
|
||||
|
||||
#include "AASCallback_AvoidLocation.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
idAASCallback_FindAreaOutOfRange
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
class idAASCallback_FindAreaOutOfRange : public idAASCallback_AvoidLocation
|
||||
{
|
||||
public:
|
||||
idAASCallback_FindAreaOutOfRange( const idVec3& targetPos, float maxDist );
|
||||
|
||||
virtual bool AreaIsGoal( const idAAS* aas, int areaNum );
|
||||
|
||||
private:
|
||||
idVec3 targetPos;
|
||||
float maxDistSqr;
|
||||
};
|
||||
|
||||
#endif /* !__AASCALLBACK_FINDAREAOUTOFRANGE_H__ */
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2007 Id Software, Inc.
|
||||
//
|
||||
|
||||
#ifndef __AASCALLBACK_FINDCOVERAREA_H__
|
||||
#define __AASCALLBACK_FINDCOVERAREA_H__
|
||||
|
||||
#include "AASCallback_AvoidLocation.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
idAASCallback_FindCoverArea
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
class idAASCallback_FindCoverArea : public idAASCallback_AvoidLocation
|
||||
{
|
||||
public:
|
||||
idAASCallback_FindCoverArea( const idVec3& hideFromPos );
|
||||
~idAASCallback_FindCoverArea();
|
||||
|
||||
virtual bool AreaIsGoal( const idAAS* aas, int areaNum );
|
||||
|
||||
private:
|
||||
static const int MAX_PVS_AREAS = 4;
|
||||
|
||||
pvsHandle_t hidePVS;
|
||||
int PVSAreas[ MAX_PVS_AREAS ];
|
||||
};
|
||||
|
||||
#endif /* !__AASCALLBACK_FINDCOVERAREA_H__ */
|
||||
+19
-19
@@ -30,10 +30,10 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#pragma hdrstop
|
||||
|
||||
#include "../Game_local.h"
|
||||
#include "AASCallback_AvoidLocation.h"
|
||||
#include "AASCallback_FindAreaOutOfRange.h"
|
||||
#include "AASCallback_FindAttackPosition.h"
|
||||
#include "AASCallback_FindCoverArea.h"
|
||||
#include "NAVCallback_AvoidLocation.h"
|
||||
#include "NAVCallback_FindAreaOutOfRange.h"
|
||||
#include "NAVCallback_FindAttackPosition.h"
|
||||
#include "NAVCallback_FindCoverArea.h"
|
||||
|
||||
static const char* moveCommandString[NUM_MOVE_COMMANDS] = {
|
||||
"MOVE_NONE",
|
||||
@@ -533,11 +533,11 @@ void idAI::Restore(idRestoreGame* savefile) {
|
||||
|
||||
savefile->ReadBool(restorePhysics);
|
||||
|
||||
// Set the AAS if the character has the correct gravity vector
|
||||
// Set the NAV if the character has the correct gravity vector
|
||||
idVec3 gravity = spawnArgs.GetVector("gravityDir", "0 0 -1");
|
||||
gravity *= g_gravity.GetFloat();
|
||||
if (gravity == gameLocal.GetGravity()) {
|
||||
SetAAS();
|
||||
SetNAV();
|
||||
}
|
||||
|
||||
SetCombatModel();
|
||||
@@ -743,7 +743,7 @@ void idAI::Spawn(void) {
|
||||
|
||||
move.blockTime = 0;
|
||||
|
||||
SetAAS();
|
||||
SetNAV();
|
||||
|
||||
projectile = NULL;
|
||||
projectileDef = NULL;
|
||||
@@ -1030,7 +1030,7 @@ void idAI::Think(void) {
|
||||
}
|
||||
/* this still draws in retail builds.. not sure why.. don't care at this point.
|
||||
if ( !aas && developer.GetBool() && !fl.hidden && !num_cinematics ) {
|
||||
gameRenderWorld->DrawText( "No AAS", physicsObj.GetAbsBounds().GetCenter(), 0.1f, colorWhite, gameLocal.GetLocalPlayer()->viewAngles.ToMat3(), 1, gameLocal.msec );
|
||||
gameRenderWorld->DrawText( "No NAV", physicsObj.GetAbsBounds().GetCenter(), 0.1f, colorWhite, gameLocal.GetLocalPlayer()->viewAngles.ToMat3(), 1, gameLocal.msec );
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1180,14 +1180,14 @@ bool ValidForBounds(const idAASSettings* settings, const idBounds& bounds) {
|
||||
|
||||
/*
|
||||
=====================
|
||||
idAI::SetAAS
|
||||
idAI::SetNAV
|
||||
=====================
|
||||
*/
|
||||
void idAI::SetAAS(void) {
|
||||
void idAI::SetNAV(void) {
|
||||
idStr use_aas;
|
||||
|
||||
spawnArgs.GetString("use_aas", NULL, use_aas);
|
||||
aas = gameLocal.GetAAS(use_aas);
|
||||
aas = gameLocal.GetNAV(use_aas);
|
||||
if (aas) {
|
||||
const idAASSettings* settings = aas->GetSettings();
|
||||
if (settings) {
|
||||
@@ -1202,7 +1202,7 @@ void idAI::SetAAS(void) {
|
||||
aas = NULL;
|
||||
}
|
||||
}
|
||||
gameLocal.Printf("WARNING: %s has no AAS file\n", name.c_str());
|
||||
gameLocal.Printf("WARNING: %s has no NAV file\n", name.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1317,7 +1317,7 @@ bool idAI::PathToGoal(aasPath_t& path, int areaNum, const idVec3& origin, int go
|
||||
=====================
|
||||
idAI::TravelDistance
|
||||
|
||||
Returns the approximate travel distance from one position to the goal, or if no AAS, the straight line distance.
|
||||
Returns the approximate travel distance from one position to the goal, or if no NAV, the straight line distance.
|
||||
|
||||
This is feakin' slow, so it's not good to do it too many times per frame. It also is slower the further you
|
||||
are from the goal, so try to break the goals up into shorter distances.
|
||||
@@ -1695,7 +1695,7 @@ bool idAI::MoveOutOfRange(idEntity* ent, float range) {
|
||||
pos = ent->GetPhysics()->GetOrigin();
|
||||
}
|
||||
|
||||
idAASCallback_FindAreaOutOfRange findGoal(pos, range);
|
||||
idNAVCallback_FindAreaOutOfRange findGoal(pos, range);
|
||||
if (!aas->FindNearestGoal(goal, areaNum, org, pos, travelFlags, &obstacle, 1, findGoal)) {
|
||||
StopMove(MOVE_STATUS_DEST_UNREACHABLE);
|
||||
AI_DEST_UNREACHABLE = true;
|
||||
@@ -1753,7 +1753,7 @@ bool idAI::MoveToAttackPosition(idEntity* ent, int attack_anim) {
|
||||
pos = ent->GetPhysics()->GetOrigin();
|
||||
}
|
||||
|
||||
idAASFindAttackPosition findGoal(this, physicsObj.GetGravityAxis(), ent, pos, missileLaunchOffset[attack_anim]);
|
||||
idNAVFindAttackPosition findGoal(this, physicsObj.GetGravityAxis(), ent, pos, missileLaunchOffset[attack_anim]);
|
||||
if (!aas->FindNearestGoal(goal, areaNum, org, pos, travelFlags, &obstacle, 1, findGoal)) {
|
||||
StopMove(MOVE_STATUS_DEST_UNREACHABLE);
|
||||
AI_DEST_UNREACHABLE = true;
|
||||
@@ -1846,7 +1846,7 @@ bool idAI::MoveToCover(idEntity* entity, const idVec3& hideFromPos) {
|
||||
// consider the entity the monster tries to hide from as an obstacle
|
||||
obstacle.absBounds = entity->GetPhysics()->GetAbsBounds();
|
||||
|
||||
idAASCallback_FindCoverArea findCover(hideFromPos);
|
||||
idNAVCallback_FindCoverArea findCover(hideFromPos);
|
||||
if (!aas->FindNearestGoal(hideGoal, areaNum, org, hideFromPos, travelFlags, &obstacle, 1, findCover)) {
|
||||
StopMove(MOVE_STATUS_DEST_UNREACHABLE);
|
||||
AI_DEST_UNREACHABLE = true;
|
||||
@@ -3647,7 +3647,7 @@ void idAI::SetEnemyPosition(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
// when we don't have an AAS, we can't tell if an enemy is reachable or not,
|
||||
// when we don't have a NAV, we can't tell if an enemy is reachable or not,
|
||||
// so just assume that he is.
|
||||
if (!aas) {
|
||||
lastVisibleReachableEnemyPos = lastVisibleEnemyPos;
|
||||
@@ -3739,7 +3739,7 @@ void idAI::UpdateEnemyPosition(void) {
|
||||
}
|
||||
|
||||
if (onGround) {
|
||||
// when we don't have an AAS, we can't tell if an enemy is reachable or not,
|
||||
// when we don't have a NAV, we can't tell if an enemy is reachable or not,
|
||||
// so just assume that he is.
|
||||
if (!aas) {
|
||||
enemyAreaNum = 0;
|
||||
@@ -3808,7 +3808,7 @@ void idAI::SetEnemy(idActor* newEnemy) {
|
||||
return;
|
||||
}
|
||||
// let the monster know where the enemy is
|
||||
newEnemy->GetAASLocation(aas, lastReachableEnemyPos, enemyAreaNum);
|
||||
newEnemy->GetNAVLocation(aas, lastReachableEnemyPos, enemyAreaNum);
|
||||
SetEnemyPosition();
|
||||
SetChatSound();
|
||||
|
||||
|
||||
@@ -221,11 +221,11 @@ public:
|
||||
static void List_f(const idCmdArgs& args);
|
||||
|
||||
// Finds a path around dynamic obstacles.
|
||||
static bool FindPathAroundObstacles(const idPhysics* physics, const idAAS* aas, const idEntity* ignore, const idVec3& startPos, const idVec3& seekPos, obstaclePath_t& path);
|
||||
static bool FindPathAroundObstacles(const idPhysics* physics, const idNAV* aas, const idEntity* ignore, const idVec3& startPos, const idVec3& seekPos, obstaclePath_t& path);
|
||||
// Frees any nodes used for the dynamic obstacle avoidance.
|
||||
static void FreeObstacleAvoidanceNodes(void);
|
||||
// Predicts movement, returns true if a stop event was triggered.
|
||||
static bool PredictPath(const idEntity* ent, const idAAS* aas, const idVec3& start, const idVec3& velocity, int totalTime, int frameTime, int stopEvent, predictedPath_t& path);
|
||||
static bool PredictPath(const idEntity* ent, const idNAV* aas, const idVec3& start, const idVec3& velocity, int totalTime, int frameTime, int stopEvent, predictedPath_t& path);
|
||||
// Return true if the trajectory of the clip model is collision free.
|
||||
static bool TestTrajectory(const idVec3& start, const idVec3& end, float zVel, float gravity, float time, float max_height, const idClipModel* clip, int clipmask, const idEntity* ignore, const idEntity* targetEntity, int drawtime);
|
||||
// Finds the best collision free trajectory for a clip model.
|
||||
@@ -233,7 +233,7 @@ public:
|
||||
|
||||
protected:
|
||||
// navigation
|
||||
idAAS* aas;
|
||||
idNAV* aas;
|
||||
int travelFlags;
|
||||
|
||||
idMoveState move;
|
||||
@@ -377,7 +377,7 @@ protected:
|
||||
//
|
||||
// ai/ai.cpp
|
||||
//
|
||||
void SetAAS(void);
|
||||
void SetNAV(void);
|
||||
virtual void DormantBegin(void); // called when entity becomes dormant
|
||||
virtual void DormantEnd(void); // called when entity wakes from being dormant
|
||||
void Think(void);
|
||||
@@ -586,7 +586,7 @@ protected:
|
||||
void LocateEnemy(void);
|
||||
void KickObstacles(idEntity* kickEnt, float force);
|
||||
idEntity* GetObstacle(void);
|
||||
idVec3 PushPointIntoAAS(const idVec3& pos);
|
||||
idVec3 PushPointIntoNAV(const idVec3& pos);
|
||||
float GetTurnRate(void);
|
||||
void SetTurnRate(float rate);
|
||||
void AnimTurn(float angles);
|
||||
@@ -718,7 +718,7 @@ protected:
|
||||
void Event_LocateEnemy(void);
|
||||
void Event_KickObstacles(idEntity* kickEnt, float force);
|
||||
void Event_GetObstacle(void);
|
||||
void Event_PushPointIntoAAS(const idVec3& pos);
|
||||
void Event_PushPointIntoNAV(const idVec3& pos);
|
||||
void Event_GetTurnRate(void);
|
||||
void Event_SetTurnRate(float rate);
|
||||
void Event_AnimTurn(float angles);
|
||||
|
||||
@@ -149,7 +149,7 @@ const idEventDef AI_WakeOnFlashlight("wakeOnFlashlight", "d");
|
||||
const idEventDef AI_LocateEnemy("locateEnemy");
|
||||
const idEventDef AI_KickObstacles("kickObstacles", "Ef");
|
||||
const idEventDef AI_GetObstacle("getObstacle", NULL, 'e');
|
||||
const idEventDef AI_PushPointIntoAAS("pushPointIntoAAS", "v", 'v');
|
||||
const idEventDef AI_PushPointIntoNAV("pushPointIntoAAS", "v", 'v');
|
||||
const idEventDef AI_GetTurnRate("getTurnRate", NULL, 'f');
|
||||
const idEventDef AI_SetTurnRate("setTurnRate", "f");
|
||||
const idEventDef AI_AnimTurn("animTurn", "f");
|
||||
@@ -279,7 +279,7 @@ EVENT(AI_WakeOnFlashlight, idAI::Event_WakeOnFlashlight)
|
||||
EVENT(AI_LocateEnemy, idAI::Event_LocateEnemy)
|
||||
EVENT(AI_KickObstacles, idAI::Event_KickObstacles)
|
||||
EVENT(AI_GetObstacle, idAI::Event_GetObstacle)
|
||||
EVENT(AI_PushPointIntoAAS, idAI::Event_PushPointIntoAAS)
|
||||
EVENT(AI_PushPointIntoNAV, idAI::Event_PushPointIntoNAV)
|
||||
EVENT(AI_GetTurnRate, idAI::Event_GetTurnRate)
|
||||
EVENT(AI_SetTurnRate, idAI::Event_SetTurnRate)
|
||||
EVENT(AI_AnimTurn, idAI::Event_AnimTurn)
|
||||
@@ -2209,7 +2209,7 @@ void idAI::LocateEnemy(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
enemyEnt->GetAASLocation(aas, lastReachableEnemyPos, areaNum);
|
||||
enemyEnt->GetNAVLocation(aas, lastReachableEnemyPos, areaNum);
|
||||
SetEnemyPosition();
|
||||
UpdateEnemyPosition();
|
||||
}
|
||||
@@ -2251,10 +2251,10 @@ idEntity* idAI::GetObstacle(void) {
|
||||
|
||||
/*
|
||||
=====================
|
||||
idAI::PushPointIntoAAS
|
||||
idAI::PushPointIntoNAV
|
||||
=====================
|
||||
*/
|
||||
idVec3 idAI::PushPointIntoAAS(const idVec3& pos) {
|
||||
idVec3 idAI::PushPointIntoNAV(const idVec3& pos) {
|
||||
int areaNum;
|
||||
idVec3 newPos;
|
||||
|
||||
@@ -2425,7 +2425,7 @@ int idAI::CanReachEnemy(void) {
|
||||
if (enemyEnt->OnLadder()) {
|
||||
return false;
|
||||
}
|
||||
enemyEnt->GetAASLocation(aas, pos, toAreaNum);
|
||||
enemyEnt->GetNAVLocation(aas, pos, toAreaNum);
|
||||
}
|
||||
else {
|
||||
pos = enemyEnt->GetPhysics()->GetOrigin();
|
||||
@@ -3614,11 +3614,11 @@ void idAI::Event_GetObstacle(void) {
|
||||
|
||||
/*
|
||||
=====================
|
||||
idAI::Event_PushPointIntoAAS
|
||||
idAI::Event_PushPointIntoNAV
|
||||
=====================
|
||||
*/
|
||||
void idAI::Event_PushPointIntoAAS(const idVec3& pos) {
|
||||
idThread::ReturnVector(PushPointIntoAAS(pos));
|
||||
void idAI::Event_PushPointIntoNAV(const idVec3& pos) {
|
||||
idThread::ReturnVector(PushPointIntoNAV(pos));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -30,50 +30,50 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#pragma hdrstop
|
||||
|
||||
#include "../Game_local.h"
|
||||
#include "AAS_local.h"
|
||||
#include "NAV_local.h"
|
||||
|
||||
/*
|
||||
============
|
||||
idAAS::Alloc
|
||||
idNAV::Alloc
|
||||
============
|
||||
*/
|
||||
idAAS *idAAS::Alloc( void ) {
|
||||
return new idAASLocal;
|
||||
idNAV *idNAV::Alloc( void ) {
|
||||
return new idNAVLocal;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAAS::idAAS
|
||||
idNAV::~idNAV
|
||||
============
|
||||
*/
|
||||
idAAS::~idAAS( void ) {
|
||||
idNAV::~idNAV( void ) {
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::idAASLocal
|
||||
idNAVLocal::idNAVLocal
|
||||
============
|
||||
*/
|
||||
idAASLocal::idAASLocal( void ) {
|
||||
idNAVLocal::idNAVLocal( void ) {
|
||||
file = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::~idAASLocal
|
||||
idNAVLocal::~idNAVLocal
|
||||
============
|
||||
*/
|
||||
idAASLocal::~idAASLocal( void ) {
|
||||
idNAVLocal::~idNAVLocal( void ) {
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::Init
|
||||
idNAVLocal::Init
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::Init( const idStr &mapName, unsigned int mapFileCRC ) {
|
||||
const idStr navName = idRecastNavMesh::NavFileNameForAASName( mapName );
|
||||
bool idNAVLocal::Init( const idStr &mapName, unsigned int mapFileCRC ) {
|
||||
const idStr navName = idRecastNavMesh::NavFileNameForMapName( mapName );
|
||||
if ( recastNavMesh.IsLoaded() && mapName.Icmp( name ) == 0 ) {
|
||||
common->Printf( "Keeping %s\n", navName.c_str() );
|
||||
recastNavMesh.RemoveAllObstacles();
|
||||
@@ -104,7 +104,7 @@ bool idAASLocal::Init( const idStr &mapName, unsigned int mapFileCRC ) {
|
||||
|
||||
file = AASFileManager->LoadAAS( mapName, mapFileCRC );
|
||||
if ( !file ) {
|
||||
common->DWarning( "Couldn't load AAS file: '%s'", mapName.c_str() );
|
||||
common->DWarning( "Couldn't load NAV file: '%s'", mapName.c_str() );
|
||||
return false;
|
||||
}
|
||||
SetupRouting();
|
||||
@@ -114,10 +114,10 @@ bool idAASLocal::Init( const idStr &mapName, unsigned int mapFileCRC ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::Shutdown
|
||||
idNAVLocal::Shutdown
|
||||
============
|
||||
*/
|
||||
void idAASLocal::Shutdown( void ) {
|
||||
void idNAVLocal::Shutdown( void ) {
|
||||
recastNavMesh.Shutdown();
|
||||
if ( file ) {
|
||||
ShutdownRouting();
|
||||
@@ -129,10 +129,10 @@ void idAASLocal::Shutdown( void ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::Stats
|
||||
idNAVLocal::Stats
|
||||
============
|
||||
*/
|
||||
void idAASLocal::Stats( void ) const {
|
||||
void idNAVLocal::Stats( void ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
recastNavMesh.Stats();
|
||||
return;
|
||||
@@ -147,10 +147,10 @@ void idAASLocal::Stats( void ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetSettings
|
||||
idNAVLocal::GetSettings
|
||||
============
|
||||
*/
|
||||
const idAASSettings *idAASLocal::GetSettings( void ) const {
|
||||
const idAASSettings *idNAVLocal::GetSettings( void ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.GetSettings();
|
||||
}
|
||||
@@ -162,10 +162,10 @@ const idAASSettings *idAASLocal::GetSettings( void ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::PointAreaNum
|
||||
idNAVLocal::PointAreaNum
|
||||
============
|
||||
*/
|
||||
int idAASLocal::PointAreaNum( const idVec3 &origin ) const {
|
||||
int idNAVLocal::PointAreaNum( const idVec3 &origin ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.PointAreaNum( origin );
|
||||
}
|
||||
@@ -177,10 +177,10 @@ int idAASLocal::PointAreaNum( const idVec3 &origin ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::PointReachableAreaNum
|
||||
idNAVLocal::PointReachableAreaNum
|
||||
============
|
||||
*/
|
||||
int idAASLocal::PointReachableAreaNum( const idVec3 &origin, const idBounds &searchBounds, const int areaFlags ) const {
|
||||
int idNAVLocal::PointReachableAreaNum( const idVec3 &origin, const idBounds &searchBounds, const int areaFlags ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.PointReachableAreaNum( origin, searchBounds, areaFlags );
|
||||
}
|
||||
@@ -193,10 +193,10 @@ int idAASLocal::PointReachableAreaNum( const idVec3 &origin, const idBounds &sea
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::BoundsReachableAreaNum
|
||||
idNAVLocal::BoundsReachableAreaNum
|
||||
============
|
||||
*/
|
||||
int idAASLocal::BoundsReachableAreaNum( const idBounds &bounds, const int areaFlags ) const {
|
||||
int idNAVLocal::BoundsReachableAreaNum( const idBounds &bounds, const int areaFlags ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.BoundsReachableAreaNum( bounds, areaFlags );
|
||||
}
|
||||
@@ -209,10 +209,10 @@ int idAASLocal::BoundsReachableAreaNum( const idBounds &bounds, const int areaFl
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::PushPointIntoAreaNum
|
||||
idNAVLocal::PushPointIntoAreaNum
|
||||
============
|
||||
*/
|
||||
void idAASLocal::PushPointIntoAreaNum( int areaNum, idVec3 &origin ) const {
|
||||
void idNAVLocal::PushPointIntoAreaNum( int areaNum, idVec3 &origin ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
recastNavMesh.PushPointIntoAreaNum( areaNum, origin );
|
||||
return;
|
||||
@@ -225,10 +225,10 @@ void idAASLocal::PushPointIntoAreaNum( int areaNum, idVec3 &origin ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::AreaCenter
|
||||
idNAVLocal::AreaCenter
|
||||
============
|
||||
*/
|
||||
idVec3 idAASLocal::AreaCenter( int areaNum ) const {
|
||||
idVec3 idNAVLocal::AreaCenter( int areaNum ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.AreaCenter( areaNum );
|
||||
}
|
||||
@@ -240,10 +240,10 @@ idVec3 idAASLocal::AreaCenter( int areaNum ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::AreaFlags
|
||||
idNAVLocal::AreaFlags
|
||||
============
|
||||
*/
|
||||
int idAASLocal::AreaFlags( int areaNum ) const {
|
||||
int idNAVLocal::AreaFlags( int areaNum ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.AreaFlags( areaNum );
|
||||
}
|
||||
@@ -255,10 +255,10 @@ int idAASLocal::AreaFlags( int areaNum ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::AreaTravelFlags
|
||||
idNAVLocal::AreaTravelFlags
|
||||
============
|
||||
*/
|
||||
int idAASLocal::AreaTravelFlags( int areaNum ) const {
|
||||
int idNAVLocal::AreaTravelFlags( int areaNum ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.AreaTravelFlags( areaNum );
|
||||
}
|
||||
@@ -270,10 +270,10 @@ int idAASLocal::AreaTravelFlags( int areaNum ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::Trace
|
||||
idNAVLocal::Trace
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::Trace( aasTrace_t &trace, const idVec3 &start, const idVec3 &end ) const {
|
||||
bool idNAVLocal::Trace( aasTrace_t &trace, const idVec3 &start, const idVec3 &end ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.Trace( trace, start, end );
|
||||
}
|
||||
@@ -288,10 +288,10 @@ bool idAASLocal::Trace( aasTrace_t &trace, const idVec3 &start, const idVec3 &en
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetPlane
|
||||
idNAVLocal::GetPlane
|
||||
============
|
||||
*/
|
||||
const idPlane &idAASLocal::GetPlane( int planeNum ) const {
|
||||
const idPlane &idNAVLocal::GetPlane( int planeNum ) const {
|
||||
if ( !file ) {
|
||||
static idPlane dummy;
|
||||
return dummy;
|
||||
@@ -301,10 +301,10 @@ const idPlane &idAASLocal::GetPlane( int planeNum ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetEdgeVertexNumbers
|
||||
idNAVLocal::GetEdgeVertexNumbers
|
||||
============
|
||||
*/
|
||||
void idAASLocal::GetEdgeVertexNumbers( int edgeNum, int verts[2] ) const {
|
||||
void idNAVLocal::GetEdgeVertexNumbers( int edgeNum, int verts[2] ) const {
|
||||
if ( !file ) {
|
||||
verts[0] = verts[1] = 0;
|
||||
return;
|
||||
@@ -316,10 +316,10 @@ void idAASLocal::GetEdgeVertexNumbers( int edgeNum, int verts[2] ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetEdge
|
||||
idNAVLocal::GetEdge
|
||||
============
|
||||
*/
|
||||
void idAASLocal::GetEdge( int edgeNum, idVec3 &start, idVec3 &end ) const {
|
||||
void idNAVLocal::GetEdge( int edgeNum, idVec3 &start, idVec3 &end ) const {
|
||||
if ( !file ) {
|
||||
start.Zero();
|
||||
end.Zero();
|
||||
@@ -333,10 +333,10 @@ void idAASLocal::GetEdge( int edgeNum, idVec3 &start, idVec3 &end ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::AdjustPositionAndGetArea
|
||||
idNAVLocal::AdjustPositionAndGetArea
|
||||
============
|
||||
*/
|
||||
int idAASLocal::AdjustPositionAndGetArea(idVec3& origin)
|
||||
int idNAVLocal::AdjustPositionAndGetArea(idVec3& origin)
|
||||
{
|
||||
int area = PointReachableAreaNum(origin, DefaultSearchBounds(), AREA_REACHABLE_WALK);
|
||||
PushPointIntoAreaNum(area, origin);
|
||||
@@ -26,8 +26,8 @@ If you have questions concerning this license or the applicable additional terms
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __AAS_H__
|
||||
#define __AAS_H__
|
||||
#ifndef __NAV_H__
|
||||
#define __NAV_H__
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
@@ -64,25 +64,25 @@ typedef struct aasObstacle_s {
|
||||
idBounds expAbsBounds; // expanded absolute bounds of obstacle
|
||||
} aasObstacle_t;
|
||||
|
||||
class idAASCallback {
|
||||
class idNAVCallback {
|
||||
public:
|
||||
virtual ~idAASCallback() {};
|
||||
virtual bool AreaIsGoal( const class idAAS *aas, int areaNum ) = 0;
|
||||
virtual ~idNAVCallback() {};
|
||||
virtual bool AreaIsGoal( const class idNAV *aas, int areaNum ) = 0;
|
||||
};
|
||||
|
||||
typedef int aasHandle_t;
|
||||
|
||||
class idAAS {
|
||||
class idNAV {
|
||||
public:
|
||||
static idAAS * Alloc( void );
|
||||
virtual ~idAAS( void ) = 0;
|
||||
static idNAV * Alloc( void );
|
||||
virtual ~idNAV( void ) = 0;
|
||||
// Initialize for the given map.
|
||||
virtual bool Init( const idStr &mapName, unsigned int mapFileCRC ) = 0;
|
||||
// Print AAS stats.
|
||||
// Print NAV stats.
|
||||
virtual void Stats( void ) const = 0;
|
||||
// Test from the given origin.
|
||||
virtual void Test( const idVec3 &origin ) = 0;
|
||||
// Get the AAS settings.
|
||||
// Get the NAV settings.
|
||||
virtual const idAASSettings *GetSettings( void ) const = 0;
|
||||
// Returns the number of the area the origin is in.
|
||||
virtual int PointAreaNum( const idVec3 &origin ) const = 0;
|
||||
@@ -135,12 +135,12 @@ public:
|
||||
// Show the fly path from the origin towards the area.
|
||||
virtual void ShowFlyPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const = 0;
|
||||
// Find the nearest goal which satisfies the callback.
|
||||
virtual bool FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idAASCallback &callback ) const = 0;
|
||||
virtual bool FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idNAVCallback &callback ) const = 0;
|
||||
|
||||
virtual int AdjustPositionAndGetArea(idVec3& origin) = 0;
|
||||
virtual void ShowArea(const idVec3& origin) const = 0;
|
||||
virtual idAASFile* GetAASFile(void) = 0;
|
||||
virtual idAASFile* GetNAVFile(void) = 0;
|
||||
virtual const idBounds& DefaultSearchBounds(void) const = 0;
|
||||
};
|
||||
|
||||
#endif /* !__AAS_H__ */
|
||||
#endif /* !__NAV_H__ */
|
||||
+14
-14
@@ -4,16 +4,16 @@
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "AAS_local.h"
|
||||
#include "NAV_local.h"
|
||||
#include "../Game_local.h" // for print and error
|
||||
#include "AASCallback_AvoidLocation.h"
|
||||
#include "NAVCallback_AvoidLocation.h"
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_AvoidLocation::idAASCallback_AvoidLocation
|
||||
idNAVCallback_AvoidLocation::idNAVCallback_AvoidLocation
|
||||
============
|
||||
*/
|
||||
idAASCallback_AvoidLocation::idAASCallback_AvoidLocation()
|
||||
idNAVCallback_AvoidLocation::idNAVCallback_AvoidLocation()
|
||||
{
|
||||
avoidLocation.Zero();
|
||||
avoidDist = 0.0f;
|
||||
@@ -23,19 +23,19 @@ idAASCallback_AvoidLocation::idAASCallback_AvoidLocation()
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_AvoidLocation::~idAASCallback_AvoidLocation
|
||||
idNAVCallback_AvoidLocation::~idNAVCallback_AvoidLocation
|
||||
============
|
||||
*/
|
||||
idAASCallback_AvoidLocation::~idAASCallback_AvoidLocation()
|
||||
idNAVCallback_AvoidLocation::~idNAVCallback_AvoidLocation()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_AvoidLocation::SetAvoidLocation
|
||||
idNAVCallback_AvoidLocation::SetAvoidLocation
|
||||
============
|
||||
*/
|
||||
void idAASCallback_AvoidLocation::SetAvoidLocation( const idVec3& start, const idVec3& avoidLocation )
|
||||
void idNAVCallback_AvoidLocation::SetAvoidLocation( const idVec3& start, const idVec3& avoidLocation )
|
||||
{
|
||||
this->avoidLocation = avoidLocation;
|
||||
this->avoidDist = ( avoidLocation - start ).Length();
|
||||
@@ -43,10 +43,10 @@ void idAASCallback_AvoidLocation::SetAvoidLocation( const idVec3& start, const i
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_AvoidLocation::SetObstacles
|
||||
idNAVCallback_AvoidLocation::SetObstacles
|
||||
============
|
||||
*/
|
||||
void idAASCallback_AvoidLocation::SetObstacles( const idAAS* aas, const idAASObstacle* obstacles, int numObstacles )
|
||||
void idNAVCallback_AvoidLocation::SetObstacles( const idNAV* aas, const idNAVObstacle* obstacles, int numObstacles )
|
||||
{
|
||||
this->obstacles = obstacles;
|
||||
this->numObstacles = numObstacles;
|
||||
@@ -60,10 +60,10 @@ void idAASCallback_AvoidLocation::SetObstacles( const idAAS* aas, const idAASObs
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_AvoidLocation::PathValid
|
||||
idNAVCallback_AvoidLocation::PathValid
|
||||
============
|
||||
*/
|
||||
bool idAASCallback_AvoidLocation::PathValid( const idAAS* aas, const idVec3& start, const idVec3& end )
|
||||
bool idNAVCallback_AvoidLocation::PathValid( const idNAV* aas, const idVec3& start, const idVec3& end )
|
||||
{
|
||||
// path may not go through any obstacles
|
||||
for( int i = 0; i < numObstacles; i++ )
|
||||
@@ -79,10 +79,10 @@ bool idAASCallback_AvoidLocation::PathValid( const idAAS* aas, const idVec3& sta
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_AvoidLocation::AdditionalTravelTimeForPath
|
||||
idNAVCallback_AvoidLocation::AdditionalTravelTimeForPath
|
||||
============
|
||||
*/
|
||||
int idAASCallback_AvoidLocation::AdditionalTravelTimeForPath( const idAAS* aas, const idVec3& start, const idVec3& end )
|
||||
int idNAVCallback_AvoidLocation::AdditionalTravelTimeForPath( const idNAV* aas, const idVec3& start, const idVec3& end )
|
||||
{
|
||||
if( avoidDist <= 0.0f )
|
||||
{
|
||||
+13
-13
@@ -1,41 +1,41 @@
|
||||
// Copyright (C) 2007 Id Software, Inc.
|
||||
//
|
||||
|
||||
#ifndef __AASCALLBACK_AVOIDLOCATION_H__
|
||||
#define __AASCALLBACK_AVOIDLOCATION_H__
|
||||
#ifndef __NAVCALLBACK_AVOIDLOCATION_H__
|
||||
#define __NAVCALLBACK_AVOIDLOCATION_H__
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
idAASCallback_AvoidLocation
|
||||
idNAVCallback_AvoidLocation
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
struct idAASObstacle
|
||||
struct idNAVObstacle
|
||||
{
|
||||
idBounds absBounds; // absolute bounds of obstacle
|
||||
mutable idBounds expAbsBounds; // expanded absolute bounds of obstacle
|
||||
};
|
||||
|
||||
class idAASCallback_AvoidLocation : public idAASCallback
|
||||
class idNAVCallback_AvoidLocation : public idNAVCallback
|
||||
{
|
||||
public:
|
||||
idAASCallback_AvoidLocation();
|
||||
~idAASCallback_AvoidLocation();
|
||||
idNAVCallback_AvoidLocation();
|
||||
~idNAVCallback_AvoidLocation();
|
||||
|
||||
void SetAvoidLocation( const idVec3& start, const idVec3& avoidLocation );
|
||||
void SetObstacles( const idAAS* aas, const idAASObstacle* obstacles, int numObstacles );
|
||||
void SetObstacles( const idNAV* aas, const idNAVObstacle* obstacles, int numObstacles );
|
||||
|
||||
virtual bool PathValid( const idAAS* aas, const idVec3& start, const idVec3& end );
|
||||
virtual int AdditionalTravelTimeForPath( const idAAS* aas, const idVec3& start, const idVec3& end );
|
||||
virtual bool AreaIsGoal( const idAAS* aas, int areaNum ) = 0;
|
||||
virtual bool PathValid( const idNAV* aas, const idVec3& start, const idVec3& end );
|
||||
virtual int AdditionalTravelTimeForPath( const idNAV* aas, const idVec3& start, const idVec3& end );
|
||||
virtual bool AreaIsGoal( const idNAV* aas, int areaNum ) = 0;
|
||||
|
||||
private:
|
||||
idVec3 avoidLocation;
|
||||
float avoidDist;
|
||||
const idAASObstacle* obstacles;
|
||||
const idNAVObstacle* obstacles;
|
||||
int numObstacles;
|
||||
};
|
||||
|
||||
#endif /* !__AASCALLBACK_AVOIDLOCATION_H__ */
|
||||
#endif /* !__NAVCALLBACK_AVOIDLOCATION_H__ */
|
||||
+6
-6
@@ -4,17 +4,17 @@
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "AAS_local.h"
|
||||
#include "NAV_local.h"
|
||||
#include "../Game_local.h" // for print and error
|
||||
|
||||
#include "AASCallback_FindAreaOutOfRange.h"
|
||||
#include "NAVCallback_FindAreaOutOfRange.h"
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_FindAreaOutOfRange::idAASCallback_FindAreaOutOfRange
|
||||
idNAVCallback_FindAreaOutOfRange::idNAVCallback_FindAreaOutOfRange
|
||||
============
|
||||
*/
|
||||
idAASCallback_FindAreaOutOfRange::idAASCallback_FindAreaOutOfRange( const idVec3& targetPos, float maxDist )
|
||||
idNAVCallback_FindAreaOutOfRange::idNAVCallback_FindAreaOutOfRange( const idVec3& targetPos, float maxDist )
|
||||
{
|
||||
this->targetPos = targetPos;
|
||||
this->maxDistSqr = maxDist * maxDist;
|
||||
@@ -22,10 +22,10 @@ idAASCallback_FindAreaOutOfRange::idAASCallback_FindAreaOutOfRange( const idVec3
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_FindAreaOutOfRange::AreaIsGoal
|
||||
idNAVCallback_FindAreaOutOfRange::AreaIsGoal
|
||||
============
|
||||
*/
|
||||
bool idAASCallback_FindAreaOutOfRange::AreaIsGoal( const idAAS* aas, int areaNum )
|
||||
bool idNAVCallback_FindAreaOutOfRange::AreaIsGoal( const idNAV* aas, int areaNum )
|
||||
{
|
||||
const idVec3& areaCenter = aas->AreaCenter( areaNum );
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2007 Id Software, Inc.
|
||||
//
|
||||
|
||||
#ifndef __NAVCALLBACK_FINDAREAOUTOFRANGE_H__
|
||||
#define __NAVCALLBACK_FINDAREAOUTOFRANGE_H__
|
||||
|
||||
#include "NAVCallback_AvoidLocation.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
idNAVCallback_FindAreaOutOfRange
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
class idNAVCallback_FindAreaOutOfRange : public idNAVCallback_AvoidLocation
|
||||
{
|
||||
public:
|
||||
idNAVCallback_FindAreaOutOfRange( const idVec3& targetPos, float maxDist );
|
||||
|
||||
virtual bool AreaIsGoal( const idNAV* aas, int areaNum );
|
||||
|
||||
private:
|
||||
idVec3 targetPos;
|
||||
float maxDistSqr;
|
||||
};
|
||||
|
||||
#endif /* !__NAVCALLBACK_FINDAREAOUTOFRANGE_H__ */
|
||||
+8
-8
@@ -1,16 +1,16 @@
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "AAS_local.h"
|
||||
#include "NAV_local.h"
|
||||
#include "../Game_local.h"
|
||||
#include "AASCallback_FindAttackPosition.h"
|
||||
#include "NAVCallback_FindAttackPosition.h"
|
||||
|
||||
/*
|
||||
============
|
||||
idAASFindAttackPosition::idAASFindAttackPosition
|
||||
idNAVFindAttackPosition::idNAVFindAttackPosition
|
||||
============
|
||||
*/
|
||||
idAASFindAttackPosition::idAASFindAttackPosition(const idAI* self, const idMat3& gravityAxis, idEntity* target, const idVec3& targetPos, const idVec3& fireOffset) {
|
||||
idNAVFindAttackPosition::idNAVFindAttackPosition(const idAI* self, const idMat3& gravityAxis, idEntity* target, const idVec3& targetPos, const idVec3& fireOffset) {
|
||||
int numPVSAreas;
|
||||
|
||||
this->target = target;
|
||||
@@ -30,19 +30,19 @@ idAASFindAttackPosition::idAASFindAttackPosition(const idAI* self, const idMat3&
|
||||
|
||||
/*
|
||||
============
|
||||
idAASFindAttackPosition::~idAASFindAttackPosition
|
||||
idNAVFindAttackPosition::~idNAVFindAttackPosition
|
||||
============
|
||||
*/
|
||||
idAASFindAttackPosition::~idAASFindAttackPosition() {
|
||||
idNAVFindAttackPosition::~idNAVFindAttackPosition() {
|
||||
gameLocal.pvs.FreeCurrentPVS(targetPVS);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAASFindAttackPosition::TestArea
|
||||
idNAVFindAttackPosition::TestArea
|
||||
============
|
||||
*/
|
||||
bool idAASFindAttackPosition::AreaIsGoal(const idAAS* aas, int areaNum) {
|
||||
bool idNAVFindAttackPosition::AreaIsGoal(const idNAV* aas, int areaNum) {
|
||||
idVec3 dir;
|
||||
idVec3 local_dir;
|
||||
idVec3 fromPos;
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
class idAASFindAttackPosition : public idAASCallback {
|
||||
class idNAVFindAttackPosition : public idNAVCallback {
|
||||
public:
|
||||
idAASFindAttackPosition(const idAI* self, const idMat3& gravityAxis, idEntity* target, const idVec3& targetPos, const idVec3& fireOffset);
|
||||
~idAASFindAttackPosition();
|
||||
idNAVFindAttackPosition(const idAI* self, const idMat3& gravityAxis, idEntity* target, const idVec3& targetPos, const idVec3& fireOffset);
|
||||
~idNAVFindAttackPosition();
|
||||
|
||||
virtual bool AreaIsGoal(const idAAS* aas, int areaNum);
|
||||
virtual bool AreaIsGoal(const idNAV* aas, int areaNum);
|
||||
|
||||
private:
|
||||
const idAI* self;
|
||||
+8
-8
@@ -4,17 +4,17 @@
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "AAS_local.h"
|
||||
#include "NAV_local.h"
|
||||
#include "../Game_local.h" // for print and error
|
||||
|
||||
#include "AASCallback_FindCoverArea.h"
|
||||
#include "NAVCallback_FindCoverArea.h"
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_FindCoverArea::idAASCallback_FindCoverArea
|
||||
idNAVCallback_FindCoverArea::idNAVCallback_FindCoverArea
|
||||
============
|
||||
*/
|
||||
idAASCallback_FindCoverArea::idAASCallback_FindCoverArea( const idVec3& hideFromPos )
|
||||
idNAVCallback_FindCoverArea::idNAVCallback_FindCoverArea( const idVec3& hideFromPos )
|
||||
{
|
||||
int numPVSAreas;
|
||||
idBounds bounds( hideFromPos - idVec3( 16, 16, 0 ), hideFromPos + idVec3( 16, 16, 64 ) );
|
||||
@@ -26,20 +26,20 @@ idAASCallback_FindCoverArea::idAASCallback_FindCoverArea( const idVec3& hideFrom
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_FindCoverArea::~idAASCallback_FindCoverArea
|
||||
idNAVCallback_FindCoverArea::~idNAVCallback_FindCoverArea
|
||||
============
|
||||
*/
|
||||
idAASCallback_FindCoverArea::~idAASCallback_FindCoverArea()
|
||||
idNAVCallback_FindCoverArea::~idNAVCallback_FindCoverArea()
|
||||
{
|
||||
gameLocal.pvs.FreeCurrentPVS( hidePVS );
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAASCallback_FindCoverArea::AreaIsGoal
|
||||
idNAVCallback_FindCoverArea::AreaIsGoal
|
||||
============
|
||||
*/
|
||||
bool idAASCallback_FindCoverArea::AreaIsGoal( const idAAS* aas, int areaNum )
|
||||
bool idNAVCallback_FindCoverArea::AreaIsGoal( const idNAV* aas, int areaNum )
|
||||
{
|
||||
idVec3 areaCenter;
|
||||
int numPVSAreas;
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2007 Id Software, Inc.
|
||||
//
|
||||
|
||||
#ifndef __NAVCALLBACK_FINDCOVERAREA_H__
|
||||
#define __NAVCALLBACK_FINDCOVERAREA_H__
|
||||
|
||||
#include "NAVCallback_AvoidLocation.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
idNAVCallback_FindCoverArea
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
class idNAVCallback_FindCoverArea : public idNAVCallback_AvoidLocation
|
||||
{
|
||||
public:
|
||||
idNAVCallback_FindCoverArea( const idVec3& hideFromPos );
|
||||
~idNAVCallback_FindCoverArea();
|
||||
|
||||
virtual bool AreaIsGoal( const idNAV* aas, int areaNum );
|
||||
|
||||
private:
|
||||
static const int MAX_PVS_AREAS = 4;
|
||||
|
||||
pvsHandle_t hidePVS;
|
||||
int PVSAreas[ MAX_PVS_AREAS ];
|
||||
};
|
||||
|
||||
#endif /* !__NAVCALLBACK_FINDCOVERAREA_H__ */
|
||||
@@ -29,16 +29,16 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "AAS_local.h"
|
||||
#include "NAV_local.h"
|
||||
#include "../Game_local.h" // for cvars and debug drawing
|
||||
#include "AASCallback_FindCoverArea.h"
|
||||
#include "NAVCallback_FindCoverArea.h"
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DrawCone
|
||||
idNAVLocal::DrawCone
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DrawCone( const idVec3 &origin, const idVec3 &dir, float radius, const idVec4 &color ) const {
|
||||
void idNAVLocal::DrawCone( const idVec3 &origin, const idVec3 &dir, float radius, const idVec4 &color ) const {
|
||||
int i;
|
||||
idMat3 axis;
|
||||
idVec3 center, top, p, lastp;
|
||||
@@ -61,10 +61,10 @@ void idAASLocal::DrawCone( const idVec3 &origin, const idVec3 &dir, float radius
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DrawReachability
|
||||
idNAVLocal::DrawReachability
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DrawReachability( const idReachability *reach ) const {
|
||||
void idNAVLocal::DrawReachability( const idReachability *reach ) const {
|
||||
gameRenderWorld->DebugArrow( colorCyan, reach->start, reach->end, 2 );
|
||||
|
||||
if ( gameLocal.GetLocalPlayer() ) {
|
||||
@@ -84,10 +84,10 @@ void idAASLocal::DrawReachability( const idReachability *reach ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DrawEdge
|
||||
idNAVLocal::DrawEdge
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DrawEdge( int edgeNum, bool arrow ) const {
|
||||
void idNAVLocal::DrawEdge( int edgeNum, bool arrow ) const {
|
||||
const aasEdge_t *edge;
|
||||
idVec4 *color;
|
||||
|
||||
@@ -110,10 +110,10 @@ void idAASLocal::DrawEdge( int edgeNum, bool arrow ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DrawFace
|
||||
idNAVLocal::DrawFace
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DrawFace( int faceNum, bool side ) const {
|
||||
void idNAVLocal::DrawFace( int faceNum, bool side ) const {
|
||||
int i, j, numEdges, firstEdge;
|
||||
const aasFace_t *face;
|
||||
idVec3 mid, end;
|
||||
@@ -144,10 +144,10 @@ void idAASLocal::DrawFace( int faceNum, bool side ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DrawArea
|
||||
idNAVLocal::DrawArea
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DrawArea( int areaNum ) const {
|
||||
void idNAVLocal::DrawArea( int areaNum ) const {
|
||||
int i, numFaces, firstFace;
|
||||
const aasArea_t *area;
|
||||
idReachability *reach;
|
||||
@@ -171,10 +171,10 @@ void idAASLocal::DrawArea( int areaNum ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DefaultSearchBounds
|
||||
idNAVLocal::DefaultSearchBounds
|
||||
============
|
||||
*/
|
||||
const idBounds &idAASLocal::DefaultSearchBounds( void ) const {
|
||||
const idBounds &idNAVLocal::DefaultSearchBounds( void ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
return recastNavMesh.GetSettings()->boundingBoxes[0];
|
||||
}
|
||||
@@ -183,10 +183,10 @@ const idBounds &idAASLocal::DefaultSearchBounds( void ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ShowArea
|
||||
idNAVLocal::ShowArea
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShowArea( const idVec3 &origin ) const {
|
||||
void idNAVLocal::ShowArea( const idVec3 &origin ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
recastNavMesh.ShowArea( origin );
|
||||
return;
|
||||
@@ -200,11 +200,11 @@ void idAASLocal::ShowArea( const idVec3 &origin ) const {
|
||||
org = origin;
|
||||
PushPointIntoAreaNum( areaNum, org );
|
||||
|
||||
if ( aas_goalArea.GetInteger() ) {
|
||||
if ( nav_goalArea.GetInteger() ) {
|
||||
int travelTime;
|
||||
idReachability *reach;
|
||||
|
||||
RouteToGoalArea( areaNum, org, aas_goalArea.GetInteger(), TFL_WALK|TFL_AIR, travelTime, &reach );
|
||||
RouteToGoalArea( areaNum, org, nav_goalArea.GetInteger(), TFL_WALK|TFL_AIR, travelTime, &reach );
|
||||
gameLocal.Printf( "\rtt = %4d", travelTime );
|
||||
if ( reach ) {
|
||||
gameLocal.Printf( " to area %4d", reach->toAreaNum );
|
||||
@@ -245,10 +245,10 @@ void idAASLocal::ShowArea( const idVec3 &origin ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ShowWalkPath
|
||||
idNAVLocal::ShowWalkPath
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const {
|
||||
void idNAVLocal::ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
recastNavMesh.ShowPath( origin, goalAreaNum, goalOrigin );
|
||||
return;
|
||||
@@ -295,10 +295,10 @@ void idAASLocal::ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVe
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ShowFlyPath
|
||||
idNAVLocal::ShowFlyPath
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShowFlyPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const {
|
||||
void idNAVLocal::ShowFlyPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
recastNavMesh.ShowPath( origin, goalAreaNum, goalOrigin );
|
||||
return;
|
||||
@@ -345,10 +345,10 @@ void idAASLocal::ShowFlyPath( const idVec3 &origin, int goalAreaNum, const idVec
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ShowWallEdges
|
||||
idNAVLocal::ShowWallEdges
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShowWallEdges( const idVec3 &origin ) const {
|
||||
void idNAVLocal::ShowWallEdges( const idVec3 &origin ) const {
|
||||
int i, areaNum, numEdges, edges[1024];
|
||||
idVec3 start, end;
|
||||
idPlayer *player;
|
||||
@@ -369,10 +369,10 @@ void idAASLocal::ShowWallEdges( const idVec3 &origin ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ShowHideArea
|
||||
idNAVLocal::ShowHideArea
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShowHideArea( const idVec3 &origin, int targetAreaNum ) const {
|
||||
void idNAVLocal::ShowHideArea( const idVec3 &origin, int targetAreaNum ) const {
|
||||
int areaNum, numObstacles;
|
||||
idVec3 target;
|
||||
aasGoal_t goal;
|
||||
@@ -387,7 +387,7 @@ void idAASLocal::ShowHideArea( const idVec3 &origin, int targetAreaNum ) const {
|
||||
|
||||
DrawCone( target, idVec3(0,0,1), 16.0f, colorYellow );
|
||||
|
||||
idAASCallback_FindCoverArea findCover( target );
|
||||
idNAVCallback_FindCoverArea findCover( target );
|
||||
if ( FindNearestGoal( goal, areaNum, origin, target, TFL_WALK|TFL_AIR, obstacles, numObstacles, findCover ) ) {
|
||||
DrawArea( goal.areaNum );
|
||||
ShowWalkPath( origin, goal.areaNum, goal.origin );
|
||||
@@ -397,10 +397,10 @@ void idAASLocal::ShowHideArea( const idVec3 &origin, int targetAreaNum ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::PullPlayer
|
||||
idNAVLocal::PullPlayer
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::PullPlayer( const idVec3 &origin, int toAreaNum ) const {
|
||||
bool idNAVLocal::PullPlayer( const idVec3 &origin, int toAreaNum ) const {
|
||||
int areaNum;
|
||||
idVec3 areaCenter, dir, vel;
|
||||
idAngles delta;
|
||||
@@ -448,33 +448,33 @@ bool idAASLocal::PullPlayer( const idVec3 &origin, int toAreaNum ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::RandomPullPlayer
|
||||
idNAVLocal::RandomPullPlayer
|
||||
============
|
||||
*/
|
||||
void idAASLocal::RandomPullPlayer( const idVec3 &origin ) const {
|
||||
void idNAVLocal::RandomPullPlayer( const idVec3 &origin ) const {
|
||||
int rnd, i, n;
|
||||
|
||||
if ( !PullPlayer( origin, aas_pullPlayer.GetInteger() ) ) {
|
||||
if ( !PullPlayer( origin, nav_pullPlayer.GetInteger() ) ) {
|
||||
|
||||
rnd = gameLocal.random.RandomFloat() * file->GetNumAreas();
|
||||
|
||||
for ( i = 0; i < file->GetNumAreas(); i++ ) {
|
||||
n = (rnd + i) % file->GetNumAreas();
|
||||
if ( file->GetArea( n ).flags & (AREA_REACHABLE_WALK|AREA_REACHABLE_FLY) ) {
|
||||
aas_pullPlayer.SetInteger( n );
|
||||
nav_pullPlayer.SetInteger( n );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ShowWalkPath( origin, aas_pullPlayer.GetInteger(), AreaCenter( aas_pullPlayer.GetInteger() ) );
|
||||
ShowWalkPath( origin, nav_pullPlayer.GetInteger(), AreaCenter( nav_pullPlayer.GetInteger() ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ShowPushIntoArea
|
||||
idNAVLocal::ShowPushIntoArea
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShowPushIntoArea( const idVec3 &origin ) const {
|
||||
void idNAVLocal::ShowPushIntoArea( const idVec3 &origin ) const {
|
||||
int areaNum;
|
||||
idVec3 target;
|
||||
|
||||
@@ -486,23 +486,23 @@ void idAASLocal::ShowPushIntoArea( const idVec3 &origin ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::Test
|
||||
idNAVLocal::Test
|
||||
============
|
||||
*/
|
||||
void idAASLocal::Test( const idVec3 &origin ) {
|
||||
void idNAVLocal::Test( const idVec3 &origin ) {
|
||||
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
if ( aas_showRecastNavMesh.GetInteger() > 0 ) {
|
||||
recastNavMesh.DebugDraw( aas_showRecastNavMesh.GetInteger() );
|
||||
if ( nav_showRecastNavMesh.GetInteger() > 0 ) {
|
||||
recastNavMesh.DebugDraw( nav_showRecastNavMesh.GetInteger() );
|
||||
}
|
||||
if ( aas_showAreas.GetBool() ) {
|
||||
if ( nav_showAreas.GetBool() ) {
|
||||
ShowArea( origin );
|
||||
}
|
||||
if ( aas_showPath.GetInteger() > 0 ) {
|
||||
ShowWalkPath( origin, aas_showPath.GetInteger(), AreaCenter( aas_showPath.GetInteger() ) );
|
||||
if ( nav_showPath.GetInteger() > 0 ) {
|
||||
ShowWalkPath( origin, nav_showPath.GetInteger(), AreaCenter( nav_showPath.GetInteger() ) );
|
||||
}
|
||||
if ( aas_showFlyPath.GetInteger() > 0 ) {
|
||||
ShowFlyPath( origin, aas_showFlyPath.GetInteger(), AreaCenter( aas_showFlyPath.GetInteger() ) );
|
||||
if ( nav_showFlyPath.GetInteger() > 0 ) {
|
||||
ShowFlyPath( origin, nav_showFlyPath.GetInteger(), AreaCenter( nav_showFlyPath.GetInteger() ) );
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -511,29 +511,29 @@ void idAASLocal::Test( const idVec3 &origin ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( aas_randomPullPlayer.GetBool() ) {
|
||||
if ( nav_randomPullPlayer.GetBool() ) {
|
||||
RandomPullPlayer( origin );
|
||||
}
|
||||
if ( ( aas_pullPlayer.GetInteger() > 0 ) && ( aas_pullPlayer.GetInteger() < file->GetNumAreas() ) ) {
|
||||
ShowWalkPath( origin, aas_pullPlayer.GetInteger(), AreaCenter( aas_pullPlayer.GetInteger() ) );
|
||||
PullPlayer( origin, aas_pullPlayer.GetInteger() );
|
||||
if ( ( nav_pullPlayer.GetInteger() > 0 ) && ( nav_pullPlayer.GetInteger() < file->GetNumAreas() ) ) {
|
||||
ShowWalkPath( origin, nav_pullPlayer.GetInteger(), AreaCenter( nav_pullPlayer.GetInteger() ) );
|
||||
PullPlayer( origin, nav_pullPlayer.GetInteger() );
|
||||
}
|
||||
if ( ( aas_showPath.GetInteger() > 0 ) && ( aas_showPath.GetInteger() < file->GetNumAreas() ) ) {
|
||||
ShowWalkPath( origin, aas_showPath.GetInteger(), AreaCenter( aas_showPath.GetInteger() ) );
|
||||
if ( ( nav_showPath.GetInteger() > 0 ) && ( nav_showPath.GetInteger() < file->GetNumAreas() ) ) {
|
||||
ShowWalkPath( origin, nav_showPath.GetInteger(), AreaCenter( nav_showPath.GetInteger() ) );
|
||||
}
|
||||
if ( ( aas_showFlyPath.GetInteger() > 0 ) && ( aas_showFlyPath.GetInteger() < file->GetNumAreas() ) ) {
|
||||
ShowFlyPath( origin, aas_showFlyPath.GetInteger(), AreaCenter( aas_showFlyPath.GetInteger() ) );
|
||||
if ( ( nav_showFlyPath.GetInteger() > 0 ) && ( nav_showFlyPath.GetInteger() < file->GetNumAreas() ) ) {
|
||||
ShowFlyPath( origin, nav_showFlyPath.GetInteger(), AreaCenter( nav_showFlyPath.GetInteger() ) );
|
||||
}
|
||||
if ( ( aas_showHideArea.GetInteger() > 0 ) && ( aas_showHideArea.GetInteger() < file->GetNumAreas() ) ) {
|
||||
ShowHideArea( origin, aas_showHideArea.GetInteger() );
|
||||
if ( ( nav_showHideArea.GetInteger() > 0 ) && ( nav_showHideArea.GetInteger() < file->GetNumAreas() ) ) {
|
||||
ShowHideArea( origin, nav_showHideArea.GetInteger() );
|
||||
}
|
||||
if ( aas_showAreas.GetBool() ) {
|
||||
if ( nav_showAreas.GetBool() ) {
|
||||
ShowArea( origin );
|
||||
}
|
||||
if ( aas_showWallEdges.GetBool() ) {
|
||||
if ( nav_showWallEdges.GetBool() ) {
|
||||
ShowWallEdges( origin );
|
||||
}
|
||||
if ( aas_showPushIntoArea.GetBool() ) {
|
||||
if ( nav_showPushIntoArea.GetBool() ) {
|
||||
ShowPushIntoArea( origin );
|
||||
}
|
||||
}
|
||||
@@ -26,16 +26,16 @@ If you have questions concerning this license or the applicable additional terms
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __AAS_LOCAL_H__
|
||||
#define __AAS_LOCAL_H__
|
||||
#ifndef __NAV_LOCAL_H__
|
||||
#define __NAV_LOCAL_H__
|
||||
|
||||
#include "AAS.h"
|
||||
#include "NAV.h"
|
||||
#include "../Pvs.h"
|
||||
#include "RecastNavMesh.h"
|
||||
|
||||
|
||||
class idRoutingCache {
|
||||
friend class idAASLocal;
|
||||
friend class idNAVLocal;
|
||||
|
||||
public:
|
||||
idRoutingCache( int size );
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
|
||||
|
||||
class idRoutingUpdate {
|
||||
friend class idAASLocal;
|
||||
friend class idNAVLocal;
|
||||
|
||||
private:
|
||||
int cluster; // cluster number of this update
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
|
||||
|
||||
class idRoutingObstacle {
|
||||
friend class idAASLocal;
|
||||
friend class idNAVLocal;
|
||||
idRoutingObstacle( void ) { }
|
||||
|
||||
private:
|
||||
@@ -84,10 +84,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class idAASLocal : public idAAS {
|
||||
class idNAVLocal : public idNAV {
|
||||
public:
|
||||
idAASLocal( void );
|
||||
virtual ~idAASLocal( void );
|
||||
idNAVLocal( void );
|
||||
virtual ~idNAVLocal( void );
|
||||
virtual bool Init( const idStr &mapName, unsigned int mapFileCRC );
|
||||
virtual void Shutdown( void );
|
||||
virtual void Stats( void ) const;
|
||||
@@ -118,10 +118,10 @@ public:
|
||||
virtual bool FlyPathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const;
|
||||
virtual void ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const;
|
||||
virtual void ShowFlyPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const;
|
||||
virtual bool FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idAASCallback &callback ) const;
|
||||
virtual bool FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idNAVCallback &callback ) const;
|
||||
virtual int AdjustPositionAndGetArea(idVec3& origin);
|
||||
virtual void ShowArea(const idVec3& origin) const;
|
||||
virtual idAASFile* GetAASFile(void) { return file; }
|
||||
virtual idAASFile* GetNAVFile(void) { return file; }
|
||||
virtual const idBounds& DefaultSearchBounds(void) const;
|
||||
private:
|
||||
idAASFile * file;
|
||||
@@ -189,4 +189,4 @@ private: // debug
|
||||
void ShowPushIntoArea( const idVec3 &origin ) const;
|
||||
};
|
||||
|
||||
#endif /* !__AAS_LOCAL_H__ */
|
||||
#endif /* !__NAV_LOCAL_H__ */
|
||||
@@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "AAS_local.h"
|
||||
#include "NAV_local.h"
|
||||
|
||||
#define SUBSAMPLE_WALK_PATH 1
|
||||
#define SUBSAMPLE_FLY_PATH 0
|
||||
@@ -45,13 +45,13 @@ const float flyPathSampleDistance = 8.0f;
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::EdgeSplitPoint
|
||||
idNAVLocal::EdgeSplitPoint
|
||||
|
||||
calculates split point of the edge with the plane
|
||||
returns true if the split point is between the edge vertices
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::EdgeSplitPoint( idVec3 &split, int edgeNum, const idPlane &plane ) const {
|
||||
bool idNAVLocal::EdgeSplitPoint( idVec3 &split, int edgeNum, const idPlane &plane ) const {
|
||||
const aasEdge_t *edge;
|
||||
idVec3 v1, v2;
|
||||
float d1, d2;
|
||||
@@ -72,13 +72,13 @@ bool idAASLocal::EdgeSplitPoint( idVec3 &split, int edgeNum, const idPlane &plan
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::FloorEdgeSplitPoint
|
||||
idNAVLocal::FloorEdgeSplitPoint
|
||||
|
||||
calculates either the closest or furthest point on the floor of the area which also lies on the pathPlane
|
||||
the point has to be on the front side of the frontPlane to be valid
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::FloorEdgeSplitPoint( idVec3 &bestSplit, int areaNum, const idPlane &pathPlane, const idPlane &frontPlane, bool closest ) const {
|
||||
bool idNAVLocal::FloorEdgeSplitPoint( idVec3 &bestSplit, int areaNum, const idPlane &pathPlane, const idPlane &frontPlane, bool closest ) const {
|
||||
int i, j, faceNum, edgeNum;
|
||||
const aasArea_t *area;
|
||||
const aasFace_t *face;
|
||||
@@ -131,12 +131,12 @@ bool idAASLocal::FloorEdgeSplitPoint( idVec3 &bestSplit, int areaNum, const idPl
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::WalkPathValid
|
||||
idNAVLocal::WalkPathValid
|
||||
|
||||
returns true if one can walk in a straight line between origin and goalOrigin
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::WalkPathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const {
|
||||
bool idNAVLocal::WalkPathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const {
|
||||
int curAreaNum, lastAreaNum, lastAreas[4], lastAreaIndex;
|
||||
idPlane pathPlane, frontPlane, farPlane;
|
||||
idReachability *reach;
|
||||
@@ -250,10 +250,10 @@ bool idAASLocal::WalkPathValid( int areaNum, const idVec3 &origin, int goalAreaN
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::SubSampleWalkPath
|
||||
idNAVLocal::SubSampleWalkPath
|
||||
============
|
||||
*/
|
||||
idVec3 idAASLocal::SubSampleWalkPath( int areaNum, const idVec3 &origin, const idVec3 &start, const idVec3 &end, int travelFlags, int &endAreaNum ) const {
|
||||
idVec3 idNAVLocal::SubSampleWalkPath( int areaNum, const idVec3 &origin, const idVec3 &start, const idVec3 &end, int travelFlags, int &endAreaNum ) const {
|
||||
int i, numSamples, curAreaNum;
|
||||
idVec3 dir, point, nextPoint, endPos;
|
||||
|
||||
@@ -266,7 +266,7 @@ idVec3 idAASLocal::SubSampleWalkPath( int areaNum, const idVec3 &origin, const i
|
||||
if ( (point - nextPoint).LengthSqr() > Square( maxWalkPathDistance ) ) {
|
||||
return point;
|
||||
}
|
||||
if ( !idAASLocal::WalkPathValid( areaNum, origin, 0, nextPoint, travelFlags, endPos, curAreaNum ) ) {
|
||||
if ( !idNAVLocal::WalkPathValid( areaNum, origin, 0, nextPoint, travelFlags, endPos, curAreaNum ) ) {
|
||||
return point;
|
||||
}
|
||||
point = nextPoint;
|
||||
@@ -277,12 +277,12 @@ idVec3 idAASLocal::SubSampleWalkPath( int areaNum, const idVec3 &origin, const i
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::WalkPathToGoal
|
||||
idNAVLocal::WalkPathToGoal
|
||||
|
||||
FIXME: don't stop optimizing on first failure ?
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::WalkPathToGoal( aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags ) const {
|
||||
bool idNAVLocal::WalkPathToGoal( aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags ) const {
|
||||
int i, travelTime, curAreaNum, lastAreas[4], lastAreaIndex, endAreaNum;
|
||||
idReachability *reach;
|
||||
idVec3 endPos;
|
||||
@@ -309,7 +309,7 @@ bool idAASLocal::WalkPathToGoal( aasPath_t &path, int areaNum, const idVec3 &ori
|
||||
|
||||
for ( i = 0; i < maxWalkPathIterations; i++ ) {
|
||||
|
||||
if ( !idAASLocal::RouteToGoalArea( curAreaNum, path.moveGoal, goalAreaNum, travelFlags, travelTime, &reach ) ) {
|
||||
if ( !idNAVLocal::RouteToGoalArea( curAreaNum, path.moveGoal, goalAreaNum, travelFlags, travelTime, &reach ) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -327,7 +327,7 @@ bool idAASLocal::WalkPathToGoal( aasPath_t &path, int areaNum, const idVec3 &ori
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !idAASLocal::WalkPathValid( areaNum, origin, 0, reach->start, travelFlags, endPos, endAreaNum ) ) {
|
||||
if ( !idNAVLocal::WalkPathValid( areaNum, origin, 0, reach->start, travelFlags, endPos, endAreaNum ) ) {
|
||||
#if SUBSAMPLE_WALK_PATH
|
||||
path.moveGoal = SubSampleWalkPath( areaNum, origin, path.moveGoal, reach->start, travelFlags, path.moveAreaNum );
|
||||
#endif
|
||||
@@ -342,7 +342,7 @@ bool idAASLocal::WalkPathToGoal( aasPath_t &path, int areaNum, const idVec3 &ori
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !idAASLocal::WalkPathValid( areaNum, origin, 0, reach->end, travelFlags, endPos, endAreaNum ) ) {
|
||||
if ( !idNAVLocal::WalkPathValid( areaNum, origin, 0, reach->end, travelFlags, endPos, endAreaNum ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ bool idAASLocal::WalkPathToGoal( aasPath_t &path, int areaNum, const idVec3 &ori
|
||||
path.moveAreaNum = reach->toAreaNum;
|
||||
|
||||
if ( reach->toAreaNum == goalAreaNum ) {
|
||||
if ( !idAASLocal::WalkPathValid( areaNum, origin, 0, goalOrigin, travelFlags, endPos, endAreaNum ) ) {
|
||||
if ( !idNAVLocal::WalkPathValid( areaNum, origin, 0, goalOrigin, travelFlags, endPos, endAreaNum ) ) {
|
||||
#if SUBSAMPLE_WALK_PATH
|
||||
path.moveGoal = SubSampleWalkPath( areaNum, origin, path.moveGoal, goalOrigin, travelFlags, path.moveAreaNum );
|
||||
#endif
|
||||
@@ -368,7 +368,7 @@ bool idAASLocal::WalkPathToGoal( aasPath_t &path, int areaNum, const idVec3 &ori
|
||||
|
||||
if ( curAreaNum == lastAreas[0] || curAreaNum == lastAreas[1] ||
|
||||
curAreaNum == lastAreas[2] || curAreaNum == lastAreas[3] ) {
|
||||
common->Warning( "idAASLocal::WalkPathToGoal: local routing minimum going from area %d to area %d", areaNum, goalAreaNum );
|
||||
common->Warning( "idNAVLocal::WalkPathToGoal: local routing minimum going from area %d to area %d", areaNum, goalAreaNum );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -402,12 +402,12 @@ bool idAASLocal::WalkPathToGoal( aasPath_t &path, int areaNum, const idVec3 &ori
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::FlyPathValid
|
||||
idNAVLocal::FlyPathValid
|
||||
|
||||
returns true if one can fly in a straight line between origin and goalOrigin
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::FlyPathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const {
|
||||
bool idNAVLocal::FlyPathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const {
|
||||
aasTrace_t trace;
|
||||
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
@@ -434,10 +434,10 @@ bool idAASLocal::FlyPathValid( int areaNum, const idVec3 &origin, int goalAreaNu
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::SubSampleFlyPath
|
||||
idNAVLocal::SubSampleFlyPath
|
||||
============
|
||||
*/
|
||||
idVec3 idAASLocal::SubSampleFlyPath( int areaNum, const idVec3 &origin, const idVec3 &start, const idVec3 &end, int travelFlags, int &endAreaNum ) const {
|
||||
idVec3 idNAVLocal::SubSampleFlyPath( int areaNum, const idVec3 &origin, const idVec3 &start, const idVec3 &end, int travelFlags, int &endAreaNum ) const {
|
||||
int i, numSamples, curAreaNum;
|
||||
idVec3 dir, point, nextPoint, endPos;
|
||||
|
||||
@@ -450,7 +450,7 @@ idVec3 idAASLocal::SubSampleFlyPath( int areaNum, const idVec3 &origin, const id
|
||||
if ( (point - nextPoint).LengthSqr() > Square( maxFlyPathDistance ) ) {
|
||||
return point;
|
||||
}
|
||||
if ( !idAASLocal::FlyPathValid( areaNum, origin, 0, nextPoint, travelFlags, endPos, curAreaNum ) ) {
|
||||
if ( !idNAVLocal::FlyPathValid( areaNum, origin, 0, nextPoint, travelFlags, endPos, curAreaNum ) ) {
|
||||
return point;
|
||||
}
|
||||
point = nextPoint;
|
||||
@@ -461,12 +461,12 @@ idVec3 idAASLocal::SubSampleFlyPath( int areaNum, const idVec3 &origin, const id
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::FlyPathToGoal
|
||||
idNAVLocal::FlyPathToGoal
|
||||
|
||||
FIXME: don't stop optimizing on first failure ?
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::FlyPathToGoal( aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags ) const {
|
||||
bool idNAVLocal::FlyPathToGoal( aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags ) const {
|
||||
int i, travelTime, curAreaNum, lastAreas[4], lastAreaIndex, endAreaNum;
|
||||
idReachability *reach;
|
||||
idVec3 endPos;
|
||||
@@ -493,7 +493,7 @@ bool idAASLocal::FlyPathToGoal( aasPath_t &path, int areaNum, const idVec3 &orig
|
||||
|
||||
for ( i = 0; i < maxFlyPathIterations; i++ ) {
|
||||
|
||||
if ( !idAASLocal::RouteToGoalArea( curAreaNum, path.moveGoal, goalAreaNum, travelFlags, travelTime, &reach ) ) {
|
||||
if ( !idNAVLocal::RouteToGoalArea( curAreaNum, path.moveGoal, goalAreaNum, travelFlags, travelTime, &reach ) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ bool idAASLocal::FlyPathToGoal( aasPath_t &path, int areaNum, const idVec3 &orig
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !idAASLocal::FlyPathValid( areaNum, origin, 0, reach->start, travelFlags, endPos, endAreaNum ) ) {
|
||||
if ( !idNAVLocal::FlyPathValid( areaNum, origin, 0, reach->start, travelFlags, endPos, endAreaNum ) ) {
|
||||
#if SUBSAMPLE_FLY_PATH
|
||||
path.moveGoal = SubSampleFlyPath( areaNum, origin, path.moveGoal, reach->start, travelFlags, path.moveAreaNum );
|
||||
#endif
|
||||
@@ -521,7 +521,7 @@ bool idAASLocal::FlyPathToGoal( aasPath_t &path, int areaNum, const idVec3 &orig
|
||||
path.moveGoal = reach->start;
|
||||
path.moveAreaNum = curAreaNum;
|
||||
|
||||
if ( !idAASLocal::FlyPathValid( areaNum, origin, 0, reach->end, travelFlags, endPos, endAreaNum ) ) {
|
||||
if ( !idNAVLocal::FlyPathValid( areaNum, origin, 0, reach->end, travelFlags, endPos, endAreaNum ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ bool idAASLocal::FlyPathToGoal( aasPath_t &path, int areaNum, const idVec3 &orig
|
||||
path.moveAreaNum = reach->toAreaNum;
|
||||
|
||||
if ( reach->toAreaNum == goalAreaNum ) {
|
||||
if ( !idAASLocal::FlyPathValid( areaNum, origin, 0, goalOrigin, travelFlags, endPos, endAreaNum ) ) {
|
||||
if ( !idNAVLocal::FlyPathValid( areaNum, origin, 0, goalOrigin, travelFlags, endPos, endAreaNum ) ) {
|
||||
#if SUBSAMPLE_FLY_PATH
|
||||
path.moveGoal = SubSampleFlyPath( areaNum, origin, path.moveGoal, goalOrigin, travelFlags, path.moveAreaNum );
|
||||
#endif
|
||||
@@ -547,7 +547,7 @@ bool idAASLocal::FlyPathToGoal( aasPath_t &path, int areaNum, const idVec3 &orig
|
||||
|
||||
if ( curAreaNum == lastAreas[0] || curAreaNum == lastAreas[1] ||
|
||||
curAreaNum == lastAreas[2] || curAreaNum == lastAreas[3] ) {
|
||||
common->Warning( "idAASLocal::FlyPathToGoal: local routing minimum going from area %d to area %d", areaNum, goalAreaNum );
|
||||
common->Warning( "idNAVLocal::FlyPathToGoal: local routing minimum going from area %d to area %d", areaNum, goalAreaNum );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -567,10 +567,10 @@ typedef struct wallEdge_s {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::SortWallEdges
|
||||
idNAVLocal::SortWallEdges
|
||||
============
|
||||
*/
|
||||
void idAASLocal::SortWallEdges( int *edges, int numEdges ) const {
|
||||
void idNAVLocal::SortWallEdges( int *edges, int numEdges ) const {
|
||||
int i, j, k, numSequences;
|
||||
wallEdge_t **sequenceFirst, **sequenceLast, *wallEdges, *wallEdge;
|
||||
|
||||
@@ -619,10 +619,10 @@ void idAASLocal::SortWallEdges( int *edges, int numEdges ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetWallEdges
|
||||
idNAVLocal::GetWallEdges
|
||||
============
|
||||
*/
|
||||
int idAASLocal::GetWallEdges( int areaNum, const idBounds &bounds, int travelFlags, int *edges, int maxEdges ) const {
|
||||
int idNAVLocal::GetWallEdges( int areaNum, const idBounds &bounds, int travelFlags, int *edges, int maxEdges ) const {
|
||||
int i, j, k, l, face1Num, face2Num, edge1Num, edge2Num, numEdges, absEdge1Num;
|
||||
int *areaQueue, curArea, queueStart, queueEnd;
|
||||
byte *areasVisited;
|
||||
@@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "AAS_local.h"
|
||||
#include "NAV_local.h"
|
||||
#include "../Game_local.h" // for print and error
|
||||
|
||||
#define CACHETYPE_AREA 1
|
||||
@@ -80,10 +80,10 @@ int idRoutingCache::Size( void ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::AreaTravelTime
|
||||
idNAVLocal::AreaTravelTime
|
||||
============
|
||||
*/
|
||||
unsigned short idAASLocal::AreaTravelTime( int areaNum, const idVec3 &start, const idVec3 &end ) const {
|
||||
unsigned short idNAVLocal::AreaTravelTime( int areaNum, const idVec3 &start, const idVec3 &end ) const {
|
||||
float dist;
|
||||
|
||||
dist = ( end - start ).Length();
|
||||
@@ -103,10 +103,10 @@ unsigned short idAASLocal::AreaTravelTime( int areaNum, const idVec3 &start, con
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::CalculateAreaTravelTimes
|
||||
idNAVLocal::CalculateAreaTravelTimes
|
||||
============
|
||||
*/
|
||||
void idAASLocal::CalculateAreaTravelTimes(void) {
|
||||
void idNAVLocal::CalculateAreaTravelTimes(void) {
|
||||
int n, i, j, numReach, numRevReach, t, maxt;
|
||||
byte *bytePtr;
|
||||
idReachability *reach, *rev_reach;
|
||||
@@ -172,10 +172,10 @@ void idAASLocal::CalculateAreaTravelTimes(void) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DeleteAreaTravelTimes
|
||||
idNAVLocal::DeleteAreaTravelTimes
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DeleteAreaTravelTimes( void ) {
|
||||
void idNAVLocal::DeleteAreaTravelTimes( void ) {
|
||||
Mem_Free( areaTravelTimes );
|
||||
areaTravelTimes = NULL;
|
||||
numAreaTravelTimes = 0;
|
||||
@@ -183,10 +183,10 @@ void idAASLocal::DeleteAreaTravelTimes( void ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::SetupRoutingCache
|
||||
idNAVLocal::SetupRoutingCache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::SetupRoutingCache( void ) {
|
||||
void idNAVLocal::SetupRoutingCache( void ) {
|
||||
int i;
|
||||
byte *bytePtr;
|
||||
|
||||
@@ -216,10 +216,10 @@ void idAASLocal::SetupRoutingCache( void ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DeleteClusterCache
|
||||
idNAVLocal::DeleteClusterCache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DeleteClusterCache( int clusterNum ) {
|
||||
void idNAVLocal::DeleteClusterCache( int clusterNum ) {
|
||||
int i;
|
||||
idRoutingCache *cache;
|
||||
|
||||
@@ -234,10 +234,10 @@ void idAASLocal::DeleteClusterCache( int clusterNum ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DeletePortalCache
|
||||
idNAVLocal::DeletePortalCache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DeletePortalCache( void ) {
|
||||
void idNAVLocal::DeletePortalCache( void ) {
|
||||
int i;
|
||||
idRoutingCache *cache;
|
||||
|
||||
@@ -252,10 +252,10 @@ void idAASLocal::DeletePortalCache( void ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ShutdownRoutingCache
|
||||
idNAVLocal::ShutdownRoutingCache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShutdownRoutingCache( void ) {
|
||||
void idNAVLocal::ShutdownRoutingCache( void ) {
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < file->GetNumClusters(); i++ ) {
|
||||
@@ -283,10 +283,10 @@ void idAASLocal::ShutdownRoutingCache( void ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::SetupRouting
|
||||
idNAVLocal::SetupRouting
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::SetupRouting( void ) {
|
||||
bool idNAVLocal::SetupRouting( void ) {
|
||||
CalculateAreaTravelTimes();
|
||||
SetupRoutingCache();
|
||||
return true;
|
||||
@@ -294,20 +294,20 @@ bool idAASLocal::SetupRouting( void ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ShutdownRouting
|
||||
idNAVLocal::ShutdownRouting
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShutdownRouting( void ) {
|
||||
void idNAVLocal::ShutdownRouting( void ) {
|
||||
DeleteAreaTravelTimes();
|
||||
ShutdownRoutingCache();
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::RoutingStats
|
||||
idNAVLocal::RoutingStats
|
||||
============
|
||||
*/
|
||||
void idAASLocal::RoutingStats( void ) const {
|
||||
void idNAVLocal::RoutingStats( void ) const {
|
||||
idRoutingCache *cache;
|
||||
int numAreaCache, numPortalCache;
|
||||
int totalAreaCacheMemory, totalPortalCacheMemory;
|
||||
@@ -334,10 +334,10 @@ void idAASLocal::RoutingStats( void ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::RemoveRoutingCacheUsingArea
|
||||
idNAVLocal::RemoveRoutingCacheUsingArea
|
||||
============
|
||||
*/
|
||||
void idAASLocal::RemoveRoutingCacheUsingArea( int areaNum ) {
|
||||
void idNAVLocal::RemoveRoutingCacheUsingArea( int areaNum ) {
|
||||
int clusterNum;
|
||||
|
||||
clusterNum = file->GetArea( areaNum ).cluster;
|
||||
@@ -355,10 +355,10 @@ void idAASLocal::RemoveRoutingCacheUsingArea( int areaNum ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DisableArea
|
||||
idNAVLocal::DisableArea
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DisableArea( int areaNum ) {
|
||||
void idNAVLocal::DisableArea( int areaNum ) {
|
||||
assert( areaNum > 0 && areaNum < file->GetNumAreas() );
|
||||
|
||||
if ( file->GetArea( areaNum ).travelFlags & TFL_INVALID ) {
|
||||
@@ -372,10 +372,10 @@ void idAASLocal::DisableArea( int areaNum ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::EnableArea
|
||||
idNAVLocal::EnableArea
|
||||
============
|
||||
*/
|
||||
void idAASLocal::EnableArea( int areaNum ) {
|
||||
void idNAVLocal::EnableArea( int areaNum ) {
|
||||
assert( areaNum > 0 && areaNum < file->GetNumAreas() );
|
||||
|
||||
if ( !( file->GetArea( areaNum ).travelFlags & TFL_INVALID ) ) {
|
||||
@@ -389,10 +389,10 @@ void idAASLocal::EnableArea( int areaNum ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::SetAreaState_r
|
||||
idNAVLocal::SetAreaState_r
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::SetAreaState_r( int nodeNum, const idBounds &bounds, const int areaContents, bool disabled ) {
|
||||
bool idNAVLocal::SetAreaState_r( int nodeNum, const idBounds &bounds, const int areaContents, bool disabled ) {
|
||||
int res;
|
||||
const aasNode_t *node;
|
||||
bool foundClusterPortal = false;
|
||||
@@ -429,10 +429,10 @@ bool idAASLocal::SetAreaState_r( int nodeNum, const idBounds &bounds, const int
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::SetAreaState
|
||||
idNAVLocal::SetAreaState
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::SetAreaState( const idBounds &bounds, const int areaContents, bool disabled ) {
|
||||
bool idNAVLocal::SetAreaState( const idBounds &bounds, const int areaContents, bool disabled ) {
|
||||
idBounds expBounds;
|
||||
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
@@ -452,10 +452,10 @@ bool idAASLocal::SetAreaState( const idBounds &bounds, const int areaContents, b
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetBoundsAreas_r
|
||||
idNAVLocal::GetBoundsAreas_r
|
||||
============
|
||||
*/
|
||||
void idAASLocal::GetBoundsAreas_r( int nodeNum, const idBounds &bounds, idList<int> &areas ) const {
|
||||
void idNAVLocal::GetBoundsAreas_r( int nodeNum, const idBounds &bounds, idList<int> &areas ) const {
|
||||
int res;
|
||||
const aasNode_t *node;
|
||||
|
||||
@@ -481,10 +481,10 @@ void idAASLocal::GetBoundsAreas_r( int nodeNum, const idBounds &bounds, idList<i
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::SetObstacleState
|
||||
idNAVLocal::SetObstacleState
|
||||
============
|
||||
*/
|
||||
void idAASLocal::SetObstacleState( const idRoutingObstacle *obstacle, bool enable ) {
|
||||
void idNAVLocal::SetObstacleState( const idRoutingObstacle *obstacle, bool enable ) {
|
||||
int i;
|
||||
const aasArea_t *area;
|
||||
idReachability *reach, *rev_reach;
|
||||
@@ -535,10 +535,10 @@ void idAASLocal::SetObstacleState( const idRoutingObstacle *obstacle, bool enabl
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::AddObstacle
|
||||
idNAVLocal::AddObstacle
|
||||
============
|
||||
*/
|
||||
aasHandle_t idAASLocal::AddObstacle( const idBounds &bounds ) {
|
||||
aasHandle_t idNAVLocal::AddObstacle( const idBounds &bounds ) {
|
||||
idRoutingObstacle *obstacle;
|
||||
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
@@ -561,10 +561,10 @@ aasHandle_t idAASLocal::AddObstacle( const idBounds &bounds ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::RemoveObstacle
|
||||
idNAVLocal::RemoveObstacle
|
||||
============
|
||||
*/
|
||||
void idAASLocal::RemoveObstacle( const aasHandle_t handle ) {
|
||||
void idNAVLocal::RemoveObstacle( const aasHandle_t handle ) {
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
recastNavMesh.RemoveObstacle( handle );
|
||||
return;
|
||||
@@ -582,10 +582,10 @@ void idAASLocal::RemoveObstacle( const aasHandle_t handle ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::RemoveAllObstacles
|
||||
idNAVLocal::RemoveAllObstacles
|
||||
============
|
||||
*/
|
||||
void idAASLocal::RemoveAllObstacles( void ) {
|
||||
void idNAVLocal::RemoveAllObstacles( void ) {
|
||||
int i;
|
||||
|
||||
if ( recastNavMesh.IsLoaded() ) {
|
||||
@@ -606,12 +606,12 @@ void idAASLocal::RemoveAllObstacles( void ) {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::LinkCache
|
||||
idNAVLocal::LinkCache
|
||||
|
||||
link the cache in the cache list sorted from oldest to newest cache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::LinkCache( idRoutingCache *cache ) const {
|
||||
void idNAVLocal::LinkCache( idRoutingCache *cache ) const {
|
||||
|
||||
// if the cache is already linked
|
||||
if ( cache->time_next || cache->time_prev || cacheListStart == cache ) {
|
||||
@@ -634,10 +634,10 @@ void idAASLocal::LinkCache( idRoutingCache *cache ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::UnlinkCache
|
||||
idNAVLocal::UnlinkCache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::UnlinkCache( idRoutingCache *cache ) const {
|
||||
void idNAVLocal::UnlinkCache( idRoutingCache *cache ) const {
|
||||
|
||||
totalCacheMemory -= cache->Size();
|
||||
|
||||
@@ -657,10 +657,10 @@ void idAASLocal::UnlinkCache( idRoutingCache *cache ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::DeleteOldestCache
|
||||
idNAVLocal::DeleteOldestCache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::DeleteOldestCache( void ) const {
|
||||
void idNAVLocal::DeleteOldestCache( void ) const {
|
||||
idRoutingCache *cache;
|
||||
|
||||
assert( cacheListStart );
|
||||
@@ -688,10 +688,10 @@ void idAASLocal::DeleteOldestCache( void ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetAreaReachability
|
||||
idNAVLocal::GetAreaReachability
|
||||
============
|
||||
*/
|
||||
idReachability *idAASLocal::GetAreaReachability( int areaNum, int reachabilityNum ) const {
|
||||
idReachability *idNAVLocal::GetAreaReachability( int areaNum, int reachabilityNum ) const {
|
||||
idReachability *reach;
|
||||
|
||||
for ( reach = file->GetArea( areaNum ).reach; reach; reach = reach->next ) {
|
||||
@@ -704,10 +704,10 @@ idReachability *idAASLocal::GetAreaReachability( int areaNum, int reachabilityNu
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::ClusterAreaNum
|
||||
idNAVLocal::ClusterAreaNum
|
||||
============
|
||||
*/
|
||||
ID_INLINE int idAASLocal::ClusterAreaNum( int clusterNum, int areaNum ) const {
|
||||
ID_INLINE int idNAVLocal::ClusterAreaNum( int clusterNum, int areaNum ) const {
|
||||
int side, areaCluster;
|
||||
|
||||
areaCluster = file->GetArea( areaNum ).cluster;
|
||||
@@ -722,10 +722,10 @@ ID_INLINE int idAASLocal::ClusterAreaNum( int clusterNum, int areaNum ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::UpdateAreaRoutingCache
|
||||
idNAVLocal::UpdateAreaRoutingCache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::UpdateAreaRoutingCache( idRoutingCache *areaCache ) const {
|
||||
void idNAVLocal::UpdateAreaRoutingCache( idRoutingCache *areaCache ) const {
|
||||
int i, nextAreaNum, cluster, badTravelFlags, clusterAreaNum, numReachableAreas;
|
||||
unsigned short t, startAreaTravelTimes[MAX_REACH_PER_AREA];
|
||||
idRoutingUpdate *updateListStart, *updateListEnd, *curUpdate, *nextUpdate;
|
||||
@@ -840,10 +840,10 @@ void idAASLocal::UpdateAreaRoutingCache( idRoutingCache *areaCache ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetAreaRoutingCache
|
||||
idNAVLocal::GetAreaRoutingCache
|
||||
============
|
||||
*/
|
||||
idRoutingCache *idAASLocal::GetAreaRoutingCache( int clusterNum, int areaNum, int travelFlags ) const {
|
||||
idRoutingCache *idNAVLocal::GetAreaRoutingCache( int clusterNum, int areaNum, int travelFlags ) const {
|
||||
int clusterAreaNum;
|
||||
idRoutingCache *cache, *clusterCache;
|
||||
|
||||
@@ -879,10 +879,10 @@ idRoutingCache *idAASLocal::GetAreaRoutingCache( int clusterNum, int areaNum, in
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::UpdatePortalRoutingCache
|
||||
idNAVLocal::UpdatePortalRoutingCache
|
||||
============
|
||||
*/
|
||||
void idAASLocal::UpdatePortalRoutingCache( idRoutingCache *portalCache ) const {
|
||||
void idNAVLocal::UpdatePortalRoutingCache( idRoutingCache *portalCache ) const {
|
||||
int i, portalNum, clusterAreaNum;
|
||||
unsigned short t;
|
||||
const aasPortal_t *portal;
|
||||
@@ -971,10 +971,10 @@ void idAASLocal::UpdatePortalRoutingCache( idRoutingCache *portalCache ) const {
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::GetPortalRoutingCache
|
||||
idNAVLocal::GetPortalRoutingCache
|
||||
============
|
||||
*/
|
||||
idRoutingCache *idAASLocal::GetPortalRoutingCache( int clusterNum, int areaNum, int travelFlags ) const {
|
||||
idRoutingCache *idNAVLocal::GetPortalRoutingCache( int clusterNum, int areaNum, int travelFlags ) const {
|
||||
idRoutingCache *cache;
|
||||
|
||||
// check if cache without undesired travel flags already exists
|
||||
@@ -1005,10 +1005,10 @@ idRoutingCache *idAASLocal::GetPortalRoutingCache( int clusterNum, int areaNum,
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::RouteToGoalArea
|
||||
idNAVLocal::RouteToGoalArea
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::RouteToGoalArea( int areaNum, const idVec3 origin, int goalAreaNum, int travelFlags, int &travelTime, idReachability **reach ) const {
|
||||
bool idNAVLocal::RouteToGoalArea( int areaNum, const idVec3 origin, int goalAreaNum, int travelFlags, int &travelTime, idReachability **reach ) const {
|
||||
int clusterNum, goalClusterNum, portalNum, i, clusterAreaNum;
|
||||
unsigned short int t, bestTime;
|
||||
const aasPortal_t *portal;
|
||||
@@ -1165,10 +1165,10 @@ bool idAASLocal::RouteToGoalArea( int areaNum, const idVec3 origin, int goalArea
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::TravelTimeToGoalArea
|
||||
idNAVLocal::TravelTimeToGoalArea
|
||||
============
|
||||
*/
|
||||
int idAASLocal::TravelTimeToGoalArea( int areaNum, const idVec3 &origin, int goalAreaNum, int travelFlags ) const {
|
||||
int idNAVLocal::TravelTimeToGoalArea( int areaNum, const idVec3 &origin, int goalAreaNum, int travelFlags ) const {
|
||||
int travelTime;
|
||||
idReachability *reach;
|
||||
|
||||
@@ -1188,10 +1188,10 @@ int idAASLocal::TravelTimeToGoalArea( int areaNum, const idVec3 &origin, int goa
|
||||
|
||||
/*
|
||||
============
|
||||
idAASLocal::FindNearestGoal
|
||||
idNAVLocal::FindNearestGoal
|
||||
============
|
||||
*/
|
||||
bool idAASLocal::FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idAASCallback &callback ) const {
|
||||
bool idNAVLocal::FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idNAVCallback &callback ) const {
|
||||
int i, j, k, badTravelFlags, nextAreaNum, bestAreaNum;
|
||||
unsigned short t, bestTravelTime;
|
||||
idRoutingUpdate *updateListStart, *updateListEnd, *curUpdate, *nextUpdate;
|
||||
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
IceTech GPL Source Code
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "../Game_local.h"
|
||||
#include "RecastNavMesh.h"
|
||||
|
||||
idRecastNavMesh::idRecastNavMesh( void ) {
|
||||
handle = RECAST_NAV_HANDLE_INVALID;
|
||||
memset( &syntheticReach, 0, sizeof( syntheticReach ) );
|
||||
if ( RecastNavigationManager ) {
|
||||
handle = RecastNavigationManager->Alloc();
|
||||
}
|
||||
}
|
||||
|
||||
idRecastNavMesh::~idRecastNavMesh( void ) {
|
||||
if ( RecastNavigationManager && handle != RECAST_NAV_HANDLE_INVALID ) {
|
||||
RecastNavigationManager->Free( handle );
|
||||
handle = RECAST_NAV_HANDLE_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::HasManager( void ) const {
|
||||
return RecastNavigationManager && handle != RECAST_NAV_HANDLE_INVALID;
|
||||
}
|
||||
|
||||
void idRecastNavMesh::Shutdown( void ) {
|
||||
if ( HasManager() ) {
|
||||
RecastNavigationManager->Free( handle );
|
||||
handle = RecastNavigationManager->Alloc();
|
||||
}
|
||||
name.Clear();
|
||||
memset( &syntheticReach, 0, sizeof( syntheticReach ) );
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::Load( const idStr &mapName, const idStr &fileName, unsigned int mapFileCRC ) {
|
||||
if ( !HasManager() ) {
|
||||
return false;
|
||||
}
|
||||
if ( !RecastNavigationManager->Load( handle, mapName, fileName, mapFileCRC ) ) {
|
||||
name.Clear();
|
||||
return false;
|
||||
}
|
||||
name = fileName;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::IsLoaded( void ) const {
|
||||
return HasManager() && RecastNavigationManager->IsLoaded( handle );
|
||||
}
|
||||
|
||||
int idRecastNavMesh::NumPolys( void ) const {
|
||||
return HasManager() ? RecastNavigationManager->NumPolys( handle ) : 0;
|
||||
}
|
||||
|
||||
const idAASSettings *idRecastNavMesh::GetSettings( void ) const {
|
||||
return HasManager() ? RecastNavigationManager->GetSettings( handle ) : NULL;
|
||||
}
|
||||
|
||||
idStr idRecastNavMesh::NavFileNameForMapName( const idStr &mapName ) {
|
||||
idStr navName = mapName;
|
||||
navName += ".navmesh";
|
||||
return navName;
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::BuildMapFile( const idStr &mapName, const idStr &aasType ) {
|
||||
return RecastNavigationManager && RecastNavigationManager->BuildMapFile( mapName.c_str(), aasType.c_str() );
|
||||
}
|
||||
|
||||
void idRecastNavMesh::Stats( void ) const {
|
||||
if ( HasManager() ) {
|
||||
RecastNavigationManager->Stats( handle );
|
||||
}
|
||||
}
|
||||
|
||||
void idRecastNavMesh::DebugDraw( int drawMode ) const {
|
||||
if ( HasManager() ) {
|
||||
RecastNavigationManager->DebugDraw( handle, gameRenderWorld, drawMode, gameLocal.msec );
|
||||
}
|
||||
}
|
||||
|
||||
int idRecastNavMesh::PointAreaNum( const idVec3 &origin ) const {
|
||||
return HasManager() ? RecastNavigationManager->PointAreaNum( handle, origin ) : 0;
|
||||
}
|
||||
|
||||
int idRecastNavMesh::PointReachableAreaNum( const idVec3 &origin, const idBounds &searchBounds, const int areaFlags ) const {
|
||||
return HasManager() ? RecastNavigationManager->PointReachableAreaNum( handle, origin, searchBounds, areaFlags ) : 0;
|
||||
}
|
||||
|
||||
int idRecastNavMesh::BoundsReachableAreaNum( const idBounds &bounds, const int areaFlags ) const {
|
||||
return HasManager() ? RecastNavigationManager->BoundsReachableAreaNum( handle, bounds, areaFlags ) : 0;
|
||||
}
|
||||
|
||||
void idRecastNavMesh::PushPointIntoAreaNum( int areaNum, idVec3 &origin ) const {
|
||||
if ( HasManager() ) {
|
||||
RecastNavigationManager->PushPointIntoAreaNum( handle, areaNum, origin );
|
||||
}
|
||||
}
|
||||
|
||||
idVec3 idRecastNavMesh::AreaCenter( int areaNum ) const {
|
||||
return HasManager() ? RecastNavigationManager->AreaCenter( handle, areaNum ) : vec3_origin;
|
||||
}
|
||||
|
||||
int idRecastNavMesh::AreaFlags( int areaNum ) const {
|
||||
return HasManager() ? RecastNavigationManager->AreaFlags( handle, areaNum ) : 0;
|
||||
}
|
||||
|
||||
int idRecastNavMesh::AreaTravelFlags( int areaNum ) const {
|
||||
return HasManager() ? RecastNavigationManager->AreaTravelFlags( handle, areaNum ) : TFL_INVALID;
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::Trace( aasTrace_t &trace, const idVec3 &start, const idVec3 &end ) const {
|
||||
return HasManager() && RecastNavigationManager->Trace( handle, trace, start, end );
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::SetAreaState( const idBounds &bounds, const int areaContents, bool disabled ) {
|
||||
return HasManager() && RecastNavigationManager->SetAreaState( handle, bounds, areaContents, disabled );
|
||||
}
|
||||
|
||||
aasHandle_t idRecastNavMesh::AddObstacle( const idBounds &bounds ) {
|
||||
return HasManager() ? RecastNavigationManager->AddObstacle( handle, bounds ) : -1;
|
||||
}
|
||||
|
||||
void idRecastNavMesh::RemoveObstacle( const aasHandle_t obstacleHandle ) {
|
||||
if ( HasManager() ) {
|
||||
RecastNavigationManager->RemoveObstacle( handle, obstacleHandle );
|
||||
}
|
||||
}
|
||||
|
||||
void idRecastNavMesh::RemoveAllObstacles( void ) {
|
||||
if ( HasManager() ) {
|
||||
RecastNavigationManager->RemoveAllObstacles( handle );
|
||||
}
|
||||
}
|
||||
|
||||
int idRecastNavMesh::TravelTimeToGoalArea( int areaNum, const idVec3 &origin, int goalAreaNum, int travelFlags ) const {
|
||||
return HasManager() ? RecastNavigationManager->TravelTimeToGoalArea( handle, areaNum, origin, goalAreaNum, travelFlags ) : 0;
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::RouteToGoalArea( int areaNum, const idVec3 origin, int goalAreaNum, int travelFlags, int &travelTime, idReachability **reach ) const {
|
||||
recastPath_t route;
|
||||
if ( !HasManager() || !RecastNavigationManager->RouteToGoalArea( handle, areaNum, origin, goalAreaNum, travelFlags, route ) ) {
|
||||
travelTime = 0;
|
||||
*reach = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
travelTime = route.travelTime;
|
||||
memset( &syntheticReach, 0, sizeof( syntheticReach ) );
|
||||
syntheticReach.travelType = TFL_WALK;
|
||||
syntheticReach.fromAreaNum = areaNum;
|
||||
syntheticReach.toAreaNum = route.moveAreaNum;
|
||||
syntheticReach.start = route.moveGoal;
|
||||
syntheticReach.end = route.moveGoal;
|
||||
syntheticReach.travelTime = travelTime;
|
||||
*reach = &syntheticReach;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::PathToGoal( aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags ) const {
|
||||
recastPath_t recastPath;
|
||||
if ( !HasManager() || !RecastNavigationManager->PathToGoal( handle, recastPath, areaNum, origin, goalAreaNum, goalOrigin, travelFlags ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
path.type = PATHTYPE_WALK;
|
||||
path.moveGoal = recastPath.moveGoal;
|
||||
path.moveAreaNum = recastPath.moveAreaNum;
|
||||
path.secondaryGoal = recastPath.secondaryGoal;
|
||||
path.reachability = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::PathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const {
|
||||
return HasManager() && RecastNavigationManager->PathValid( handle, areaNum, origin, goalAreaNum, goalOrigin, travelFlags, endPos, endAreaNum );
|
||||
}
|
||||
|
||||
bool idRecastNavMesh::FindNearestGoal( const idNAV *owner, aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *queryObstacles, int numObstacles, idNAVCallback &callback ) const {
|
||||
int areas[MAX_RECAST_PATH_AREAS];
|
||||
int numAreas = 0;
|
||||
const int targetArea = PointAreaNum( target );
|
||||
if ( targetArea <= 0 || !HasManager() || !RecastNavigationManager->PathAreaList( handle, areaNum, origin, targetArea, target, travelFlags, areas, numAreas, MAX_RECAST_PATH_AREAS ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for ( int i = numAreas - 1; i >= 0; i-- ) {
|
||||
const int candidateArea = areas[i];
|
||||
if ( !callback.AreaIsGoal( owner, candidateArea ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const idVec3 candidateOrigin = AreaCenter( candidateArea );
|
||||
bool blocked = false;
|
||||
for ( int j = 0; j < numObstacles; j++ ) {
|
||||
if ( queryObstacles[j].expAbsBounds.ContainsPoint( candidateOrigin ) ) {
|
||||
blocked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !blocked ) {
|
||||
goal.areaNum = candidateArea;
|
||||
goal.origin = candidateOrigin;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void idRecastNavMesh::ShowPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const {
|
||||
aasPath_t path;
|
||||
const int areaNum = PointAreaNum( origin );
|
||||
if ( PathToGoal( path, areaNum, origin, goalAreaNum, goalOrigin, TFL_WALK ) ) {
|
||||
gameRenderWorld->DebugLine( colorGreen, origin, path.moveGoal, gameLocal.msec );
|
||||
gameRenderWorld->DebugArrow( colorYellow, path.moveGoal, goalOrigin, 4.0f, gameLocal.msec );
|
||||
}
|
||||
}
|
||||
|
||||
void idRecastNavMesh::ShowArea( const idVec3 &origin ) const {
|
||||
const int areaNum = PointAreaNum( origin );
|
||||
if ( areaNum <= 0 ) {
|
||||
return;
|
||||
}
|
||||
const idVec3 center = AreaCenter( areaNum );
|
||||
gameRenderWorld->DebugBounds( colorCyan, idBounds( idVec3( -8.0f, -8.0f, -4.0f ), idVec3( 8.0f, 8.0f, 4.0f ) ), center, gameLocal.msec );
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
IceTech GPL Source Code
|
||||
Copyright (C) 2026 Justin Marshall
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __RECAST_NAVMESH_H__
|
||||
#define __RECAST_NAVMESH_H__
|
||||
|
||||
#include "../../../engine/tools/compilers/recast/RecastNavigation.h"
|
||||
|
||||
class idRecastNavMesh {
|
||||
public:
|
||||
idRecastNavMesh( void );
|
||||
~idRecastNavMesh( void );
|
||||
|
||||
void Shutdown( void );
|
||||
bool Load( const idStr &mapName, const idStr &fileName, unsigned int mapFileCRC );
|
||||
|
||||
bool IsLoaded( void ) const;
|
||||
const idStr & GetName( void ) const { return name; }
|
||||
int NumPolys( void ) const;
|
||||
const idAASSettings * GetSettings( void ) const;
|
||||
void Stats( void ) const;
|
||||
void DebugDraw( int drawMode ) const;
|
||||
|
||||
int PointAreaNum( const idVec3 &origin ) const;
|
||||
int PointReachableAreaNum( const idVec3 &origin, const idBounds &searchBounds, const int areaFlags ) const;
|
||||
int BoundsReachableAreaNum( const idBounds &bounds, const int areaFlags ) const;
|
||||
void PushPointIntoAreaNum( int areaNum, idVec3 &origin ) const;
|
||||
idVec3 AreaCenter( int areaNum ) const;
|
||||
int AreaFlags( int areaNum ) const;
|
||||
int AreaTravelFlags( int areaNum ) const;
|
||||
bool Trace( aasTrace_t &trace, const idVec3 &start, const idVec3 &end ) const;
|
||||
|
||||
bool SetAreaState( const idBounds &bounds, const int areaContents, bool disabled );
|
||||
aasHandle_t AddObstacle( const idBounds &bounds );
|
||||
void RemoveObstacle( const aasHandle_t handle );
|
||||
void RemoveAllObstacles( void );
|
||||
|
||||
int TravelTimeToGoalArea( int areaNum, const idVec3 &origin, int goalAreaNum, int travelFlags ) const;
|
||||
bool RouteToGoalArea( int areaNum, const idVec3 origin, int goalAreaNum, int travelFlags, int &travelTime, idReachability **reach ) const;
|
||||
bool PathToGoal( aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags ) const;
|
||||
bool PathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const;
|
||||
bool FindNearestGoal( const idNAV *owner, aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idNAVCallback &callback ) const;
|
||||
void ShowPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const;
|
||||
void ShowArea( const idVec3 &origin ) const;
|
||||
|
||||
static bool BuildMapFile( const idStr &mapName, const idStr &aasType );
|
||||
static idStr NavFileNameForMapName( const idStr &mapName );
|
||||
|
||||
private:
|
||||
bool HasManager( void ) const;
|
||||
|
||||
private:
|
||||
idStr name;
|
||||
recastNavHandle_t handle;
|
||||
mutable idReachability syntheticReach;
|
||||
};
|
||||
|
||||
#endif /* !__RECAST_NAVMESH_H__ */
|
||||
@@ -166,10 +166,10 @@ void rvmBot::Spawn( void )
|
||||
|
||||
botName = "dark";// spawnArgs.GetString("botname");
|
||||
|
||||
aas = gameLocal.GetBotAAS();
|
||||
aas = gameLocal.GetBotNAV();
|
||||
if( aas == NULL )
|
||||
{
|
||||
gameLocal.Error( "Missing AAS\n" );
|
||||
gameLocal.Error( "Missing NAV\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ void rvmBot::ServerThink( void )
|
||||
}
|
||||
|
||||
// If the selected route is not producing movement, invalidate the current path
|
||||
// and choose a small local AAS point. This prevents repeatedly pushing into the
|
||||
// and choose a small local NAV point. This prevents repeatedly pushing into the
|
||||
// same wall or corner when the item/chase goal is stale.
|
||||
if( haveMoveGoal )
|
||||
{
|
||||
@@ -535,7 +535,7 @@ void rvmBot::PresenceTypeBoundingBox( int presencetype, idVec3& mins, idVec3& ma
|
||||
}
|
||||
else
|
||||
{
|
||||
//botimport.Print(PRT_FATAL, "AAS_PresenceTypeBoundingBox: unknown presence type\n");
|
||||
//botimport.Print(PRT_FATAL, "NAV_PresenceTypeBoundingBox: unknown presence type\n");
|
||||
index = 2;
|
||||
}
|
||||
mins = boxmins[index];
|
||||
|
||||
@@ -142,11 +142,11 @@ class rvmBotAIBotActionBase;
|
||||
#define BLERR_NOERROR 0 //no error
|
||||
#define BLERR_LIBRARYNOTSETUP 1 //library not setup
|
||||
#define BLERR_INVALIDENTITYNUMBER 2 //invalid entity number
|
||||
#define BLERR_NOAASFILE 3 //no AAS file available
|
||||
#define BLERR_CANNOTOPENAASFILE 4 //cannot open AAS file
|
||||
#define BLERR_WRONGAASFILEID 5 //incorrect AAS file id
|
||||
#define BLERR_WRONGAASFILEVERSION 6 //incorrect AAS file version
|
||||
#define BLERR_CANNOTREADAASLUMP 7 //cannot read AAS file lump
|
||||
#define BLERR_NONAVFILE 3 //no NAV file available
|
||||
#define BLERR_CANNOTOPENNAVFILE 4 //cannot open NAV file
|
||||
#define BLERR_WRONGNAVFILEID 5 //incorrect NAV file id
|
||||
#define BLERR_WRONGNAVFILEVERSION 6 //incorrect NAV file version
|
||||
#define BLERR_CANNOTREADNAVLUMP 7 //cannot read NAV file lump
|
||||
#define BLERR_CANNOTLOADICHAT 8 //cannot load initial chats
|
||||
#define BLERR_CANNOTLOADITEMWEIGHTS 9 //cannot load item weights
|
||||
#define BLERR_CANNOTLOADITEMCONFIG 10 //cannot load item config
|
||||
@@ -688,7 +688,7 @@ void BotInitLevelItems( void );
|
||||
|
||||
void BotChooseWeapon( bot_state_t* bs );
|
||||
|
||||
inline float AAS_Time()
|
||||
inline float NAV_Time()
|
||||
{
|
||||
return floattime;
|
||||
}
|
||||
@@ -928,7 +928,7 @@ private:
|
||||
stateResult_t state_SeekLTG(stateParms_t* parms);
|
||||
stateResult_t state_Attacked(stateParms_t* parms);
|
||||
private:
|
||||
idAAS* aas;
|
||||
idNAV* aas;
|
||||
};
|
||||
|
||||
extern idCVar bot_skill;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
#include "../Game_local.h"
|
||||
#include "../ai/AASCallback_FindCoverArea.h"
|
||||
#include "../ai/NAVCallback_FindCoverArea.h"
|
||||
|
||||
#define IDEAL_ATTACKDIST 140
|
||||
|
||||
@@ -1106,7 +1106,7 @@ rvmBot::BotGetRandomPointNearPosition
|
||||
void rvmBot::BotGetRandomPointNearPosition(const idVec3 point, idVec3& randomPoint, float radius) {
|
||||
randomPoint = point;
|
||||
|
||||
idAAS* aas = this->aas;
|
||||
idNAV* aas = this->aas;
|
||||
if (!aas) {
|
||||
return;
|
||||
}
|
||||
@@ -1207,7 +1207,7 @@ void rvmBot::MoveToCoverPoint(void)
|
||||
aasGoal_t goal;
|
||||
aasObstacle_t obstacles[10];
|
||||
idVec3 origin = GetOrigin();
|
||||
idAAS* aas = gameLocal.GetBotAAS();
|
||||
idNAV* aas = gameLocal.GetBotNAV();
|
||||
if (aas == NULL)
|
||||
{
|
||||
return;
|
||||
@@ -1234,7 +1234,7 @@ void rvmBot::MoveToCoverPoint(void)
|
||||
obstacles[0].absBounds = idBounds(target).Expand(16);
|
||||
numObstacles = 1;
|
||||
|
||||
idAASCallback_FindCoverArea findCover(target);
|
||||
idNAVCallback_FindCoverArea findCover(target);
|
||||
if (aas->FindNearestGoal(goal, areaNum, origin, target, TFL_WALK | TFL_AIR, obstacles, numObstacles, findCover))
|
||||
{
|
||||
bs.currentGoal.origin = goal.origin;
|
||||
|
||||
@@ -725,7 +725,7 @@ void idBotGoalManager::InitLevelItems( void )
|
||||
// }
|
||||
//}
|
||||
|
||||
//for (ent = AAS_NextBSPEntity(0); ent; ent = AAS_NextBSPEntity(ent))
|
||||
//for (ent = NAV_NextBSPEntity(0); ent; ent = NAV_NextBSPEntity(ent))
|
||||
for( int idx = 0; idx < gameLocal.num_entities; idx++ )
|
||||
{
|
||||
if( gameLocal.entities[idx] == NULL )
|
||||
@@ -764,16 +764,16 @@ void idBotGoalManager::InitLevelItems( void )
|
||||
//if (spawnflags & 1)
|
||||
//{
|
||||
// //if the item is not floating in water
|
||||
// if (!(AAS_PointContents(origin) & CONTENTS_WATER))
|
||||
// if (!(NAV_PointContents(origin) & CONTENTS_WATER))
|
||||
// {
|
||||
// VectorCopy(origin, end);
|
||||
// end[2] -= 32;
|
||||
// trace = AAS_Trace(origin, ic->iteminfo[i].mins, ic->iteminfo[i].maxs, end, -1, CONTENTS_SOLID | CONTENTS_PLAYERCLIP);
|
||||
// trace = NAV_Trace(origin, ic->iteminfo[i].mins, ic->iteminfo[i].maxs, end, -1, CONTENTS_SOLID | CONTENTS_PLAYERCLIP);
|
||||
// //if the item not near the ground
|
||||
// if (trace.fraction >= 1)
|
||||
// {
|
||||
// //if the item is not reachable from a jumppad
|
||||
// goalareanum = AAS_BestReachableFromJumpPadArea(origin, ic->iteminfo[i].mins, ic->iteminfo[i].maxs);
|
||||
// goalareanum = NAV_BestReachableFromJumpPadArea(origin, ic->iteminfo[i].mins, ic->iteminfo[i].maxs);
|
||||
// Log_Write("item %s reachable from jumppad area %d\r\n", ic->iteminfo[i].classname, goalareanum);
|
||||
// //G_Printf( "item %s reachable from jumppad area %d\r\n", ic->iteminfo[i].classname, goalareanum);
|
||||
// if (!goalareanum) continue;
|
||||
@@ -814,14 +814,14 @@ void idBotGoalManager::InitLevelItems( void )
|
||||
if( classname == "item_botroam" )
|
||||
{
|
||||
li->flags |= IFL_ROAM;
|
||||
//AAS_FloatForBSPEpairKey(ent, "weight", &li->weight);
|
||||
//NAV_FloatForBSPEpairKey(ent, "weight", &li->weight);
|
||||
li->weight = ent->GetFloat( "weight" );
|
||||
}
|
||||
|
||||
////if not a stationary item
|
||||
//if (!(spawnflags & 1))
|
||||
//{
|
||||
// if (!AAS_DropToFloor(origin, ic->iteminfo[i].mins, ic->iteminfo[i].maxs))
|
||||
// if (!NAV_DropToFloor(origin, ic->iteminfo[i].mins, ic->iteminfo[i].maxs))
|
||||
// {
|
||||
// G_Printf( "%s in solid at (%1.1f %1.1f %1.1f)\n",
|
||||
// classname, origin[0], origin[1], origin[2]);
|
||||
@@ -910,7 +910,7 @@ void idBotGoalManager::BotDumpAvoidGoals( int goalstate )
|
||||
{
|
||||
BotGoalName( gs->avoidgoals[i], name, 32 );
|
||||
//Log_Write("avoid goal %s, number %d for %f seconds", name,
|
||||
// gs->avoidgoals[i], gs->avoidgoaltimes[i] - AAS_Time());
|
||||
// gs->avoidgoals[i], gs->avoidgoaltimes[i] - NAV_Time());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1223,7 +1223,7 @@ void idBotGoalManager::BotFindEntityForLevelItem( levelitem_t* li )
|
||||
|
||||
// jmarshall - eval moving objects
|
||||
//get info about the entity
|
||||
//AAS_EntityInfo(ent, &entinfo);
|
||||
//NAV_EntityInfo(ent, &entinfo);
|
||||
//if the entity is still moving
|
||||
//if (entinfo.origin[0] != entinfo.lastvisorigin[0] ||
|
||||
// entinfo.origin[1] != entinfo.lastvisorigin[1] ||
|
||||
@@ -1306,7 +1306,7 @@ void idBotGoalManager::UpdateEntityItems( void )
|
||||
}
|
||||
// jmarshall - eval floating items.
|
||||
////get info about the entity
|
||||
//AAS_EntityInfo(ent, &entinfo);
|
||||
//NAV_EntityInfo(ent, &entinfo);
|
||||
////FIXME: don't do this
|
||||
////skip all floating items for now
|
||||
////if (entinfo.groundent != ENTITYNUM_WORLD) continue;
|
||||
@@ -1339,7 +1339,7 @@ void idBotGoalManager::UpdateEntityItems( void )
|
||||
//{
|
||||
// VectorCopy(entinfo.origin, li->origin);
|
||||
// //also update the goal area number
|
||||
// li->goalareanum = AAS_BestReachableArea(li->origin,
|
||||
// li->goalareanum = NAV_BestReachableArea(li->origin,
|
||||
// ic->iteminfo[li->iteminfo].mins, ic->iteminfo[li->iteminfo].maxs,
|
||||
// li->goalorigin);
|
||||
//} //end if
|
||||
@@ -1401,7 +1401,7 @@ void idBotGoalManager::UpdateEntityItems( void )
|
||||
// //update the level item origin
|
||||
// VectorCopy(ent->r.currentOrigin, li->origin);
|
||||
// //also update the goal area number
|
||||
// li->goalareanum = AAS_BestReachableArea(li->origin,
|
||||
// li->goalareanum = NAV_BestReachableArea(li->origin,
|
||||
// ic->iteminfo[li->iteminfo].mins, ic->iteminfo[li->iteminfo].maxs,
|
||||
// li->goalorigin);
|
||||
//} //end if
|
||||
@@ -1455,11 +1455,11 @@ void idBotGoalManager::UpdateEntityItems( void )
|
||||
|
||||
// jmarshall - fix this, bots, jump pads, and droppable items, bad combo.
|
||||
//get the item goal area and goal origin
|
||||
//li->goalareanum = AAS_BestReachableArea(li->origin,
|
||||
//li->goalareanum = NAV_BestReachableArea(li->origin,
|
||||
// ic->iteminfo[i].mins, ic->iteminfo[i].maxs,
|
||||
// li->goalorigin);
|
||||
////never go for items dropped into jumppads
|
||||
//if (AAS_AreaJumpPad(li->goalareanum))
|
||||
//if (NAV_AreaJumpPad(li->goalareanum))
|
||||
//{
|
||||
// FreeLevelItem(li);
|
||||
// continue;
|
||||
@@ -1635,7 +1635,7 @@ int idBotGoalManager::BotChooseLTGItem( int goalstate, idVec3 origin, int* inven
|
||||
//get the area the bot is in
|
||||
//areanum = BotReachabilityArea(origin, gs->client);
|
||||
//if the bot is in solid or if the area the bot is in has no reachability links
|
||||
//if (!areanum || !AAS_AreaReachability(areanum))
|
||||
//if (!areanum || !NAV_AreaReachability(areanum))
|
||||
//{
|
||||
// //use the last valid area the bot was in
|
||||
// areanum = gs->lastreachabilityarea;
|
||||
@@ -1729,7 +1729,7 @@ int idBotGoalManager::BotChooseLTGItem( int goalstate, idVec3 origin, int* inven
|
||||
{
|
||||
//get the travel time towards the goal area
|
||||
// jmarshall
|
||||
//t = AAS_AreaTravelTimeToGoalArea(areanum, origin, li->goalareanum, travelflags);
|
||||
//t = NAV_AreaTravelTimeToGoalArea(areanum, origin, li->goalareanum, travelflags);
|
||||
t = gameLocal.TravelTimeToGoal( origin, li->goalorigin );
|
||||
// jmarshall end
|
||||
|
||||
@@ -1759,9 +1759,9 @@ int idBotGoalManager::BotChooseLTGItem( int goalstate, idVec3 origin, int* inven
|
||||
{
|
||||
/*
|
||||
//if not in lava or slime
|
||||
if (!AAS_AreaLava(areanum) && !AAS_AreaSlime(areanum))
|
||||
if (!NAV_AreaLava(areanum) && !NAV_AreaSlime(areanum))
|
||||
{
|
||||
if (AAS_RandomGoalArea(areanum, travelflags, &goal.areanum, goal.origin))
|
||||
if (NAV_RandomGoalArea(areanum, travelflags, &goal.areanum, goal.origin))
|
||||
{
|
||||
VectorSet(goal.mins, -15, -15, -15);
|
||||
VectorSet(goal.maxs, 15, 15, 15);
|
||||
@@ -1856,7 +1856,7 @@ int idBotGoalManager::BotChooseNBGItem( int goalstate, idVec3 origin, int* inven
|
||||
areanum = 1; // BotReachabilityArea(origin, gs->client);
|
||||
// jmarshall end
|
||||
//if the bot is in solid or if the area the bot is in has no reachability links
|
||||
//if (!areanum || !AAS_AreaReachability(areanum))
|
||||
//if (!areanum || !NAV_AreaReachability(areanum))
|
||||
//{
|
||||
// //use the last valid area the bot was in
|
||||
// areanum = gs->lastreachabilityarea;
|
||||
@@ -1871,7 +1871,7 @@ int idBotGoalManager::BotChooseNBGItem( int goalstate, idVec3 origin, int* inven
|
||||
// jmarshall
|
||||
if( ltg )
|
||||
{
|
||||
//ltg_time = AAS_AreaTravelTimeToGoalArea(areanum, origin, ltg->areanum, travelflags);
|
||||
//ltg_time = NAV_AreaTravelTimeToGoalArea(areanum, origin, ltg->areanum, travelflags);
|
||||
ltg_time = gameLocal.TravelTimeToGoal( origin, ltg->origin );
|
||||
}
|
||||
else
|
||||
@@ -1962,7 +1962,7 @@ int idBotGoalManager::BotChooseNBGItem( int goalstate, idVec3 origin, int* inven
|
||||
if( weight > 0 )
|
||||
{
|
||||
//get the travel time towards the goal area
|
||||
//t = AAS_AreaTravelTimeToGoalArea(areanum, origin, li->goalareanum, travelflags);
|
||||
//t = NAV_AreaTravelTimeToGoalArea(areanum, origin, li->goalareanum, travelflags);
|
||||
t = gameLocal.TravelTimeToGoal( origin, li->goalorigin );
|
||||
|
||||
//if the goal is reachable
|
||||
@@ -1984,7 +1984,7 @@ int idBotGoalManager::BotChooseNBGItem( int goalstate, idVec3 origin, int* inven
|
||||
{
|
||||
//get the travel time from the goal to the long term goal
|
||||
// jmarshall
|
||||
//t = AAS_AreaTravelTimeToGoalArea(li->goalareanum, li->goalorigin, ltg->areanum, travelflags);
|
||||
//t = NAV_AreaTravelTimeToGoalArea(li->goalareanum, li->goalorigin, ltg->areanum, travelflags);
|
||||
t = gameLocal.TravelTimeToGoal( li->goalorigin, ltg->origin );
|
||||
// jmarshall end
|
||||
} //end if
|
||||
@@ -2121,11 +2121,11 @@ int idBotGoalManager::BotItemGoalInVisButNotVisible( int viewer, idVec3 eye, idA
|
||||
// jmarshall - time delay thing here?
|
||||
//
|
||||
//if the entity data isn't valid
|
||||
//AAS_EntityInfo(goal->entitynum, &entinfo);
|
||||
//NAV_EntityInfo(goal->entitynum, &entinfo);
|
||||
//NOTE: for some wacko reason entities are sometimes
|
||||
// not updated
|
||||
//if (!entinfo.valid) return qtrue;
|
||||
//if (entinfo.ltime < AAS_Time() - 0.5)
|
||||
//if (entinfo.ltime < NAV_Time() - 0.5)
|
||||
// return qtrue;
|
||||
// jmarshall end
|
||||
}
|
||||
|
||||
@@ -4857,12 +4857,12 @@ intptr_t idPlayer::Invoke(const char *functionName, void *param1) {
|
||||
AdjustBodyAngles();
|
||||
return 0;
|
||||
};
|
||||
if(functionNameHash == 182149) { // InitAASLocation
|
||||
InitAASLocation();
|
||||
if(functionNameHash == 184123) { // InitNAVLocation
|
||||
InitNAVLocation();
|
||||
return 0;
|
||||
};
|
||||
if(functionNameHash == 168400) { // SetAASLocation
|
||||
SetAASLocation();
|
||||
if(functionNameHash == 170358) { // SetNAVLocation
|
||||
SetNAVLocation();
|
||||
return 0;
|
||||
};
|
||||
if(functionNameHash == 49083) { // Move
|
||||
@@ -5225,10 +5225,10 @@ bool idPlayer::HasNativeFunction(const char *functionName) {
|
||||
if(functionNameHash == 205065) { // AdjustBodyAngles
|
||||
return true;
|
||||
};
|
||||
if(functionNameHash == 182149) { // InitAASLocation
|
||||
if(functionNameHash == 184123) { // InitNAVLocation
|
||||
return true;
|
||||
};
|
||||
if(functionNameHash == 168400) { // SetAASLocation
|
||||
if(functionNameHash == 170358) { // SetNAVLocation
|
||||
return true;
|
||||
};
|
||||
if(functionNameHash == 49083) { // Move
|
||||
@@ -7291,8 +7291,8 @@ intptr_t idAI::Invoke(const char *functionName, void *param1) {
|
||||
GetTalkState();
|
||||
return 0;
|
||||
};
|
||||
if(functionNameHash == 62250) { // SetAAS
|
||||
SetAAS();
|
||||
if(functionNameHash == 64208) { // SetNAV
|
||||
SetNAV();
|
||||
return 0;
|
||||
};
|
||||
if(functionNameHash == 150747) { // DormantBegin
|
||||
@@ -7900,7 +7900,7 @@ bool idAI::HasNativeFunction(const char *functionName) {
|
||||
if(functionNameHash == 149251) { // GetTalkState
|
||||
return true;
|
||||
};
|
||||
if(functionNameHash == 62250) { // SetAAS
|
||||
if(functionNameHash == 64208) { // SetNAV
|
||||
return true;
|
||||
};
|
||||
if(functionNameHash == 150747) { // DormantBegin
|
||||
|
||||
@@ -5360,11 +5360,11 @@ static classVariableInfo_t aasObstacle_t_typeInfo[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static classVariableInfo_t idAASCallback_typeInfo[] = {
|
||||
static classVariableInfo_t idNAVCallback_typeInfo[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static classVariableInfo_t idAAS_typeInfo[] = {
|
||||
static classVariableInfo_t idNAV_typeInfo[] = {
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -5626,8 +5626,8 @@ static classVariableInfo_t idGameLocal_typeInfo[] = {
|
||||
{ "idLocationEntity * *", "locationEntities", (intptr_t)(&((idGameLocal *)0)->locationEntities), sizeof( ((idGameLocal *)0)->locationEntities ) },
|
||||
{ "idCamera *", "camera", (intptr_t)(&((idGameLocal *)0)->camera), sizeof( ((idGameLocal *)0)->camera ) },
|
||||
{ "const idMaterial *", "globalMaterial", (intptr_t)(&((idGameLocal *)0)->globalMaterial), sizeof( ((idGameLocal *)0)->globalMaterial ) },
|
||||
{ "idList < idAAS * >", "aasList", (intptr_t)(&((idGameLocal *)0)->aasList), sizeof( ((idGameLocal *)0)->aasList ) },
|
||||
{ "idStrList", "aasNames", (intptr_t)(&((idGameLocal *)0)->aasNames), sizeof( ((idGameLocal *)0)->aasNames ) },
|
||||
{ "idList < idNAV * >", "navList", (intptr_t)(&((idGameLocal *)0)->navList), sizeof( ((idGameLocal *)0)->navList ) },
|
||||
{ "idStrList", "navNames", (intptr_t)(&((idGameLocal *)0)->navNames), sizeof( ((idGameLocal *)0)->navNames ) },
|
||||
{ "idEntityPtr < idActor >", "lastAIAlertEntity", (intptr_t)(&((idGameLocal *)0)->lastAIAlertEntity), sizeof( ((idGameLocal *)0)->lastAIAlertEntity ) },
|
||||
{ "int", "lastAIAlertTime", (intptr_t)(&((idGameLocal *)0)->lastAIAlertTime), sizeof( ((idGameLocal *)0)->lastAIAlertTime ) },
|
||||
{ "idDict", "spawnArgs", (intptr_t)(&((idGameLocal *)0)->spawnArgs), sizeof( ((idGameLocal *)0)->spawnArgs ) },
|
||||
@@ -5653,7 +5653,7 @@ static classVariableInfo_t idGameLocal_typeInfo[] = {
|
||||
{ "byte[16384]", "lagometer", (intptr_t)(&((idGameLocal *)0)->lagometer), sizeof( ((idGameLocal *)0)->lagometer ) },
|
||||
{ "idList < rvmGameDelayRemoveEntry_t >", "delayRemoveEntities", (intptr_t)(&((idGameLocal *)0)->delayRemoveEntities), sizeof( ((idGameLocal *)0)->delayRemoveEntities ) },
|
||||
{ "const idDeclEntityDef *", "botItemTable", (intptr_t)(&((idGameLocal *)0)->botItemTable), sizeof( ((idGameLocal *)0)->botItemTable ) },
|
||||
{ "idAAS *", "bot_aas", (intptr_t)(&((idGameLocal *)0)->bot_aas), sizeof( ((idGameLocal *)0)->bot_aas ) },
|
||||
{ "idNAV *", "bot_nav", (intptr_t)(&((idGameLocal *)0)->bot_nav), sizeof( ((idGameLocal *)0)->bot_nav ) },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -7488,7 +7488,7 @@ static classVariableInfo_t idDoor_typeInfo[] = {
|
||||
{ ": float", "triggersize", (intptr_t)(&((idDoor *)0)->triggersize), sizeof( ((idDoor *)0)->triggersize ) },
|
||||
{ "bool", "crusher", (intptr_t)(&((idDoor *)0)->crusher), sizeof( ((idDoor *)0)->crusher ) },
|
||||
{ "bool", "noTouch", (intptr_t)(&((idDoor *)0)->noTouch), sizeof( ((idDoor *)0)->noTouch ) },
|
||||
{ "bool", "aas_area_closed", (intptr_t)(&((idDoor *)0)->aas_area_closed), sizeof( ((idDoor *)0)->aas_area_closed ) },
|
||||
{ "bool", "nav_area_closed", (intptr_t)(&((idDoor *)0)->nav_area_closed), sizeof( ((idDoor *)0)->nav_area_closed ) },
|
||||
{ "idStr", "buddyStr", (intptr_t)(&((idDoor *)0)->buddyStr), sizeof( ((idDoor *)0)->buddyStr ) },
|
||||
{ "idClipModel *", "trigger", (intptr_t)(&((idDoor *)0)->trigger), sizeof( ((idDoor *)0)->trigger ) },
|
||||
{ "idClipModel *", "sndTrigger", (intptr_t)(&((idDoor *)0)->sndTrigger), sizeof( ((idDoor *)0)->sndTrigger ) },
|
||||
@@ -7952,7 +7952,7 @@ static classVariableInfo_t idMoveState_typeInfo[] = {
|
||||
};
|
||||
|
||||
static classVariableInfo_t idAI_typeInfo[] = {
|
||||
{ ": idAAS *", "aas", (intptr_t)(&((idAI *)0)->aas), sizeof( ((idAI *)0)->aas ) },
|
||||
{ ": idNAV *", "aas", (intptr_t)(&((idAI *)0)->aas), sizeof( ((idAI *)0)->aas ) },
|
||||
{ "int", "travelFlags", (intptr_t)(&((idAI *)0)->travelFlags), sizeof( ((idAI *)0)->travelFlags ) },
|
||||
{ "idMoveState", "move", (intptr_t)(&((idAI *)0)->move), sizeof( ((idAI *)0)->move ) },
|
||||
{ "idMoveState", "savedMove", (intptr_t)(&((idAI *)0)->savedMove), sizeof( ((idAI *)0)->savedMove ) },
|
||||
@@ -8576,7 +8576,7 @@ static classVariableInfo_t rvmBot_typeInfo[] = {
|
||||
{ "int", "weapon_shotgun", (intptr_t)(&((rvmBot *)0)->weapon_shotgun), sizeof( ((rvmBot *)0)->weapon_shotgun ) },
|
||||
{ "int", "weapon_plasmagun", (intptr_t)(&((rvmBot *)0)->weapon_plasmagun), sizeof( ((rvmBot *)0)->weapon_plasmagun ) },
|
||||
{ "int", "weapon_rocketlauncher", (intptr_t)(&((rvmBot *)0)->weapon_rocketlauncher), sizeof( ((rvmBot *)0)->weapon_rocketlauncher ) },
|
||||
{ ": idAAS *", "aas", (intptr_t)(&((rvmBot *)0)->aas), sizeof( ((rvmBot *)0)->aas ) },
|
||||
{ ": idNAV *", "aas", (intptr_t)(&((rvmBot *)0)->aas), sizeof( ((rvmBot *)0)->aas ) },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -8882,8 +8882,8 @@ static classTypeInfo_t classTypeInfo[] = {
|
||||
{ "aasPath_t", "", sizeof(aasPath_t), aasPath_t_typeInfo },
|
||||
{ "aasGoal_t", "", sizeof(aasGoal_t), aasGoal_t_typeInfo },
|
||||
{ "aasObstacle_t", "", sizeof(aasObstacle_t), aasObstacle_t_typeInfo },
|
||||
{ "idAASCallback", "", sizeof(idAASCallback), idAASCallback_typeInfo },
|
||||
{ "idAAS", "", sizeof(idAAS), idAAS_typeInfo },
|
||||
{ "idNAVCallback", "", sizeof(idNAVCallback), idNAVCallback_typeInfo },
|
||||
{ "idNAV", "", sizeof(idNAV), idNAV_typeInfo },
|
||||
{ "idClipModel", "", sizeof(idClipModel), idClipModel_typeInfo },
|
||||
{ "idClip", "", sizeof(idClip), idClip_typeInfo },
|
||||
{ "idPush::pushed_s", "", sizeof(idPush::pushed_s), idPush_pushed_s_typeInfo },
|
||||
|
||||
@@ -1458,20 +1458,20 @@ static void Cmd_ListAnims_f( const idCmdArgs &args ) {
|
||||
|
||||
/*
|
||||
==================
|
||||
Cmd_AASStats_f
|
||||
Cmd_NAVStats_f
|
||||
==================
|
||||
*/
|
||||
static void Cmd_AASStats_f( const idCmdArgs &args ) {
|
||||
static void Cmd_NAVStats_f( const idCmdArgs &args ) {
|
||||
int aasNum;
|
||||
|
||||
if ( !gameLocal.CheatsOk() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
aasNum = aas_test.GetInteger();
|
||||
idAAS *aas = gameLocal.GetAAS( aasNum );
|
||||
aasNum = nav_test.GetInteger();
|
||||
idNAV *aas = gameLocal.GetNAV( aasNum );
|
||||
if ( !aas ) {
|
||||
gameLocal.Printf( "No aas #%d loaded\n", aasNum );
|
||||
gameLocal.Printf( "No nav #%d loaded\n", aasNum );
|
||||
} else {
|
||||
aas->Stats();
|
||||
}
|
||||
@@ -2411,7 +2411,7 @@ void idGameLocal::InitConsoleCommands( void ) {
|
||||
cmdSystem->AddCommand( "reexportmodels", Cmd_ReexportModels_f, CMD_FL_GAME|CMD_FL_CHEAT, "reexports models", ArgCompletion_DefFile );
|
||||
cmdSystem->AddCommand( "reloadanims", Cmd_ReloadAnims_f, CMD_FL_GAME|CMD_FL_CHEAT, "reloads animations" );
|
||||
cmdSystem->AddCommand( "listAnims", Cmd_ListAnims_f, CMD_FL_GAME, "lists all animations" );
|
||||
cmdSystem->AddCommand( "aasStats", Cmd_AASStats_f, CMD_FL_GAME, "shows AAS stats" );
|
||||
cmdSystem->AddCommand( "navStats", Cmd_NAVStats_f, CMD_FL_GAME, "shows NAV stats" );
|
||||
cmdSystem->AddCommand( "recastNavBuild", Cmd_RecastNavBuild_f, CMD_FL_GAME|CMD_FL_CHEAT, "builds Recast navmesh data for a map" );
|
||||
cmdSystem->AddCommand( "testDamage", Cmd_TestDamage_f, CMD_FL_GAME|CMD_FL_CHEAT, "tests a damage def", idCmdSystem::ArgCompletion_Decl<DECL_ENTITYDEF> );
|
||||
cmdSystem->AddCommand( "weaponSplat", Cmd_WeaponSplat_f, CMD_FL_GAME|CMD_FL_CHEAT, "projects a blood splat on the player weapon" );
|
||||
|
||||
@@ -294,17 +294,17 @@ idCVar g_testDeath( "g_testDeath", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar g_exportMask( "g_exportMask", "", CVAR_GAME, "" );
|
||||
idCVar g_flushSave( "g_flushSave", "0", CVAR_GAME | CVAR_BOOL, "1 = don't buffer file writing for save games." );
|
||||
|
||||
idCVar aas_test( "aas_test", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar aas_showAreas( "aas_showAreas", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar aas_showRecastNavMesh( "aas_showRecastNavMesh", "0", CVAR_GAME | CVAR_INTEGER, "0 = off, 1 = draw Recast navmesh, 2 = also draw dynamic blockers" );
|
||||
idCVar aas_showPath( "aas_showPath", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar aas_showFlyPath( "aas_showFlyPath", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar aas_showWallEdges( "aas_showWallEdges", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar aas_showHideArea( "aas_showHideArea", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar aas_pullPlayer( "aas_pullPlayer", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar aas_randomPullPlayer( "aas_randomPullPlayer", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar aas_goalArea( "aas_goalArea", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar aas_showPushIntoArea( "aas_showPushIntoArea", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar nav_test( "nav_test", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar nav_showAreas( "nav_showAreas", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar nav_showRecastNavMesh( "nav_showRecastNavMesh", "0", CVAR_GAME | CVAR_INTEGER, "0 = off, 1 = draw Recast navmesh, 2 = also draw dynamic blockers" );
|
||||
idCVar nav_showPath( "nav_showPath", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar nav_showFlyPath( "nav_showFlyPath", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar nav_showWallEdges( "nav_showWallEdges", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar nav_showHideArea( "nav_showHideArea", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar nav_pullPlayer( "nav_pullPlayer", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar nav_randomPullPlayer( "nav_randomPullPlayer", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar nav_goalArea( "nav_goalArea", "0", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
idCVar nav_showPushIntoArea( "nav_showPushIntoArea", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
|
||||
idCVar g_password( "g_password", "", CVAR_GAME | CVAR_ARCHIVE, "game password" );
|
||||
idCVar password( "password", "", CVAR_GAME | CVAR_NOCHEAT, "client password used when connecting" );
|
||||
|
||||
@@ -222,17 +222,17 @@ extern idCVar g_testModelBlend;
|
||||
extern idCVar g_exportMask;
|
||||
extern idCVar g_flushSave;
|
||||
|
||||
extern idCVar aas_test;
|
||||
extern idCVar aas_showAreas;
|
||||
extern idCVar aas_showRecastNavMesh;
|
||||
extern idCVar aas_showPath;
|
||||
extern idCVar aas_showFlyPath;
|
||||
extern idCVar aas_showWallEdges;
|
||||
extern idCVar aas_showHideArea;
|
||||
extern idCVar aas_pullPlayer;
|
||||
extern idCVar aas_randomPullPlayer;
|
||||
extern idCVar aas_goalArea;
|
||||
extern idCVar aas_showPushIntoArea;
|
||||
extern idCVar nav_test;
|
||||
extern idCVar nav_showAreas;
|
||||
extern idCVar nav_showRecastNavMesh;
|
||||
extern idCVar nav_showPath;
|
||||
extern idCVar nav_showFlyPath;
|
||||
extern idCVar nav_showWallEdges;
|
||||
extern idCVar nav_showHideArea;
|
||||
extern idCVar nav_pullPlayer;
|
||||
extern idCVar nav_randomPullPlayer;
|
||||
extern idCVar nav_goalArea;
|
||||
extern idCVar nav_showPushIntoArea;
|
||||
|
||||
extern idCVar net_clientPredictGUI;
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
D:\projects\Doom3\neo\engine\opengl\x64\Debug\opengl.lib
|
||||
|
||||
+1
Submodule neo/external/recastnavigation added at 4c198ed15d
Reference in New Issue
Block a user