Merge pull request #64531 from madmiraal/fix-63972-2
Fix axis mapped to DPad buttons not releasing opposite button
This commit is contained in:
commit
d0a2a4c981
1 changed files with 3 additions and 5 deletions
|
@ -971,11 +971,9 @@ void Input::joy_axis(int p_device, JoyAxis p_axis, float p_value) {
|
||||||
|
|
||||||
if (map.type == TYPE_BUTTON) {
|
if (map.type == TYPE_BUTTON) {
|
||||||
bool pressed = map.value > 0.5;
|
bool pressed = map.value > 0.5;
|
||||||
if (pressed == joy_buttons_pressed.has(_combine_device((JoyButton)map.index, p_device))) {
|
if (pressed != joy_buttons_pressed.has(_combine_device((JoyButton)map.index, p_device))) {
|
||||||
// Button already pressed or released; so ignore.
|
_button_event(p_device, (JoyButton)map.index, pressed);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
_button_event(p_device, (JoyButton)map.index, pressed);
|
|
||||||
|
|
||||||
// Ensure opposite D-Pad button is also released.
|
// Ensure opposite D-Pad button is also released.
|
||||||
switch ((JoyButton)map.index) {
|
switch ((JoyButton)map.index) {
|
||||||
|
@ -1126,7 +1124,7 @@ Input::JoyEvent Input::_get_mapped_axis_event(const JoyDeviceMapping &mapping, J
|
||||||
value = -value;
|
value = -value;
|
||||||
}
|
}
|
||||||
if (binding.input.axis.range == FULL_AXIS ||
|
if (binding.input.axis.range == FULL_AXIS ||
|
||||||
(binding.input.axis.range == POSITIVE_HALF_AXIS && value > 0) ||
|
(binding.input.axis.range == POSITIVE_HALF_AXIS && value >= 0) ||
|
||||||
(binding.input.axis.range == NEGATIVE_HALF_AXIS && value < 0)) {
|
(binding.input.axis.range == NEGATIVE_HALF_AXIS && value < 0)) {
|
||||||
event.type = binding.outputType;
|
event.type = binding.outputType;
|
||||||
float shifted_positive_value = 0;
|
float shifted_positive_value = 0;
|
||||||
|
|
Loading…
Reference in a new issue