Fix crash when going into a cut scene with scope activated

This commit is contained in:
Simon 2023-12-09 17:05:09 +00:00
parent 930d64b758
commit 1141b17bf1
1 changed files with 21 additions and 13 deletions

View File

@ -669,22 +669,30 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
} }
//Should we trigger the disruptor scope? //Should we trigger the disruptor scope?
if ((cl.frame.ps.weapon == WP_DISRUPTOR || if (!vr.cin_camera)
cl.frame.ps.weapon == WP_BLASTER) &&
cl.frame.ps.stats[STAT_HEALTH] > 0)
{ {
if (vr.weapon_stabilised && if ((cl.frame.ps.weapon == WP_DISRUPTOR ||
VectorLength(vr.weaponoffset) < vr_scope_engage_distance->value && cl.frame.ps.weapon == WP_BLASTER) &&
vr.cgzoommode == 0) { cl.frame.ps.stats[STAT_HEALTH] > 0)
sendButtonAction("enterscope", true); {
} else if ((VectorLength(vr.weaponoffset) > 0.26f || !vr.weapon_stabilised) && if (vr.weapon_stabilised &&
(vr.cgzoommode == 2 || vr.cgzoommode == 4)) { VectorLength(vr.weaponoffset) < vr_scope_engage_distance->value &&
vr.cgzoommode == 0)
{
sendButtonAction("enterscope", true);
}
else if ((VectorLength(vr.weaponoffset) > 0.26f || !vr.weapon_stabilised) &&
(vr.cgzoommode == 2 || vr.cgzoommode == 4))
{
sendButtonActionSimple("exitscope");
}
}
else if (vr.cgzoommode == 2 || vr.cgzoommode == 4)
{
// In case we were using weapon scope and weapon
// was changed due to out of ammo, exit scope
sendButtonActionSimple("exitscope"); sendButtonActionSimple("exitscope");
} }
} else if (vr.cgzoommode == 2 || vr.cgzoommode == 4) {
// In case we were using weapon scope and weapon
// was changed due to out of ammo, exit scope
sendButtonActionSimple("exitscope");
} }
vec3_t offhandPositionAverage; vec3_t offhandPositionAverage;