Merge pull request #21 from petr666/feature/turning-as-mappable-command

Fix the issue of comfort vignette not working while smooth turning
This commit is contained in:
Simon 2022-03-16 23:05:59 +00:00 committed by GitHub
commit adaf21b98e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 12 deletions

View File

@ -2602,7 +2602,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;
}