Skip to content

Commit

Permalink
fix: add again VR_GetMove movements for mobile only and disable movem…
Browse files Browse the repository at this point in the history
…ent with keyboard keys when in VR so they don't interfere with joystick
  • Loading branch information
emawind84 committed Aug 14, 2024
1 parent da2796c commit e10ddba
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/g_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,15 +717,15 @@ void G_BuildTiccmd (ticcmd_t *cmd)
}
else
{
if (buttonMap.ButtonDown(Button_Forward))
if (!vrmode->IsVR() && buttonMap.ButtonDown(Button_Forward))
forward += (vr_move_speed * (speed ? vr_run_multiplier : 1.0));
if (buttonMap.ButtonDown(Button_Back))
if (!vrmode->IsVR() && buttonMap.ButtonDown(Button_Back))
forward -= (vr_move_speed * (speed ? vr_run_multiplier : 1.0));
}

if (buttonMap.ButtonDown(Button_MoveRight))
if (!vrmode->IsVR() && buttonMap.ButtonDown(Button_MoveRight))
side += sidemove[speed];
if (buttonMap.ButtonDown(Button_MoveLeft))
if (!vrmode->IsVR() && buttonMap.ButtonDown(Button_MoveLeft))
side -= sidemove[speed];

// buttons
Expand Down Expand Up @@ -796,7 +796,16 @@ void G_BuildTiccmd (ticcmd_t *cmd)
{
forward += xs_CRoundToInt(mousey * m_forward);
}

#ifdef USE_OPENXR
if (!vr_teleport) {
float joyforward=0;
float joyside=0;
float dummy=0;
VR_GetMove(&joyforward, &joyside, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy);
side += joyint(joyside * (vr_move_speed * (speed ? vr_run_multiplier : 1.0)));
forward += joyint(joyforward * (vr_move_speed * (speed ? vr_run_multiplier : 1.0)));
}
#endif
if (vr_teleport)
{
side = forward = 0;
Expand Down

0 comments on commit e10ddba

Please sign in to comment.