mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-25 18:39:18 +01:00
Fix axis mapped to DPad buttons not releasing opposite button
This commit is contained in:
parent
eecd2b11df
commit
8e94d451b4
@ -847,11 +847,9 @@ void InputDefault::joy_axis(int p_device, int p_axis, float p_value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool pressed = map.value > 0.5;
|
bool pressed = map.value > 0.5;
|
||||||
if (pressed == joy_buttons_pressed.has(_combine_device(map.index, p_device))) {
|
if (pressed != joy_buttons_pressed.has(_combine_device(map.index, p_device))) {
|
||||||
// Button already pressed or released; so ignore.
|
_button_event(p_device, map.index, pressed);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
_button_event(p_device, map.index, pressed);
|
|
||||||
|
|
||||||
// Ensure opposite D-Pad button is also released.
|
// Ensure opposite D-Pad button is also released.
|
||||||
switch (map.index) {
|
switch (map.index) {
|
||||||
@ -998,7 +996,7 @@ InputDefault::JoyEvent InputDefault::_get_mapped_axis_event(const JoyDeviceMappi
|
|||||||
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 New Issue
Block a user