@@ -1676,7 +1676,7 @@ void Input::joy_button(int p_device, JoyButton p_button, bool p_pressed) {
16761676 }
16771677
16781678 if (map.type == TYPE_AXIS ) {
1679- _axis_event (p_device, (JoyAxis)map.index , p_pressed ? map.value : 0.0 , p_pressed ? 0.0 : map. value );
1679+ _axis_event (p_device, (JoyAxis)map.index , p_pressed ? map.value : 0.0 );
16801680 }
16811681 // no event?
16821682}
@@ -1696,13 +1696,10 @@ void Input::joy_axis(int p_device, JoyAxis p_axis, float p_value) {
16961696 return ;
16971697 }
16981698
1699- float last_axis = joy.last_axis [(size_t )p_axis];
1700- float last_val = last_axis;
17011699 joy.last_axis [(size_t )p_axis] = p_value;
1702- float val = p_value;
17031700
17041701 if (joy.mapping == -1 ) {
1705- _axis_event (p_device, p_axis, val, last_val );
1702+ _axis_event (p_device, p_axis, p_value );
17061703 return ;
17071704 }
17081705
@@ -1753,7 +1750,7 @@ void Input::joy_axis(int p_device, JoyAxis p_axis, float p_value) {
17531750 value = 0 .5f + value / 2 .0f ;
17541751 }
17551752#endif
1756- _axis_event (p_device, axis, value, last_val );
1753+ _axis_event (p_device, axis, value);
17571754 return ;
17581755 }
17591756}
@@ -1797,7 +1794,7 @@ void Input::joy_hat(int p_device, BitField<HatMask> p_val) {
17971794 _button_event (p_device, (JoyButton)map[hat_direction].index , (int )p_val & hat_mask);
17981795 }
17991796 if (map[hat_direction].type == TYPE_AXIS ) {
1800- _axis_event (p_device, (JoyAxis)map[hat_direction].index , ((int )p_val & hat_mask) ? map[hat_direction].value : 0.0 , (( int )p_val & hat_mask) ? 0.0 : map[hat_direction]. value );
1797+ _axis_event (p_device, (JoyAxis)map[hat_direction].index , ((int )p_val & hat_mask) ? map[hat_direction].value : 0.0 );
18011798 }
18021799 }
18031800 }
@@ -1836,30 +1833,14 @@ void Input::_button_event(int p_device, JoyButton p_index, bool p_pressed) {
18361833 parse_input_event (ievent);
18371834}
18381835
1839- void Input::_axis_event (int p_device, JoyAxis p_axis, float p_value, float p_last_value) {
1840- bool sign_diff = (p_last_value < 0 ) != (p_value < 0 );
1841- // Release event
1842- if ((p_value == 0 && p_last_value != 0 ) || sign_diff) {
1843- Ref<InputEventJoypadMotion> ievent;
1844- ievent.instantiate ();
1845- ievent->set_device (p_device);
1846- ievent->set_axis (p_axis);
1847- ievent->set_axis_value (p_last_value < 0 ? -CMP_EPSILON : CMP_EPSILON );
1848- ievent->set_axis_last_value (p_last_value);
1849-
1850- parse_input_event (ievent);
1851- }
1852- // Active event
1853- if (p_value != 0 ) {
1854- Ref<InputEventJoypadMotion> ievent;
1855- ievent.instantiate ();
1856- ievent->set_device (p_device);
1857- ievent->set_axis (p_axis);
1858- ievent->set_axis_value (p_value);
1859- ievent->set_axis_last_value (!sign_diff ? p_last_value : 0 );
1836+ void Input::_axis_event (int p_device, JoyAxis p_axis, float p_value) {
1837+ Ref<InputEventJoypadMotion> ievent;
1838+ ievent.instantiate ();
1839+ ievent->set_device (p_device);
1840+ ievent->set_axis (p_axis);
1841+ ievent->set_axis_value (p_value);
18601842
1861- parse_input_event (ievent);
1862- }
1843+ parse_input_event (ievent);
18631844}
18641845
18651846void Input::_update_action_cache (const StringName &p_action_name, ActionState &r_action_state) {
0 commit comments