Fix crash introduced by stabilised weapon logic

This commit is contained in:
Simon 2021-04-07 22:02:35 +01:00
parent 3bf538336d
commit 4602287931
3 changed files with 11 additions and 13 deletions

View file

@ -13486,7 +13486,7 @@ void idPlayer::CalculateViewWeaponPosVR( int hand, idVec3 &origin, idMat3 &axis
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();
hands[hand].motionRotation = weaponPitch * hands[hand].motionRotation;
@ -13762,7 +13762,7 @@ void idPlayer::CalculateViewFlashlightPos( idVec3 &origin, idMat3 &axis, idVec3
axis = idAngles( 0.0, viewAngles.yaw - commonVr->bodyYawOffset, 0.0f ).ToMat3();
int flashlightMode = commonVr->GetCurrentFlashlightMode();
if (pVRClientInfo->weapon_stabilised && flashlightMode == FLASHLIGHT_HAND )
if (commonVr->GetWeaponStabilised() && flashlightMode == FLASHLIGHT_HAND )
{
flashlightMode = FLASHLIGHT_GUN;
}

View file

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

View file

@ -2092,7 +2092,7 @@ void idWeapon::BeginAttack( void ) {
}
if (currentWeapon == WEAPON_CHAINGUN)
{
position = pVRClientInfo->weapon_stabilised ? 4 : position;
position = commonVr->GetWeaponStabilised() ? 4 : position;
common->HapticEvent("chaingun_init", position, 0, 100, 0, 0);
}
if (currentWeapon == WEAPON_BFG)
@ -4049,21 +4049,19 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
int position = vr_weaponHand.GetInteger() ? 1 : 2;
vrClientInfo *pVRClientInfo = owner->GetVRClientInfo();
if (currentWeap == WEAPON_PISTOL)
{
position = pVRClientInfo->weapon_stabilised ? 4 : position;
position = commonVr->GetWeaponStabilised() ? 4 : position;
common->HapticEvent("pistol_fire", position, 0, 100, 0, 0);
}
if (currentWeap == WEAPON_SHOTGUN)
{
position = pVRClientInfo->weapon_stabilised ? 4 : position;
position = commonVr->GetWeaponStabilised() ? 4 : position;
common->HapticEvent("shotgun_fire", position, 0, 100, 0, 0);
}
if (currentWeap == WEAPON_PLASMAGUN)
{
position = pVRClientInfo->weapon_stabilised ? 4 : position;
position = commonVr->GetWeaponStabilised() ? 4 : position;
common->HapticEvent("plasmagun_fire", position, 0, 100, 0, 0);
}
if (currentWeap == WEAPON_HANDGRENADE)
@ -4072,12 +4070,12 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
}
if (currentWeap == WEAPON_MACHINEGUN)
{
position = pVRClientInfo->weapon_stabilised ? 4 : position;
position = commonVr->GetWeaponStabilised() ? 4 : position;
common->HapticEvent("machinegun_fire", position, 0, 100, 0, 0);
}
if (currentWeap == WEAPON_CHAINGUN)
{
position = pVRClientInfo->weapon_stabilised ? 4 : position;
position = commonVr->GetWeaponStabilised() ? 4 : position;
common->HapticEvent("chaingun_fire", position, 0, 100, 0, 0);
}
if (currentWeap == WEAPON_BFG)
@ -4086,7 +4084,7 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
}
if (currentWeap == WEAPON_ROCKETLAUNCHER)
{
position = pVRClientInfo->weapon_stabilised ? 4 : position;
position = commonVr->GetWeaponStabilised() ? 4 : position;
common->HapticEvent("rocket_fire", position, 0, 100, 0, 0);
}
@ -4247,8 +4245,6 @@ void idWeapon::Event_Melee( void ) {
gameLocal.Error( "No meleeDef on '%s'", weaponDef->dict.GetString( "classname" ) );
}
vrClientInfo *pVRClientInfo = owner->GetVRClientInfo();
weapon_t currentWeapon = IdentifyWeapon();
if (currentWeapon == WEAPON_FISTS)
{