diff --git a/Projects/Android/jni/d3es-multithread-master/neo/framework/Common.cpp b/Projects/Android/jni/d3es-multithread-master/neo/framework/Common.cpp index 86e3f51..2b700ec 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/framework/Common.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/framework/Common.cpp @@ -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 diff --git a/Projects/Android/jni/d3es-multithread-master/neo/framework/Common.h b/Projects/Android/jni/d3es-multithread-master/neo/framework/Common.h index 6c5b72b..daebe3b 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/framework/Common.h +++ b/Projects/Android/jni/d3es-multithread-master/neo/framework/Common.h @@ -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; diff --git a/Projects/Android/jni/d3es-multithread-master/neo/game/Player.cpp b/Projects/Android/jni/d3es-multithread-master/neo/game/Player.cpp index a023a8e..bcaf15a 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/game/Player.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/game/Player.cpp @@ -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; diff --git a/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.cpp b/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.cpp index 302648e..9b3b1bb 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/game/Vr.cpp @@ -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; diff --git a/Projects/Android/jni/d3es-multithread-master/neo/game/Weapon.cpp b/Projects/Android/jni/d3es-multithread-master/neo/game/Weapon.cpp index 2f7188b..91ff01d 100644 --- a/Projects/Android/jni/d3es-multithread-master/neo/game/Weapon.cpp +++ b/Projects/Android/jni/d3es-multithread-master/neo/game/Weapon.cpp @@ -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;