From b868352951acee0e556d702e5e90aa67d9a2b39e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 11 Sep 2008 21:03:48 +0000 Subject: Refactor configuration file system to allow configuration file variables to be bound in a distributed fashion around the program. Remove dependency of m_config.c on doom/. Subversion-branch: /branches/raven-branch Subversion-revision: 1222 --- src/i_joystick.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/i_joystick.c') diff --git a/src/i_joystick.c b/src/i_joystick.c index 1547e569..d11d3084 100644 --- a/src/i_joystick.c +++ b/src/i_joystick.c @@ -35,6 +35,8 @@ #include "d_event.h" #include "i_joystick.h" +#include "m_config.h" + // When an axis is within the dead zone, it is set to zero. // This is 5% of the full range: @@ -46,23 +48,23 @@ static SDL_Joystick *joystick = NULL; // Standard default.cfg Joystick enable/disable -extern int usejoystick; +static int usejoystick = 0; // Joystick to use, as an SDL joystick index: -int joystick_index = -1; +static int joystick_index = -1; // Which joystick axis to use for horizontal movement, and whether to // invert the direction: -int joystick_x_axis = 0; -int joystick_x_invert = 0; +static int joystick_x_axis = 0; +static int joystick_x_invert = 0; // Which joystick axis to use for vertical movement, and whether to // invert the direction: -int joystick_y_axis = 1; -int joystick_y_invert = 0; +static int joystick_y_axis = 1; +static int joystick_y_invert = 0; void I_InitJoystick(void) { @@ -184,3 +186,13 @@ void I_UpdateJoystick(void) } } +void I_BindJoystickVariables(void) +{ + M_BindVariable("use_joystick", &usejoystick); + M_BindVariable("joystick_index", &joystick_index); + M_BindVariable("joystick_x_axis", &joystick_x_axis); + M_BindVariable("joystick_y_axis", &joystick_y_axis); + M_BindVariable("joystick_x_invert", &joystick_x_invert); + M_BindVariable("joystick_y_invert", &joystick_y_invert); +} + -- cgit v1.2.3