mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 15:15:31 +00:00
Revert questionable input manager decisions
Remove Options Menu shortcut Revert to more pleasant 0.45.0 Escape behavior Re-enable keyboard GUI arrow conversion feature Remove gamepad button release handling
This commit is contained in:
parent
cad4ba0423
commit
15bf05215e
2 changed files with 20 additions and 49 deletions
|
@ -197,6 +197,11 @@ namespace MWInput
|
||||||
|
|
||||||
void InputManager::handleGuiArrowKey(int action)
|
void InputManager::handleGuiArrowKey(int action)
|
||||||
{
|
{
|
||||||
|
// This is currently keyboard-specific code
|
||||||
|
// TODO: see if GUI controls can be refactored into a single function
|
||||||
|
if (mJoystickLastUsed)
|
||||||
|
return;
|
||||||
|
|
||||||
if (SDL_IsTextInputActive())
|
if (SDL_IsTextInputActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -224,13 +229,10 @@ namespace MWInput
|
||||||
MWBase::Environment::get().getWindowManager()->injectKeyPress(key, 0, false);
|
MWBase::Environment::get().getWindowManager()->injectKeyPress(key, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputManager::gamepadToGuiControl(const SDL_ControllerButtonEvent &arg, bool release=false)
|
bool InputManager::gamepadToGuiControl(const SDL_ControllerButtonEvent &arg)
|
||||||
{
|
{
|
||||||
// Presumption of GUI mode will be removed in the future.
|
// Presumption of GUI mode will be removed in the future.
|
||||||
// MyGUI KeyCodes *may* change.
|
// MyGUI KeyCodes *may* change.
|
||||||
// Currently button releases are ignored.
|
|
||||||
if (release)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
MyGUI::KeyCode key = MyGUI::KeyCode::None;
|
MyGUI::KeyCode key = MyGUI::KeyCode::None;
|
||||||
switch (arg.button)
|
switch (arg.button)
|
||||||
|
@ -381,9 +383,6 @@ namespace MWInput
|
||||||
case A_GameMenu:
|
case A_GameMenu:
|
||||||
toggleMainMenu ();
|
toggleMainMenu ();
|
||||||
break;
|
break;
|
||||||
case A_OptionsMenu:
|
|
||||||
toggleOptionsMenu();
|
|
||||||
break;
|
|
||||||
case A_Screenshot:
|
case A_Screenshot:
|
||||||
screenshot();
|
screenshot();
|
||||||
break;
|
break;
|
||||||
|
@ -401,8 +400,7 @@ namespace MWInput
|
||||||
case A_MoveRight:
|
case A_MoveRight:
|
||||||
case A_MoveForward:
|
case A_MoveForward:
|
||||||
case A_MoveBackward:
|
case A_MoveBackward:
|
||||||
// Temporary shut-down of this function until deemed necessary.
|
handleGuiArrowKey(action);
|
||||||
//handleGuiArrowKey(action);
|
|
||||||
break;
|
break;
|
||||||
case A_Journal:
|
case A_Journal:
|
||||||
toggleJournal ();
|
toggleJournal ();
|
||||||
|
@ -1000,9 +998,9 @@ namespace MWInput
|
||||||
mJoystickLastUsed = true;
|
mJoystickLastUsed = true;
|
||||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
{
|
{
|
||||||
if (gamepadToGuiControl(arg, false))
|
if (gamepadToGuiControl(arg))
|
||||||
return;
|
return;
|
||||||
else if (mGamepadGuiCursorEnabled)
|
if (mGamepadGuiCursorEnabled)
|
||||||
{
|
{
|
||||||
// Temporary mouse binding until keyboard controls are available:
|
// Temporary mouse binding until keyboard controls are available:
|
||||||
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
|
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
|
||||||
|
@ -1043,9 +1041,7 @@ namespace MWInput
|
||||||
mJoystickLastUsed = true;
|
mJoystickLastUsed = true;
|
||||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
{
|
{
|
||||||
if (gamepadToGuiControl(arg, true))
|
if (mGamepadGuiCursorEnabled)
|
||||||
return;
|
|
||||||
else if (mGamepadGuiCursorEnabled)
|
|
||||||
{
|
{
|
||||||
// Temporary mouse binding until keyboard controls are available:
|
// Temporary mouse binding until keyboard controls are available:
|
||||||
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
|
if (arg.button == SDL_CONTROLLER_BUTTON_A) // We'll pretend that A is left click.
|
||||||
|
@ -1144,37 +1140,19 @@ namespace MWInput
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||||
return;
|
|
||||||
|
|
||||||
bool inGame = MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame;
|
|
||||||
MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
|
||||||
|
|
||||||
if ((inGame && mode == MWGui::GM_MainMenu) || mode == MWGui::GM_Settings)
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
||||||
|
|
||||||
if (inGame && mode != MWGui::GM_MainMenu)
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_MainMenu);
|
|
||||||
}
|
|
||||||
|
|
||||||
void InputManager::toggleOptionsMenu()
|
|
||||||
{
|
|
||||||
if (MyGUI::InputManager::getInstance().isModalAny())
|
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager()->exitCurrentModal();
|
MWBase::Environment::get().getWindowManager()->toggleConsole();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
if (!MWBase::Environment::get().getWindowManager()->isGuiMode()) //No open GUIs, open up the MainMenu
|
||||||
return;
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
|
||||||
MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
}
|
||||||
bool inGame = MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame;
|
else //Close current GUI
|
||||||
|
{
|
||||||
if ((inGame && mode == MWGui::GM_MainMenu) || mode == MWGui::GM_Settings)
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
}
|
||||||
|
|
||||||
if (inGame && mode != MWGui::GM_Settings)
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::quickLoad() {
|
void InputManager::quickLoad() {
|
||||||
|
@ -1529,7 +1507,6 @@ namespace MWInput
|
||||||
defaultButtonBindings[A_TogglePOV] = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
|
defaultButtonBindings[A_TogglePOV] = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
|
||||||
defaultButtonBindings[A_Inventory] = SDL_CONTROLLER_BUTTON_B;
|
defaultButtonBindings[A_Inventory] = SDL_CONTROLLER_BUTTON_B;
|
||||||
defaultButtonBindings[A_GameMenu] = SDL_CONTROLLER_BUTTON_START;
|
defaultButtonBindings[A_GameMenu] = SDL_CONTROLLER_BUTTON_START;
|
||||||
defaultButtonBindings[A_OptionsMenu] = SDL_CONTROLLER_BUTTON_BACK;
|
|
||||||
defaultButtonBindings[A_QuickSave] = SDL_CONTROLLER_BUTTON_GUIDE;
|
defaultButtonBindings[A_QuickSave] = SDL_CONTROLLER_BUTTON_GUIDE;
|
||||||
defaultButtonBindings[A_MoveForward] = SDL_CONTROLLER_BUTTON_DPAD_UP;
|
defaultButtonBindings[A_MoveForward] = SDL_CONTROLLER_BUTTON_DPAD_UP;
|
||||||
defaultButtonBindings[A_MoveLeft] = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
|
defaultButtonBindings[A_MoveLeft] = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
|
||||||
|
@ -1610,7 +1587,6 @@ namespace MWInput
|
||||||
descriptions[A_Journal] = "sJournal";
|
descriptions[A_Journal] = "sJournal";
|
||||||
descriptions[A_Rest] = "sRestKey";
|
descriptions[A_Rest] = "sRestKey";
|
||||||
descriptions[A_Inventory] = "sInventory";
|
descriptions[A_Inventory] = "sInventory";
|
||||||
descriptions[A_OptionsMenu] = "sPreferences";
|
|
||||||
descriptions[A_TogglePOV] = "sTogglePOVCmd";
|
descriptions[A_TogglePOV] = "sTogglePOVCmd";
|
||||||
descriptions[A_QuickKeysMenu] = "sQuickMenu";
|
descriptions[A_QuickKeysMenu] = "sQuickMenu";
|
||||||
descriptions[A_QuickKey1] = "sQuick1Cmd";
|
descriptions[A_QuickKey1] = "sQuick1Cmd";
|
||||||
|
@ -1748,7 +1724,6 @@ namespace MWInput
|
||||||
ret.push_back(A_Inventory);
|
ret.push_back(A_Inventory);
|
||||||
ret.push_back(A_Journal);
|
ret.push_back(A_Journal);
|
||||||
ret.push_back(A_Rest);
|
ret.push_back(A_Rest);
|
||||||
ret.push_back(A_OptionsMenu);
|
|
||||||
ret.push_back(A_Console);
|
ret.push_back(A_Console);
|
||||||
ret.push_back(A_QuickSave);
|
ret.push_back(A_QuickSave);
|
||||||
ret.push_back(A_QuickLoad);
|
ret.push_back(A_QuickLoad);
|
||||||
|
@ -1781,7 +1756,6 @@ namespace MWInput
|
||||||
ret.push_back(A_Inventory);
|
ret.push_back(A_Inventory);
|
||||||
ret.push_back(A_Journal);
|
ret.push_back(A_Journal);
|
||||||
ret.push_back(A_Rest);
|
ret.push_back(A_Rest);
|
||||||
ret.push_back(A_OptionsMenu);
|
|
||||||
ret.push_back(A_QuickSave);
|
ret.push_back(A_QuickSave);
|
||||||
ret.push_back(A_QuickLoad);
|
ret.push_back(A_QuickLoad);
|
||||||
ret.push_back(A_Screenshot);
|
ret.push_back(A_Screenshot);
|
||||||
|
|
|
@ -225,7 +225,7 @@ namespace MWInput
|
||||||
void setPlayerControlsEnabled(bool enabled);
|
void setPlayerControlsEnabled(bool enabled);
|
||||||
void handleGuiArrowKey(int action);
|
void handleGuiArrowKey(int action);
|
||||||
// Return true if GUI consumes input.
|
// Return true if GUI consumes input.
|
||||||
bool gamepadToGuiControl(const SDL_ControllerButtonEvent &arg, bool release);
|
bool gamepadToGuiControl(const SDL_ControllerButtonEvent &arg);
|
||||||
bool gamepadToGuiControl(const SDL_ControllerAxisEvent &arg);
|
bool gamepadToGuiControl(const SDL_ControllerAxisEvent &arg);
|
||||||
|
|
||||||
void updateCursorMode();
|
void updateCursorMode();
|
||||||
|
@ -234,7 +234,6 @@ namespace MWInput
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void toggleMainMenu();
|
void toggleMainMenu();
|
||||||
void toggleOptionsMenu();
|
|
||||||
void toggleSpell();
|
void toggleSpell();
|
||||||
void toggleWeapon();
|
void toggleWeapon();
|
||||||
void toggleInventory();
|
void toggleInventory();
|
||||||
|
@ -327,8 +326,6 @@ namespace MWInput
|
||||||
A_MoveForwardBackward,
|
A_MoveForwardBackward,
|
||||||
A_MoveLeftRight,
|
A_MoveLeftRight,
|
||||||
|
|
||||||
A_OptionsMenu,
|
|
||||||
|
|
||||||
A_Last // Marker for the last item
|
A_Last // Marker for the last item
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue