- Add support for several control layouts.

This commit is contained in:
drfrag 2020-02-28 12:44:13 +01:00
parent bbf72c2891
commit fa5902b538
7 changed files with 323 additions and 6 deletions

View file

@ -54,6 +54,8 @@
#include <math.h>
#include <stdlib.h>
CVAR (Int, k_modern, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
const char *KeyNames[NUM_KEYS] =
{
// This array is dependant on the particular keyboard input
@ -747,8 +749,25 @@ CCMD (rebind)
void C_BindDefaults ()
{
int lump, lastlump = 0;
FString defbinds;
while ((lump = Wads.FindLump("DEFBINDS", &lastlump)) != -1)
switch (k_modern)
{
case 1:
defbinds = "DEFBIND1";
break;
case 2:
defbinds = "DEFBIND2";
break;
case 3:
defbinds = "DEFBIND3";
break;
default:
defbinds = "DEFBINDS";
break;
}
while ((lump = Wads.FindLump(defbinds, &lastlump)) != -1)
{
FScanner sc(lump);

View file

@ -0,0 +1,96 @@
/* Default keybindings for all games */
` toggleconsole
1 "slot 1"
2 "slot 2"
3 "slot 3"
4 "slot 4"
5 "slot 5"
6 "slot 6"
7 "slot 7"
8 "slot 8"
9 "slot 9"
0 "slot 0"
[ invprev
] invnext
mwheelleft invprev
mwheelright invnext
enter invuse
- sizedown
= sizeup
shift +speed
space +use
W +forward
S +back
A +moveleft
D +moveright
E +jump
X crouch
mouse1 +attack
mouse2 +altattack
mouse3 +speed
capslock "toggle cl_run"
f1 menu_help
f2 menu_save
f3 menu_load
f4 menu_options
f5 menu_display
f6 quicksave
f7 menu_endgame
f8 togglemessages
f9 quickload
f11 bumpgamma
f10 menu_quit
tab togglemap
pause pause
sysrq screenshot
t messagemode
\ +showscores
f12 spynext
mwheeldown weapnext
mwheelup weapprev
// Originally just for Heretic, Hexen, and Strife.
// I can't see why they shouldn't be for Doom or Chex either.
pgup +moveup
ins +movedown
home land
pgdn +lookup
del +lookdown
end centerview
// Generic joystick buttons
// Xbox 360 / PS2 controllers
pad_a +use
pad_y +jump
rtrigger +attack
ltrigger +altattack
lshoulder weapprev
rshoulder weapnext
dpadleft invprev
dpadright invnext
dpaddown invuse
dpadup togglemap
pad_start pause
pad_back menu_main
lthumb crouch
/* Default automap bindings */
mapbind f am_togglefollow
mapbind g am_togglegrid
mapbind p am_toggletexture
mapbind m am_setmark
mapbind c am_clearmarks
mapbind 0 am_gobig
mapbind rightarrow +am_panright
mapbind leftarrow +am_panleft
mapbind uparrow +am_panup
mapbind downarrow +am_pandown
mapbind - +am_zoomout
mapbind = +am_zoomin
mapbind kp- +am_zoomout
mapbind kp+ +am_zoomin
mapbind mwheelup "am_zoom 1.2"
mapbind mwheeldown "am_zoom -1.2"

View file

@ -0,0 +1,96 @@
/* Default keybindings for all games */
` toggleconsole
1 "slot 1"
2 "slot 2"
3 "slot 3"
4 "slot 4"
5 "slot 5"
6 "slot 6"
7 "slot 7"
8 "slot 8"
9 "slot 9"
0 "slot 0"
[ invprev
] invnext
mwheelleft invprev
mwheelright invnext
enter invuse
- sizedown
= sizeup
shift +speed
space +use
E +forward
D +back
S +moveleft
F +moveright
W +jump
C crouch
mouse1 +attack
mouse2 +altattack
mouse3 +speed
capslock "toggle cl_run"
f1 menu_help
f2 menu_save
f3 menu_load
f4 menu_options
f5 menu_display
f6 quicksave
f7 menu_endgame
f8 togglemessages
f9 quickload
f11 bumpgamma
f10 menu_quit
tab togglemap
pause pause
sysrq screenshot
t messagemode
\ +showscores
f12 spynext
mwheeldown weapnext
mwheelup weapprev
// Originally just for Heretic, Hexen, and Strife.
// I can't see why they shouldn't be for Doom or Chex either.
pgup +moveup
ins +movedown
home land
pgdn +lookup
del +lookdown
end centerview
// Generic joystick buttons
// Xbox 360 / PS2 controllers
pad_a +use
pad_y +jump
rtrigger +attack
ltrigger +altattack
lshoulder weapprev
rshoulder weapnext
dpadleft invprev
dpadright invnext
dpaddown invuse
dpadup togglemap
pad_start pause
pad_back menu_main
lthumb crouch
/* Default automap bindings */
mapbind f am_togglefollow
mapbind g am_togglegrid
mapbind p am_toggletexture
mapbind m am_setmark
mapbind c am_clearmarks
mapbind 0 am_gobig
mapbind rightarrow +am_panright
mapbind leftarrow +am_panleft
mapbind uparrow +am_panup
mapbind downarrow +am_pandown
mapbind - +am_zoomout
mapbind = +am_zoomin
mapbind kp- +am_zoomout
mapbind kp+ +am_zoomin
mapbind mwheelup "am_zoom 1.2"
mapbind mwheeldown "am_zoom -1.2"

View file

@ -0,0 +1,96 @@
/* Default keybindings for all games */
` toggleconsole
1 "slot 1"
2 "slot 2"
3 "slot 3"
4 "slot 4"
5 "slot 5"
6 "slot 6"
7 "slot 7"
8 "slot 8"
9 "slot 9"
0 "slot 0"
[ invprev
] invnext
mwheelleft invprev
mwheelright invnext
enter invuse
- sizedown
= sizeup
shift +speed
space +use
I +forward
K +back
J +moveleft
L +moveright
O +jump
M crouch
mouse1 +attack
mouse2 +altattack
mouse3 +speed
capslock "toggle cl_run"
f1 menu_help
f2 menu_save
f3 menu_load
f4 menu_options
f5 menu_display
f6 quicksave
f7 menu_endgame
f8 togglemessages
f9 quickload
f11 bumpgamma
f10 menu_quit
tab togglemap
pause pause
sysrq screenshot
t messagemode
\ +showscores
f12 spynext
mwheeldown weapnext
mwheelup weapprev
// Originally just for Heretic, Hexen, and Strife.
// I can't see why they shouldn't be for Doom or Chex either.
pgup +moveup
ins +movedown
home land
pgdn +lookup
del +lookdown
end centerview
// Generic joystick buttons
// Xbox 360 / PS2 controllers
pad_a +use
pad_y +jump
rtrigger +attack
ltrigger +altattack
lshoulder weapprev
rshoulder weapnext
dpadleft invprev
dpadright invnext
dpaddown invuse
dpadup togglemap
pad_start pause
pad_back menu_main
lthumb crouch
/* Default automap bindings */
mapbind f am_togglefollow
mapbind g am_togglegrid
mapbind p am_toggletexture
mapbind m am_setmark
mapbind c am_clearmarks
mapbind 0 am_gobig
mapbind rightarrow +am_panright
mapbind leftarrow +am_panleft
mapbind uparrow +am_panup
mapbind downarrow +am_pandown
mapbind - +am_zoomout
mapbind = +am_zoomin
mapbind kp- +am_zoomout
mapbind kp+ +am_zoomin
mapbind mwheelup "am_zoom 1.2"
mapbind mwheeldown "am_zoom -1.2"

View file

@ -28,10 +28,6 @@ uparrow +forward
downarrow +back
, +moveleft
. +moveright
w +forward
s +back
a +moveleft
d +moveright
mouse1 +attack
mouse2 +strafe
mouse3 +forward

View file

@ -1827,6 +1827,7 @@ CNTRLMNU_POPUPS = "Strife Popup Screens";
CNTRLMNU_MISSION = "Mission objectives";
CNTRLMNU_KEYS = "Keys list";
CNTRLMNU_STATS = "Weapons/ammo/stats";
CNTRLMNU_LAYOUT = "Default Control Layout";
// Mouse Menu
@ -2874,6 +2875,10 @@ OPTVAL_HIGH = "High";
OPTVAL_EXTREME = "Extreme";
OPTVAL_OBVERSEFIRST = "Obverse";
OPTVAL_REVERSEFIRST = "Reverse";
OPTVAL_CLASSICZ = "Classic ZDoom";
OPTVAL_MODERN = "Modern (WASD)";
OPTVAL_MODERN2 = "Modern (ESDF)";
OPTVAL_MODERN3 = "Modern (IJKL)";
// QZDoom exclusive:

View file

@ -478,6 +478,14 @@ ListMenu "PlayerMenu"
//
//-------------------------------------------------------------------------------------------
OptionValue "Layouts"
{
0, "$OPTVAL_CLASSICZ"
1, "$OPTVAL_MODERN"
2, "$OPTVAL_MODERN2"
3, "$OPTVAL_MODERN3"
}
OptionMenu "CustomizeControls" protected
{
Title "$CNTRLMNU_TITLE"
@ -490,7 +498,8 @@ OptionMenu "CustomizeControls" protected
Submenu "$CNTRLMNU_POPUPS" , "StrifeControlsMenu"
Submenu "$MAPCNTRLMNU_CONTROLS" , "MapControlsMenu"
StaticText " "
SafeCommand "$OPTMNU_DEFAULTS", "resetb2defaults"
Option "$CNTRLMNU_LAYOUT", "k_modern", "Layouts"
SafeCommand "$OPTMNU_DEFAULTS", "resetb2defaults"
}
OptionMenu "ActionControlsMenu" protected