diff options
Diffstat (limited to 'setup')
-rw-r--r-- | setup/configfile.c | 22 | ||||
-rw-r--r-- | setup/keyboard.c | 84 | ||||
-rw-r--r-- | setup/keyboard.h | 28 |
3 files changed, 130 insertions, 4 deletions
diff --git a/setup/configfile.c b/setup/configfile.c index 97e06744..5013e3ce 100644 --- a/setup/configfile.c +++ b/setup/configfile.c @@ -283,6 +283,7 @@ static default_t extra_defaults_list[] = {"mouseb_use", &mousebuse, DEFAULT_INT, 0, 0}, {"mouseb_backward", &mousebbackward, DEFAULT_INT, 0, 0}, {"use_libsamplerate", &use_libsamplerate, DEFAULT_INT, 0, 0}, + {"key_menu_activate", &key_menu_activate, DEFAULT_KEY, 0, 0}, {"key_menu_up", &key_menu_up, DEFAULT_KEY, 0, 0}, {"key_menu_down", &key_menu_down, DEFAULT_KEY, 0, 0}, @@ -305,6 +306,27 @@ static default_t extra_defaults_list[] = {"key_menu_gamma", &key_menu_gamma, DEFAULT_KEY, 0, 0}, {"key_menu_incscreen", &key_menu_incscreen, DEFAULT_KEY, 0, 0}, {"key_menu_decscreen", &key_menu_decscreen, DEFAULT_KEY, 0, 0}, + + {"key_map_toggle", &key_map_toggle, DEFAULT_KEY, 0, 0}, + {"key_map_north", &key_map_north, DEFAULT_KEY, 0, 0}, + {"key_map_south", &key_map_south, DEFAULT_KEY, 0, 0}, + {"key_map_east", &key_map_east, DEFAULT_KEY, 0, 0}, + {"key_map_west", &key_map_west, DEFAULT_KEY, 0, 0}, + {"key_map_zoomin", &key_map_zoomin, DEFAULT_KEY, 0, 0}, + {"key_map_zoomout", &key_map_zoomout, DEFAULT_KEY, 0, 0}, + {"key_map_maxzoom", &key_map_maxzoom, DEFAULT_KEY, 0, 0}, + {"key_map_follow", &key_map_follow, DEFAULT_KEY, 0, 0}, + {"key_map_grid", &key_map_grid, DEFAULT_KEY, 0, 0}, + {"key_map_mark", &key_map_mark, DEFAULT_KEY, 0, 0}, + {"key_map_clearmark", &key_map_clearmark, DEFAULT_KEY, 0, 0}, + {"key_weapon1", &key_weapon1, DEFAULT_KEY, 0, 0}, + {"key_weapon2", &key_weapon2, DEFAULT_KEY, 0, 0}, + {"key_weapon3", &key_weapon3, DEFAULT_KEY, 0, 0}, + {"key_weapon4", &key_weapon4, DEFAULT_KEY, 0, 0}, + {"key_weapon5", &key_weapon5, DEFAULT_KEY, 0, 0}, + {"key_weapon6", &key_weapon6, DEFAULT_KEY, 0, 0}, + {"key_weapon7", &key_weapon7, DEFAULT_KEY, 0, 0}, + {"key_weapon8", &key_weapon8, DEFAULT_KEY, 0, 0}, }; static default_collection_t extra_defaults = diff --git a/setup/keyboard.c b/setup/keyboard.c index c587f80e..27ade663 100644 --- a/setup/keyboard.c +++ b/setup/keyboard.c @@ -66,6 +66,28 @@ int key_menu_gamma = KEY_F11; int key_menu_incscreen = KEY_EQUALS; int key_menu_decscreen = KEY_MINUS; +int key_map_north = KEY_UPARROW; +int key_map_south = KEY_DOWNARROW; +int key_map_east = KEY_RIGHTARROW; +int key_map_west = KEY_LEFTARROW; +int key_map_zoomin = '='; +int key_map_zoomout = '-'; +int key_map_toggle = KEY_TAB; +int key_map_maxzoom = '0'; +int key_map_follow = 'f'; +int key_map_grid = 'g'; +int key_map_mark = 'm'; +int key_map_clearmark = 'c'; + +int key_weapon1 = '1'; +int key_weapon2 = '2'; +int key_weapon3 = '3'; +int key_weapon4 = '4'; +int key_weapon5 = '5'; +int key_weapon6 = '6'; +int key_weapon7 = '7'; +int key_weapon8 = '8'; + int vanilla_keyboard_mapping = 1; static int always_run = 0; @@ -74,7 +96,10 @@ static int always_run = 0; static int *controls[] = { &key_left, &key_right, &key_up, &key_down, &key_strafeleft, &key_straferight, &key_fire, - &key_use, &key_strafe, &key_speed, NULL }; + &key_use, &key_strafe, &key_speed, + &key_weapon1, &key_weapon2, &key_weapon3, + &key_weapon4, &key_weapon5, &key_weapon6, + &key_weapon7, &key_weapon8, NULL }; static int *menu_nav[] = { &key_menu_activate, &key_menu_up, &key_menu_down, &key_menu_left, &key_menu_right, &key_menu_back, @@ -86,6 +111,12 @@ static int *shortcuts[] = { &key_menu_help, &key_menu_save, &key_menu_load, &key_menu_qload, &key_menu_quit, &key_menu_gamma, &key_menu_incscreen, &key_menu_decscreen, NULL }; +static int *map_keys[] = { &key_map_north, &key_map_south, &key_map_east, + &key_map_west, &key_map_zoomin, &key_map_zoomout, + &key_map_toggle, &key_map_maxzoom, &key_map_follow, + &key_map_grid, &key_map_mark, &key_map_clearmark, + NULL }; + static void UpdateJoybSpeed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(var)) { if (always_run) @@ -156,6 +187,7 @@ static void KeySetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) CheckKeyGroup(variable, controls); CheckKeyGroup(variable, menu_nav); CheckKeyGroup(variable, shortcuts); + CheckKeyGroup(variable, map_keys); } // Add a label and keyboard input to the specified table. @@ -171,18 +203,37 @@ static void AddKeyControl(txt_table_t *table, char *name, int *var) TXT_SignalConnect(key_input, "set", KeySetCallback, var); } -static void MenuKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) +static void OtherKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) { txt_window_t *window; txt_table_t *table; txt_scrollpane_t *scrollpane; - window = TXT_NewWindow("Menu keys"); + window = TXT_NewWindow("Other keys"); table = TXT_NewTable(2); TXT_SetColumnWidths(table, 25, 10); + TXT_AddWidgets(table, TXT_NewLabel(" - Weapons - "), + TXT_NewStrut(0, 0), + NULL); + + AddKeyControl(table, "Weapon 1", &key_weapon1); + AddKeyControl(table, "Weapon 2", &key_weapon2); + AddKeyControl(table, "Weapon 3", &key_weapon3); + AddKeyControl(table, "Weapon 4", &key_weapon4); + AddKeyControl(table, "Weapon 5", &key_weapon5); + AddKeyControl(table, "Weapon 6", &key_weapon6); + AddKeyControl(table, "Weapon 7", &key_weapon7); + AddKeyControl(table, "Weapon 8", &key_weapon8); + + TXT_AddWidgets(table, TXT_NewStrut(0, 1), + TXT_NewStrut(0, 1), + TXT_NewLabel(" - Menu navigation - "), + TXT_NewStrut(0, 0), + NULL); + AddKeyControl(table, "Activate menu", &key_menu_activate); AddKeyControl(table, "Move cursor up", &key_menu_up); AddKeyControl(table, "Move cursor down", &key_menu_down); @@ -193,6 +244,12 @@ static void MenuKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) AddKeyControl(table, "Confirm action", &key_menu_confirm); AddKeyControl(table, "Cancel action", &key_menu_abort); + TXT_AddWidgets(table, TXT_NewStrut(0, 1), + TXT_NewStrut(0, 1), + TXT_NewLabel(" - Shortcut keys - "), + TXT_NewStrut(0, 0), + NULL); + AddKeyControl(table, "Help screen", &key_menu_help); AddKeyControl(table, "Save game", &key_menu_save); AddKeyControl(table, "Load game", &key_menu_load); @@ -208,6 +265,25 @@ static void MenuKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) AddKeyControl(table, "Increase screen size", &key_menu_incscreen); AddKeyControl(table, "Decrease screen size", &key_menu_decscreen); + TXT_AddWidgets(table, TXT_NewStrut(0, 1), + TXT_NewStrut(0, 1), + TXT_NewLabel(" - Map - "), + TXT_NewStrut(0, 0), + NULL); + + AddKeyControl(table, "Toggle map", &key_map_toggle); + AddKeyControl(table, "Zoom in", &key_map_zoomin); + AddKeyControl(table, "Zoom out", &key_map_zoomout); + AddKeyControl(table, "Maximum zoom out", &key_map_maxzoom); + AddKeyControl(table, "Follow mode", &key_map_follow); + AddKeyControl(table, "Pan north", &key_map_north); + AddKeyControl(table, "Pan south", &key_map_south); + AddKeyControl(table, "Pan east", &key_map_east); + AddKeyControl(table, "Pan west", &key_map_west); + AddKeyControl(table, "Toggle grid", &key_map_grid); + AddKeyControl(table, "Mark location", &key_map_mark); + AddKeyControl(table, "Clear all marks", &key_map_clearmark); + scrollpane = TXT_NewScrollPane(0, 12, table); TXT_AddWidget(window, scrollpane); @@ -230,7 +306,7 @@ void ConfigKeyboard(void) TXT_NewSeparator("Action"), action_table = TXT_NewTable(4), - TXT_NewButton2("Menu keys...", MenuKeysDialog, NULL), + TXT_NewButton2("Other keys...", OtherKeysDialog, NULL), NULL); TXT_AddWidgets(window, diff --git a/setup/keyboard.h b/setup/keyboard.h index 19ce7147..29ff2a1a 100644 --- a/setup/keyboard.h +++ b/setup/keyboard.h @@ -35,6 +35,8 @@ extern int key_speed; extern int joybspeed; extern int vanilla_keyboard_mapping; +// Menu keys: + extern int key_menu_activate; extern int key_menu_up; extern int key_menu_down; @@ -60,6 +62,32 @@ extern int key_menu_gamma; extern int key_menu_incscreen; extern int key_menu_decscreen; +// Automap keys: + +extern int key_map_north; +extern int key_map_south; +extern int key_map_east; +extern int key_map_west; +extern int key_map_zoomin; +extern int key_map_zoomout; +extern int key_map_toggle; +extern int key_map_maxzoom; +extern int key_map_follow; +extern int key_map_grid; +extern int key_map_mark; +extern int key_map_clearmark; + +// Weapon keys: + +extern int key_weapon1; +extern int key_weapon2; +extern int key_weapon3; +extern int key_weapon4; +extern int key_weapon5; +extern int key_weapon6; +extern int key_weapon7; +extern int key_weapon8; + void ConfigKeyboard(void); #endif /* #ifndef SETUP_KEYBOARD_H */ |