mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
Merge advanceTime and advanceTimeByFrame
This commit is contained in:
parent
cd8ec5c11e
commit
4fd00a75d5
6 changed files with 13 additions and 43 deletions
|
@ -128,7 +128,10 @@ void OMW::Engine::frame(float frametime)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!guiActive)
|
if (!guiActive)
|
||||||
mEnvironment.getWorld()->advanceTimeByFrame(frametime);
|
{
|
||||||
|
double hours = (frametime * mEnvironment.getWorld()->getTimeScaleFactor()) / 3600.0;
|
||||||
|
mEnvironment.getWorld()->advanceTime(hours, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
osg::Timer_t afterScriptTick = osg::Timer::instance()->tick();
|
osg::Timer_t afterScriptTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
|
|
|
@ -185,12 +185,9 @@ namespace MWBase
|
||||||
|
|
||||||
virtual void disable (const MWWorld::Ptr& ptr) = 0;
|
virtual void disable (const MWWorld::Ptr& ptr) = 0;
|
||||||
|
|
||||||
virtual void advanceTime (double hours) = 0;
|
virtual void advanceTime (double hours, bool incremental = false) = 0;
|
||||||
///< Advance in-game time.
|
///< Advance in-game time.
|
||||||
|
|
||||||
virtual void advanceTimeByFrame (double frametime) = 0;
|
|
||||||
///< Advance in-game time by the duration of a frame.
|
|
||||||
|
|
||||||
virtual void setHour (double hour) = 0;
|
virtual void setHour (double hour) = 0;
|
||||||
///< Set in-game time hour.
|
///< Set in-game time hour.
|
||||||
|
|
||||||
|
|
|
@ -670,19 +670,12 @@ osg::Vec3f WeatherManager::getStormDirection() const
|
||||||
return mStormDirection;
|
return mStormDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WeatherManager::advanceTime(double hours)
|
void WeatherManager::advanceTime(double hours, bool incremental)
|
||||||
{
|
{
|
||||||
// This is called when the player sleeps/waits, serves jail time, travels, or trains.
|
// In Morrowind, when the player sleeps/waits, serves jail time, travels, or trains, all weather transitions are
|
||||||
// In Morrowind, when any of those events occur, all weather transitions are immediately applied, regardless of
|
// immediately applied, regardless of whatever transition time might have been remaining.
|
||||||
// whatever transition time might have been remaining.
|
|
||||||
mTimePassed += hours;
|
|
||||||
mFastForward = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WeatherManager::advanceTimeByFrame(double hours)
|
|
||||||
{
|
|
||||||
// Called when time is advanced by an incremental update for each frame.
|
|
||||||
mTimePassed += hours;
|
mTimePassed += hours;
|
||||||
|
mFastForward = (!mFastForward && !incremental) ? true : mFastForward;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int WeatherManager::getWeatherID() const
|
unsigned int WeatherManager::getWeatherID() const
|
||||||
|
|
|
@ -206,8 +206,7 @@ namespace MWWorld
|
||||||
|
|
||||||
osg::Vec3f getStormDirection() const;
|
osg::Vec3f getStormDirection() const;
|
||||||
|
|
||||||
void advanceTime(double hours);
|
void advanceTime(double hours, bool incremental);
|
||||||
void advanceTimeByFrame(double hours);
|
|
||||||
|
|
||||||
unsigned int getWeatherID() const;
|
unsigned int getWeatherID() const;
|
||||||
|
|
||||||
|
|
|
@ -787,30 +787,11 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::advanceTime (double hours)
|
void World::advanceTime (double hours, bool incremental)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getMechanicsManager()->advanceTime(static_cast<float>(hours * 3600));
|
MWBase::Environment::get().getMechanicsManager()->advanceTime(static_cast<float>(hours * 3600));
|
||||||
|
|
||||||
mWeatherManager->advanceTime (hours);
|
mWeatherManager->advanceTime (hours, incremental);
|
||||||
|
|
||||||
hours += mGlobalVariables["gamehour"].getFloat();
|
|
||||||
|
|
||||||
setHour (hours);
|
|
||||||
|
|
||||||
int days = static_cast<int>(hours / 24);
|
|
||||||
|
|
||||||
if (days>0)
|
|
||||||
mGlobalVariables["dayspassed"].setInteger (
|
|
||||||
days + mGlobalVariables["dayspassed"].getInteger());
|
|
||||||
}
|
|
||||||
|
|
||||||
void World::advanceTimeByFrame (double frametime)
|
|
||||||
{
|
|
||||||
double hours = (frametime * getTimeScaleFactor()) / 3600.0;
|
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->advanceTime(static_cast<float>(hours * 3600));
|
|
||||||
|
|
||||||
mWeatherManager->advanceTimeByFrame (hours);
|
|
||||||
|
|
||||||
hours += mGlobalVariables["gamehour"].getFloat();
|
hours += mGlobalVariables["gamehour"].getFloat();
|
||||||
|
|
||||||
|
|
|
@ -274,12 +274,9 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual void disable (const Ptr& ptr);
|
virtual void disable (const Ptr& ptr);
|
||||||
|
|
||||||
virtual void advanceTime (double hours);
|
virtual void advanceTime (double hours, bool incremental = false);
|
||||||
///< Advance in-game time.
|
///< Advance in-game time.
|
||||||
|
|
||||||
virtual void advanceTimeByFrame (double frametime);
|
|
||||||
///< Advance in-game time by the duration of a frame.
|
|
||||||
|
|
||||||
virtual void setHour (double hour);
|
virtual void setHour (double hour);
|
||||||
///< Set in-game time hour.
|
///< Set in-game time hour.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue