Couple of changes

- Remove dodgy weapon angle adjust (not needed as there is already implementation in there to adjust)
- Added method to get frame number from the engine
This commit is contained in:
Simon 2020-11-16 23:44:42 +00:00
parent cb68e1ee26
commit 28bd463e09
5 changed files with 25 additions and 20 deletions

View File

@ -169,7 +169,9 @@ public:
virtual int ButtonState( int key );
virtual int KeyState( int key );
virtual void Vibrate(int channel, float low, float high );
virtual int GetFrameNumber();
virtual void Vibrate(int channel, float low, float high );
// DG: hack to allow adding callbacks and exporting additional functions without breaking the game ABI
// see Common.h for longer explanation...
@ -1639,6 +1641,12 @@ void idCommonLocal::LocalizeSpecificMapData( const char *fileName, idLangDict &l
}
}
int idCommonLocal::GetFrameNumber()
{
return idLib::frameNumber;
}
/*
===============
idCommonLocal::LocalizeMapData

View File

@ -217,6 +217,8 @@ public:
// Directly sample a keystate.
virtual int KeyState( int key ) = 0;
virtual int GetFrameNumber() = 0;
//Haptic Feedback
virtual void Vibrate(int channel, float low, float high ) = 0;

View File

@ -3754,9 +3754,10 @@ idPlayer::GetHudAlpha
*/
float idPlayer::GetHudAlpha()
{
static int lastFrame = idLib::frameNumber;
static int lastFrame = 0;
static float currentAlpha = 0.0f;
static float delta = 0.0f;
int currentFrameNumber = common->GetFrameNumber();
delta = vr_hudTransparency.GetFloat() / (125 / (1000 / commonVr->hmdHz));
@ -3764,10 +3765,10 @@ float idPlayer::GetHudAlpha()
{
return hudActive ? vr_hudTransparency.GetFloat() : 0;
}
//GB This doesn't seem to work as it didn't elsewhere
//if ( lastFrame == idLib::frameNumber ) return currentAlpha;
lastFrame = idLib::frameNumber;
if ( lastFrame == currentFrameNumber ) return currentAlpha;
lastFrame = currentFrameNumber;
bool force = false;

View File

@ -549,7 +549,7 @@ void iVr::HMDGetOrientation( idAngles &hmdAngles, idVec3 &headPositionDelta, idV
poseLastHmdAbsolutePosition = poseHmdAbsolutePosition;
if ( vr_frameCheck.GetInteger() == 1 && idLib::frameNumber == lastFrame )//&& !commonVr->renderingSplash )
if ( vr_frameCheck.GetInteger() == 1 && common->GetFrameNumber() == lastFrame )//&& !commonVr->renderingSplash )
{
//make sure to return the same values for this frame.
hmdAngles.roll = lastRoll;
@ -586,12 +586,11 @@ void iVr::HMDGetOrientation( idAngles &hmdAngles, idVec3 &headPositionDelta, idV
cinematicStartViewYaw = trackingOriginYawOffset;
}
common->Printf( "HMDGetOrientation FramCheck Bail == idLib:: framenumber lf %d ilfn %d rendersplash = %d\n", lastFrame, idLib::frameNumber, commonVr->renderingSplash );
common->Printf( "HMDGetOrientation FramCheck Bail == idLib:: framenumber lf %d ilfn %d rendersplash = %d\n", lastFrame, common->GetFrameNumber(), commonVr->renderingSplash );
return;
}
lastFrame = idLib::frameNumber;
lastFrame = common->GetFrameNumber();
static idPosef translationPose;
static idPosef orientationPose;
@ -629,15 +628,10 @@ void iVr::HMDGetOrientation( idAngles &hmdAngles, idVec3 &headPositionDelta, idV
}
//GB Get all hand poses
idQuat weaponAdjust = idAngles(0, 0, -20).ToQuat();
idQuat flashlightAdjust = idAngles(0, 0, -35).ToQuat();
idVec3 _lhandPosition = idVec3(pVRClientInfo->lhandposition[0],pVRClientInfo->lhandposition[1],pVRClientInfo->lhandposition[2]);
idQuat _lhandOrientation = idQuat(pVRClientInfo->lhand_orientation_quat[0],pVRClientInfo->lhand_orientation_quat[1],pVRClientInfo->lhand_orientation_quat[2],pVRClientInfo->lhand_orientation_quat[3]) *
(pVRClientInfo->right_handed ? flashlightAdjust : weaponAdjust);
idQuat _lhandOrientation = idQuat(pVRClientInfo->lhand_orientation_quat[0],pVRClientInfo->lhand_orientation_quat[1],pVRClientInfo->lhand_orientation_quat[2],pVRClientInfo->lhand_orientation_quat[3]);
idVec3 _rhandPosition = idVec3(pVRClientInfo->rhandposition[0],pVRClientInfo->rhandposition[1],pVRClientInfo->rhandposition[2]);
idQuat _rhandOrientation = idQuat(pVRClientInfo->rhand_orientation_quat[0],pVRClientInfo->rhand_orientation_quat[1],pVRClientInfo->rhand_orientation_quat[2],pVRClientInfo->rhand_orientation_quat[3]) *
(!pVRClientInfo->right_handed ? flashlightAdjust : weaponAdjust);
idQuat _rhandOrientation = idQuat(pVRClientInfo->rhand_orientation_quat[0],pVRClientInfo->rhand_orientation_quat[1],pVRClientInfo->rhand_orientation_quat[2],pVRClientInfo->rhand_orientation_quat[3]);
commonVr->handPose[1].Orientation = _lhandOrientation;

View File

@ -1193,13 +1193,13 @@ Koz return weapon enumeration
weapon_t idWeapon::IdentifyWeapon()
{
/*if ( lastIdentifiedFrame == idLib::frameNumber ) // only check once per game frame.
int currentFrameNumber = common->GetFrameNumber();
if ( lastIdentifiedFrame == currentFrameNumber ) // only check once per game frame.
{
//GBFIX - This is true even though it isnt!!
//return currentIdentifiedWeapon;
return currentIdentifiedWeapon;
}
lastIdentifiedFrame = idLib::frameNumber;*/
lastIdentifiedFrame = currentFrameNumber;
currentIdentifiedWeapon = WEAPON_NONE;