Skip to content

Commit

Permalink
Remove motion control toggle, as disabling motion controls is no long…
Browse files Browse the repository at this point in the history
…er supported
  • Loading branch information
fholger committed Jan 20, 2025
1 parent 9868d46 commit dd8c589
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 36 deletions.
3 changes: 1 addition & 2 deletions Code/GameCVars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,6 @@ void SCVars::InitVRCVars(IConsole* pConsole)
pConsole->Register("vr_yaw_deadzone_angle", &vr_yaw_deadzone_angle, 30, VF_RESTRICTEDMODE|VF_SAVEGAME, "Controls the deadzone angle in front of the player where weapon aim does not rotate the camera");
pConsole->Register("vr_shadow_optimization", &vr_shadow_optimization, 1, VF_RESTRICTEDMODE, "If enabled, only draws shadow maps once for the first eye, hopefully improving performance without any side effects");
pConsole->Register("vr_resolution_scale", &vr_resolution_scale, 1, VF_RESTRICTEDMODE|VF_DUMPTODISK, "Allows changing the VR render resolution");
pConsole->Register("vr_enable_motion_controllers", &vr_enable_motion_controllers, 1, VF_RESTRICTEDMODE|VF_SAVEGAME, "Play with tracked motion controllers");
pConsole->Register("vr_controller_yaw_deadzone", &vr_controller_yaw_deadzone, 0.15f, VF_RESTRICTEDMODE, "Deadzone for stick turning");
pConsole->Register("vr_controller_stick_action_threshold", &vr_controller_stick_action_threshold, 0.75f, VF_RESTRICTEDMODE, "How far a stick needs to be extended to trigger an input action");
pConsole->Register("vr_controller_stick_zone_cutoff", &vr_controller_stick_zone_cutoff, 0.35f, VF_RESTRICTEDMODE, "If stick is extended this far in one axis, disable any input actions in the other axis");
Expand All @@ -884,7 +883,7 @@ void SCVars::InitVRCVars(IConsole* pConsole)
pConsole->Register("vr_weapon_angle_offset", &vr_weapon_angle_offset, 0, VF_RESTRICTEDMODE|VF_DUMPTODISK, "Adjust weapon holding angle");
pConsole->Register("vr_weapon_crosshair", &vr_weapon_crosshair, 0, VF_RESTRICTEDMODE|VF_DUMPTODISK, "If enabled, displays a simple crosshair for player weapons to assist with aiming in VR");
pConsole->Register("vr_vehicle_crosshair", &vr_vehicle_crosshair, 1, VF_RESTRICTEDMODE|VF_DUMPTODISK, "If enabled, displays a simple crosshair for vehicle weapons to assist with aiming in VR");
pConsole->Register("vr_cutscenes_angle_snap", &vr_cutscenes_angle_snap, 60, VF_RESTRICTEDMODE|VF_DUMPTODISK, "Ignores camera rotation in cutscenes until the angle difference reaches this value, then snaps the angle to the new value");
pConsole->Register("vr_cutscenes_angle_snap", &vr_cutscenes_angle_snap, 45, VF_RESTRICTEDMODE|VF_DUMPTODISK, "Ignores camera rotation in cutscenes until the angle difference reaches this value, then snaps the angle to the new value");
pConsole->Register("vr_cinema_3d", &vr_cinema_3d, 1, VF_RESTRICTEDMODE|VF_DUMPTODISK, "If enabled, whenever the game switches to a cinema mode (e.g. binoculars, weapon scopes or cutscenes), the cinema will render in 3D");
pConsole->Register("vr_cinema_3d_eye_dist", &vr_cinema_3d_eye_dist, 0.032f, VF_RESTRICTEDMODE|VF_DUMPTODISK, "Determines the distance between the stereoscopic cameras in 3D cinema render mode");
pConsole->Register("vr_haptics_enabled", &vr_haptics_enabled, 1, VF_RESTRICTEDMODE|VF_DUMPTODISK, "Send haptic feedback to the motion controllers");
Expand Down
1 change: 0 additions & 1 deletion Code/GameCVars.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ struct SCVars
float vr_yaw_deadzone_angle;
int vr_shadow_optimization;
float vr_resolution_scale;
int vr_enable_motion_controllers;
int vr_weapon_hand;
int vr_movement_hand;
float vr_weapon_angle_offset;
Expand Down
10 changes: 2 additions & 8 deletions Code/HomingMissile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,8 @@ void CHomingMissile::UpdateControlledMissile(float frameTime)
SMovementState state;
pMC->GetMovementState(state);

eyePos = state.eyePosition;
eyeDir = state.eyeDirection;

