From 4890591ba50bfc8b11cda684b223cb7c551e6dd3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 30 Apr 2014 22:56:04 -0400 Subject: joystick: Add virtual-physical button mapping. The solution to solving #386 is to add a layer of indirection: the game code can only support up to ~20 joystick buttons, but this doesn't matter as long as we never want to bind more than 20 buttons to actions anyway. Redefine the game's notion of buttons to be based on "virtual" joystick buttons, and map these buttons to physical (SDL) buttons based on configuration file variables. --- src/m_config.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'src/m_config.c') diff --git a/src/m_config.c b/src/m_config.c index 898c9368..90d3776f 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -938,6 +938,66 @@ static default_t extra_defaults_list[] = CONFIG_VARIABLE_INT(joystick_strafe_invert), + //! + // The physical joystick button that corresponds to button #0. + // + + CONFIG_VARIABLE_INT(joystick_physical_button0), + + //! + // The physical joystick button that corresponds to button #1. + // + + CONFIG_VARIABLE_INT(joystick_physical_button1), + + //! + // The physical joystick button that corresponds to button #2. + // + + CONFIG_VARIABLE_INT(joystick_physical_button2), + + //! + // The physical joystick button that corresponds to button #3. + // + + CONFIG_VARIABLE_INT(joystick_physical_button3), + + //! + // The physical joystick button that corresponds to button #4. + // + + CONFIG_VARIABLE_INT(joystick_physical_button4), + + //! + // The physical joystick button that corresponds to button #5. + // + + CONFIG_VARIABLE_INT(joystick_physical_button5), + + //! + // The physical joystick button that corresponds to button #6. + // + + CONFIG_VARIABLE_INT(joystick_physical_button6), + + //! + // The physical joystick button that corresponds to button #7. + // + + CONFIG_VARIABLE_INT(joystick_physical_button7), + + //! + // The physical joystick button that corresponds to button #8. + // + + CONFIG_VARIABLE_INT(joystick_physical_button8), + + //! + // The physical joystick button that corresponds to button #9. + // + + CONFIG_VARIABLE_INT(joystick_physical_button9), + //! // Joystick button to strafe left. // -- cgit v1.2.3