mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-17 19:23:51 +02:00
Added recast navmesh.
This commit is contained in:
@@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||
#pragma hdrstop
|
||||
|
||||
#include "../Game_local.h"
|
||||
#include "../ai/RecastNavMesh.h"
|
||||
|
||||
#include "TypeInfo.h"
|
||||
|
||||
@@ -1476,6 +1477,51 @@ static void Cmd_AASStats_f( const idCmdArgs &args ) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Cmd_RecastNavBuild_f
|
||||
==================
|
||||
*/
|
||||
static void Cmd_RecastNavBuild_f( const idCmdArgs &args ) {
|
||||
if ( !gameLocal.CheatsOk( false ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( args.Argc() < 2 || args.Argc() > 3 ) {
|
||||
gameLocal.Printf( "usage: recastNavBuild <mapfile> [aasType|all]\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
const idStr mapName = args.Argv( 1 );
|
||||
const idStr requestedType = args.Argc() > 2 ? args.Argv( 2 ) : "all";
|
||||
bool builtAny = false;
|
||||
|
||||
if ( requestedType.Icmp( "all" ) != 0 ) {
|
||||
common->SetRefreshOnPrint(true);
|
||||
builtAny = idRecastNavMesh::BuildMapFile( mapName, requestedType );
|
||||
common->SetRefreshOnPrint(false);
|
||||
} else {
|
||||
const idDict *dict = gameLocal.FindEntityDefDict( "aas_types", false );
|
||||
if ( !dict ) {
|
||||
gameLocal.Warning( "Unable to find entityDef for 'aas_types'" );
|
||||
return;
|
||||
}
|
||||
common->SetRefreshOnPrint(true);
|
||||
for ( const idKeyValue *kv = dict->MatchPrefix( "type" ); kv != NULL; kv = dict->MatchPrefix( "type", kv ) ) {
|
||||
if ( idRecastNavMesh::BuildMapFile( mapName, kv->GetValue() ) ) {
|
||||
builtAny = true;
|
||||
}
|
||||
}
|
||||
common->SetRefreshOnPrint(false);
|
||||
}
|
||||
|
||||
if ( builtAny ) {
|
||||
gameLocal.Printf( "Recast navmesh build complete for %s\n", mapName.c_str() );
|
||||
} else {
|
||||
gameLocal.Warning( "Recast navmesh build failed for %s", mapName.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Cmd_TestDamage_f
|
||||
@@ -2366,6 +2412,7 @@ void idGameLocal::InitConsoleCommands( void ) {
|
||||
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( "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" );
|
||||
cmdSystem->AddCommand( "saveSelected", Cmd_SaveSelected_f, CMD_FL_GAME|CMD_FL_CHEAT, "saves the selected entity to the .map file" );
|
||||
|
||||
Reference in New Issue
Block a user