Remove outdated joystick preprocessor guards
Testing for buttons||hats||axes is equivalent to testing for joysticks!=0, since SConstruct forces joysticks=0 when buttons == 0 && hats == 0 && axes == 0. Remove tests of buttons||hats||axes when those occur inside a test for joysticks!=0.
This commit is contained in:
parent
4f26a205ea
commit
6af56a27f2
|
@ -339,10 +339,8 @@ void joy_init()
|
|||
#if DXX_MAX_AXES_PER_JOYSTICK
|
||||
joyaxis_text.clear();
|
||||
#endif
|
||||
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK || DXX_MAX_AXES_PER_JOYSTICK
|
||||
joybutton_text.clear();
|
||||
joy_key_map.clear();
|
||||
#endif
|
||||
|
||||
const auto n = check_warn_joy_support_limit(SDL_NumJoysticks(), "joystick", DXX_MAX_JOYSTICKS);
|
||||
cf_assert(n <= DXX_MAX_JOYSTICKS);
|
||||
|
@ -374,7 +372,6 @@ void joy_init()
|
|||
const auto n_axes = 0;
|
||||
#endif
|
||||
|
||||
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK || DXX_MAX_AXES_PER_JOYSTICK
|
||||
const auto n_buttons = check_warn_joy_support_limit(SDL_JoystickNumButtons(handle), "button", DXX_MAX_BUTTONS_PER_JOYSTICK);
|
||||
const auto n_hats = check_warn_joy_support_limit(SDL_JoystickNumHats(handle), "hat", DXX_MAX_HATS_PER_JOYSTICK);
|
||||
|
||||
|
@ -424,7 +421,6 @@ void joy_init()
|
|||
joy_key_map[joystick_n_buttons] = (e.idx == 1) ? KEY_LEFT : (e.idx == 2) ? KEY_UP : 0;
|
||||
snprintf(&joybutton_text[joystick_n_buttons++][0], sizeof(joybutton_text[0]), "J%u +A%u", i + 1, e.idx);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
num_joysticks++;
|
||||
|
@ -444,9 +440,7 @@ void joy_close()
|
|||
#if DXX_MAX_AXES_PER_JOYSTICK
|
||||
joyaxis_text.clear();
|
||||
#endif
|
||||
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK || DXX_MAX_AXES_PER_JOYSTICK
|
||||
joybutton_text.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
const d_event_joystick_axis_value &event_joystick_get_axis(const d_event &event)
|
||||
|
|
|
@ -202,12 +202,10 @@ using joyaxis_text_t = joystick_text_t<sizeof("J A") + number_to_text_length<DXX
|
|||
extern joyaxis_text_t joyaxis_text;
|
||||
#endif
|
||||
|
||||
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK || DXX_MAX_AXES_PER_JOYSTICK
|
||||
#define DXX_JOY_MAX(A,B) ((A) < (B) ? (B) : (A))
|
||||
using joybutton_text_t = joystick_text_t<number_to_text_length<DXX_MAX_JOYSTICKS> + DXX_JOY_MAX(DXX_JOY_MAX(sizeof("J H ") + number_to_text_length<DXX_MAX_HATS_PER_JOYSTICK>, sizeof("J B") + number_to_text_length<DXX_MAX_BUTTONS_PER_JOYSTICK>), sizeof("J -A") + number_to_text_length<DXX_MAX_AXES_PER_JOYSTICK>)>;
|
||||
#undef DXX_JOY_MAX
|
||||
extern joybutton_text_t joybutton_text;
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -91,7 +91,7 @@ const std::array<sbyte, 64> fades{{
|
|||
}};
|
||||
|
||||
const std::array<char[2], 2> invert_text{{"N", "Y"}};
|
||||
#if DXX_MAX_BUTTONS_PER_JOYSTICK || DXX_MAX_HATS_PER_JOYSTICK
|
||||
#if DXX_MAX_JOYSTICKS
|
||||
joybutton_text_t joybutton_text;
|
||||
#endif
|
||||
#if DXX_MAX_AXES_PER_JOYSTICK
|
||||
|
|
Loading…
Reference in a new issue