From db04bfb989a5ebbd1f57e9983a2bb819c3ce4d67 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 21 Dec 2025 20:02:10 -0700 Subject: hehehehe over designed interaction menu --- src/player.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'src/player.c') diff --git a/src/player.c b/src/player.c index 40c60c3..27a4780 100644 --- a/src/player.c +++ b/src/player.c @@ -102,10 +102,22 @@ bool playerCanEntityBeSelected(Player* player, Entity entity) <= PLAYER_MAX_SELECT_DISTANCE; } +void playerEndInteraction(Player* player, Game* game) +{ + player->selectedEntity = ENTITY_NONE; + player->isInteracting = false; + + hideInteractionChat(&game->interactionChat); + hideInteractionMenu(&game->interactionMenu); + game->interactionChat.entityId = ENTITY_NONE; + game->interactionMenu.entityId = ENTITY_NONE; +} + void playerInteractWithEntity(Player* player, WorldUID uid, Game* game, Selection selection) { InteractionChat* chat = &game->interactionChat; + InteractionMenu* menu = &game->interactionMenu; Entity* entity = &game->world.entities[uid]; @@ -114,14 +126,14 @@ void playerInteractWithEntity(Player* player, WorldUID uid, Game* game, { case SELECTION_INTERACT: clearInteractionChat(chat); + resetInteractionMenu(menu); chat->entityId = entity->id; + menu->entityId = entity->id; player->selectedEntity = uid; player->isInteracting = true; break; case SELECTION_LEAVE: - player->selectedEntity = ENTITY_NONE; - player->isInteracting = false; - chat->entityId = ENTITY_NONE; + playerEndInteraction(player, game); break; default: break; @@ -131,13 +143,19 @@ void playerInteractWithEntity(Player* player, WorldUID uid, Game* game, switch (interactWithEntity(entity, game, selection)) { case INTERACTION_TALK: + hideInteractionMenu(menu); showInteractionChat(chat); break; - case INTERACTION_END: + case INTERACTION_SHOW_MENU: hideInteractionChat(chat); - player->selectedEntity = ENTITY_NONE; - player->isInteracting = false; - chat->entityId = ENTITY_NONE; + showInteractionMenu(menu); + break; + case INTERACTION_TALK_AND_SHOW_MENU: + showInteractionChat(chat); + showInteractionMenu(menu); + break; + case INTERACTION_END: + playerEndInteraction(player, game); break; default: break; -- cgit v1.2.3