mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:53:50 +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)
|
||||
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();
|
||||
|
||||
|
|
|
@ -185,12 +185,9 @@ namespace MWBase
|
|||
|
||||
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.
|
||||
|
||||
virtual void advanceTimeByFrame (double frametime) = 0;
|
||||
///< Advance in-game time by the duration of a frame.
|
||||
|
||||
virtual void setHour (double hour) = 0;
|
||||
///< Set in-game time hour.
|
||||
|
||||
|
|
|
@ -670,19 +670,12 @@ osg::Vec3f WeatherManager::getStormDirection() const
|
|||
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 any of those events occur, all weather transitions are immediately applied, regardless of
|
||||
// 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.
|
||||
// In Morrowind, when the player sleeps/waits, serves jail time, travels, or trains, all weather transitions are
|
||||
// immediately applied, regardless of whatever transition time might have been remaining.
|
||||
mTimePassed += hours;
|
||||
mFastForward = (!mFastForward && !incremental) ? true : mFastForward;
|
||||
}
|
||||
|
||||
unsigned int WeatherManager::getWeatherID() const
|
||||
|
|
|
@ -206,8 +206,7 @@ namespace MWWorld
|
|||
|
||||
osg::Vec3f getStormDirection() const;
|
||||
|
||||
void advanceTime(double hours);
|
||||
void advanceTimeByFrame(double hours);
|
||||
void advanceTime(double hours, bool incremental);
|
||||
|
||||
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));
|
||||
|
||||
mWeatherManager->advanceTime (hours);
|
||||
|
||||
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);
|
||||
mWeatherManager->advanceTime (hours, incremental);
|
||||
|
||||
hours += mGlobalVariables["gamehour"].getFloat();
|
||||
|
||||
|
|
|
@ -274,12 +274,9 @@ namespace MWWorld
|
|||
|
||||
virtual void disable (const Ptr& ptr);
|
||||
|
||||
virtual void advanceTime (double hours);
|
||||
virtual void advanceTime (double hours, bool incremental = false);
|
||||
///< Advance in-game time.
|
||||
|
||||
virtual void advanceTimeByFrame (double frametime);
|
||||
///< Advance in-game time by the duration of a frame.
|
||||
|
||||
virtual void setHour (double hour);
|
||||
///< Set in-game time hour.
|
||||
|
||||
|
|
Loading…
Reference in a new issue