ref: 557a502de5e1aa47ea2a002480ac7270cc6364bb
parent: 627017d833c095586533b4e0cda2b4289f4d924a
author: Simon Howard <fraggle@gmail.com>
date: Tue Jun 9 15:38:13 EDT 2009
Move menu/map/weapon key variables into common code, and bind variables. Subversion-branch: /branches/raven-branch Subversion-revision: 1581
--- a/src/doom/am_map.c
+++ b/src/doom/am_map.c
@@ -37,6 +37,7 @@
#include "w_wad.h"
#include "m_cheat.h"
+#include "m_controls.h"
#include "i_system.h"
// Needs access to LFB.
@@ -89,19 +90,6 @@
#define XHAIRCOLORS GRAYS
// drawing stuff
-
-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';
#define AM_NUMMARKPOINTS 10
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -353,6 +353,10 @@
I_BindSoundVariables();
M_BindBaseControls();
+ M_BindWeaponControls();
+ M_BindMapControls();
+ M_BindMenuControls();
+
#ifdef FEATURE_MULTIPLAYER
NET_BindVariables();
#endif
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -157,15 +157,6 @@
byte consistancy[MAXPLAYERS][BACKUPTICS];
-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';
-
#define MAXPLMOVE (forwardmove[1])
#define TURBOTHRESHOLD 0x32
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -53,6 +53,7 @@
#include "g_game.h"
#include "m_argv.h"
+#include "m_controls.h"
#include "p_saveg.h"
#include "s_sound.h"
@@ -71,35 +72,6 @@
extern boolean message_dontfuckwithme;
extern boolean chat_on; // in heads-up code
-
-//
-// menu keys:
-//
-
-int key_menu_activate = KEY_ESCAPE;
-int key_menu_up = KEY_UPARROW;
-int key_menu_down = KEY_DOWNARROW;
-int key_menu_left = KEY_LEFTARROW;
-int key_menu_right = KEY_RIGHTARROW;
-int key_menu_back = KEY_BACKSPACE;
-int key_menu_forward = KEY_ENTER;
-int key_menu_confirm = 'y';
-int key_menu_abort = 'n';
-
-int key_menu_help = KEY_F1;
-int key_menu_save = KEY_F2;
-int key_menu_load = KEY_F3;
-int key_menu_volume = KEY_F4;
-int key_menu_detail = KEY_F5;
-int key_menu_qsave = KEY_F6;
-int key_menu_endgame = KEY_F7;
-int key_menu_messages = KEY_F8;
-int key_menu_qload = KEY_F9;
-int key_menu_quit = KEY_F10;
-int key_menu_gamma = KEY_F11;
-
-int key_menu_incscreen = KEY_EQUALS;
-int key_menu_decscreen = KEY_MINUS;
//
// defaulted values
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -80,6 +80,59 @@
int mousebbackward = -1;
int mousebuse = -1;
+// Weapon selection keys:
+
+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';
+
+// Map cotnrols keys:
+
+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';
+
+// menu keys:
+
+int key_menu_activate = KEY_ESCAPE;
+int key_menu_up = KEY_UPARROW;
+int key_menu_down = KEY_DOWNARROW;
+int key_menu_left = KEY_LEFTARROW;
+int key_menu_right = KEY_RIGHTARROW;
+int key_menu_back = KEY_BACKSPACE;
+int key_menu_forward = KEY_ENTER;
+int key_menu_confirm = 'y';
+int key_menu_abort = 'n';
+
+int key_menu_help = KEY_F1;
+int key_menu_save = KEY_F2;
+int key_menu_load = KEY_F3;
+int key_menu_volume = KEY_F4;
+int key_menu_detail = KEY_F5;
+int key_menu_qsave = KEY_F6;
+int key_menu_endgame = KEY_F7;
+int key_menu_messages = KEY_F8;
+int key_menu_qload = KEY_F9;
+int key_menu_quit = KEY_F10;
+int key_menu_gamma = KEY_F11;
+
+int key_menu_incscreen = KEY_EQUALS;
+int key_menu_decscreen = KEY_MINUS;
+
//
// Joystick controls
//
@@ -156,5 +209,61 @@
M_BindVariable("key_jump", &key_jump);
M_BindVariable("mouseb_jump", &mousebjump);
M_BindVariable("joyb_jump", &joybjump);
+}
+
+void M_BindWeaponControls(void)
+{
+ M_BindVariable("key_weapon1", &key_weapon1);
+ M_BindVariable("key_weapon2", &key_weapon2);
+ M_BindVariable("key_weapon3", &key_weapon3);
+ M_BindVariable("key_weapon4", &key_weapon4);
+ M_BindVariable("key_weapon5", &key_weapon5);
+ M_BindVariable("key_weapon6", &key_weapon6);
+ M_BindVariable("key_weapon7", &key_weapon7);
+ M_BindVariable("key_weapon8", &key_weapon8);
+}
+
+void M_BindMapControls(void)
+{
+ M_BindVariable("key_map_north", &key_map_north);
+ M_BindVariable("key_map_south", &key_map_south);
+ M_BindVariable("key_map_east", &key_map_east);
+ M_BindVariable("key_map_west", &key_map_west);
+ M_BindVariable("key_map_zoomin", &key_map_zoomin);
+ M_BindVariable("key_map_zoomout", &key_map_zoomout);
+ M_BindVariable("key_map_toggle", &key_map_toggle);
+ M_BindVariable("key_map_maxzoom", &key_map_maxzoom);
+ M_BindVariable("key_map_follow", &key_map_follow);
+ M_BindVariable("key_map_grid", &key_map_grid);
+ M_BindVariable("key_map_mark", &key_map_mark);
+ M_BindVariable("key_map_clearmark", &key_map_clearmark);
+}
+
+void M_BindMenuControls(void)
+{
+ M_BindVariable("key_menu_activate", &key_menu_activate);
+ M_BindVariable("key_menu_up", &key_menu_up);
+ M_BindVariable("key_menu_down", &key_menu_down);
+ M_BindVariable("key_menu_left", &key_menu_left);
+ M_BindVariable("key_menu_right", &key_menu_right);
+ M_BindVariable("key_menu_back", &key_menu_back);
+ M_BindVariable("key_menu_forward", &key_menu_forward);
+ M_BindVariable("key_menu_confirm", &key_menu_confirm);
+ M_BindVariable("key_menu_abort", &key_menu_abort);
+
+ M_BindVariable("key_menu_help", &key_menu_help);
+ M_BindVariable("key_menu_save", &key_menu_save);
+ M_BindVariable("key_menu_load", &key_menu_load);
+ M_BindVariable("key_menu_volume", &key_menu_volume);
+ M_BindVariable("key_menu_detail", &key_menu_detail);
+ M_BindVariable("key_menu_qsave", &key_menu_qsave);
+ M_BindVariable("key_menu_endgame", &key_menu_endgame);
+ M_BindVariable("key_menu_messages", &key_menu_messages);
+ M_BindVariable("key_menu_qload", &key_menu_qload);
+ M_BindVariable("key_menu_quit", &key_menu_quit);
+ M_BindVariable("key_menu_gamma", &key_menu_gamma);
+
+ M_BindVariable("key_menu_incscreen", &key_menu_incscreen);
+ M_BindVariable("key_menu_decscreen", &key_menu_decscreen);
}
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -37,6 +37,8 @@
extern int key_strafe;
extern int key_speed;
+extern int key_jump;
+
extern int key_flyup;
extern int key_flydown;
extern int key_flycenter;
@@ -47,8 +49,68 @@
extern int key_invright;
extern int key_useartifact;
-extern int key_jump;
-
+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;
+
+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;
+
+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;
+
+// menu keys:
+
+extern int key_menu_activate;
+extern int key_menu_up;
+extern int key_menu_down;
+extern int key_menu_left;
+extern int key_menu_right;
+extern int key_menu_back;
+extern int key_menu_forward;
+extern int key_menu_confirm;
+extern int key_menu_abort;
+
+extern int key_menu_help;
+extern int key_menu_save;
+extern int key_menu_load;
+extern int key_menu_volume;
+extern int key_menu_detail;
+extern int key_menu_qsave;
+extern int key_menu_endgame;
+extern int key_menu_messages;
+extern int key_menu_qload;
+extern int key_menu_quit;
+extern int key_menu_gamma;
+
+extern int key_menu_incscreen;
+extern int key_menu_decscreen;
+
extern int mousebfire;
extern int mousebstrafe;
extern int mousebforward;
@@ -75,6 +137,9 @@
void M_BindBaseControls(void);
void M_BindHereticControls(void);
void M_BindHexenControls(void);
+void M_BindWeaponControls(void);
+void M_BindMapControls(void);
+void M_BindMenuControls(void);
#endif /* #ifndef __M_CONTROLS_H__ */
--- a/src/setup/keyboard.c
+++ b/src/setup/keyboard.c
@@ -33,55 +33,6 @@
static int vanilla_keyboard_mapping = 1;
-// Menu keys:
-
-int key_menu_activate = KEY_ESCAPE;
-int key_menu_up = KEY_UPARROW;
-int key_menu_down = KEY_DOWNARROW;
-int key_menu_left = KEY_LEFTARROW;
-int key_menu_right = KEY_RIGHTARROW;
-int key_menu_back = KEY_BACKSPACE;
-int key_menu_forward = KEY_ENTER;
-int key_menu_confirm = 'y';
-int key_menu_abort = 'n';
-
-int key_menu_help = KEY_F1;
-int key_menu_save = KEY_F2;
-int key_menu_load = KEY_F3;
-int key_menu_volume = KEY_F4;
-int key_menu_detail = KEY_F5;
-int key_menu_qsave = KEY_F6;
-int key_menu_endgame = KEY_F7;
-int key_menu_messages = KEY_F8;
-int key_menu_qload = KEY_F9;
-int key_menu_quit = KEY_F10;
-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';
-
static int always_run = 0;
// Keys within these groups cannot have the same value.
--- a/src/setup/mode.c
+++ b/src/setup/mode.c
@@ -130,6 +130,9 @@
// Keyboard, mouse, joystick controls
M_BindBaseControls();
+ M_BindWeaponControls();
+ M_BindMapControls();
+ M_BindMenuControls();
if (gamemission == heretic || gamemission == hexen)
{