1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-18 07:46:38 +00:00

Dialog window improvements: use LB/RB to move up/down by 5; if only one dialog choice, autoselect it.

This commit is contained in:
Andrew Lanzone 2025-07-02 22:00:40 -07:00
parent 3767b60512
commit 7cc25d8916

View file

@ -968,7 +968,9 @@ namespace MWGui
{ {
if (mChoices.size() > 0) if (mChoices.size() > 0)
{ {
if (mControllerChoice >= 0 && mControllerChoice < static_cast<int>(mChoices.size())) if (mChoices.size() == 1)
onChoiceActivated(mChoices[0].second);
else if (mControllerChoice >= 0 && mControllerChoice < static_cast<int>(mChoices.size()))
onChoiceActivated(mChoices[mControllerChoice].second); onChoiceActivated(mChoices[mControllerChoice].second);
} }
else if (mControllerFocus == static_cast<int>(mTopicsList->getItemCount())) else if (mControllerFocus == static_cast<int>(mTopicsList->getItemCount()))
@ -1025,6 +1027,18 @@ namespace MWGui
setControllerFocus(mControllerFocus, true); setControllerFocus(mControllerFocus, true);
} }
} }
else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER && mChoices.size() == 0)
{
setControllerFocus(mControllerFocus, false);
mControllerFocus = std::max(mControllerFocus - 5, 0);
setControllerFocus(mControllerFocus, true);
}
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER && mChoices.size() == 0)
{
setControllerFocus(mControllerFocus, false);
mControllerFocus = std::min(mControllerFocus + 5, static_cast<int>(mTopicsList->getItemCount()));
setControllerFocus(mControllerFocus, true);
}
return true; return true;
} }