aboutsummaryrefslogtreecommitdiffstats
path: root/src/entity.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/entity.h')
-rw-r--r--src/entity.h22
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];