r5sdk/r5dev/game/server/ai_utility.cpp
Kawe Mazidjatari 35ad8554a5 Somewhat correct working navmesh
The reachability table needs to be figured out still. The issue should be very small, but at the moment I do not have time for it.

The pointer to the table, and table pointers to data is correct, however, not a single poly is ever getting marked as 'reachable' (0xffffffff). This could be either within recast itself (see build_link_table() and set_reachable() functions), or the way the engine parses the data. The function that determines whether poly is reachable is located at '0x140F448E0'
2022-03-18 03:14:07 +01:00

37 lines
1.2 KiB
C++

//=============================================================================//
//
// Purpose: AI system utility
//
//=============================================================================//
#include "core/stdafx.h"
#include "tier0/cvar.h"
#include "game/server/detour_impl.h"
//-----------------------------------------------------------------------------
// Purpose: determines whether target poly is reachable from current agent poly
// input : *this -
// poly_1 -
// poly_2 -
// hull_type -
// Output : true if reachable, false otherwise
//-----------------------------------------------------------------------------
bool hdtNavMesh__isPolyReachable(dtNavMesh* thisptr, dtPolyRef poly_1, dtPolyRef poly_2, int hull_type)
{
if (navmesh_always_reachable->GetBool())
{
return true;
}
return dtNavMesh__isPolyReachable(thisptr, poly_1, poly_2, hull_type);
}
///////////////////////////////////////////////////////////////////////////////
void CAI_Utility_Attach()
{
DetourAttach((LPVOID*)&dtNavMesh__isPolyReachable, &hdtNavMesh__isPolyReachable);
}
void CAI_Utility_Detach()
{
DetourDetach((LPVOID*)&dtNavMesh__isPolyReachable, &hdtNavMesh__isPolyReachable);
}