diff options
| author | nathan <nathansmith@disroot.org> | 2025-10-24 10:24:35 +0000 |
|---|---|---|
| committer | nathan <nathansmith@disroot.org> | 2025-10-24 10:24:35 +0000 |
| commit | 8874e4a585d66c16299ad45e79ea6c55960dee02 (patch) | |
| tree | 728de2a02a5b61e0ecb57d35f653c7f280a97e0d /src/entity.h | |
| parent | 5f402fc99a19d7d73ba75f632aed5cbef7e3920a (diff) | |
| download | FindThings-8874e4a585d66c16299ad45e79ea6c55960dee02.tar.gz FindThings-8874e4a585d66c16299ad45e79ea6c55960dee02.tar.bz2 FindThings-8874e4a585d66c16299ad45e79ea6c55960dee02.zip | |
Working on interaction system (finally)
Diffstat (limited to 'src/entity.h')
| -rw-r--r-- | src/entity.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/entity.h b/src/entity.h index 9c842d3..72fadb4 100644 --- a/src/entity.h +++ b/src/entity.h @@ -40,7 +40,12 @@ #define SHOPKEEPER_HEIGHT (2.59521 / 2.0) #define SHOPKEEPER_THICKNESS (0.493349 / 2.0) +#define INTERACTION_MENU_MAX 9 +#define INTERACTION_LABEL_MAX 64 +#define ENTITY_DEFAULT_STATE -1 + typedef int8_t EntityId; +typedef int8_t EntityState; enum { ENTITY_NONE = -1, @@ -60,15 +65,39 @@ enum { RON }; +typedef enum { + INTERACTION_TALK, + INTERACTION_SHOW_MENU, + INTERACTION_END +} InteractionCommand; + +typedef enum { + SELECTION_INTERACT, + SELECTION_NEXT_MESSAGE, + SELECTION_MENU_ITEM, // +x to select any given menu entry + SELECTION_LEAVE +} Selection; + typedef struct { EntityId id; Vector3 position; // Shouldnt be changed directly. BoundingBox box; + EntityState state; } Entity; +typedef void (*InteractionCallback)(Entity* entity, Game* game); + +typedef struct { + char label[INTERACTION_LABEL_MAX]; + InteractionCallback callback; +} InteractionMenuEntry; + Entity createEntity(EntityId id, Vector3 position); void updateEntity(Entity* entity, Game* game); void setEntityPosition(Entity* entity, Vector3 position); void placeEntityOnGround(Entity* entity, const World* world); +InteractionCommand interactWithEntity(Entity* entity, Game* game, + Selection selection); + #endif |