if (g_pGameCVars->vr_enable_motion_controllers)
{
eyePos = state.weaponPosition;
eyeDir = state.fireDirection;
}
eyePos = state.weaponPosition;
eyeDir = state.fireDirection;
}
else
{
Expand Down
8 changes: 2 additions & 6 deletions Code/Lam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,11 +931,8 @@ void CLam::AdjustLaserFPDirection(CItem* parent, Vec3 &dir, Vec3 &pos)
pos = camera.GetPosition();
dir = camera.GetMatrix().GetColumn1();

if (g_pGameCVars->vr_enable_motion_controllers)
{
pos = info.weaponPosition;
dir = info.fireDirection;
}
pos = info.weaponPosition;
dir = info.fireDirection;

dir.Normalize();
}
Expand Down Expand Up @@ -1023,4 +1020,3 @@ void CLam::PostSerialize()
ActivateLight(true);
}*/
}

4 changes: 2 additions & 2 deletions Code/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ void CPlayer::Update(SEntityUpdateContext& ctx, int updateSlot)
void CPlayer::ProcessRoomscaleMovement()
{
bool modalHudActive = g_pGame->GetHUD() && g_pGame->GetHUD()->GetModalHUD();
if (modalHudActive || !m_linkStats.CanRotate() || !g_pGameCVars->vr_enable_motion_controllers)
if (modalHudActive || !m_linkStats.CanRotate())
return;
if (GetLinkedVehicle() || m_stats.isOnLadder || !GetEntity()->GetPhysics() || m_stats.mountedWeaponID || m_stats.isGrabbed || m_stats.isFrozen.Value())
return;
Expand Down Expand Up @@ -1085,7 +1085,7 @@ void CPlayer::ProcessRoomscaleMovement()
void CPlayer::ProcessRoomscaleRotation()
{
bool modalHudActive = g_pGame->GetHUD() && g_pGame->GetHUD()->GetModalHUD();
if (modalHudActive || !m_linkStats.CanRotate() || !g_pGameCVars->vr_enable_motion_controllers)
if (modalHudActive || !m_linkStats.CanRotate())
return;
if (GetLinkedVehicle() || m_stats.isOnLadder || !GetEntity()->GetPhysics() || m_stats.mountedWeaponID || m_stats.isGrabbed || m_stats.isFrozen.Value())
return;
Expand Down
2 changes: 1 addition & 1 deletion Code/RocketLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ void CRocketLauncher::UpdateDotEffect(float frameTime)

CActor *pActor = GetOwnerActor();
IMovementController * pMC = pActor ? pActor->GetMovementController() : NULL;
if (pMC && !g_pGameCVars->vr_enable_motion_controllers)
if (pMC && false)
{
SMovementState info;
pMC->GetMovementState(info);
Expand Down
2 changes: 1 addition & 1 deletion Code/VR/OpenXRInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void OpenXRInput::Shutdown()

void OpenXRInput::Update()
{
if (!m_session || !g_pGameCVars->vr_enable_motion_controllers)
if (!m_session)
return;

std::vector<XrActiveActionSet> activeSets;
Expand Down
10 changes: 2 additions & 8 deletions Code/VR/VRManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,8 @@ inline float GetAngleDifference360( float a1, float a2 )

void VRManager::ModifyWeaponPosition(CPlayer* player, Ang3& weaponAngles, Vec3& weaponPosition, bool slave)
{
if (!g_pGameCVars->vr_enable_motion_controllers
|| g_pGame->GetMenu()->IsMenuActive()
//|| g_pGame->GetHUD()->GetModalHUD()
)
{
if (g_pGame->GetMenu()->IsMenuActive())
return;
}

CWeapon* weapon = player->GetWeapon(player->GetCurrentItemId());
if (!weapon || weapon->IsModifying() || (!gVRRenderer->ShouldRenderVR() && !weapon->IsZoomed() && !weapon->IsZooming()))
Expand Down Expand Up @@ -508,8 +503,7 @@ Vec3 VRManager::GetControllerWorldVelocity(int side)

void VRManager::ModifyPlayerEye(CPlayer* pPlayer, Vec3& eyePosition, Vec3& eyeDirection)
{
if (!g_pGameCVars->vr_enable_motion_controllers
|| g_pGame->GetMenu()->IsMenuActive()
if (g_pGame->GetMenu()->IsMenuActive()
|| g_pGame->GetHUD()->GetModalHUD()
|| !gVRRenderer->ShouldRenderVR())
{
Expand Down
11 changes: 4 additions & 7 deletions Code/VR/VRRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,10 @@ void VRRenderer::DrawCrosshair()
Vec3 crosshairPos = cam.GetPosition();
Vec3 dir = cam.GetViewdir();

if (g_pGameCVars->vr_enable_motion_controllers)
{
SMovementState moveState;
pPlayer->GetMovementController()->GetMovementState(moveState);
crosshairPos = moveState.weaponPosition;
dir = moveState.fireDirection;
}
SMovementState moveState;
pPlayer->GetMovementController()->GetMovementState(moveState);
crosshairPos = moveState.weaponPosition;
dir = moveState.fireDirection;

dir.Normalize();
float maxDistance = 10.f;
Expand Down

0 comments on commit dd8c589

Please sign in to comment.