mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 12:06:41 +00:00
Some fixes
This commit is contained in:
parent
c41f119ba6
commit
aaa9aba999
6 changed files with 38 additions and 25 deletions
|
@ -131,6 +131,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||||
, mFpsLevel(0)
|
, mFpsLevel(0)
|
||||||
, mDebug (false)
|
, mDebug (false)
|
||||||
, mVerboseScripts (false)
|
, mVerboseScripts (false)
|
||||||
|
, mNewGame (false)
|
||||||
, mUseSound (true)
|
, mUseSound (true)
|
||||||
, mCompileAll (false)
|
, mCompileAll (false)
|
||||||
, mScriptContext (0)
|
, mScriptContext (0)
|
||||||
|
@ -277,6 +278,11 @@ void OMW::Engine::setScriptsVerbosity(bool scriptsVerbosity)
|
||||||
mVerboseScripts = scriptsVerbosity;
|
mVerboseScripts = scriptsVerbosity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OMW::Engine::setNewGame(bool newGame)
|
||||||
|
{
|
||||||
|
mNewGame = newGame;
|
||||||
|
}
|
||||||
|
|
||||||
std::string OMW::Engine::loadSettings (Settings::Manager & settings)
|
std::string OMW::Engine::loadSettings (Settings::Manager & settings)
|
||||||
{
|
{
|
||||||
// Create the settings manager and load default settings file
|
// Create the settings manager and load default settings file
|
||||||
|
@ -375,6 +381,8 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
mEnvironment.setWindowManager (new MWGui::WindowManager(
|
mEnvironment.setWindowManager (new MWGui::WindowManager(
|
||||||
mExtensions, mFpsLevel, mOgre, mCfgMgr.getLogPath().string() + std::string("/"),
|
mExtensions, mFpsLevel, mOgre, mCfgMgr.getLogPath().string() + std::string("/"),
|
||||||
mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage));
|
mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage));
|
||||||
|
if (mNewGame)
|
||||||
|
mEnvironment.getWindowManager()->setNewGame(true);
|
||||||
|
|
||||||
// Create sound system
|
// Create sound system
|
||||||
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
|
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
|
||||||
|
@ -403,13 +411,15 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
MWBase::Environment::get().getWorld()->getPlayer(),
|
MWBase::Environment::get().getWorld()->getPlayer(),
|
||||||
*MWBase::Environment::get().getWindowManager(), mDebug, *this, keybinderUser, keybinderUserExists));
|
*MWBase::Environment::get().getWindowManager(), mDebug, *this, keybinderUser, keybinderUserExists));
|
||||||
|
|
||||||
|
mEnvironment.getWorld()->renderPlayer();
|
||||||
|
|
||||||
|
if (!mNewGame)
|
||||||
|
{
|
||||||
// load cell
|
// load cell
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||||
pos.pos[2] = 0;
|
pos.pos[2] = 0;
|
||||||
|
|
||||||
mEnvironment.getWorld()->renderPlayer();
|
|
||||||
|
|
||||||
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName))
|
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName))
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->indexToPosition (exterior->mData.mX, exterior->mData.mY,
|
MWBase::Environment::get().getWorld()->indexToPosition (exterior->mData.mX, exterior->mData.mY,
|
||||||
|
@ -421,6 +431,9 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
pos.pos[0] = pos.pos[1] = 0;
|
pos.pos[0] = pos.pos[1] = 0;
|
||||||
MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, pos);
|
MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, pos);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mEnvironment.getWorld()->startNewGame();
|
||||||
|
|
||||||
Ogre::FrameEvent event;
|
Ogre::FrameEvent event;
|
||||||
event.timeSinceLastEvent = 0;
|
event.timeSinceLastEvent = 0;
|
||||||
|
|
|
@ -136,6 +136,9 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
("script-run", bpo::value<std::string>()->default_value(""),
|
("script-run", bpo::value<std::string>()->default_value(""),
|
||||||
"select a file containing a list of console commands that is executed on startup")
|
"select a file containing a list of console commands that is executed on startup")
|
||||||
|
|
||||||
|
("new-game", bpo::value<bool>()->implicit_value(true)
|
||||||
|
->default_value(false), "activate char gen/new game mechanics")
|
||||||
|
|
||||||
("fs-strict", bpo::value<bool>()->implicit_value(true)
|
("fs-strict", bpo::value<bool>()->implicit_value(true)
|
||||||
->default_value(false), "strict file system handling (no case folding)")
|
->default_value(false), "strict file system handling (no case folding)")
|
||||||
|
|
||||||
|
@ -237,6 +240,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
||||||
|
|
||||||
// startup-settings
|
// startup-settings
|
||||||
engine.setCell(variables["start"].as<std::string>());
|
engine.setCell(variables["start"].as<std::string>());
|
||||||
|
engine.setNewGame(variables["new-game"].as<bool>());
|
||||||
|
|
||||||
// other settings
|
// other settings
|
||||||
engine.setDebugMode(variables["debug"].as<bool>());
|
engine.setDebugMode(variables["debug"].as<bool>());
|
||||||
|
|
|
@ -40,10 +40,7 @@ void MWWorld::Cells::clear()
|
||||||
{
|
{
|
||||||
mInteriors.clear();
|
mInteriors.clear();
|
||||||
mExteriors.clear();
|
mExteriors.clear();
|
||||||
|
std::fill(mIdCache.begin(), mIdCache.end(), std::make_pair("", (MWWorld::Ptr::CellStore*)0));
|
||||||
mIdCache = std::vector<std::pair<std::string, MWWorld::CellStore *> >(
|
|
||||||
40, std::pair<std::string, MWWorld::Ptr::CellStore *> ("", (MWWorld::Ptr::CellStore*)0)), /// \todo make cache size configurable
|
|
||||||
|
|
||||||
mIdCacheIndex = 0;
|
mIdCacheIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,8 @@ namespace MWWorld
|
||||||
std::map<std::string, int> mIds;
|
std::map<std::string, int> mIds;
|
||||||
std::map<int, StoreBase *> mStores;
|
std::map<int, StoreBase *> mStores;
|
||||||
|
|
||||||
|
ESM::NPC mPlayerTemplate;
|
||||||
|
|
||||||
unsigned int mDynamicCount;
|
unsigned int mDynamicCount;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -143,19 +145,17 @@ namespace MWWorld
|
||||||
|
|
||||||
void clearDynamic ()
|
void clearDynamic ()
|
||||||
{
|
{
|
||||||
ESM::NPC playerNpc = *mNpcs.find("player");
|
|
||||||
|
|
||||||
for (std::map<int, StoreBase *>::iterator it = mStores.begin(); it != mStores.end(); ++it)
|
for (std::map<int, StoreBase *>::iterator it = mStores.begin(); it != mStores.end(); ++it)
|
||||||
it->second->clearDynamic();
|
it->second->clearDynamic();
|
||||||
|
|
||||||
mNpcs.insert(playerNpc);
|
mNpcs.insert(mPlayerTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void movePlayerRecord ()
|
void movePlayerRecord ()
|
||||||
{
|
{
|
||||||
ESM::NPC playerNpc = *mNpcs.find("player");
|
mPlayerTemplate = *mNpcs.find("player");
|
||||||
mNpcs.eraseStatic(playerNpc.mId);
|
mNpcs.eraseStatic(mPlayerTemplate.mId);
|
||||||
mNpcs.insert(playerNpc);
|
mNpcs.insert(mPlayerTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load(ESM::ESMReader &esm);
|
void load(ESM::ESMReader &esm);
|
||||||
|
|
|
@ -225,7 +225,6 @@ namespace MWWorld
|
||||||
|
|
||||||
void World::startNewGame()
|
void World::startNewGame()
|
||||||
{
|
{
|
||||||
|
|
||||||
mWorldScene->changeToVoid();
|
mWorldScene->changeToVoid();
|
||||||
|
|
||||||
mStore.clearDynamic();
|
mStore.clearDynamic();
|
||||||
|
|
Loading…
Reference in a new issue