From de83ad0116c434e8bf90ab4f330a93e50f392191 Mon Sep 17 00:00:00 2001 From: rexelion Date: Sat, 4 Nov 2017 00:24:09 +0000 Subject: [PATCH] use real time; wait random number of seconds --- apps/openmw/mwmechanics/character.cpp | 7 +++---- apps/openmw/mwmechanics/character.hpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index c3ca8f512..dffc095e9 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -248,15 +248,14 @@ void CharacterController::refreshHitRecoilAnims() bool knockdown = mPtr.getClass().getCreatureStats(mPtr).getKnockedDown(); bool block = mPtr.getClass().getCreatureStats(mPtr).getBlock(); bool isSwimming = MWBase::Environment::get().getWorld()->isSwimming(mPtr); - MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp(); - float timeScale = MWBase::Environment::get().getWorld()->getTimeScaleFactor(); if(mHitState == CharState_None) { if ((mPtr.getClass().getCreatureStats(mPtr).getFatigue().getCurrent() < 0 || mPtr.getClass().getCreatureStats(mPtr).getFatigue().getBase() == 0) && mAnimation->hasAnimation("knockout")) { - mKnockoutTime = MWBase::Environment::get().getWorld()->getTimeStamp(); + mTimeToWake = time(NULL); + mTimeToWake += rand() % 2 + 1; // Wake up after 1 to 3 seconds if (isSwimming && mAnimation->hasAnimation("swimknockout")) { mHitState = CharState_SwimKnockOut; @@ -342,7 +341,7 @@ void CharacterController::refreshHitRecoilAnims() mHitState = CharState_None; } else if (isKnockedOut() && mPtr.getClass().getCreatureStats(mPtr).getFatigue().getCurrent() > 0 - && (currentTime - mKnockoutTime) > 3*timeScale/3600) //Wait 3 seconds before getting up + && time(NULL) > mTimeToWake) { mHitState = isSwimming ? CharState_SwimKnockDown : CharState_KnockDown; mAnimation->disable(mCurrentHit); diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 0654b8534..af8415e35 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -197,7 +197,7 @@ class CharacterController : public MWRender::Animation::TextKeyListener float mSecondsOfSwimming; float mSecondsOfRunning; - MWWorld::TimeStamp mKnockoutTime; + time_t mTimeToWake; MWWorld::ConstPtr mHeadTrackTarget;