Couple of fixes

- Walking/running speed config (and menu options)
- Prevent weapon clipping on near Z plane so that iron sights can be used better
- Stop switch from left to right handed mode messing up control of menus
This commit is contained in:
Simon 2020-04-05 19:02:54 +01:00
parent b55c77987c
commit c1f71d5c3e
6 changed files with 30 additions and 47 deletions

View file

@ -33,16 +33,25 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
if (getGameState() != 0 || isMenuActive()) //gamestate != GS_LEVEL
{
Joy_GenerateButtonEvents((pOffTrackedRemoteOld->Joystick.x > 0.7f ? 1 : 0), (pOffTrackedRemoteNew->Joystick.x > 0.7f ? 1 : 0), 1, KEY_PAD_DPAD_RIGHT);
Joy_GenerateButtonEvents((pDominantTrackedRemoteOld->Joystick.x > 0.7f ? 1 : 0), (pDominantTrackedRemoteNew->Joystick.x > 0.7f ? 1 : 0), 1, KEY_PAD_DPAD_RIGHT);
Joy_GenerateButtonEvents((pOffTrackedRemoteOld->Joystick.x < -0.7f ? 1 : 0), (pOffTrackedRemoteNew->Joystick.x < -0.7f ? 1 : 0), 1, KEY_PAD_DPAD_LEFT);
Joy_GenerateButtonEvents((pDominantTrackedRemoteOld->Joystick.x < -0.7f ? 1 : 0), (pDominantTrackedRemoteNew->Joystick.x < -0.7f ? 1 : 0), 1, KEY_PAD_DPAD_LEFT);
Joy_GenerateButtonEvents((pOffTrackedRemoteOld->Joystick.y < -0.7f ? 1 : 0), (pOffTrackedRemoteNew->Joystick.y < -0.7f ? 1 : 0), 1, KEY_PAD_DPAD_DOWN);
Joy_GenerateButtonEvents((pDominantTrackedRemoteOld->Joystick.y < -0.7f ? 1 : 0), (pDominantTrackedRemoteNew->Joystick.y < -0.7f ? 1 : 0), 1, KEY_PAD_DPAD_DOWN);
Joy_GenerateButtonEvents((pOffTrackedRemoteOld->Joystick.y > 0.7f ? 1 : 0), (pOffTrackedRemoteNew->Joystick.y > 0.7f ? 1 : 0), 1, KEY_PAD_DPAD_UP);
Joy_GenerateButtonEvents((pDominantTrackedRemoteOld->Joystick.y > 0.7f ? 1 : 0), (pDominantTrackedRemoteNew->Joystick.y > 0.7f ? 1 : 0), 1, KEY_PAD_DPAD_UP);
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton1, KEY_PAD_A);
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, ovrButton_Trigger, KEY_PAD_A);
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton2, KEY_PAD_B);
handleTrackedControllerButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, domButton1, KEY_PAD_A);
handleTrackedControllerButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, ovrButton_Trigger, KEY_PAD_A);
handleTrackedControllerButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, domButton2, KEY_PAD_B);
handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, KEY_PAD_B);
}
else
@ -98,7 +107,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
float zxDist = length(x, z);
if (zxDist != 0.0f && z != 0.0f) {
VectorSet(weaponangles, -degrees(atanf(y / zxDist)), -degrees(atan2f(x, -z)), 0.0f);
VectorSet(weaponangles, -degrees(atanf(y / zxDist)), -degrees(atan2f(x, -z)), weaponangles[ROLL]);
}
}
}
@ -162,6 +171,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
{
ready_teleport = false;
trigger_teleport = true;
resetDoomYaw = true;
}
//Apply a filter and quadratic scaler so small movements are easier to make

View file

