mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:53:52 +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)
|
||||
, mDebug (false)
|
||||
, mVerboseScripts (false)
|
||||
, mNewGame (false)
|
||||
, mUseSound (true)
|
||||
, mCompileAll (false)
|
||||
, mScriptContext (0)
|
||||
|
@ -277,6 +278,11 @@ void OMW::Engine::setScriptsVerbosity(bool scriptsVerbosity)
|
|||
mVerboseScripts = scriptsVerbosity;
|
||||
}
|
||||
|
||||
void OMW::Engine::setNewGame(bool newGame)
|
||||
{
|
||||
mNewGame = newGame;
|
||||
}
|
||||
|
||||
std::string OMW::Engine::loadSettings (Settings::Manager & settings)
|
||||
{
|
||||
// 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(
|
||||
mExtensions, mFpsLevel, mOgre, mCfgMgr.getLogPath().string() + std::string("/"),
|
||||
mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage));
|
||||
if (mNewGame)
|
||||
mEnvironment.getWindowManager()->setNewGame(true);
|
||||
|
||||
// Create sound system
|
||||
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
|
||||
|
@ -403,24 +411,29 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
|||
MWBase::Environment::get().getWorld()->getPlayer(),
|
||||
*MWBase::Environment::get().getWindowManager(), mDebug, *this, keybinderUser, keybinderUserExists));
|
||||
|
||||
// load cell
|
||||
ESM::Position pos;
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
pos.pos[2] = 0;
|
||||
|
||||
mEnvironment.getWorld()->renderPlayer();
|
||||
|
||||
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName))
|
||||
if (!mNewGame)
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->indexToPosition (exterior->mData.mX, exterior->mData.mY,
|
||||
pos.pos[0], pos.pos[1], true);
|
||||
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
|
||||
// load cell
|
||||
ESM::Position pos;
|
||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||
pos.pos[2] = 0;
|
||||
|
||||
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName))
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->indexToPosition (exterior->mData.mX, exterior->mData.mY,
|
||||
pos.pos[0], pos.pos[1], true);
|
||||
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.pos[0] = pos.pos[1] = 0;
|
||||
MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.pos[0] = pos.pos[1] = 0;
|
||||
MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, pos);
|
||||
}
|
||||
mEnvironment.getWorld()->startNewGame();
|
||||
|
||||
Ogre::FrameEvent event;
|
||||
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(""),
|
||||
"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)
|
||||
->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
|
||||
engine.setCell(variables["start"].as<std::string>());
|
||||
engine.setNewGame(variables["new-game"].as<bool>());
|
||||
|
||||
// other settings
|
||||
engine.setDebugMode(variables["debug"].as<bool>());
|
||||
|
|
|
@ -40,10 +40,7 @@ void MWWorld::Cells::clear()
|
|||
{
|
||||
mInteriors.clear();
|
||||
mExteriors.clear();
|
||||
|
||||
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
|
||||
|
||||
std::fill(mIdCache.begin(), mIdCache.end(), std::make_pair("", (MWWorld::Ptr::CellStore*)0));
|
||||
mIdCacheIndex = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ namespace MWWorld
|
|||
std::map<std::string, int> mIds;
|
||||
std::map<int, StoreBase *> mStores;
|
||||
|
||||
ESM::NPC mPlayerTemplate;
|
||||
|
||||
unsigned int mDynamicCount;
|
||||
|
||||
public:
|
||||
|
@ -143,19 +145,17 @@ namespace MWWorld
|
|||
|
||||
void clearDynamic ()
|
||||
{
|
||||
ESM::NPC playerNpc = *mNpcs.find("player");
|
||||
|
||||
for (std::map<int, StoreBase *>::iterator it = mStores.begin(); it != mStores.end(); ++it)
|
||||
it->second->clearDynamic();
|
||||
|
||||
mNpcs.insert(playerNpc);
|
||||
mNpcs.insert(mPlayerTemplate);
|
||||
}
|
||||
|
||||
void movePlayerRecord ()
|
||||
{
|
||||
ESM::NPC playerNpc = *mNpcs.find("player");
|
||||
mNpcs.eraseStatic(playerNpc.mId);
|
||||
mNpcs.insert(playerNpc);
|
||||
mPlayerTemplate = *mNpcs.find("player");
|
||||
mNpcs.eraseStatic(mPlayerTemplate.mId);
|
||||
mNpcs.insert(mPlayerTemplate);
|
||||
}
|
||||
|
||||
void load(ESM::ESMReader &esm);
|
||||
|
|
|
@ -225,7 +225,6 @@ namespace MWWorld
|
|||
|
||||
void World::startNewGame()
|
||||
{
|
||||
|
||||
mWorldScene->changeToVoid();
|
||||
|
||||
mStore.clearDynamic();
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace MWWorld
|
|||
World (OEngine::Render::OgreRenderer& renderer,
|
||||
const Files::Collections& fileCollections,
|
||||
const std::vector<std::string>& master, const std::vector<std::string>& plugins,
|
||||
const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir,
|
||||
const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir,
|
||||
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride);
|
||||
|
||||
virtual ~World();
|
||||
|
|
Loading…
Reference in a new issue