diff --git a/Source/controls/plrctrls.cpp b/Source/controls/plrctrls.cpp index 9e4f7b0ba..d1122ed98 100644 --- a/Source/controls/plrctrls.cpp +++ b/Source/controls/plrctrls.cpp @@ -26,6 +26,7 @@ namespace devilution { +bool sgbTouchActive = false; bool sgbControllerActive = false; Point speedspellscoords[50]; int speedspellcount = 0; diff --git a/Source/controls/touch/event_handlers.cpp b/Source/controls/touch/event_handlers.cpp index 148efb9eb..ee0b4e8e4 100644 --- a/Source/controls/touch/event_handlers.cpp +++ b/Source/controls/touch/event_handlers.cpp @@ -14,6 +14,8 @@ namespace devilution { +extern bool sgbTouchActive; + namespace { VirtualGamepadEventHandler Handler(&VirtualGamepadState); @@ -86,12 +88,16 @@ void HandleBottomPanelInteraction(const SDL_Event &event) void HandleTouchEvent(const SDL_Event &event) { + sgbTouchActive = false; + if (Handler.Handle(event)) return; if (!IsAnyOf(event.type, SDL_FINGERDOWN, SDL_FINGERUP, SDL_FINGERMOTION)) return; + sgbTouchActive = true; + SimulateMouseMovement(event); if (HandleGameMenuInteraction(event)) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 1394cd0a3..a46aebcb0 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -251,7 +251,18 @@ void UndrawCursor(const Surface &out) bool ShouldShowCursor() { - return !(sgbControllerActive && !IsMovingMouseCursorWithController() && pcurs != CURSOR_TELEPORT && !invflag && (!chrflag || Players[MyPlayerId]._pStatPts <= 0)); + if (!sgbControllerActive && !sgbTouchActive) + return true; + if (IsMovingMouseCursorWithController()) + return true; + if (pcurs == CURSOR_TELEPORT) + return true; + if (invflag) + return true; + if (chrflag && Players[MyPlayerId]._pStatPts > 0) + return true; + + return false; } /** diff --git a/Source/scrollrt.h b/Source/scrollrt.h index 478b697d3..195423aff 100644 --- a/Source/scrollrt.h +++ b/Source/scrollrt.h @@ -27,6 +27,7 @@ enum class ScrollDirection : uint8_t { // Defined in SourceX/controls/plctrls.cpp extern bool sgbControllerActive; +extern bool sgbTouchActive; extern bool IsMovingMouseCursorWithController(); extern int LightTableIndex;