diff options
| author | nathan <nathansmith@disroot.org> | 2025-10-27 12:58:37 +0000 |
|---|---|---|
| committer | nathan <nathansmith@disroot.org> | 2025-10-27 12:58:37 +0000 |
| commit | 95af9c76abef62466dc99cd48fe60d5c8c0677aa (patch) | |
| tree | 016e9b8ca2681603512980bb32b571db6b530e10 /src/entity.h | |
| parent | 5925230971875ba3e6e591f0655cf84b739b50fc (diff) | |
| download | FindThings-95af9c76abef62466dc99cd48fe60d5c8c0677aa.tar.gz FindThings-95af9c76abef62466dc99cd48fe60d5c8c0677aa.tar.bz2 FindThings-95af9c76abef62466dc99cd48fe60d5c8c0677aa.zip | |
Working on interaction stuff
Diffstat (limited to 'src/entity.h')
| -rw-r--r-- | src/entity.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/entity.h b/src/entity.h index a394d7a..d791c51 100644 --- a/src/entity.h +++ b/src/entity.h @@ -13,9 +13,13 @@ typedef int8_t EntityId; typedef int16_t EntityState; +typedef enum InteractionCommand InteractionCommand; +typedef enum Selection Selection; typedef struct Entity Entity; -typedef void (*InteractionCallback)(Entity* entity, Game* game); + +typedef InteractionCommand (*InteractionCallback)(Entity* entity, Game* game, + Selection selection); typedef void (*InitEntityCallback)(Entity* entity); typedef void (*UpdateEntityCallback)(Entity* entity, Game* game); typedef void (*CloseEntityCallback)(Entity* entity); @@ -38,18 +42,18 @@ enum { RON }; -typedef enum { +enum InteractionCommand { + INTERACTION_END, INTERACTION_TALK, INTERACTION_SHOW_MENU, - INTERACTION_END -} InteractionCommand; +}; -typedef enum { +enum Selection { SELECTION_INTERACT, SELECTION_NEXT_MESSAGE, SELECTION_MENU_ITEM, // +x to select any given menu entry SELECTION_LEAVE -} Selection; +}; struct Entity { EntityId id; @@ -63,14 +67,12 @@ typedef struct { InitEntityCallback initCallback; UpdateEntityCallback updateCallback; CloseEntityCallback closeCallback; + InteractionCallback interactionCallback; bool isPlace; bool canBeSelected; } EntityEntry; -typedef struct { - char label[INTERACTION_LABEL_MAX]; - InteractionCallback callback; -} InteractionMenuEntry; +// Am I still insane if I am aware of my insanity? extern const EntityEntry entityEntries[ENTITY_COUNT]; |
