Server: create new core NavMesh types

Create new types which will be used to refactor the current Detour implementation in the SDK.
This commit is contained in:
Kawe Mazidjatari 2024-07-05 15:47:56 +02:00
parent 089dddf2c4
commit e638cc9323
2 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,38 @@
//=============================================================================//
//
// Purpose: defines the agent types for AI
//
//=============================================================================//
#ifndef AI_AGENT_H
#define AI_AGENT_H
// The traverse types determine the animations, they also determine the jump
// links that can be taken (e.g. ANIMTYPE_FRAG_DRONE can take far more jumps
// than ANIMTYPE_STALKER. This is determined during the creation of the static
// pathing data in the NavMesh.
enum TraverseAnimType_e
{
// NAVMESH_SMALL
ANIMTYPE_HUMAN = 0,
ANIMTYPE_SPECTRE,
ANIMTYPE_STALKER,
ANIMTYPE_FRAG_DRONE,
ANIMTYPE_PILOT,
// NAVMESH_MED_SHORT
ANIMTYPE_PROWLER,
// NAVMESH_MEDIUM
ANIMTYPE_SUPER_SPECTRE,
// NAVMESH_LARGE
ANIMTYPE_TITAN,
// NAVMESH_EXTRA_LARGE
ANIMTYPE_GOLIATH,
// Not an anim type!
ANIMTYPE_COUNT
};
#endif // AI_AGENT_H

View File

@ -0,0 +1,53 @@
//=============================================================================//
//
// Purpose: defines the NavMesh types for AI
//
//=============================================================================//
#ifndef AI_NAVMESH_H
#define AI_NAVMESH_H
#include "ai_agent.h"
enum NavMeshType_e
{
NAVMESH_SMALL = 0,
NAVMESH_MED_SHORT,
NAVMESH_MEDIUM,
NAVMESH_LARGE,
NAVMESH_EXTRA_LARGE,
// Not a NavMesh!
NAVMESH_COUNT
};
inline const char* const g_navMeshNames[NAVMESH_COUNT] = {
"small",
"med_short",
"medium",
"large",
"extra_large"
};
inline const char* NavMesh_GetNameForType(const NavMeshType_e navMeshType)
{
Assert(navMeshType >= 0 && navMeshType < NAVMESH_COUNT);
return g_navMeshNames[navMeshType];
}
inline const int g_traverseAnimTypeSetTableIndices[ANIMTYPE_COUNT] = {
// NAVMESH_SMALL has 5 reachability tables, so each traverse anim type indexes
// into its own.
0, 0, 0, 0, 0,
// All other navmeshes have 1 reachability table, so we need to subtract the
// number from the enumerant to index into the first one.
-5, -6, -7, -8
};
inline int NavMesh_GetReachabilityTableIndexForTraverseAnimType(const TraverseAnimType_e animType)
{
Assert(animType >= 0 && animType < V_ARRAYSIZE(g_traverseAnimTypeSetTableIndices));
return animType + g_traverseAnimTypeSetTableIndices[animType];
}
#endif // AI_NAVMESH_H