@ -137,6 +137,8 @@ CVAR (Bool, cl_waitforsave, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR (Bool, enablescriptscreenshot, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
EXTERN_CVAR (Float, con_midtime);
EXTERN_CVAR(Bool, vr_teleport);
EXTERN_CVAR(Int, vr_move_speed);
EXTERN_CVAR(Float, vr_run_multiplier);
//==========================================================================
//
@ -618,9 +620,9 @@ void G_BuildTiccmd (ticcmd_t *cmd)
if (strafe)
{
if (Button_Right.bDown)
side += sidemove[speed];
side += (vr_move_speed * (speed ? vr_run_multiplier : 1.0));
if (Button_Left.bDown)
side -= sidemove[speed];
side -= (vr_move_speed * (speed ? vr_run_multiplier : 1.0));
}
else
{
@ -663,9 +665,9 @@ void G_BuildTiccmd (ticcmd_t *cmd)
else
{
if (Button_Forward.bDown)
forward += forwardmove[speed];
forward += (vr_move_speed * (speed ? vr_run_multiplier : 1.0));
if (Button_Back.bDown)
forward -= forwardmove[speed];
forward -= (vr_move_speed * (speed ? vr_run_multiplier : 1.0));
}
if (Button_MoveRight.bDown)
@ -701,47 +703,13 @@ void G_BuildTiccmd (ticcmd_t *cmd)
if (Button_MoveUp.bDown) cmd->ucmd.buttons |= BT_MOVEUP;
if (Button_ShowScores.bDown) cmd->ucmd.buttons |= BT_SHOWSCORES;
// Handle joysticks/game controllers.
if (0) {
float joyaxes[NUM_JOYAXIS];
I_GetAxes(joyaxes);
// Remap some axes depending on button state.
if (Button_Strafe.bDown || (Button_Mlook.bDown && lookstrafe)) {
joyaxes[JOYAXIS_Side] = joyaxes[JOYAXIS_Yaw];
joyaxes[JOYAXIS_Yaw] = 0;
}
if (Button_Mlook.bDown) {
joyaxes[JOYAXIS_Pitch] = joyaxes[JOYAXIS_Forward];
joyaxes[JOYAXIS_Forward] = 0;
}
if (joyaxes[JOYAXIS_Pitch] != 0) {
G_AddViewPitch(joyint(joyaxes[JOYAXIS_Pitch] * 2048));
}
if (joyaxes[JOYAXIS_Yaw] != 0) {
G_AddViewAngle(joyint(-1280 * joyaxes[JOYAXIS_Yaw]));
}
side -= joyint(sidemove[speed] * joyaxes[JOYAXIS_Side]);
forward += joyint(joyaxes[JOYAXIS_Forward] * forwardmove[speed]);
fly += joyint(joyaxes[JOYAXIS_Up] * 2048);
// Handle mice.
if (!Button_Mlook.bDown && !freelook)
{
forward += (int)((float)mousey * m_forward);
}
}
float joyforward=0;
float joyside=0;
float dummy=0;
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 * sidemove[speed]);
forward += joyint(joyforward * forwardmove[speed]);
side += joyint(joyside * (vr_move_speed * (speed ? vr_run_multiplier : 1.0)));
forward += joyint(joyforward * (vr_move_speed * (speed ? vr_run_multiplier : 1.0)));
}
cmd->ucmd.pitch = LocalViewPitch >> 16;

View file

@ -243,7 +243,7 @@ public:
int PTM_BestColor (const uint32_t *pal_in, int r, int g, int b, int first, int num);
static float GetZNear() { return 5.f; }
static float GetZNear() { return 0.5f; }
static float GetZFar() { return 65536.f; }
};

View file

@ -56,7 +56,7 @@ CVAR(Float, vr_ipd, 0.064f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // METERS
CVAR(Float, vr_screendist, 0.80f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
// default conversion between (vertical) DOOM units and meters
CVAR(Float, vr_vunits_per_meter, 30.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
CVAR(Float, vr_vunits_per_meter, 38.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
CVAR(Float, vr_height_adjust, 0.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
CVAR(Int, vr_control_scheme, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_move_use_offhand, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -64,6 +64,8 @@ CVAR(Bool, vr_teleport, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_weaponRotate, -30, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_weaponScale, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_snapTurn, 45.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Int, vr_move_speed, 24, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_run_multiplier, 1.6, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
//HUD control
CVAR(Float, vr_hud_scale, 0.5f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

View file

@ -2282,6 +2282,10 @@ OptionMenu VROptionsMenu protected
Option "Use Teleport", "vr_teleport", "OnOff"
Slider "Snap-turn Angle", "vr_snapTurn", 0.0, 90.0, 1.0, 2
StaticText " "
Slider "Walking Speed", "vr_move_speed", 5, 50, 1, 2
Slider "Run Multiplier", "vr_run_multiplier", 0.0, 4.0, 0.1, 2
StaticText " "
Slider "Weapon Pitch Adjust", "vr_weaponRotate", -45, 45, 5, 2
Slider "Weapon Scale", "vr_weaponScale", 0.1, 1.0, 0.01, 2
@ -2611,7 +2615,6 @@ OptionMenu "OpenGLOptions" protected
{
Title "$GLMNU_TITLE"
Submenu "$GLMNU_TEXOPT", "GLTextureGLOptions"
Submenu "$GLPREFMNU_VRMODE", "VR3DMenu"
Submenu "$GLMNU_POSTPROCESS", "PostProcessMenu"
StaticText " "
Option "$GLPREFMNU_SECLIGHTMODE", gl_lightmode, "LightingModes"

Binary file not shown.