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

View file

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