mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-28 15:02:13 +00:00
Multiple fixes
- Scope mask / force effects masks are too small. Edges are visible.
- Cutscenes can't be skipped when in 2D mode (none immersive)
- If you zoom in with the scoped rifle you also change the running speed. 😬
- walking while shooting scoped
This commit is contained in:
parent
3cec1ae469
commit
83bee3bbff
4 changed files with 58 additions and 17 deletions
|
@ -121,6 +121,14 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
Cvar_Set("vr_control_scheme", "99");
|
Cvar_Set("vr_control_scheme", "99");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cinCameraTimestamp = -1;
|
||||||
|
if (vr.cin_camera && cinCameraTimestamp == -1) {
|
||||||
|
cinCameraTimestamp = Sys_Milliseconds();
|
||||||
|
}
|
||||||
|
else if (!vr.cin_camera) {
|
||||||
|
cinCameraTimestamp = -1;
|
||||||
|
}
|
||||||
|
|
||||||
//Set controller angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
//Set controller angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||||
{
|
{
|
||||||
vec3_t rotation = {0};
|
vec3_t rotation = {0};
|
||||||
|
@ -212,6 +220,28 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
static float menuYaw = 0;
|
static float menuYaw = 0;
|
||||||
if (VR_UseScreenLayer() && !vr.misc_camera)
|
if (VR_UseScreenLayer() && !vr.misc_camera)
|
||||||
{
|
{
|
||||||
|
if (vr.cin_camera && cinCameraTimestamp + 1000 < Sys_Milliseconds())
|
||||||
|
{
|
||||||
|
// To skip cinematic use any thumb or trigger (but wait a while
|
||||||
|
// to prevent skipping when cinematic is started during action)
|
||||||
|
if ((primaryButtonsNew & primaryThumb) != (primaryButtonsOld & primaryThumb)) {
|
||||||
|
sendButtonAction("+use", (primaryButtonsNew & primaryThumb));
|
||||||
|
}
|
||||||
|
if ((secondaryButtonsNew & secondaryThumb) != (secondaryButtonsOld & secondaryThumb)) {
|
||||||
|
sendButtonAction("+use", (secondaryButtonsNew & secondaryThumb));
|
||||||
|
}
|
||||||
|
if ((pDominantTrackedRemoteNew->Buttons & xrButton_Trigger) != (pDominantTrackedRemoteOld->Buttons & xrButton_Trigger)) {
|
||||||
|
sendButtonAction("+use", (pDominantTrackedRemoteNew->Buttons & xrButton_Trigger));
|
||||||
|
// mark button as already pressed to prevent firing after entering the game
|
||||||
|
pDominantTrackedRemoteOld->Buttons |= xrButton_Trigger;
|
||||||
|
}
|
||||||
|
if ((pOffTrackedRemoteNew->Buttons & xrButton_Trigger) != (pOffTrackedRemoteOld->Buttons & xrButton_Trigger)) {
|
||||||
|
sendButtonAction("+use", (pOffTrackedRemoteNew->Buttons & xrButton_Trigger));
|
||||||
|
// mark button as already pressed to prevent firing after entering the game
|
||||||
|
pOffTrackedRemoteOld->Buttons |= xrButton_Trigger;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool controlsLeftHanded = vr_control_scheme->integer >= 10;
|
bool controlsLeftHanded = vr_control_scheme->integer >= 10;
|
||||||
if (controlsLeftHanded == vr.menu_right_handed) {
|
if (controlsLeftHanded == vr.menu_right_handed) {
|
||||||
interactWithTouchScreen(menuYaw, vr.offhandangles[ANGLES_DEFAULT]);
|
interactWithTouchScreen(menuYaw, vr.offhandangles[ANGLES_DEFAULT]);
|
||||||
|
@ -377,12 +407,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cinCameraTimestamp = -1;
|
|
||||||
if (vr.cin_camera && cinCameraTimestamp == -1) {
|
|
||||||
cinCameraTimestamp = Sys_Milliseconds();
|
|
||||||
} else if (!vr.cin_camera) {
|
|
||||||
cinCameraTimestamp = -1;
|
|
||||||
}
|
|
||||||
if (vr.cin_camera && cinCameraTimestamp + 1000 < Sys_Milliseconds())
|
if (vr.cin_camera && cinCameraTimestamp + 1000 < Sys_Milliseconds())
|
||||||
{
|
{
|
||||||
// To skip cinematic use any thumb or trigger (but wait a while
|
// To skip cinematic use any thumb or trigger (but wait a while
|
||||||
|
@ -472,6 +496,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
}
|
}
|
||||||
|
|
||||||
//Switch movement speed
|
//Switch movement speed
|
||||||
|
if (!vr.cgzoommode)
|
||||||
{
|
{
|
||||||
static bool switched = false;
|
static bool switched = false;
|
||||||
if (between(-0.2f, primaryJoystickX, 0.2f) &&
|
if (between(-0.2f, primaryJoystickX, 0.2f) &&
|
||||||
|
|
|
@ -138,10 +138,10 @@ void VR_GetMove(float *forward, float *side, float *pos_forward, float *pos_side
|
||||||
}
|
}
|
||||||
else if (vr.cgzoommode == 2 || vr.cgzoommode == 4)
|
else if (vr.cgzoommode == 2 || vr.cgzoommode == 4)
|
||||||
{
|
{
|
||||||
*forward = 0.0f;
|
*forward = remote_movementForward / 3.0f;
|
||||||
*pos_forward = 0.0f;
|
*pos_forward = 0.0f;
|
||||||
*up = 0.0f;
|
*up = 0.0f;
|
||||||
*side = 0.0f;
|
*side = remote_movementSideways / 3.0f;
|
||||||
*pos_side = 0.0f;
|
*pos_side = 0.0f;
|
||||||
*yaw = vr.snapTurn;
|
*yaw = vr.snapTurn;
|
||||||
*pitch = vr.weaponangles[ANGLES_ADJUSTED][PITCH];
|
*pitch = vr.weaponangles[ANGLES_ADJUSTED][PITCH];
|
||||||
|
|
|
@ -4117,16 +4117,25 @@ CG_DrawVignette
|
||||||
float currentComfortVignetteValue = 0.0f;
|
float currentComfortVignetteValue = 0.0f;
|
||||||
float filteredViewYawDelta = 0.0f;
|
float filteredViewYawDelta = 0.0f;
|
||||||
|
|
||||||
static void CG_DrawVignette( void )
|
static void CG_DrawVignette( bool force )
|
||||||
{
|
{
|
||||||
playerState_t *ps;
|
playerState_t *ps;
|
||||||
ps = &cg.snap->ps;
|
ps = &cg.snap->ps;
|
||||||
|
|
||||||
|
float vignetteValue;
|
||||||
cvar_t *vr_comfort_vignette = gi.cvar("vr_comfort_vignette", "0.0", CVAR_ARCHIVE); // defined in VrCvars.h
|
cvar_t *vr_comfort_vignette = gi.cvar("vr_comfort_vignette", "0.0", CVAR_ARCHIVE); // defined in VrCvars.h
|
||||||
|
if (!force)
|
||||||
|
{
|
||||||
if (vr_comfort_vignette->value <= 0.0f || vr_comfort_vignette->value > 1.0f || !cg.zoomMode == 0)
|
if (vr_comfort_vignette->value <= 0.0f || vr_comfort_vignette->value > 1.0f || !cg.zoomMode == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
vignetteValue = vr_comfort_vignette->value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vignetteValue = 0.3f;
|
||||||
|
}
|
||||||
|
|
||||||
bool isMoving = VectorLength(cg.predicted_player_state.velocity) > 30.0;
|
bool isMoving = VectorLength(cg.predicted_player_state.velocity) > 30.0;
|
||||||
// When player is in the air, apply vignette (to prevent throbbing on top of jump)
|
// When player is in the air, apply vignette (to prevent throbbing on top of jump)
|
||||||
|
@ -4144,17 +4153,17 @@ static void CG_DrawVignette( void )
|
||||||
isTurning = filteredViewYawDelta > 1;
|
isTurning = filteredViewYawDelta > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMoving || isInAir || isTurning)
|
if (isMoving || isInAir || isTurning || force)
|
||||||
{
|
{
|
||||||
if (currentComfortVignetteValue < vr_comfort_vignette->value)
|
if (currentComfortVignetteValue < vignetteValue)
|
||||||
{
|
{
|
||||||
currentComfortVignetteValue += vr_comfort_vignette->value * 0.05;
|
currentComfortVignetteValue += vignetteValue * 0.05;
|
||||||
if (currentComfortVignetteValue > 1.0f)
|
if (currentComfortVignetteValue > 1.0f)
|
||||||
currentComfortVignetteValue = 1.0f;
|
currentComfortVignetteValue = 1.0f;
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
if (currentComfortVignetteValue > 0.0f)
|
if (currentComfortVignetteValue > 0.0f)
|
||||||
currentComfortVignetteValue -= vr_comfort_vignette->value * 0.05;
|
currentComfortVignetteValue -= vignetteValue * 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentComfortVignetteValue > 0.0f && currentComfortVignetteValue <= 1.0f)
|
if (currentComfortVignetteValue > 0.0f && currentComfortVignetteValue <= 1.0f)
|
||||||
|
@ -4335,7 +4344,8 @@ static void CG_Draw2D( void )
|
||||||
{//force sight is on
|
{//force sight is on
|
||||||
//indicate this with sight cone thingy
|
//indicate this with sight cone thingy
|
||||||
cg.drawingHUD = CG_HUD_NORMAL;
|
cg.drawingHUD = CG_HUD_NORMAL;
|
||||||
CG_DrawPic( 35, 50, 570, 400, cgi_R_RegisterShader( "gfx/2d/jsense" ));
|
CG_DrawVignette(true);
|
||||||
|
CG_DrawPic( 50, 40, 540, 400, cgi_R_RegisterShader( "gfx/2d/jsense" ));
|
||||||
cg.drawingHUD = CG_HUD_SCALED;
|
cg.drawingHUD = CG_HUD_SCALED;
|
||||||
CG_DrawHealthBars();
|
CG_DrawHealthBars();
|
||||||
}
|
}
|
||||||
|
@ -4348,7 +4358,7 @@ static void CG_Draw2D( void )
|
||||||
// don't draw any status if dead
|
// don't draw any status if dead
|
||||||
if ( cg.snap->ps.stats[STAT_HEALTH] > 0 )
|
if ( cg.snap->ps.stats[STAT_HEALTH] > 0 )
|
||||||
{
|
{
|
||||||
CG_DrawVignette();
|
CG_DrawVignette(false);
|
||||||
|
|
||||||
if ( !(cent->gent && cent->gent->s.eFlags & (EF_LOCKED_TO_WEAPON )))//|EF_IN_ATST
|
if ( !(cent->gent && cent->gent->s.eFlags & (EF_LOCKED_TO_WEAPON )))//|EF_IN_ATST
|
||||||
{
|
{
|
||||||
|
@ -4384,7 +4394,10 @@ static void CG_Draw2D( void )
|
||||||
|
|
||||||
CG_UseIcon();
|
CG_UseIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cg.drawingHUD = CG_HUD_NORMAL;
|
||||||
CG_SaberClashFlare();
|
CG_SaberClashFlare();
|
||||||
|
cg.drawingHUD = CG_HUD_SCALED;
|
||||||
|
|
||||||
float y = 0;
|
float y = 0;
|
||||||
if (cg_drawSnapshot.integer) {
|
if (cg_drawSnapshot.integer) {
|
||||||
|
|
|
@ -2841,7 +2841,10 @@ static void CG_Draw2D( void )
|
||||||
|
|
||||||
CG_UseIcon();
|
CG_UseIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cg.drawingHUD = CG_HUD_NORMAL;
|
||||||
CG_SaberClashFlare();
|
CG_SaberClashFlare();
|
||||||
|
cg.drawingHUD = CG_HUD_SCALED;
|
||||||
|
|
||||||
float y = 0;
|
float y = 0;
|
||||||
if (cg_drawSnapshot.integer) {
|
if (cg_drawSnapshot.integer) {
|
||||||
|
|
Loading…
Reference in a new issue