A number of fixes...

- Fixed issue where sounds when using scope came from the wrong location
 - Now walk direction when scoped is correct
 - Walking when scoped won't cause horrible display jitering between scoped and unscoped views
 - Fixed situation when NPC saber battles caused haptics to fire
This commit is contained in:
Simon 2023-11-23 22:33:07 +00:00
parent 959ee3b485
commit a21b683cc2
9 changed files with 48 additions and 32 deletions

View file

@ -56,7 +56,7 @@ void VR_SetHMDOrientation(float pitch, float yaw, float roll)
//Keep this for our records
VectorCopy(vr.hmdorientation, vr.hmdorientation_last);
if (!vr.third_person && !vr.remote_npc && !vr.remote_turret
if (!vr.third_person && !vr.remote_npc && !vr.remote_turret && !vr.cgzoommode
#ifndef JK2_MODE
&& !vr.in_vehicle
#endif
@ -65,7 +65,7 @@ void VR_SetHMDOrientation(float pitch, float yaw, float roll)
VectorCopy(vr.hmdorientation, vr.hmdorientation_first);
}
if (!vr.remote_turret)
if (!vr.remote_turret && !vr.cgzoommode)
{
VectorCopy(vr.weaponangles[ANGLES_ADJUSTED], vr.weaponangles_first[ANGLES_ADJUSTED]);
}
@ -143,7 +143,8 @@ void VR_GetMove(float *forward, float *side, float *pos_forward, float *pos_side
*up = 0.0f;
*side = remote_movementSideways / 3.0f;
*pos_side = 0.0f;
*yaw = vr.snapTurn;
*yaw = vr.snapTurn + vr.hmdorientation_first[YAW] +
vr.weaponangles[ANGLES_ADJUSTED][YAW] - vr.weaponangles_first[ANGLES_ADJUSTED][YAW];
*pitch = vr.weaponangles[ANGLES_ADJUSTED][PITCH];
*roll = 0.0f;//vr.hmdorientation[ROLL];
}
@ -241,7 +242,7 @@ void VR_Init()
vr_positional_factor = Cvar_Get( "vr_positional_factor", "12", CVAR_ARCHIVE);
vr_walkdirection = Cvar_Get( "vr_walkdirection", "1", CVAR_ARCHIVE);
vr_weapon_pitchadjust = Cvar_Get( "vr_weapon_pitchadjust", "-20.0", CVAR_ARCHIVE);
vr_saber_pitchadjust = Cvar_Get( "vr_saber_pitchadjust", "-20.0", CVAR_ARCHIVE);
vr_saber_pitchadjust = Cvar_Get( "vr_saber_pitchadjust", "-13.36", CVAR_ARCHIVE);
vr_virtual_stock = Cvar_Get( "vr_virtual_stock", "0", CVAR_ARCHIVE);
//Defaults

View file

@ -368,6 +368,7 @@ static void CG_RegisterCustomSounds(clientInfo_t *ci, int iSoundEntryBase,
//SB: Never render any player model if 1st person and using the saber
bool CG_getPlayer1stPersonSaber(const centity_t *cent) {
return (!cent->gent->NPC && !cg.renderingThirdPerson &&
cent->gent->client->ps.clientNum == 0 &&
cent->gent->client->ps.weapon == WP_SABER);
}
@ -6506,6 +6507,8 @@ Ghoul2 Insert End
if ( (trace.contents&CONTENTS_WATER) || (trace.contents&CONTENTS_SLIME) )
{
if ( !noMarks )
{
if (CG_getPlayer1stPersonSaber(cent))
{
if (saberNum == 1 || !cent->gent->client->ps.saberInFlight)
{
@ -6514,6 +6517,7 @@ Ghoul2 Insert End
((saberNum == 0) ? 1 : 2));
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0);
}
}
/*
if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) )
@ -6539,6 +6543,8 @@ Ghoul2 Insert End
else
{
if ( !noMarks )
{
if (CG_getPlayer1stPersonSaber(cent))
{
if (saberNum == 1 || !cent->gent->client->ps.saberInFlight)
{
@ -6547,6 +6553,7 @@ Ghoul2 Insert End
((saberNum == 0) ? 1 : 2));
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0);
}
}
if ( ( !WP_SaberBladeUseSecondBladeStyle( &client->ps.saber[saberNum], bladeNum ) && !(client->ps.saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS) )
|| ( WP_SaberBladeUseSecondBladeStyle( &client->ps.saber[saberNum], bladeNum ) && !(client->ps.saber[saberNum].saberFlags2&SFL2_NO_WALL_MARKS2) ) )

View file

@ -2261,8 +2261,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
{
cg.refdef.viewangles[ROLL] = vr->hmdorientation[ROLL];
cg.refdef.viewangles[PITCH] = vr->weaponangles[ANGLES_ADJUSTED][PITCH];
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW]
+ vr->weaponangles[ANGLES_ADJUSTED][YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
}

View file

@ -725,7 +725,7 @@ float getHMDYawForCalc()
return vr->hmdorientation[YAW];
}
return 0.0f;
return vr->weaponangles[ANGLES_ADJUSTED][YAW];
}
void BG_ConvertFromVR(vec3_t in, vec3_t offset, vec3_t out)

View file

@ -4970,12 +4970,13 @@ extern cvar_t *g_skippingcin;
// ucmd->angles[PITCH] = 0;
// }
if ( cg.zoomMode == 2 )
//Allow movement when zoomed
/* if (cg.zoomMode == 2)
{
// Any kind of movement when the player is NOT ducked when the disruptor gun is zoomed will cause us to auto-magically un-zoom
if ( ( (ucmd->forwardmove||ucmd->rightmove)
&& ucmd->upmove >= 0 //crouching-moving is ok
&& !(ucmd->buttons&BUTTON_USE)/*leaning is ok*/
&& !(ucmd->buttons&BUTTON_USE)//leaning is ok
)
|| ucmd->upmove > 0 //jumping not allowed
)
@ -4986,7 +4987,8 @@ extern cvar_t *g_skippingcin;
cg.zoomTime = cg.time;
cg.zoomLocked = qfalse;
}
}
}*/
if ( (player_locked
|| (ent->client->ps.eFlags&EF_FORCE_GRIPPED)

View file

@ -3074,8 +3074,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
{
cg.refdef.viewangles[ROLL] = vr->hmdorientation[ROLL];
cg.refdef.viewangles[PITCH] = vr->weaponangles[ANGLES_ADJUSTED][PITCH];
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW]
+ vr->weaponangles[ANGLES_ADJUSTED][YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
}

View file

@ -4587,12 +4587,15 @@ Ghoul2 Insert End
if ( trace.fraction < 1.0f )
{
if ( (trace.contents&CONTENTS_WATER) || (trace.contents&CONTENTS_SLIME) )
{
if (cent->gent->client->ps.clientNum == 0)
{
if (!cent->gent->client->ps.saberInFlight)
{
int position = (vr->right_handed ? 2 : 1);
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0);
}
}
/*
if ( !(cent->gent->client->ps.saberEventFlags&SEF_INWATER) )
@ -4612,12 +4615,15 @@ Ghoul2 Insert End
i = 1;
}
else
{
if (cent->gent->client->ps.clientNum == 0)
{
if (!cent->gent->client->ps.saberInFlight)
{
int position = (vr->right_handed ? 2 : 1);
cgi_HapticEvent("chainsaw_fire", position, 0, 25, 0, 0);
}
}
theFxScheduler.PlayEffect( "spark", trace.endpos, trace.plane.normal );
// All I need is a bool to mark whether I have a previous point to work with.

View file

@ -658,7 +658,8 @@ float getHMDYawForCalc()
if (!vr->third_person && vr->cgzoommode != 2 && vr->cgzoommode != 4 ) {
return vr->hmdorientation[YAW];
}
return 0.0f;
return vr->weaponangles[ANGLES_ADJUSTED][YAW];
}
void BG_ConvertFromVR(vec3_t in, vec3_t offset, vec3_t out)

View file

@ -2248,12 +2248,13 @@ extern cvar_t *g_skippingcin;
// ucmd->angles[PITCH] = 0;
// }
if ( cg.zoomMode == 2 )
//Allow movement when zoomed
/* if ( cg.zoomMode == 2 )
{
// Any kind of movement when the player is NOT ducked when the disruptor gun is zoomed will cause us to auto-magically un-zoom
if ( ( (ucmd->forwardmove||ucmd->rightmove)
&& ucmd->upmove >= 0 //crouching-moving is ok
&& !(ucmd->buttons&BUTTON_USE)/*leaning is ok*/
&& !(ucmd->buttons&BUTTON_USE)//leaning is ok
)
|| ucmd->upmove > 0 //jumping not allowed
)
@ -2265,7 +2266,7 @@ extern cvar_t *g_skippingcin;
cg.zoomLocked = qfalse;
}
}
*/
if ( (player_locked || (ent->client->ps.eFlags&EF_FORCE_GRIPPED)) && ent->client->ps.pm_type < PM_DEAD ) // unless dead
{//lock out player control
if ( !player_locked )