From 2f67325278637a349bb86fa6fc388e527a75a5c9 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Mon, 24 Nov 2008 19:01:09 +0000 Subject: Make chocolate-setup use m_controls.c definitions for config file keyboard/mouse/joystick variables. Make other configuration file variables static and add bind functions. Subversion-branch: /branches/raven-branch Subversion-revision: 1387 --- src/Makefile.am | 1 + src/setup/compatibility.c | 7 +++++++ src/setup/compatibility.h | 4 +--- src/setup/display.c | 31 +++++++++++++++++++++++-------- src/setup/display.h | 9 +-------- src/setup/joystick.c | 31 +++++++++++++++++-------------- src/setup/joystick.h | 13 +------------ src/setup/keyboard.c | 20 ++++++++------------ src/setup/keyboard.h | 14 +------------- src/setup/mouse.c | 34 ++++++++++++++++++---------------- src/setup/mouse.h | 18 +----------------- 11 files changed, 79 insertions(+), 103 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 8e1e7544..3438099f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -150,6 +150,7 @@ chocolate_hexen_LDADD = hexen/libhexen.a $(EXTRA_LIBS) SETUP_FILES= \ m_config.c m_config.h \ +m_controls.c m_controls.h \ z_native.c z_zone.h chocolate_setup_SOURCES=$(SETUP_FILES) $(COMMON_SOURCE_FILES) diff --git a/src/setup/compatibility.c b/src/setup/compatibility.c index bebf5a87..4553f6bb 100644 --- a/src/setup/compatibility.c +++ b/src/setup/compatibility.c @@ -23,6 +23,7 @@ #include +#include "m_config.h" #include "textscreen.h" #include "compatibility.h" @@ -44,3 +45,9 @@ void CompatibilitySettings(void) NULL); } +void BindCompatibilityVariables(void) +{ + M_BindVariable("vanilla_savegame_limit", &vanilla_savegame_limit); + M_BindVariable("vanilla_demo_limit", &vanilla_demo_limit); +} + diff --git a/src/setup/compatibility.h b/src/setup/compatibility.h index 1d46b174..386a4798 100644 --- a/src/setup/compatibility.h +++ b/src/setup/compatibility.h @@ -22,10 +22,8 @@ #ifndef SETUP_COMPATIBILITY_H #define SETUP_COMPATIBILITY_H -extern int vanilla_savegame_limit; -extern int vanilla_demo_limit; - void CompatibilitySettings(void); +void BindCompatibilityVariables(void); #endif /* #ifndef SETUP_COMPATIBILITY_H */ diff --git a/src/setup/display.c b/src/setup/display.c index 5e9d4fcf..efb659a3 100644 --- a/src/setup/display.c +++ b/src/setup/display.c @@ -22,6 +22,7 @@ #include #include "textscreen.h" +#include "m_config.h" #include "display.h" @@ -65,14 +66,14 @@ static screen_mode_t *screen_modes_fullscreen = NULL; static int vidmode = 0; -char *video_driver = ""; -int autoadjust_video_settings = 1; -int aspect_ratio_correct = 1; -int fullscreen = 1; -int screen_width = 320; -int screen_height = 200; -int startup_delay = 1000; -int show_endoom = 1; +static char *video_driver = ""; +static int autoadjust_video_settings = 1; +static int aspect_ratio_correct = 1; +static int fullscreen = 1; +static int screen_width = 320; +static int screen_height = 200; +static int startup_delay = 1000; +static int show_endoom = 1; // These are the last screen width/height values that were chosen by the // user. These are used when finding the "nearest" mode, so when @@ -436,3 +437,17 @@ void ConfigDisplay(void) GenerateModesTable(NULL, modes_table); } +void BindDisplayVariables(void) +{ + M_BindVariable("autoadjust_video_settings", &autoadjust_video_settings); + M_BindVariable("aspect_ratio_correct", &aspect_ratio_correct); + M_BindVariable("fullscreen", &fullscreen); + M_BindVariable("screen_width", &screen_width); + M_BindVariable("screen_height", &screen_height); + M_BindVariable("startup_delay", &startup_delay); + M_BindVariable("video_driver", &video_driver); + + // doom, heretic only: + M_BindVariable("show_endoom", &show_endoom); +} + diff --git a/src/setup/display.h b/src/setup/display.h index f0c76184..2c17d8c4 100644 --- a/src/setup/display.h +++ b/src/setup/display.h @@ -22,16 +22,9 @@ #ifndef SETUP_DISPLAY_H #define SETUP_DISPLAY_H -extern int autoadjust_video_settings; -extern int aspect_ratio_correct; -extern int fullscreen; -extern int screen_width, screen_height; -extern int startup_delay; -extern int show_endoom; -extern char *video_driver; - void ConfigDisplay(void); void SetDisplayDriver(void); +void BindDisplayVariables(void); #endif /* #ifndef SETUP_DISPLAY_H */ diff --git a/src/setup/joystick.c b/src/setup/joystick.c index 69c0e508..9b064905 100644 --- a/src/setup/joystick.c +++ b/src/setup/joystick.c @@ -23,6 +23,8 @@ #include #include "doomtype.h" +#include "m_config.h" +#include "m_controls.h" #include "textscreen.h" #include "txt_joybinput.h" @@ -41,16 +43,7 @@ static int joystick_initted = 0; // Joystick enable/disable -int usejoystick = 0; - -// Button mappings - -int joybfire = 0; -int joybstrafe = 1; -int joybuse = 2; -int joybspeed = 3; -int joybstrafeleft = -1; -int joybstraferight = -1; +static int usejoystick = 0; // Joystick to use, as an SDL joystick index: @@ -59,14 +52,14 @@ 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; static txt_button_t *joystick_button; @@ -438,3 +431,13 @@ void ConfigJoystick(void) SetJoystickButtonLabel(); } +void 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); +} + diff --git a/src/setup/joystick.h b/src/setup/joystick.h index 39cf0bf4..b6dd09b9 100644 --- a/src/setup/joystick.h +++ b/src/setup/joystick.h @@ -22,21 +22,10 @@ #ifndef SETUP_JOYSTICK_H #define SETUP_JOYSTICK_H -extern int usejoystick; -extern int joybfire; -extern int joybstrafe; -extern int joybuse; -extern int joybspeed; -extern int joybstrafeleft; -extern int joybstraferight; - extern int joystick_index; -extern int joystick_x_axis; -extern int joystick_x_invert; -extern int joystick_y_axis; -extern int joystick_y_invert; void ConfigJoystick(void); +void BindJoystickVariables(void); #endif /* #ifndef SETUP_JOYSTICK_H */ diff --git a/src/setup/keyboard.c b/src/setup/keyboard.c index 3a7ccb8f..908e5c7a 100644 --- a/src/setup/keyboard.c +++ b/src/setup/keyboard.c @@ -20,6 +20,8 @@ // #include "textscreen.h" #include "doomtype.h" +#include "m_config.h" +#include "m_controls.h" #include "execute.h" #include "txt_keyinput.h" @@ -27,18 +29,7 @@ #include "joystick.h" #include "keyboard.h" -int key_left = KEY_LEFTARROW; -int key_right = KEY_RIGHTARROW; -int key_up = KEY_UPARROW; -int key_down = KEY_DOWNARROW; -int key_strafeleft = ','; -int key_straferight = '.'; -int key_fire = KEY_RCTRL; -int key_use = ' '; -int key_strafe = KEY_RALT; -int key_speed = KEY_RSHIFT; - -int vanilla_keyboard_mapping = 1; +static int vanilla_keyboard_mapping = 1; static int always_run = 0; @@ -141,3 +132,8 @@ void ConfigKeyboard(void) TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction()); } +void BindKeyboardVariables(void) +{ + M_BindVariable("vanilla_keyboard_mapping", &vanilla_keyboard_mapping); +} + diff --git a/src/setup/keyboard.h b/src/setup/keyboard.h index 6442e1e4..12059bf8 100644 --- a/src/setup/keyboard.h +++ b/src/setup/keyboard.h @@ -22,20 +22,8 @@ #ifndef SETUP_KEYBOARD_H #define SETUP_KEYBOARD_H -extern int key_left; -extern int key_right; -extern int key_up; -extern int key_down; -extern int key_strafeleft; -extern int key_straferight; -extern int key_fire; -extern int key_use; -extern int key_strafe; -extern int key_speed; -extern int joybspeed; -extern int vanilla_keyboard_mapping; - void ConfigKeyboard(void); +void BindKeyboardVariables(void); #endif /* #ifndef SETUP_KEYBOARD_H */ diff --git a/src/setup/mouse.c b/src/setup/mouse.c index 49266d48..16b8045f 100644 --- a/src/setup/mouse.c +++ b/src/setup/mouse.c @@ -23,29 +23,21 @@ #include "textscreen.h" #include "doomtype.h" +#include "m_config.h" +#include "m_controls.h" #include "execute.h" #include "txt_mouseinput.h" #include "mouse.h" -int usemouse = 1; +static int usemouse = 1; -int novert = 0; -int mouseSensitivity = 5; -float mouse_acceleration = 1.0; -int mouse_threshold = 10; -int grabmouse = 1; - -int mousebfire = 0; -int mousebforward = 1; -int mousebstrafe = 2; -int mousebstrafeleft = -1; -int mousebstraferight = -1; -int mousebbackward = -1; -int mousebuse = -1; - -int dclick_use = 1; +static int novert = 0; +static int mouseSensitivity = 5; +static float mouse_acceleration = 1.0; +static int mouse_threshold = 10; +static int grabmouse = 1; static int *all_mouse_buttons[] = { &mousebfire, @@ -155,3 +147,13 @@ void ConfigMouse(void) TXT_SignalConnect(more_buttons, "pressed", ConfigExtraButtons, NULL); } +void BindMouseVariables(void) +{ + M_BindVariable("use_mouse", &usemouse); + M_BindVariable("novert", &novert); + M_BindVariable("mouse_sensitivity", &mouseSensitivity); + M_BindVariable("mouse_acceleration", &mouse_acceleration); + M_BindVariable("mouse_threshold", &mouse_threshold); + M_BindVariable("grabmouse", &grabmouse); +} + diff --git a/src/setup/mouse.h b/src/setup/mouse.h index f0a39ade..cdaa541a 100644 --- a/src/setup/mouse.h +++ b/src/setup/mouse.h @@ -22,24 +22,8 @@ #ifndef SETUP_MOUSE_H #define SETUP_MOUSE_H -extern int usemouse; - -extern int novert; -extern int mouseSensitivity; -extern float mouse_acceleration; -extern int mouse_threshold; -extern int grabmouse; -extern int mousebfire; -extern int mousebforward; -extern int mousebstrafe; -extern int mousebstrafeleft; -extern int mousebstraferight; -extern int mousebbackward; -extern int mousebuse; -extern int dclick_use; - void ConfigMouse(void); - +void BindMouseVariables(void); #endif /* #ifndef SETUP_MOUSE_H */ -- cgit v1.2.3