mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-10 23:04:34 +00:00
Merge branch 'fasterwait' into 'master'
More closely match rest/wait progress speed to vanilla See merge request OpenMW/openmw!4772
This commit is contained in:
commit
2504550c6f
5 changed files with 11 additions and 10 deletions
|
|
@ -23,7 +23,6 @@ namespace MWGui
|
||||||
: WindowBase("openmw_jail_screen.layout")
|
: WindowBase("openmw_jail_screen.layout")
|
||||||
, mDays(1)
|
, mDays(1)
|
||||||
, mFadeTimeRemaining(0)
|
, mFadeTimeRemaining(0)
|
||||||
, mTimeAdvancer(0.01f)
|
|
||||||
{
|
{
|
||||||
getWidget(mProgressBar, "ProgressBar");
|
getWidget(mProgressBar, "ProgressBar");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,19 @@
|
||||||
#include "timeadvancer.hpp"
|
#include "timeadvancer.hpp"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// Time per hour tick
|
||||||
|
constexpr float kProgressStepDelay = 1.0f / 60.0f;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
TimeAdvancer::TimeAdvancer(float delay)
|
TimeAdvancer::TimeAdvancer()
|
||||||
: mRunning(false)
|
: mRunning(false)
|
||||||
, mCurHour(0)
|
, mCurHour(0)
|
||||||
, mHours(1)
|
, mHours(1)
|
||||||
, mInterruptAt(-1)
|
, mInterruptAt(-1)
|
||||||
, mDelay(delay)
|
, mRemainingTime(kProgressStepDelay)
|
||||||
, mRemainingTime(delay)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17,7 +22,7 @@ namespace MWGui
|
||||||
mHours = hours;
|
mHours = hours;
|
||||||
mCurHour = 0;
|
mCurHour = 0;
|
||||||
mInterruptAt = interruptAt;
|
mInterruptAt = interruptAt;
|
||||||
mRemainingTime = mDelay;
|
mRemainingTime = kProgressStepDelay;
|
||||||
|
|
||||||
mRunning = true;
|
mRunning = true;
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +48,7 @@ namespace MWGui
|
||||||
|
|
||||||
while (mRemainingTime <= 0)
|
while (mRemainingTime <= 0)
|
||||||
{
|
{
|
||||||
mRemainingTime += mDelay;
|
mRemainingTime += kProgressStepDelay;
|
||||||
++mCurHour;
|
++mCurHour;
|
||||||
|
|
||||||
if (mCurHour <= mHours)
|
if (mCurHour <= mHours)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace MWGui
|
||||||
class TimeAdvancer
|
class TimeAdvancer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TimeAdvancer(float delay);
|
TimeAdvancer();
|
||||||
|
|
||||||
void run(int hours, int interruptAt = -1);
|
void run(int hours, int interruptAt = -1);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
@ -32,7 +32,6 @@ namespace MWGui
|
||||||
int mHours;
|
int mHours;
|
||||||
int mInterruptAt;
|
int mInterruptAt;
|
||||||
|
|
||||||
float mDelay;
|
|
||||||
float mRemainingTime;
|
float mRemainingTime;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ namespace MWGui
|
||||||
|
|
||||||
TrainingWindow::TrainingWindow()
|
TrainingWindow::TrainingWindow()
|
||||||
: WindowBase("openmw_trainingwindow.layout")
|
: WindowBase("openmw_trainingwindow.layout")
|
||||||
, mTimeAdvancer(0.05f)
|
|
||||||
{
|
{
|
||||||
getWidget(mTrainingOptions, "TrainingOptions");
|
getWidget(mTrainingOptions, "TrainingOptions");
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ namespace MWGui
|
||||||
|
|
||||||
WaitDialog::WaitDialog()
|
WaitDialog::WaitDialog()
|
||||||
: WindowBase("openmw_wait_dialog.layout")
|
: WindowBase("openmw_wait_dialog.layout")
|
||||||
, mTimeAdvancer(0.05f)
|
|
||||||
, mSleeping(false)
|
, mSleeping(false)
|
||||||
, mHours(1)
|
, mHours(1)
|
||||||
, mManualHours(1)
|
, mManualHours(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue