ui/requester: add option to allow requester wraparound
Some checks are pending
Run code linters / Run code linters (push) Waiting to run
Publish a pre-release / Build TR1 (push) Has been skipped
Publish a pre-release / Build TR2 (push) Has been skipped
Publish a pre-release / Create a prerelease (push) Has been skipped

This allows the up or down input key to be held in requesters and the
UI will wrap around to the top/bottom.
This commit is contained in:
lahm86 2025-04-18 19:58:46 +01:00
parent 2d05a683d6
commit 80757eb08c
5 changed files with 17 additions and 4 deletions

View file

@ -122,6 +122,7 @@ CFG_BOOL(g_Config, visuals.enable_skybox, true)
CFG_BOOL(g_Config, visuals.enable_ps1_crystals, true)
CFG_BOOL(g_Config, ui.enable_game_ui, true)
CFG_BOOL(g_Config, ui.enable_photo_mode_ui, true)
CFG_BOOL(g_Config, ui.enable_wraparound, true)
CFG_BOOL(g_Config, gameplay.enable_item_examining, true)
CFG_BOOL(g_Config, gameplay.enable_auto_item_selection, true)
CFG_BOOL(g_Config, gameplay.enable_pickup_aids, false)

View file

@ -32,6 +32,7 @@ CFG_RGB888(g_Config, visuals.water_color, 0x80, 0xDF, 0xFF)
CFG_DOUBLE(g_Config, ui.text_scale, 1.0)
CFG_DOUBLE(g_Config, ui.bar_scale, 1.0)
CFG_BOOL(g_Config, ui.enable_photo_mode_ui, true)
CFG_BOOL(g_Config, ui.enable_wraparound, true)
CFG_INT32(g_Config, rendering.fps, 60)
CFG_ENUM(g_Config, rendering.screenshot_format, SCREENSHOT_FORMAT_JPEG, SCREENSHOT_FORMAT)
CFG_ENUM(g_Config, rendering.render_mode, RM_HARDWARE, RENDER_MODE)

View file

@ -1,5 +1,6 @@
#include "game/ui/elements/requester.h"
#include "config.h"
#include "game/input.h"
#include "game/ui/elements/frame.h"
#include "game/ui/elements/pad.h"
@ -27,10 +28,18 @@ void UI_Requester_Free(UI_REQUESTER_STATE *const s)
int32_t UI_Requester_Control(UI_REQUESTER_STATE *const s)
{
if (s->is_selectable) {
if (g_InputDB.menu_down && s->sel_row + 1 < s->max_rows) {
s->sel_row++;
} else if (g_InputDB.menu_up && s->sel_row > 0) {
s->sel_row--;
if (g_InputDB.menu_down) {
if (s->sel_row + 1 < s->max_rows) {
s->sel_row++;
} else if (g_Config.ui.enable_wraparound) {
s->sel_row = 0;
}
} else if (g_InputDB.menu_up) {
if (s->sel_row > 0) {
s->sel_row--;
} else if (g_Config.ui.enable_wraparound) {
s->sel_row = s->max_rows - 1;
}
}
}

View file

@ -98,6 +98,7 @@ typedef struct {
struct {
bool enable_game_ui;
bool enable_photo_mode_ui;
bool enable_wraparound;
double text_scale;
double bar_scale;
UI_STYLE menu_style;

View file

@ -60,6 +60,7 @@ typedef struct {
struct {
bool enable_photo_mode_ui;
bool enable_wraparound;
double text_scale;
double bar_scale;
} ui;