From f7b5fbbdc719b108cec4a94b6ceb8294ae4e4e6e Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 21 Mar 2021 18:35:50 +0000 Subject: [PATCH] Enable D-Pad / Left stick navigation in stores --- SourceX/controls/game_controls.cpp | 2 +- SourceX/controls/plrctrls.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/SourceX/controls/game_controls.cpp b/SourceX/controls/game_controls.cpp index 654988b09..e34711376 100644 --- a/SourceX/controls/game_controls.cpp +++ b/SourceX/controls/game_controls.cpp @@ -315,7 +315,7 @@ bool GetGameAction(const SDL_Event &event, ControllerButtonEvent ctrl_event, Gam // DPad navigation is handled separately for these. - if (gmenu_is_active() || questlog) + if (gmenu_is_active() || questlog || stextflag != STORE_NONE) { switch (ctrl_event.button) { case ControllerButton_BUTTON_DPAD_UP: diff --git a/SourceX/controls/plrctrls.cpp b/SourceX/controls/plrctrls.cpp index 260e08f66..9a98d917c 100644 --- a/SourceX/controls/plrctrls.cpp +++ b/SourceX/controls/plrctrls.cpp @@ -832,6 +832,16 @@ void QuestLogMove(AxisDirection move_dir) QuestlogDown(); } +void StoreMove(AxisDirection move_dir) +{ + static AxisDirectionRepeater repeater; + move_dir = repeater.Get(move_dir); + if (move_dir.y == AxisDirectionY_UP) + STextUp(); + else if (move_dir.y == AxisDirectionY_DOWN) + STextDown(); +} + typedef void (*HandleLeftStickOrDPadFn)(dvl::AxisDirection); HandleLeftStickOrDPadFn GetLeftStickOrDPadGameUIHandler() @@ -846,6 +856,8 @@ HandleLeftStickOrDPadFn GetLeftStickOrDPadGameUIHandler() return &SpellBookMove; } else if (questlog) { return &QuestLogMove; + } else if (stextflag != STORE_NONE) { + return &StoreMove; } return NULL; }