Fix crash introduced by stabilised weapon logic

This commit is contained in:
Simon 2021-04-07 22:02:35 +01:00
parent b0f9b4ed9a
commit 6e7f124a7d
4 changed files with 14 additions and 3 deletions

View file

@ -13389,7 +13389,7 @@ void idPlayer::CalculateViewWeaponPosVR( int hand, idVec3 &origin, idMat3 &axis
commonVr->MotionControlGetHand( hand, hands[ hand ].motionPosition, hands[ hand ].motionRotation ); commonVr->MotionControlGetHand( hand, hands[ hand ].motionPosition, hands[ hand ].motionRotation );
if (!pVRClientInfo->weapon_stabilised) if (!commonVr->GetWeaponStabilised())
{ {
weaponPitch = idAngles( vr_motionWeaponPitchAdj.GetFloat(), 0.0f, 0.0f ).ToQuat(); weaponPitch = idAngles( vr_motionWeaponPitchAdj.GetFloat(), 0.0f, 0.0f ).ToQuat();
hands[hand].motionRotation = weaponPitch * hands[hand].motionRotation; hands[hand].motionRotation = weaponPitch * hands[hand].motionRotation;
@ -13665,7 +13665,7 @@ void idPlayer::CalculateViewFlashlightPos( idVec3 &origin, idMat3 &axis, idVec3
axis = idAngles( 0.0, viewAngles.yaw - commonVr->bodyYawOffset, 0.0f ).ToMat3(); axis = idAngles( 0.0, viewAngles.yaw - commonVr->bodyYawOffset, 0.0f ).ToMat3();
int flashlightMode = commonVr->GetCurrentFlashlightMode(); int flashlightMode = commonVr->GetCurrentFlashlightMode();
if (pVRClientInfo->weapon_stabilised && flashlightMode == FLASHLIGHT_HAND ) if (commonVr->GetWeaponStabilised() && flashlightMode == FLASHLIGHT_HAND )
{ {
flashlightMode = FLASHLIGHT_GUN; flashlightMode = FLASHLIGHT_GUN;
} }

View file

@ -1096,6 +1096,16 @@ void iVr::CalcAimMove( float &yawDelta, float &pitchDelta )
} }
bool iVr::GetWeaponStabilised()
{
if (pVRClientInfo)
{
return pVRClientInfo->weapon_stabilised;
}
return false;
}
/* /*

View file

@ -163,6 +163,8 @@ public:
void MotionControllerSetHapticOculus( float low, float hi ); void MotionControllerSetHapticOculus( float low, float hi );
void MotionControllerSetHapticOpenVR( int hand, unsigned short value ); void MotionControllerSetHapticOpenVR( int hand, unsigned short value );
bool GetWeaponStabilised();
//void MSAAResolve( void ); //void MSAAResolve( void );
//void FXAAResolve( idImage * leftCurrent, idImage * rightCurrent ); //void FXAAResolve( idImage * leftCurrent, idImage * rightCurrent );
//void FXAASetUniforms( Framebuffer FBO ); //void FXAASetUniforms( Framebuffer FBO );

View file

@ -2079,7 +2079,6 @@ void idWeapon::BeginAttack( void ) {
} }
} }
WEAPON_ATTACK = true; WEAPON_ATTACK = true;
} }
/* /*