diff options
| author | nathan <nathansmith@disroot.org> | 2025-12-22 08:34:40 +0000 |
|---|---|---|
| committer | nathan <nathansmith@disroot.org> | 2025-12-22 08:34:40 +0000 |
| commit | 08c502d813b11b1f9dd7b7143a0987454c76ea32 (patch) | |
| tree | 8caa319d59ab991a270495f5b9f9c263eb2de74f /src/player.c | |
| parent | db04bfb989a5ebbd1f57e9983a2bb819c3ce4d67 (diff) | |
| download | FindThings-08c502d813b11b1f9dd7b7143a0987454c76ea32.tar.gz FindThings-08c502d813b11b1f9dd7b7143a0987454c76ea32.tar.bz2 FindThings-08c502d813b11b1f9dd7b7143a0987454c76ea32.zip | |
Menu item selection
Diffstat (limited to 'src/player.c')
| -rw-r--r-- | src/player.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/player.c b/src/player.c index 27a4780..2b72477 100644 --- a/src/player.c +++ b/src/player.c @@ -165,6 +165,8 @@ void playerInteractWithEntity(Player* player, WorldUID uid, Game* game, void playerUpdateSelectedEntity(Player* player, WorldUID uid, Game* game) { Entity* entity = &game->world.entities[uid]; + InteractionChat* chat = &game->interactionChat; + InteractionMenu* menu = &game->interactionMenu; // If the entity can be selected. if (!playerCanEntityBeSelected(player, *entity)) @@ -184,15 +186,27 @@ void playerUpdateSelectedEntity(Player* player, WorldUID uid, Game* game) // Draw outline. DrawBoundingBox(entity->box, player->isInteracting ? YELLOW : PINK); + // Number keys for menu selection. + int keyPressed = GetKeyPressed(); + // Handle key presses. if (IsKeyPressed(game->settings.interactKey)) { playerInteractWithEntity(player, uid, game, SELECTION_INTERACT); } + else if (IsKeyPressed(game->settings.leaveKey)) + { + playerInteractWithEntity(player, uid, game, SELECTION_LEAVE); + } else if (IsKeyPressed(game->settings.nextMessageKey)) { playerInteractWithEntity(player, uid, game, SELECTION_NEXT_MESSAGE); } + else if (keyPressed >= KEY_ONE && keyPressed <= KEY_NINE) + { + playerInteractWithEntity(player, uid, game, + SELECTION_MENU_ITEM + (keyPressed - KEY_ONE)); + } } void updatePlayer(Player* player, Game* game) |
