summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2009-06-09 19:38:13 +0000
committerSimon Howard2009-06-09 19:38:13 +0000
commit557a502de5e1aa47ea2a002480ac7270cc6364bb (patch)
treeb07f5dacc7e86e4463acb137699297e7885e8b66 /src
parent627017d833c095586533b4e0cda2b4289f4d924a (diff)
downloadchocolate-doom-557a502de5e1aa47ea2a002480ac7270cc6364bb.tar.gz
chocolate-doom-557a502de5e1aa47ea2a002480ac7270cc6364bb.tar.bz2
chocolate-doom-557a502de5e1aa47ea2a002480ac7270cc6364bb.zip
Move menu/map/weapon key variables into common code, and bind variables.
Subversion-branch: /branches/raven-branch Subversion-revision: 1581
Diffstat (limited to 'src')
-rw-r--r--src/doom/am_map.c14
-rw-r--r--src/doom/d_main.c4
-rw-r--r--src/doom/g_game.c9
-rw-r--r--src/doom/m_menu.c30
-rw-r--r--src/m_controls.c109
-rw-r--r--src/m_controls.h69
-rw-r--r--src/setup/keyboard.c49
-rw-r--r--src/setup/mode.c3
8 files changed, 185 insertions, 102 deletions
diff --git a/src/doom/am_map.c b/src/doom/am_map.c
index 37ccf5b3..89a5dffc 100644
--- 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.
@@ -90,19 +91,6 @@
// 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
// scale on entry
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index ce8f6ec8..ce9b667d 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -353,6 +353,10 @@ void D_BindVariables(void)
I_BindSoundVariables();
M_BindBaseControls();
+ M_BindWeaponControls();
+ M_BindMapControls();
+ M_BindMenuControls();
+
#ifdef FEATURE_MULTIPLAYER
NET_BindVariables();
#endif
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index a2b08739..5d49c5b4 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -157,15 +157,6 @@ wbstartstruct_t wminfo; // parms for world map / intermission
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
diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index af3d1ae2..a0d66dd4 100644
--- 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"
@@ -73,35 +74,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
//
int mouseSensitivity = 5;
diff --git a/src/m_controls.c b/src/m_controls.c
index 8343d27c..a4a14c02 100644
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -80,6 +80,59 @@ int mousebstraferight = -1;
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
//
@@ -158,3 +211,59 @@ void M_BindHexenControls(void)
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);
+}
+
diff --git a/src/m_controls.h b/src/m_controls.h
index a77f53f6..4591348c 100644
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -37,6 +37,8 @@ extern int key_use;
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_invleft;
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 @@ extern int dclick_use;
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__ */
diff --git a/src/setup/keyboard.c b/src/setup/keyboard.c
index 05c357dc..cd5eb4f5 100644
--- 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.
diff --git a/src/setup/mode.c b/src/setup/mode.c
index 54ebc2a2..9d900319 100644
--- a/src/setup/mode.c
+++ b/src/setup/mode.c
@@ -130,6 +130,9 @@ void InitBindings(void)
// Keyboard, mouse, joystick controls
M_BindBaseControls();
+ M_BindWeaponControls();
+ M_BindMapControls();
+ M_BindMenuControls();
if (gamemission == heretic || gamemission == hexen)
{