|
|
|
@ -91,7 +91,11 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|
|
|
|
if (mUseSound)
|
|
|
|
|
MWBase::Environment::get().getSoundManager()->update(frametime);
|
|
|
|
|
|
|
|
|
|
bool paused = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
|
|
|
|
// GUI active? Most game processing will be paused, but scripts still run.
|
|
|
|
|
bool guiActive = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
|
|
|
|
|
|
|
|
|
// Main menu opened? Then scripts are also paused.
|
|
|
|
|
bool paused = MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu);
|
|
|
|
|
|
|
|
|
|
// update game state
|
|
|
|
|
MWBase::Environment::get().getStateManager()->update (frametime);
|
|
|
|
@ -99,15 +103,18 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|
|
|
|
if (MWBase::Environment::get().getStateManager()->getState()==
|
|
|
|
|
MWBase::StateManager::State_Running)
|
|
|
|
|
{
|
|
|
|
|
// global scripts
|
|
|
|
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().run();
|
|
|
|
|
if (!paused)
|
|
|
|
|
{
|
|
|
|
|
// global scripts
|
|
|
|
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().run();
|
|
|
|
|
|
|
|
|
|
// local scripts
|
|
|
|
|
executeLocalScripts();
|
|
|
|
|
// local scripts
|
|
|
|
|
executeLocalScripts();
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
|
|
|
|
|
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!paused)
|
|
|
|
|
if (!guiActive)
|
|
|
|
|
MWBase::Environment::get().getWorld()->advanceTime(
|
|
|
|
|
frametime*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
|
|
|
|
|
}
|
|
|
|
@ -118,14 +125,14 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|
|
|
|
MWBase::StateManager::State_NoGame)
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->update(frametime,
|
|
|
|
|
paused);
|
|
|
|
|
guiActive);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MWBase::Environment::get().getStateManager()->getState()==
|
|
|
|
|
MWBase::StateManager::State_Running)
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Ptr player = mEnvironment.getWorld()->getPlayerPtr();
|
|
|
|
|
if(!paused && player.getClass().getCreatureStats(player).isDead())
|
|
|
|
|
if(!guiActive && player.getClass().getCreatureStats(player).isDead())
|
|
|
|
|
MWBase::Environment::get().getStateManager()->endGame();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -133,7 +140,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|
|
|
|
if (MWBase::Environment::get().getStateManager()->getState()!=
|
|
|
|
|
MWBase::StateManager::State_NoGame)
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getWorld()->update(frametime, paused);
|
|
|
|
|
MWBase::Environment::get().getWorld()->update(frametime, guiActive);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// update GUI
|
|
|
|
|