Fix the issue of comfort vignette not working while smooth turning

This commit is contained in:
Petr Bartos 2022-03-16 17:11:54 +01:00
parent 4c8719b9b8
commit ead81a8886
3 changed files with 9 additions and 12 deletions

View file

@ -2603,7 +2603,8 @@ static void CG_DrawVignette( void )
return;
}
if (VectorLength(cg.predictedPlayerState.velocity) > 30.0 || vr->smooth_turning)
const float yawDelta = abs(vr->clientview_yaw_delta);
if (VectorLength(cg.predictedPlayerState.velocity) > 30.0 || (yawDelta > 0 && yawDelta < 20) || (yawDelta > 340))
{
if (currentComfortVignetteValue < comfortVignetteValue)
{

View file

@ -19,12 +19,13 @@ typedef struct {
vrFollowMode_t follow_mode;
qboolean weapon_select;
qboolean weapon_select_autoclose;
qboolean smooth_turning;
int realign; // used to realign the fake 6DoF playspace in a multiplayer game
int clientNum;
vec3_t clientviewangles; //orientation in the client - we use this in the cgame
float clientview_yaw_last; // Don't use this, it is just for calculating delta!
float clientview_yaw_delta;
vec3_t hmdposition;
vec3_t hmdorigin; //used to recenter the mp fake 6DoF playspace

View file

@ -291,11 +291,6 @@ static qboolean IN_SendButtonAction(const char* action, qboolean pressed, qboole
}
CL_SnapTurn(-snap);
} else { // yaw (smooth turn)
// TODO How to disable this once enabled?
// (In this method i do not know to which button it is assigned and
// since i need to invoke the button repeatedly, i will not receive
// the "pressed=false" event)
// vr.smooth_turning = true;
float value = (isThumbstickAxis ? axisValue : 1.0f) * cl_sensitivity->value * m_yaw->value;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, -value, 0, 0, NULL);
return qtrue;
@ -308,11 +303,6 @@ static qboolean IN_SendButtonAction(const char* action, qboolean pressed, qboole
}
CL_SnapTurn(snap);
} else { // yaw (smooth turn)
// TODO How to disable this once enabled?
// (In this method i do not know to which button it is assigned and
// since i need to invoke the button repeatedly, i will not receive
// the "pressed=false" event)
// vr.smooth_turning = true;
float value = (isThumbstickAxis ? axisValue : 1.0f) * cl_sensitivity->value * m_yaw->value;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, value, 0, 0, NULL);
return qtrue;
@ -1164,6 +1154,11 @@ void IN_VRInputFrame( void )
//Keep this for our records
VectorCopy(vr.hmdorientation, vr.hmdorientation_last);
// View yaw delta
const float clientview_yaw = vr.clientviewangles[YAW] - vr.hmdorientation[YAW];
vr.clientview_yaw_delta = vr.clientview_yaw_last - clientview_yaw;
vr.clientview_yaw_last = clientview_yaw;
}