1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-17 02:46: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:
Alexei Kotov 2025-07-12 21:55:58 +03:00
commit 2504550c6f
5 changed files with 11 additions and 10 deletions

View file

@ -23,7 +23,6 @@ namespace MWGui
: WindowBase("openmw_jail_screen.layout")
, mDays(1)
, mFadeTimeRemaining(0)
, mTimeAdvancer(0.01f)
{
getWidget(mProgressBar, "ProgressBar");

View file

@ -1,14 +1,19 @@
#include "timeadvancer.hpp"
namespace
{
// Time per hour tick
constexpr float kProgressStepDelay = 1.0f / 60.0f;
}
namespace MWGui
{
TimeAdvancer::TimeAdvancer(float delay)
TimeAdvancer::TimeAdvancer()
: mRunning(false)
, mCurHour(0)
, mHours(1)
, mInterruptAt(-1)
, mDelay(delay)
, mRemainingTime(delay)
, mRemainingTime(kProgressStepDelay)
{
}
@ -17,7 +22,7 @@ namespace MWGui
mHours = hours;
mCurHour = 0;
mInterruptAt = interruptAt;
mRemainingTime = mDelay;
mRemainingTime = kProgressStepDelay;
mRunning = true;
}
@ -43,7 +48,7 @@ namespace MWGui
while (mRemainingTime <= 0)
{
mRemainingTime += mDelay;
mRemainingTime += kProgressStepDelay;
++mCurHour;
if (mCurHour <= mHours)

View file

@ -8,7 +8,7 @@ namespace MWGui
class TimeAdvancer
{
public:
TimeAdvancer(float delay);
TimeAdvancer();
void run(int hours, int interruptAt = -1);
void stop();
@ -32,7 +32,6 @@ namespace MWGui
int mHours;
int mInterruptAt;
float mDelay;
float mRemainingTime;
};
}

View file

@ -27,7 +27,6 @@ namespace MWGui
TrainingWindow::TrainingWindow()
: WindowBase("openmw_trainingwindow.layout")
, mTimeAdvancer(0.05f)
{
getWidget(mTrainingOptions, "TrainingOptions");
getWidget(mCancelButton, "CancelButton");

View file

@ -52,7 +52,6 @@ namespace MWGui
WaitDialog::WaitDialog()
: WindowBase("openmw_wait_dialog.layout")
, mTimeAdvancer(0.05f)
, mSleeping(false)
, mHours(1)
, mManualHours(1)