Prevent being in a menu from disabling script execution or actor damage

This commit is contained in:
David Cernat 2016-10-25 17:48:00 +03:00
parent cc40b85034
commit aaf4cc0d7e
3 changed files with 16 additions and 1 deletions

View file

@ -104,12 +104,14 @@ void OMW::Engine::frame(float frametime)
mwmp::Main::Frame(frametime);
// Main menu opened? Then scripts are also paused.
bool paused = mEnvironment.getWindowManager()->containsMode(MWGui::GM_MainMenu);
bool paused = /*mEnvironment.getWindowManager()->containsMode(MWGui::GM_MainMenu);*/ false;
// The above is overridden by tes3mp, where the game should never be pausable
// update game state
mEnvironment.getStateManager()->update (frametime);
bool guiActive = /*mEnvironment.getWindowManager()->isGuiMode()*/ false;
// The above is overridden by tes3mp, where the Gui being active doesn't matter
osg::Timer_t beforeScriptTick = osg::Timer::instance()->tick();
if (mEnvironment.getStateManager()->getState()==
@ -693,6 +695,8 @@ void OMW::Engine::go()
dt = std::min(dt, 0.2);
bool guiActive = /*mEnvironment.getWindowManager()->isGuiMode()*/ false;
// The above is overridden by tes3mp, where the Gui being active doesn't matter
if (!guiActive)
simulationTime += dt;

View file

@ -210,7 +210,12 @@ namespace MWScript
bool InterpreterContext::menuMode()
{
/* Disabled by tes3mp, because being in a menu should not pause scripts in it
return MWBase::Environment::get().getWindowManager()->isGuiMode();
*/
return 0;
}
int InterpreterContext::getGlobalShort (const std::string& name) const

View file

@ -2327,8 +2327,11 @@ namespace MWWorld
void World::hurtStandingActors(const ConstPtr &object, float healthPerSecond)
{
/* Disabled by tes3mp, because being in a menu should not pause the game in it
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
return;
*/
std::vector<MWWorld::Ptr> actors;
mPhysics->getActorsStandingOn(object, actors);
@ -2357,8 +2360,11 @@ namespace MWWorld
void World::hurtCollidingActors(const ConstPtr &object, float healthPerSecond)
{
/* Disabled by tes3mp, because being in a menu should not pause the game in it
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
return;
*/
std::vector<MWWorld::Ptr> actors;
mPhysics->getActorsCollidingWith(object, actors);