feat: Added nav and start of npc stuff

This commit is contained in:
2025-10-04 21:08:52 +01:00
parent 7a27309c5b
commit d0d79d0551
7 changed files with 214 additions and 0 deletions

40
code/game/nav.h Normal file
View File

@@ -0,0 +1,40 @@
#if !defined(LD_GAME_NAV_H_)
#define LD_GAME_NAV_H_
#include "../core/types.h"
#include "../core/macros.h"
#define NAV_MAX_PATH 1024
#define NAV_MAX_CONNECTIONS 8
#define NAV_MAX_NODES 4096
typedef struct NavNode NavNode;
typedef struct NavConnection NavConnection;
struct NavConnection{
F32 Cost;
U32 NodeIndex;
};
struct NavNode {
V2f pos;
U8 connectionCount;
NavConnection connections[NAV_MAX_CONNECTIONS];
};
typedef struct NavPath NavPath;
struct NavPath {
U32 nodeCount;
U32 indexes[NAV_MAX_PATH];
};
typedef struct NavMesh NavMesh;
struct NavMesh{
U32 nodeCount;
NavNode nodes[NAV_MAX_NODES];
};
function NavPath Nav_Path(NavMesh mesh, U32 start, U32 end);
#endif