mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-04-22 23:11:02 +00:00
More improvements to mounted gun
also prevent laser sight making a mess when the menu is active
This commit is contained in:
parent
c152d5a358
commit
443641b629
5 changed files with 69 additions and 42 deletions
|
@ -133,13 +133,15 @@ LAMBDA1VR Stuff
|
|||
|
||||
qboolean RTCWVR_useScreenLayer()
|
||||
{
|
||||
return (qboolean)(showingScreenLayer ||
|
||||
vr.screen = (qboolean)(showingScreenLayer ||
|
||||
(cls.state == CA_CINEMATIC) ||
|
||||
(cls.state == CA_LOADING) ||
|
||||
(clc.demoplaying) ||
|
||||
(cl.cameraMode) ||
|
||||
( Key_GetCatcher( ) & KEYCATCH_UI ) ||
|
||||
( Key_GetCatcher( ) & KEYCATCH_CONSOLE ));
|
||||
|
||||
return vr.screen;
|
||||
}
|
||||
|
||||
int runStatus = -1;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#define NUM_WEAPON_SAMPLES 10
|
||||
|
||||
typedef struct {
|
||||
qboolean screen;
|
||||
float fov;
|
||||
qboolean weapon_stabilised;
|
||||
qboolean right_handed;
|
||||
|
@ -13,6 +14,7 @@ typedef struct {
|
|||
int weaponid;
|
||||
int lastweaponid;
|
||||
int backpackitemactive; //0 - nothing, 1 - grenades, 2 - knife, 3 - Binoculars
|
||||
qboolean mountedgun;
|
||||
|
||||
vec3_t hmdposition;
|
||||
vec3_t hmdposition_last; // Don't use this, it is just for calculating delta!
|
||||
|
|
|
@ -505,9 +505,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
|
||||
//We need to record if we have started firing primary so that releasing trigger will stop definitely firing, if user has pushed grip
|
||||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||
static bool firingPrimary = false;
|
||||
|
||||
|
||||
if (!vr.teleportenabled)
|
||||
{
|
||||
//Run
|
||||
|
@ -528,50 +525,67 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
|
||||
|
||||
//Resync Yaw on mounted gun transition
|
||||
static int usingMountedGun = false;
|
||||
if (vr.mountedgun != usingMountedGun)
|
||||
{
|
||||
resyncClientYawWithGameYaw = 10; // HACK
|
||||
usingMountedGun = vr.mountedgun;
|
||||
}
|
||||
|
||||
//No snap turn when using mounted gun
|
||||
static int increaseSnap = true;
|
||||
if (pDominantTrackedRemoteNew->Joystick.x > 0.6f)
|
||||
{
|
||||
if (increaseSnap)
|
||||
{
|
||||
snapTurn -= vr_snapturn_angle->value;
|
||||
if (vr_snapturn_angle->value > 10.0f) {
|
||||
increaseSnap = false;
|
||||
}
|
||||
if (!vr.mountedgun) {
|
||||
if (pDominantTrackedRemoteNew->Joystick.x > 0.6f) {
|
||||
if (increaseSnap) {
|
||||
snapTurn -= vr_snapturn_angle->value;
|
||||
if (vr_snapturn_angle->value > 10.0f) {
|
||||
increaseSnap = false;
|
||||
}
|
||||
|
||||
if (snapTurn < -180.0f)
|
||||
{
|
||||
snapTurn += 360.f;
|
||||
}
|
||||
if (snapTurn < -180.0f) {
|
||||
snapTurn += 360.f;
|
||||
}
|
||||
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
} else if (pDominantTrackedRemoteNew->Joystick.x < 0.4f) {
|
||||
increaseSnap = true;
|
||||
}
|
||||
} else if (pDominantTrackedRemoteNew->Joystick.x < 0.4f) {
|
||||
increaseSnap = true;
|
||||
}
|
||||
|
||||
static int decreaseSnap = true;
|
||||
if (pDominantTrackedRemoteNew->Joystick.x < -0.6f)
|
||||
{
|
||||
if (decreaseSnap)
|
||||
{
|
||||
snapTurn += vr_snapturn_angle->value;
|
||||
static int decreaseSnap = true;
|
||||
if (pDominantTrackedRemoteNew->Joystick.x < -0.6f) {
|
||||
if (decreaseSnap) {
|
||||
snapTurn += vr_snapturn_angle->value;
|
||||
|
||||
//If snap turn configured for less than 10 degrees
|
||||
if (vr_snapturn_angle->value > 10.0f) {
|
||||
decreaseSnap = false;
|
||||
//If snap turn configured for less than 10 degrees
|
||||
if (vr_snapturn_angle->value > 10.0f) {
|
||||
decreaseSnap = false;
|
||||
}
|
||||
|
||||
if (snapTurn > 180.0f) {
|
||||
snapTurn -= 360.f;
|
||||
}
|
||||
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
|
||||
if (snapTurn > 180.0f)
|
||||
} else if (pDominantTrackedRemoteNew->Joystick.x > -0.4f) {
|
||||
decreaseSnap = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (fabs(pDominantTrackedRemoteNew->Joystick.x) > 0.5f) {
|
||||
if (increaseSnap)
|
||||
{
|
||||
snapTurn -= 360.f;
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
} else if (pDominantTrackedRemoteNew->Joystick.x > -0.4f)
|
||||
{
|
||||
decreaseSnap = true;
|
||||
}
|
||||
increaseSnap = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
increaseSnap = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateScopeAngles();
|
||||
|
|
|
@ -2926,10 +2926,16 @@ static void CG_DrawFlashZoomTransition( void ) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( cg.snap->ps.eFlags & EF_MG42_ACTIVE ) { // don't draw when on mg_42
|
||||
static qboolean mg42faded = qfalse;
|
||||
if ( cg.snap->ps.eFlags & EF_MG42_ACTIVE && !mg42faded) { // don't draw when on mg_42
|
||||
// keep the timer fresh so when you remove yourself from the mg42, it'll fade
|
||||
cg.zoomTime = cg.time;
|
||||
return;
|
||||
mg42faded = qtrue;
|
||||
} else {
|
||||
if (!( cg.snap->ps.eFlags & EF_MG42_ACTIVE))
|
||||
{
|
||||
mg42faded = qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cgs.gametype != GT_SINGLE_PLAYER ) { // JPW NERVE
|
||||
|
|
|
@ -3424,6 +3424,7 @@ void CG_AddViewWeapon( playerState_t *ps ) {
|
|||
}
|
||||
|
||||
if ( ps->eFlags & EF_MG42_ACTIVE ) {
|
||||
cgVR->mountedgun = qtrue;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3509,6 +3510,7 @@ void CG_AddViewWeapon( playerState_t *ps ) {
|
|||
|
||||
|
||||
//Set some important flags based on the current weapon
|
||||
cgVR->mountedgun = qfalse;
|
||||
switch ( ps->weapon ) {
|
||||
case WP_KNIFE:
|
||||
cgVR->velocitytriggered = qtrue;
|
||||
|
@ -3572,7 +3574,8 @@ void CG_AddViewWeapon( playerState_t *ps ) {
|
|||
|
||||
if (trap_Cvar_VariableIntegerValue("vr_lasersight") != 0 &&
|
||||
cgVR->backpackitemactive == 0 &&
|
||||
cg.predictedPlayerState.stats[STAT_HEALTH] > 0)
|
||||
cg.predictedPlayerState.stats[STAT_HEALTH] > 0 &&
|
||||
!cgVR->screen)
|
||||
{
|
||||
switch (ps->weapon)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue