mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-27 14:10:46 -04:00
fix the weather not changing when sleeping/waiting
This commit is contained in:
parent
359824d614
commit
caef570c8a
@ -41,7 +41,8 @@ const float WeatherGlobals::mThunderSoundDelay = 0.25;
|
|||||||
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering) :
|
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering) :
|
||||||
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
||||||
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0),
|
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0),
|
||||||
mRemainingTransitionTime(0), mMonth(0), mDay(0)
|
mRemainingTransitionTime(0), mMonth(0), mDay(0),
|
||||||
|
mTimePassed(0)
|
||||||
{
|
{
|
||||||
mRendering = rendering;
|
mRendering = rendering;
|
||||||
|
|
||||||
@ -487,7 +488,10 @@ WeatherResult WeatherManager::transition(float factor)
|
|||||||
|
|
||||||
void WeatherManager::update(float duration)
|
void WeatherManager::update(float duration)
|
||||||
{
|
{
|
||||||
mWeatherUpdateTime -= duration * MWBase::Environment::get().getWorld()->getTimeScaleFactor();
|
float timePassed = mTimePassed;
|
||||||
|
mTimePassed = 0;
|
||||||
|
|
||||||
|
mWeatherUpdateTime -= timePassed;
|
||||||
|
|
||||||
bool exterior = (MWBase::Environment::get().getWorld()->isCellExterior() || MWBase::Environment::get().getWorld()->isCellQuasiExterior());
|
bool exterior = (MWBase::Environment::get().getWorld()->isCellExterior() || MWBase::Environment::get().getWorld()->isCellQuasiExterior());
|
||||||
|
|
||||||
@ -558,7 +562,7 @@ void WeatherManager::update(float duration)
|
|||||||
|
|
||||||
if (mNextWeather != "")
|
if (mNextWeather != "")
|
||||||
{
|
{
|
||||||
mRemainingTransitionTime -= duration * MWBase::Environment::get().getWorld()->getTimeScaleFactor();
|
mRemainingTransitionTime -= timePassed;
|
||||||
if (mRemainingTransitionTime < 0)
|
if (mRemainingTransitionTime < 0)
|
||||||
{
|
{
|
||||||
mCurrentWeather = mNextWeather;
|
mCurrentWeather = mNextWeather;
|
||||||
|
@ -231,6 +231,11 @@ namespace MWWorld
|
|||||||
|
|
||||||
void setDate(const int day, const int month);
|
void setDate(const int day, const int month);
|
||||||
|
|
||||||
|
void advanceTime(double hours)
|
||||||
|
{
|
||||||
|
mTimePassed += hours*3600;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int getWeatherID() const;
|
unsigned int getWeatherID() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -261,6 +266,8 @@ namespace MWWorld
|
|||||||
float mThunderChanceNeeded;
|
float mThunderChanceNeeded;
|
||||||
float mThunderSoundDelay;
|
float mThunderSoundDelay;
|
||||||
|
|
||||||
|
double mTimePassed; // time passed since last update
|
||||||
|
|
||||||
WeatherResult transition(const float factor);
|
WeatherResult transition(const float factor);
|
||||||
WeatherResult getResult(const Ogre::String& weather);
|
WeatherResult getResult(const Ogre::String& weather);
|
||||||
|
|
||||||
|
@ -366,6 +366,8 @@ namespace MWWorld
|
|||||||
|
|
||||||
void World::advanceTime (double hours)
|
void World::advanceTime (double hours)
|
||||||
{
|
{
|
||||||
|
mWeatherManager->advanceTime (hours);
|
||||||
|
|
||||||
hours += mGlobalVariables->getFloat ("gamehour");
|
hours += mGlobalVariables->getFloat ("gamehour");
|
||||||
|
|
||||||
setHour (hours);
|
setHour (hours);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user