|
|
|
@ -128,17 +128,45 @@ void OMW::Engine::frame(float frametime)
|
|
|
|
|
if (mUseSound)
|
|
|
|
|
mEnvironment.getSoundManager()->update(frametime);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp addition
|
|
|
|
|
|
|
|
|
|
Update multiplayer processing for the current frame
|
|
|
|
|
*/
|
|
|
|
|
mwmp::Main::frame(frametime);
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp addition
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Main menu opened? Then scripts are also paused.
|
|
|
|
|
bool paused = /*mEnvironment.getWindowManager()->containsMode(MWGui::GM_MainMenu);*/ false;
|
|
|
|
|
// The above is overridden by tes3mp, where the game should never be pausable
|
|
|
|
|
bool paused = mEnvironment.getWindowManager()->containsMode(MWGui::GM_MainMenu);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp change (major)
|
|
|
|
|
|
|
|
|
|
Time should not be frozen in multiplayer, so the paused boolean is always set to
|
|
|
|
|
false instead
|
|
|
|
|
*/
|
|
|
|
|
paused = false;
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp change (major)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
bool guiActive = mEnvironment.getWindowManager()->isGuiMode();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp change (major)
|
|
|
|
|
|
|
|
|
|
Whether the GUI is active should have no relevance in multiplayer, so the guiActive
|
|
|
|
|
boolean is always set to false instead
|
|
|
|
|
*/
|
|
|
|
|
guiActive = false;
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp change (major)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
osg::Timer_t beforeScriptTick = osg::Timer::instance()->tick();
|
|
|
|
|
if (mEnvironment.getStateManager()->getState()==
|
|
|
|
@ -179,9 +207,18 @@ void OMW::Engine::frame(float frametime)
|
|
|
|
|
if (mEnvironment.getStateManager()->getState()==
|
|
|
|
|
MWBase::StateManager::State_Running)
|
|
|
|
|
{
|
|
|
|
|
/*MWWorld::Ptr player = mEnvironment.getWorld()->getPlayerPtr();
|
|
|
|
|
if(!guiActive && player.getClass().getCreatureStats(player).isDead())
|
|
|
|
|
mEnvironment.getStateManager()->endGame();*/
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp change (major)
|
|
|
|
|
|
|
|
|
|
In multiplayer, the game should not end when the player dies,
|
|
|
|
|
so the code here has been commented out
|
|
|
|
|
*/
|
|
|
|
|
//MWWorld::Ptr player = mEnvironment.getWorld()->getPlayerPtr();
|
|
|
|
|
//if(!guiActive && player.getClass().getCreatureStats(player).isDead())
|
|
|
|
|
// mEnvironment.getStateManager()->endGame();
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp change (major)
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// update world
|
|
|
|
@ -267,10 +304,27 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
|
|
|
|
|
|
|
|
|
OMW::Engine::~Engine()
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp addition
|
|
|
|
|
|
|
|
|
|
Free up memory allocated by multiplayer's GUIController
|
|
|
|
|
*/
|
|
|
|
|
mwmp::Main::get().getGUIController()->cleanUp();
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp addition
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
mEnvironment.cleanup();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp addition
|
|
|
|
|
|
|
|
|
|
Free up memory allocated by multiplayer's Main class
|
|
|
|
|
*/
|
|
|
|
|
mwmp::Main::destroy();
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp addition
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
delete mScriptContext;
|
|
|
|
|
mScriptContext = NULL;
|
|
|
|
@ -289,8 +343,15 @@ OMW::Engine::~Engine()
|
|
|
|
|
|
|
|
|
|
SDL_Quit();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp addition
|
|
|
|
|
|
|
|
|
|
Free up memory allocated by multiplayer's logger
|
|
|
|
|
*/
|
|
|
|
|
LOG_QUIT();
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp addition
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OMW::Engine::enableFSStrict(bool fsStrict)
|
|
|
|
@ -662,8 +723,17 @@ private:
|
|
|
|
|
void OMW::Engine::go()
|
|
|
|
|
{
|
|
|
|
|
assert (!mContentFiles.empty());
|
|
|
|
|
if(!mwmp::Main::init(mContentFiles, mFileCollections))
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp change (major)
|
|
|
|
|
|
|
|
|
|
Attempt multiplayer initialization and proceed no further if it fails
|
|
|
|
|
*/
|
|
|
|
|
if (!mwmp::Main::init(mContentFiles, mFileCollections))
|
|
|
|
|
return;
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp change (major)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
std::cout << "OSG version: " << osgGetVersion() << std::endl;
|
|
|
|
|
|
|
|
|
@ -698,8 +768,26 @@ void OMW::Engine::go()
|
|
|
|
|
mEncoder = &encoder;
|
|
|
|
|
|
|
|
|
|
prepareEngine (settings);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp addition
|
|
|
|
|
|
|
|
|
|
Handle post-initialization for multiplayer classes
|
|
|
|
|
*/
|
|
|
|
|
mwmp::Main::postInit();
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp addition
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp change (major)
|
|
|
|
|
|
|
|
|
|
Always skip the main menu in multiplayer
|
|
|
|
|
*/
|
|
|
|
|
mSkipMenu = true;
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp change (major)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (!mSaveGameFile.empty())
|
|
|
|
|
{
|
|
|
|
@ -735,8 +823,18 @@ void OMW::Engine::go()
|
|
|
|
|
frameTimer.setStartTick();
|
|
|
|
|
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
|
|
|
|
|
bool guiActive = mEnvironment.getWindowManager()->isGuiMode();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp change (major)
|
|
|
|
|
|
|
|
|
|
Whether the GUI is active should have no relevance in multiplayer, so the guiActive
|
|
|
|
|
boolean is always set to false instead
|
|
|
|
|
*/
|
|
|
|
|
guiActive = false;
|
|
|
|
|
/*
|
|
|
|
|
End of tes3mp change (major)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (!guiActive)
|
|
|
|
|
simulationTime += dt;
|
|
|
|
|