Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Input: Ignore mouse buttons in action bindings in the main menu
Otherwise the player can lock themselves out of the config menu by
binding the 'toggle fullscreen' or 'quick load' actions to the left
mouse button.

Fixes: issue #1136
  • Loading branch information
dscharrer committed Jan 17, 2018
1 parent bd0d815 commit 5d3d195
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/input/Input.cpp
Expand Up @@ -57,6 +57,7 @@ ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
#include "core/Config.h"
#include "core/GameTime.h"
#include "graphics/Math.h"
#include "gui/Menu.h"
#include "input/InputBackend.h"
#include "io/log/Logger.h"
#include "window/RenderWindow.h"
Expand Down Expand Up @@ -977,7 +978,7 @@ bool Input::actionNowPressed(ControlAction actionId) const {
}

if(key & Mouse::ButtonBase) {
if(getMouseButtonNowPressed(key)) {
if(ARXmenu.mode() != Mode_MainMenu && getMouseButtonNowPressed(key)) {
return true;
}
continue;
Expand Down Expand Up @@ -1018,8 +1019,9 @@ bool Input::actionPressed(ControlAction actionId) const {
for(int j = 0; j < 2; j++) {
if(config.actions[actionId].key[j] != -1) {
if(config.actions[actionId].key[j] & Mouse::ButtonBase) {
if(getMouseButtonRepeat(config.actions[actionId].key[j]))
if(ARXmenu.mode() != Mode_MainMenu && getMouseButtonRepeat(config.actions[actionId].key[j])) {
return true;
}
} else if(config.actions[actionId].key[j] & Mouse::WheelBase) {
if (config.actions[actionId].key[j] == Mouse::Wheel_Down) {
if(getMouseWheelDir() < 0)
Expand Down Expand Up @@ -1114,8 +1116,9 @@ bool Input::actionPressed(ControlAction actionId) const {
for(int j = 0; j < 2; j++) {
if(config.actions[actionId].key[j] != -1) {
if(config.actions[actionId].key[j] & Mouse::ButtonBase) {
if(getMouseButtonRepeat(config.actions[actionId].key[j]))
if(ARXmenu.mode() != Mode_MainMenu && getMouseButtonRepeat(config.actions[actionId].key[j])) {
return true;
}
} else if(config.actions[actionId].key[j] & Mouse::WheelBase) {
if(config.actions[actionId].key[j] == Mouse::Wheel_Down) {
if(getMouseWheelDir() < 0)
Expand Down Expand Up @@ -1152,7 +1155,7 @@ bool Input::actionNowReleased(ControlAction actionId) const {
}

if(key & Mouse::ButtonBase) {
if(getMouseButtonNowUnPressed(key)) {
if(ARXmenu.mode() != Mode_MainMenu && getMouseButtonNowUnPressed(key)) {
return true;
}
continue;
Expand Down

0 comments on commit 5d3d195

Please sign in to comment.