diff options
author | Simon Howard | 2009-06-09 20:22:12 +0000 |
---|---|---|
committer | Simon Howard | 2009-06-09 20:22:12 +0000 |
commit | e32215d28ef9e0ed883c5e78e43101c9f0958570 (patch) | |
tree | 46d5bec81f24a85f1839c61c5fb1222b540bd967 /src | |
parent | f6912e1de63e3e5e0cf842afeebeec393546e5cc (diff) | |
download | chocolate-doom-e32215d28ef9e0ed883c5e78e43101c9f0958570.tar.gz chocolate-doom-e32215d28ef9e0ed883c5e78e43101c9f0958570.tar.bz2 chocolate-doom-e32215d28ef9e0ed883c5e78e43101c9f0958570.zip |
Make Heretic weapon keys reconfigurable.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1584
Diffstat (limited to 'src')
-rw-r--r-- | src/heretic/d_main.c | 1 | ||||
-rw-r--r-- | src/heretic/g_game.c | 24 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 2026e3c0..cca440ce 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -743,6 +743,7 @@ void D_BindVariables(void) M_BindBaseControls(); M_BindHereticControls(); + M_BindWeaponControls(); M_BindMenuControls(); M_BindMapControls(); diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index 22c17f13..a256b63b 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -147,6 +147,17 @@ fixed_t forwardmove[2] = { 0x19, 0x32 }; fixed_t sidemove[2] = { 0x18, 0x28 }; fixed_t angleturn[3] = { 640, 1280, 320 }; // + slow turn +static int *weapon_keys[] = +{ + &key_weapon1, + &key_weapon2, + &key_weapon3, + &key_weapon4, + &key_weapon5, + &key_weapon6, + &key_weapon7 +}; + #define SLOWTURNTICS 6 #define NUMKEYS 256 @@ -393,15 +404,18 @@ void G_BuildTiccmd(ticcmd_t * cmd) dclicks = 0; // clear double clicks if hit use button } - for (i = 0; i < NUMWEAPONS - 2; i++) + for (i=0; i<arrlen(weapon_keys); ++i) { - if (gamekeydown['1' + i]) + int key = *weapon_keys[i]; + + if (gamekeydown[key]) { - cmd->buttons |= BT_CHANGE; - cmd->buttons |= i << BT_WEAPONSHIFT; - break; + cmd->buttons |= BT_CHANGE; + cmd->buttons |= i<<BT_WEAPONSHIFT; + break; } } + // // mouse |