Skip to content

Commit

Permalink
fix: restored the commonbinds for PC and moved all VR related binds t…
Browse files Browse the repository at this point in the history
…o subfolder vr

Now when non in VR the original commonbinds will be used and is possible to use normal PC profiles
  • Loading branch information
emawind84 committed Mar 5, 2024
1 parent 7663568 commit 3d8b2e2
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 17 deletions.
17 changes: 11 additions & 6 deletions src/common/console/c_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "c_dispatch.h"
#include "configfile.h"
#include "filesystem.h"
#include "hw_vrmodes.h"

#include "i_time.h"
#include "printf.h"
Expand Down Expand Up @@ -733,15 +734,19 @@ void ReadBindings(int lump, bool override)

void C_SetDefaultKeys(const char* baseconfig)
{
auto lump = fileSystem.CheckNumForFullName("engine/commonbinds.txt");
auto vrmode = VRMode::GetVRMode(true);
auto commonbinds = "engine/commonbinds.txt";
if (vrmode->IsVR())
commonbinds = "engine/vr/commonbinds.txt";
auto lump = fileSystem.CheckNumForFullName(commonbinds);
if (lump >= 0)
{
// Bail out if a mod tries to override this. Main game resources are allowed to do this, though.
auto fileno2 = fileSystem.GetFileContainer(lump);
if (fileno2 > fileSystem.GetMaxIwadNum())
{
I_FatalError("File %s is overriding core lump %s.",
fileSystem.GetResourceFileFullName(fileno2), "engine/commonbinds.txt");
fileSystem.GetResourceFileFullName(fileno2), commonbinds);
}

ReadBindings(lump, true);
Expand Down Expand Up @@ -784,16 +789,16 @@ void C_BindDefaults()
switch (cl_defaultconfiguration)
{
case 0:
defbinds = "engine/defbind0.txt";
defbinds = "engine/vr/defbind0.txt";
break;
case 1:
defbinds = "engine/defbind1.txt";
defbinds = "engine/vr/defbind1.txt";
break;
case 2:
defbinds = "engine/defbind2.txt";
defbinds = "engine/vr/defbind2.txt";
break;
case 3:
defbinds = "engine/defbind3.txt";
defbinds = "engine/vr/defbind3.txt";
break;
case 4:
defbinds = "engine/defbinds.txt";
Expand Down
72 changes: 61 additions & 11 deletions wadsrc/static/engine/commonbinds.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,84 @@
// These bindings are valid for all configurations

` 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
mouse1 +attack
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

pgup invnext
pgdn invprev
// 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

// Xbox 360 / PS2 controllers
pad_a +use
pad_b +jump
pad_y togglemap
pad_x invuse
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

axis1plus +moveright
axis1minus +moveleft
axis2plus +forward
axis2minus +back

/* 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"
34 changes: 34 additions & 0 deletions wadsrc/static/engine/vr/commonbinds.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// These bindings are valid for all configurations

mwheelleft invprev
mwheelright invnext
enter invuse
shift +speed
space +use
tab togglemap
mwheeldown weapnext
mwheelup weapprev

pgup invnext
pgdn invprev
home land

// Xbox 360 / PS2 controllers
pad_a +use
pad_b +jump
pad_y togglemap
pad_x invuse
rtrigger +attack
ltrigger +altattack
pad_start pause
pad_back menu_main
lthumb crouch

axis1plus +moveright
axis1minus +moveleft
axis2plus +forward
axis2minus +back

/* Default automap bindings */
mapbind mwheelup "am_zoom 1.2"
mapbind mwheeldown "am_zoom -1.2"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3d8b2e2

Please sign in to comment.