Files
ld58/code/game/npc.h

51 lines
1.0 KiB
C
Raw Normal View History

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"
#include "npc_look.h"
2025-10-05 00:25:37 +01:00
#include "../core/types.h"
#define NPC_SPEED 0.1
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-04 21:08:52 +01:00
typedef struct NPC NPC;
struct NPC {
//// Personal
2025-10-04 21:08:52 +01:00
AABB collision;
2025-10-05 00:25:37 +01:00
Str8 name;
NPC_LOOK look;
//// Actions
2025-10-05 00:25:37 +01:00
NPC_ACTION mode;
// How long they've been waiting
2025-10-05 00:25:37 +01:00
F32 waitTime;
// How long they will wait until changing action
2025-10-05 00:25:37 +01:00
F32 maxWaitTime;
//// Navigation
// The NPC's current path
2025-10-05 00:25:37 +01:00
NavPath path;
// Which node the NPC is on in the path
2025-10-05 00:25:37 +01:00
U32 currentNavNode;
// The current index of the NPC's current node
2025-10-05 00:25:37 +01:00
U32 pathIndex;
// Target navNode index the npc is walking to
2025-10-05 00:25:37 +01:00
U32 targetNavNode;
// How long the npc has been walking to the next index
2025-10-05 00:25:37 +01:00
F32 walkTimer;
//// Knowledge
// What the NPC knows about the bandit.
NPC_LOOK banditKnowledge;
2025-10-04 21:08:52 +01:00
};
#endif // LD_GAME_NPC_H_