2025-10-04 21:08:52 +01:00
|
|
|
#if !defined(LD_GAME_NPC_H_)
|
|
|
|
|
#define LD_GAME_NPC_H_
|
|
|
|
|
#include "aabb.h"
|
2025-10-05 00:25:37 +01:00
|
|
|
#include "nav.h"
|
2025-10-05 14:42:19 +01:00
|
|
|
#include "npc_look.h"
|
2025-10-05 00:25:37 +01:00
|
|
|
#include "../core/types.h"
|
|
|
|
|
|
2025-10-05 18:28:58 +01:00
|
|
|
#define NPC_SPEED 1.0f
|
2025-10-05 00:25:37 +01:00
|
|
|
|
|
|
|
|
typedef enum NPC_ACTION NPC_ACTION;
|
|
|
|
|
enum NPC_ACTION {
|
|
|
|
|
// Waiting can be at any point of interest
|
|
|
|
|
NPC_ACTION_WAITING,
|
|
|
|
|
// Walking is when they are actively moving somewhere
|
|
|
|
|
NPC_ACTION_WALKING,
|
|
|
|
|
};
|
2025-10-04 21:08:52 +01:00
|
|
|
|
2025-10-05 14:42:19 +01:00
|
|
|
|
2025-10-04 21:08:52 +01:00
|
|
|
typedef struct NPC NPC;
|
|
|
|
|
struct NPC {
|
2025-10-05 14:42:19 +01:00
|
|
|
//// Personal
|
2025-10-04 21:08:52 +01:00
|
|
|
AABB collision;
|
2025-10-05 00:25:37 +01:00
|
|
|
Str8 name;
|
2025-10-05 14:42:19 +01:00
|
|
|
NPC_LOOK look;
|
|
|
|
|
|
2025-10-05 18:28:58 +01:00
|
|
|
bool customPOI;
|
|
|
|
|
U32 customPOICount;
|
|
|
|
|
U32 npcPOI[16];
|
|
|
|
|
|
2025-10-05 14:42:19 +01:00
|
|
|
//// Actions
|
2025-10-05 00:25:37 +01:00
|
|
|
NPC_ACTION mode;
|
2025-10-05 14:42:19 +01:00
|
|
|
// How long they've been waiting
|
2025-10-05 00:25:37 +01:00
|
|
|
F32 waitTime;
|
2025-10-05 14:42:19 +01:00
|
|
|
// How long they will wait until changing action
|
2025-10-05 00:25:37 +01:00
|
|
|
F32 maxWaitTime;
|
2025-10-05 14:42:19 +01:00
|
|
|
|
|
|
|
|
//// Navigation
|
|
|
|
|
// The NPC's current path
|
2025-10-05 00:25:37 +01:00
|
|
|
NavPath path;
|
2025-10-05 14:42:19 +01:00
|
|
|
// Which node the NPC is on in the path
|
2025-10-05 00:25:37 +01:00
|
|
|
U32 currentNavNode;
|
2025-10-05 14:42:19 +01:00
|
|
|
// The current index of the NPC's current node
|
2025-10-05 00:25:37 +01:00
|
|
|
U32 pathIndex;
|
2025-10-05 14:42:19 +01:00
|
|
|
// Target navNode index the npc is walking to
|
2025-10-05 00:25:37 +01:00
|
|
|
U32 targetNavNode;
|
2025-10-05 14:42:19 +01:00
|
|
|
// How long the npc has been walking to the next index
|
2025-10-05 00:25:37 +01:00
|
|
|
F32 walkTimer;
|
2025-10-05 14:42:19 +01:00
|
|
|
|
|
|
|
|
//// Knowledge
|
|
|
|
|
// What the NPC knows about the bandit.
|
|
|
|
|
NPC_LOOK banditKnowledge;
|
2025-10-04 21:08:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // LD_GAME_NPC_H_
|