From 95af9c76abef62466dc99cd48fe60d5c8c0677aa Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 27 Oct 2025 06:58:37 -0600 Subject: Working on interaction stuff --- src/entity.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/entity.h') 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]; -- cgit v1.2.3