forked from mirror/openmw-tes3mp
Added new game button
This commit is contained in:
parent
ac4fa1941d
commit
c41f119ba6
38 changed files with 263 additions and 89 deletions
|
@ -131,7 +131,6 @@ 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)
|
||||||
|
@ -278,11 +277,6 @@ 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
|
||||||
|
@ -366,7 +360,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
|
|
||||||
// Create the world
|
// Create the world
|
||||||
mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mMaster, mPlugins,
|
mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mMaster, mPlugins,
|
||||||
mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoder, mFallbackMap,
|
mResDir, mCfgMgr.getCachePath(), mEncoder, mFallbackMap,
|
||||||
mActivationDistanceOverride));
|
mActivationDistanceOverride));
|
||||||
MWBase::Environment::get().getWorld()->setupPlayer();
|
MWBase::Environment::get().getWorld()->setupPlayer();
|
||||||
|
|
||||||
|
@ -379,7 +373,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||||
MWScript::registerExtensions (mExtensions);
|
MWScript::registerExtensions (mExtensions);
|
||||||
|
|
||||||
mEnvironment.setWindowManager (new MWGui::WindowManager(
|
mEnvironment.setWindowManager (new MWGui::WindowManager(
|
||||||
mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/"),
|
mExtensions, mFpsLevel, mOgre, mCfgMgr.getLogPath().string() + std::string("/"),
|
||||||
mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage));
|
mCfgMgr.getCachePath ().string(), mScriptConsoleMode, mTranslationDataStorage));
|
||||||
|
|
||||||
// Create sound system
|
// Create sound system
|
||||||
|
|
|
@ -136,9 +136,6 @@ 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)")
|
||||||
|
|
||||||
|
@ -240,7 +237,6 @@ 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>());
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace MWBase
|
||||||
|
|
||||||
DialogueManager() {}
|
DialogueManager() {}
|
||||||
|
|
||||||
|
virtual void clear() = 0;
|
||||||
|
|
||||||
virtual ~DialogueManager() {}
|
virtual ~DialogueManager() {}
|
||||||
|
|
||||||
virtual bool isInChoice() const = 0;
|
virtual bool isInChoice() const = 0;
|
||||||
|
|
|
@ -33,6 +33,8 @@ namespace MWBase
|
||||||
|
|
||||||
Journal() {}
|
Journal() {}
|
||||||
|
|
||||||
|
virtual void clear() = 0;
|
||||||
|
|
||||||
virtual ~Journal() {}
|
virtual ~Journal() {}
|
||||||
|
|
||||||
virtual void addEntry (const std::string& id, int index) = 0;
|
virtual void addEntry (const std::string& id, int index) = 0;
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace MWBase
|
||||||
|
|
||||||
virtual ~ScriptManager() {}
|
virtual ~ScriptManager() {}
|
||||||
|
|
||||||
|
virtual void resetGlobalScripts() = 0;
|
||||||
|
|
||||||
virtual void run (const std::string& name, Interpreter::Context& interpreterContext) = 0;
|
virtual void run (const std::string& name, Interpreter::Context& interpreterContext) = 0;
|
||||||
///< Run the script with the given name (compile first, if not compiled yet)
|
///< Run the script with the given name (compile first, if not compiled yet)
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,16 @@ namespace MWBase
|
||||||
*/
|
*/
|
||||||
virtual void update() = 0;
|
virtual void update() = 0;
|
||||||
|
|
||||||
|
virtual void setNewGame(bool newgame) = 0;
|
||||||
|
|
||||||
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
||||||
virtual void popGuiMode() = 0;
|
virtual void popGuiMode() = 0;
|
||||||
|
|
||||||
virtual void removeGuiMode (MWGui::GuiMode mode) = 0;
|
virtual void removeGuiMode (MWGui::GuiMode mode) = 0;
|
||||||
///< can be anywhere in the stack
|
///< can be anywhere in the stack
|
||||||
|
|
||||||
|
virtual void updatePlayer() = 0;
|
||||||
|
|
||||||
virtual MWGui::GuiMode getMode() const = 0;
|
virtual MWGui::GuiMode getMode() const = 0;
|
||||||
|
|
||||||
virtual bool isGuiMode() const = 0;
|
virtual bool isGuiMode() const = 0;
|
||||||
|
|
|
@ -94,6 +94,8 @@ namespace MWBase
|
||||||
|
|
||||||
virtual ~World() {}
|
virtual ~World() {}
|
||||||
|
|
||||||
|
virtual void startNewGame() = 0;
|
||||||
|
|
||||||
virtual OEngine::Render::Fader* getFader() = 0;
|
virtual OEngine::Render::Fader* getFader() = 0;
|
||||||
///< \ŧodo remove this function. Rendering details should not be exposed.
|
///< \ŧodo remove this function. Rendering details should not be exposed.
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,11 @@ namespace MWDialogue
|
||||||
, mTemporaryDispositionChange(0.f)
|
, mTemporaryDispositionChange(0.f)
|
||||||
, mPermanentDispositionChange(0.f), mScriptVerbose (scriptVerbose)
|
, mPermanentDispositionChange(0.f), mScriptVerbose (scriptVerbose)
|
||||||
, mTranslationDataStorage(translationDataStorage)
|
, mTranslationDataStorage(translationDataStorage)
|
||||||
|
, mTalkedTo(false)
|
||||||
{
|
{
|
||||||
mChoice = -1;
|
mChoice = -1;
|
||||||
mIsInChoice = false;
|
mIsInChoice = false;
|
||||||
mCompilerContext.setExtensions (&extensions);
|
mCompilerContext.setExtensions (&extensions);
|
||||||
mDialogueMap.clear();
|
|
||||||
mActorKnownTopics.clear();
|
|
||||||
|
|
||||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||||
|
@ -67,6 +66,14 @@ namespace MWDialogue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogueManager::clear()
|
||||||
|
{
|
||||||
|
mKnownTopics.clear();
|
||||||
|
mTalkedTo = false;
|
||||||
|
mTemporaryDispositionChange = 0;
|
||||||
|
mPermanentDispositionChange = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void DialogueManager::addTopic (const std::string& topic)
|
void DialogueManager::addTopic (const std::string& topic)
|
||||||
{
|
{
|
||||||
mKnownTopics[Misc::StringUtils::lowerCase(topic)] = true;
|
mKnownTopics[Misc::StringUtils::lowerCase(topic)] = true;
|
||||||
|
|
|
@ -51,6 +51,8 @@ namespace MWDialogue
|
||||||
|
|
||||||
DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose, Translation::Storage& translationDataStorage);
|
DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose, Translation::Storage& translationDataStorage);
|
||||||
|
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
virtual bool isInChoice() const;
|
virtual bool isInChoice() const;
|
||||||
|
|
||||||
virtual void startDialogue (const MWWorld::Ptr& actor);
|
virtual void startDialogue (const MWWorld::Ptr& actor);
|
||||||
|
|
|
@ -29,6 +29,13 @@ namespace MWDialogue
|
||||||
Journal::Journal()
|
Journal::Journal()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void Journal::clear()
|
||||||
|
{
|
||||||
|
mJournal.clear();
|
||||||
|
mQuests.clear();
|
||||||
|
mTopics.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void Journal::addEntry (const std::string& id, int index)
|
void Journal::addEntry (const std::string& id, int index)
|
||||||
{
|
{
|
||||||
// bail out of we already have heard this...
|
// bail out of we already have heard this...
|
||||||
|
|
|
@ -21,6 +21,8 @@ namespace MWDialogue
|
||||||
|
|
||||||
Journal();
|
Journal();
|
||||||
|
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
virtual void addEntry (const std::string& id, int index);
|
virtual void addEntry (const std::string& id, int index);
|
||||||
///< Add a journal entry.
|
///< Add a journal entry.
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace MWGui
|
||||||
: WindowBase("openmw_alchemy_window.layout")
|
: WindowBase("openmw_alchemy_window.layout")
|
||||||
, mApparatus (4)
|
, mApparatus (4)
|
||||||
, mIngredients (4)
|
, mIngredients (4)
|
||||||
|
, mSortModel(NULL)
|
||||||
{
|
{
|
||||||
getWidget(mCreateButton, "CreateButton");
|
getWidget(mCreateButton, "CreateButton");
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
|
@ -60,10 +61,7 @@ namespace MWGui
|
||||||
getWidget(mNameEdit, "NameEdit");
|
getWidget(mNameEdit, "NameEdit");
|
||||||
getWidget(mItemView, "ItemView");
|
getWidget(mItemView, "ItemView");
|
||||||
|
|
||||||
InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
|
||||||
mSortModel = new SortFilterItemModel(model);
|
|
||||||
mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients);
|
|
||||||
mItemView->setModel (mSortModel);
|
|
||||||
mItemView->eventItemClicked += MyGUI::newDelegate(this, &AlchemyWindow::onSelectedItem);
|
mItemView->eventItemClicked += MyGUI::newDelegate(this, &AlchemyWindow::onSelectedItem);
|
||||||
|
|
||||||
mIngredients[0]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);
|
mIngredients[0]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);
|
||||||
|
@ -145,6 +143,11 @@ namespace MWGui
|
||||||
|
|
||||||
void AlchemyWindow::open()
|
void AlchemyWindow::open()
|
||||||
{
|
{
|
||||||
|
InventoryItemModel* model = new InventoryItemModel(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
mSortModel = new SortFilterItemModel(model);
|
||||||
|
mSortModel->setFilter(SortFilterItemModel::Filter_OnlyIngredients);
|
||||||
|
mItemView->setModel (mSortModel);
|
||||||
|
|
||||||
mNameEdit->setCaption("");
|
mNameEdit->setCaption("");
|
||||||
|
|
||||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
|
|
@ -53,15 +53,12 @@ namespace MWGui
|
||||||
|
|
||||||
mAvatar->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onAvatarClicked);
|
mAvatar->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onAvatarClicked);
|
||||||
|
|
||||||
mPtr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
|
||||||
|
|
||||||
getWidget(mItemView, "ItemView");
|
getWidget(mItemView, "ItemView");
|
||||||
mTradeModel = new TradeItemModel(new InventoryItemModel(mPtr), MWWorld::Ptr());
|
|
||||||
mSortModel = new SortFilterItemModel(mTradeModel);
|
|
||||||
mItemView->setModel(mSortModel);
|
|
||||||
mItemView->eventItemClicked += MyGUI::newDelegate(this, &InventoryWindow::onItemSelected);
|
mItemView->eventItemClicked += MyGUI::newDelegate(this, &InventoryWindow::onItemSelected);
|
||||||
mItemView->eventBackgroundClicked += MyGUI::newDelegate(this, &InventoryWindow::onBackgroundSelected);
|
mItemView->eventBackgroundClicked += MyGUI::newDelegate(this, &InventoryWindow::onBackgroundSelected);
|
||||||
|
|
||||||
|
updatePlayer();
|
||||||
|
|
||||||
mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
||||||
mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
||||||
mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
|
||||||
|
@ -76,6 +73,16 @@ namespace MWGui
|
||||||
mPreview.setup();
|
mPreview.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InventoryWindow::updatePlayer()
|
||||||
|
{
|
||||||
|
mPtr = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||||
|
mTradeModel = new TradeItemModel(new InventoryItemModel(mPtr), MWWorld::Ptr());
|
||||||
|
mSortModel = new SortFilterItemModel(mTradeModel);
|
||||||
|
mItemView->setModel(mSortModel);
|
||||||
|
mPreview = MWRender::InventoryPreview(mPtr);
|
||||||
|
mPreview.setup();
|
||||||
|
}
|
||||||
|
|
||||||
TradeItemModel* InventoryWindow::getTradeModel()
|
TradeItemModel* InventoryWindow::getTradeModel()
|
||||||
{
|
{
|
||||||
return mTradeModel;
|
return mTradeModel;
|
||||||
|
|
|
@ -45,6 +45,8 @@ namespace MWGui
|
||||||
|
|
||||||
void updateItemView();
|
void updateItemView();
|
||||||
|
|
||||||
|
void updatePlayer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DragAndDrop* mDragAndDrop;
|
DragAndDrop* mDragAndDrop;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
#include "../mwbase/journal.hpp"
|
||||||
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -29,7 +32,7 @@ namespace MWGui
|
||||||
|
|
||||||
std::vector<std::string> buttons;
|
std::vector<std::string> buttons;
|
||||||
buttons.push_back("return");
|
buttons.push_back("return");
|
||||||
//buttons.push_back("newgame");
|
buttons.push_back("newgame");
|
||||||
//buttons.push_back("loadgame");
|
//buttons.push_back("loadgame");
|
||||||
//buttons.push_back("savegame");
|
//buttons.push_back("savegame");
|
||||||
buttons.push_back("options");
|
buttons.push_back("options");
|
||||||
|
@ -72,6 +75,13 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings);
|
MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings);
|
||||||
else if (sender == mButtons["exitgame"])
|
else if (sender == mButtons["exitgame"])
|
||||||
Ogre::Root::getSingleton ().queueEndRendering ();
|
Ogre::Root::getSingleton ().queueEndRendering ();
|
||||||
|
else if (sender == mButtons["newgame"])
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWorld()->startNewGame();
|
||||||
|
MWBase::Environment::get().getWindowManager()->setNewGame(true);
|
||||||
|
MWBase::Environment::get().getDialogueManager()->clear();
|
||||||
|
MWBase::Environment::get().getJournal()->clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
WindowManager::WindowManager(
|
WindowManager::WindowManager(
|
||||||
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *ogre,
|
const Compiler::Extensions& extensions, int fpsLevel, OEngine::Render::OgreRenderer *ogre,
|
||||||
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts,
|
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts,
|
||||||
Translation::Storage& translationDataStorage)
|
Translation::Storage& translationDataStorage)
|
||||||
: mGuiManager(NULL)
|
: mGuiManager(NULL)
|
||||||
|
@ -94,8 +94,8 @@ namespace MWGui
|
||||||
, mGui(NULL)
|
, mGui(NULL)
|
||||||
, mGarbageDialogs()
|
, mGarbageDialogs()
|
||||||
, mShown(GW_ALL)
|
, mShown(GW_ALL)
|
||||||
, mAllowed(newGame ? GW_None : GW_ALL)
|
, mAllowed(GW_ALL)
|
||||||
, mRestAllowed(newGame ? false : true)
|
, mRestAllowed(true)
|
||||||
, mShowFPSLevel(fpsLevel)
|
, mShowFPSLevel(fpsLevel)
|
||||||
, mFPS(0.0f)
|
, mFPS(0.0f)
|
||||||
, mTriangleCount(0)
|
, mTriangleCount(0)
|
||||||
|
@ -203,13 +203,25 @@ namespace MWGui
|
||||||
unsetSelectedSpell();
|
unsetSelectedSpell();
|
||||||
unsetSelectedWeapon();
|
unsetSelectedWeapon();
|
||||||
|
|
||||||
if (newGame)
|
|
||||||
disallowAll ();
|
|
||||||
|
|
||||||
// Set up visibility
|
// Set up visibility
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::setNewGame(bool newgame)
|
||||||
|
{
|
||||||
|
if (newgame)
|
||||||
|
{
|
||||||
|
disallowAll();
|
||||||
|
delete mCharGen;
|
||||||
|
mCharGen = new CharacterCreation();
|
||||||
|
mGuiModes.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
allow(GW_ALL);
|
||||||
|
|
||||||
|
mRestAllowed = !newgame;
|
||||||
|
}
|
||||||
|
|
||||||
WindowManager::~WindowManager()
|
WindowManager::~WindowManager()
|
||||||
{
|
{
|
||||||
delete mConsole;
|
delete mConsole;
|
||||||
|
@ -1200,4 +1212,9 @@ namespace MWGui
|
||||||
mInventoryWindow->doRenderUpdate ();
|
mInventoryWindow->doRenderUpdate ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::updatePlayer()
|
||||||
|
{
|
||||||
|
mInventoryWindow->updatePlayer();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace MWGui
|
||||||
typedef std::pair<std::string, int> Faction;
|
typedef std::pair<std::string, int> Faction;
|
||||||
typedef std::vector<Faction> FactionList;
|
typedef std::vector<Faction> FactionList;
|
||||||
|
|
||||||
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame,
|
WindowManager(const Compiler::Extensions& extensions, int fpsLevel,
|
||||||
OEngine::Render::OgreRenderer *mOgre, const std::string& logpath,
|
OEngine::Render::OgreRenderer *mOgre, const std::string& logpath,
|
||||||
const std::string& cacheDir, bool consoleOnlyScripts,
|
const std::string& cacheDir, bool consoleOnlyScripts,
|
||||||
Translation::Storage& translationDataStorage);
|
Translation::Storage& translationDataStorage);
|
||||||
|
@ -93,6 +93,8 @@ namespace MWGui
|
||||||
*/
|
*/
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
||||||
|
virtual void setNewGame(bool newgame);
|
||||||
|
|
||||||
virtual void pushGuiMode(GuiMode mode);
|
virtual void pushGuiMode(GuiMode mode);
|
||||||
virtual void popGuiMode();
|
virtual void popGuiMode();
|
||||||
virtual void removeGuiMode(GuiMode mode); ///< can be anywhere in the stack
|
virtual void removeGuiMode(GuiMode mode); ///< can be anywhere in the stack
|
||||||
|
@ -227,6 +229,8 @@ namespace MWGui
|
||||||
virtual bool getPlayerSleeping();
|
virtual bool getPlayerSleeping();
|
||||||
virtual void wakeUpPlayer();
|
virtual void wakeUpPlayer();
|
||||||
|
|
||||||
|
virtual void updatePlayer();
|
||||||
|
|
||||||
virtual void showCompanionWindow(MWWorld::Ptr actor);
|
virtual void showCompanionWindow(MWWorld::Ptr actor);
|
||||||
virtual void startSpellMaking(MWWorld::Ptr actor);
|
virtual void startSpellMaking(MWWorld::Ptr actor);
|
||||||
virtual void startEnchanting(MWWorld::Ptr actor);
|
virtual void startEnchanting(MWWorld::Ptr actor);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
namespace MWInput
|
namespace MWInput
|
||||||
{
|
{
|
||||||
InputManager::InputManager(OEngine::Render::OgreRenderer &ogre,
|
InputManager::InputManager(OEngine::Render::OgreRenderer &ogre,
|
||||||
MWWorld::Player &player,
|
MWWorld::Player& player,
|
||||||
MWBase::WindowManager &windows,
|
MWBase::WindowManager &windows,
|
||||||
bool debug,
|
bool debug,
|
||||||
OMW::Engine& engine,
|
OMW::Engine& engine,
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace MWInput
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OEngine::Render::OgreRenderer &mOgre;
|
OEngine::Render::OgreRenderer &mOgre;
|
||||||
MWWorld::Player &mPlayer;
|
MWWorld::Player& mPlayer;
|
||||||
MWBase::WindowManager &mWindows;
|
MWBase::WindowManager &mWindows;
|
||||||
OMW::Engine& mEngine;
|
OMW::Engine& mEngine;
|
||||||
|
|
||||||
|
|
|
@ -156,17 +156,11 @@ namespace MWMechanics
|
||||||
creatureStats.setDynamic (i, stat);
|
creatureStats.setDynamic (i, stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// unequip any items that may not be equipped. we need this for when the race is changed to a beast race
|
// auto-equip again. we need this for when the race is changed to a beast race
|
||||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore(ptr);
|
MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore(ptr);
|
||||||
for (int i=0; i<MWWorld::InventoryStore::Slots; ++i)
|
for (int i=0; i<MWWorld::InventoryStore::Slots; ++i)
|
||||||
{
|
invStore.equip(i, invStore.end());
|
||||||
MWWorld::ContainerStoreIterator it = invStore.getSlot(i);
|
invStore.autoEquip(ptr);
|
||||||
if (it != invStore.end())
|
|
||||||
{
|
|
||||||
if (!MWWorld::Class::get(*it).canBeEquipped(*it, ptr).first)
|
|
||||||
invStore.equip(i, invStore.end());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MechanicsManager::MechanicsManager()
|
MechanicsManager::MechanicsManager()
|
||||||
|
|
|
@ -15,12 +15,18 @@ namespace MWScript
|
||||||
GlobalScripts::GlobalScripts (const MWWorld::ESMStore& store)
|
GlobalScripts::GlobalScripts (const MWWorld::ESMStore& store)
|
||||||
: mStore (store)
|
: mStore (store)
|
||||||
{
|
{
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlobalScripts::reset()
|
||||||
|
{
|
||||||
|
mScripts.clear();
|
||||||
addScript ("Main");
|
addScript ("Main");
|
||||||
|
|
||||||
MWWorld::Store<ESM::StartScript>::iterator iter =
|
MWWorld::Store<ESM::StartScript>::iterator iter =
|
||||||
store.get<ESM::StartScript>().begin();
|
mStore.get<ESM::StartScript>().begin();
|
||||||
|
|
||||||
for (; iter != store.get<ESM::StartScript>().end(); ++iter) {
|
for (; iter != mStore.get<ESM::StartScript>().end(); ++iter) {
|
||||||
addScript (iter->mScript);
|
addScript (iter->mScript);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace MWScript
|
||||||
|
|
||||||
GlobalScripts (const MWWorld::ESMStore& store);
|
GlobalScripts (const MWWorld::ESMStore& store);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
void addScript (const std::string& name);
|
void addScript (const std::string& name);
|
||||||
|
|
||||||
void removeScript (const std::string& name);
|
void removeScript (const std::string& name);
|
||||||
|
|
|
@ -221,4 +221,9 @@ namespace MWScript
|
||||||
|
|
||||||
throw std::runtime_error ("unable to access local variable " + variable + " of " + scriptId);
|
throw std::runtime_error ("unable to access local variable " + variable + " of " + scriptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptManager::resetGlobalScripts()
|
||||||
|
{
|
||||||
|
mGlobalScripts.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,8 @@ namespace MWScript
|
||||||
///< Compile script with the given namen
|
///< Compile script with the given namen
|
||||||
/// \return Success?
|
/// \return Success?
|
||||||
|
|
||||||
|
virtual void resetGlobalScripts();
|
||||||
|
|
||||||
virtual std::pair<int, int> compileAll();
|
virtual std::pair<int, int> compileAll();
|
||||||
///< Compile all scripts
|
///< Compile all scripts
|
||||||
/// \return count, success
|
/// \return count, success
|
||||||
|
|
|
@ -586,7 +586,7 @@ void OpenAL_Sound::update()
|
||||||
|
|
||||||
alSourcef(mSource, AL_GAIN, gain);
|
alSourcef(mSource, AL_GAIN, gain);
|
||||||
alSourcef(mSource, AL_PITCH, pitch);
|
alSourcef(mSource, AL_PITCH, pitch);
|
||||||
alSource3f(mSource, AL_POSITION, mPos[0], mPos[2], -mPos[1]);
|
alSource3f(mSource, AL_POSITION, mPos[0], mPos[1], mPos[2]);
|
||||||
alSource3f(mSource, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
|
alSource3f(mSource, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
|
||||||
alSource3f(mSource, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
alSource3f(mSource, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
@ -606,7 +606,7 @@ void OpenAL_Sound3D::update()
|
||||||
|
|
||||||
alSourcef(mSource, AL_GAIN, gain);
|
alSourcef(mSource, AL_GAIN, gain);
|
||||||
alSourcef(mSource, AL_PITCH, pitch);
|
alSourcef(mSource, AL_PITCH, pitch);
|
||||||
alSource3f(mSource, AL_POSITION, mPos[0], mPos[2], -mPos[1]);
|
alSource3f(mSource, AL_POSITION, mPos[0], mPos[1], mPos[2]);
|
||||||
alSource3f(mSource, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
|
alSource3f(mSource, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
|
||||||
alSource3f(mSource, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
alSource3f(mSource, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
@ -923,10 +923,10 @@ void OpenAL_Output::updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3
|
||||||
if(mContext)
|
if(mContext)
|
||||||
{
|
{
|
||||||
ALfloat orient[6] = {
|
ALfloat orient[6] = {
|
||||||
atdir.x, atdir.z, -atdir.y,
|
atdir.x, atdir.y, atdir.z,
|
||||||
updir.x, updir.z, -updir.y
|
updir.x, updir.y, updir.z
|
||||||
};
|
};
|
||||||
alListener3f(AL_POSITION, mPos.x, mPos.z, -mPos.y);
|
alListener3f(AL_POSITION, mPos.x, mPos.y, mPos.z);
|
||||||
alListenerfv(AL_ORIENTATION, orient);
|
alListenerfv(AL_ORIENTATION, orient);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,17 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
mIdCacheIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
|
void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
|
||||||
{
|
{
|
||||||
for (CellRefList<ESM::Container>::List::iterator iter (
|
for (CellRefList<ESM::Container>::List::iterator iter (
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace MWWorld
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
Cells (const MWWorld::ESMStore& store, std::vector<ESM::ESMReader>& reader);
|
Cells (const MWWorld::ESMStore& store, std::vector<ESM::ESMReader>& reader);
|
||||||
///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole
|
///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole
|
||||||
/// world
|
/// world
|
||||||
|
|
|
@ -134,15 +134,6 @@ void ESMStore::setUp()
|
||||||
mSkills.setUp();
|
mSkills.setUp();
|
||||||
mMagicEffects.setUp();
|
mMagicEffects.setUp();
|
||||||
mAttributes.setUp();
|
mAttributes.setUp();
|
||||||
|
|
||||||
ESM::NPC item;
|
|
||||||
item.mId = "player";
|
|
||||||
|
|
||||||
const ESM::NPC *pIt = mNpcs.find("player");
|
|
||||||
assert(pIt != NULL);
|
|
||||||
|
|
||||||
mNpcs.insert(*pIt);
|
|
||||||
mNpcs.eraseStatic(pIt->mId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
|
@ -141,6 +141,23 @@ namespace MWWorld
|
||||||
mStores[ESM::REC_WEAP] = &mWeapons;
|
mStores[ESM::REC_WEAP] = &mWeapons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void movePlayerRecord ()
|
||||||
|
{
|
||||||
|
ESM::NPC playerNpc = *mNpcs.find("player");
|
||||||
|
mNpcs.eraseStatic(playerNpc.mId);
|
||||||
|
mNpcs.insert(playerNpc);
|
||||||
|
}
|
||||||
|
|
||||||
void load(ESM::ESMReader &esm);
|
void load(ESM::ESMReader &esm);
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace MWWorld
|
||||||
physicActor->enableCollisions(wasCollisionMode);
|
physicActor->enableCollisions(wasCollisionMode);
|
||||||
|
|
||||||
if (hit)
|
if (hit)
|
||||||
return newPosition;
|
return newPosition+Ogre::Vector3(0,0,4);
|
||||||
else
|
else
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,14 @@ namespace MWWorld
|
||||||
playerPos[0] = playerPos[1] = playerPos[2] = 0;
|
playerPos[0] = playerPos[1] = playerPos[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::set(const ESM::NPC *player)
|
||||||
|
{
|
||||||
|
mPlayer.mBase = player;
|
||||||
|
|
||||||
|
float* playerPos = mPlayer.mData.getPosition().pos;
|
||||||
|
playerPos[0] = playerPos[1] = playerPos[2] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Player::setCell (MWWorld::CellStore *cellStore)
|
void Player::setCell (MWWorld::CellStore *cellStore)
|
||||||
{
|
{
|
||||||
mCellStore = cellStore;
|
mCellStore = cellStore;
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace MWWorld
|
||||||
|
|
||||||
Player(const ESM::NPC *player, const MWBase::World& world);
|
Player(const ESM::NPC *player, const MWBase::World& world);
|
||||||
|
|
||||||
|
void set (const ESM::NPC *player);
|
||||||
|
|
||||||
void setCell (MWWorld::CellStore *cellStore);
|
void setCell (MWWorld::CellStore *cellStore);
|
||||||
|
|
||||||
MWWorld::Ptr getPlayer();
|
MWWorld::Ptr getPlayer();
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace MWWorld
|
||||||
|
|
||||||
Ptr::CellStore *getCell() const
|
Ptr::CellStore *getCell() const
|
||||||
{
|
{
|
||||||
assert (mCell);
|
assert(mCell);
|
||||||
return mCell;
|
return mCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,6 +186,15 @@ namespace MWWorld
|
||||||
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Scene::changeToVoid()
|
||||||
|
{
|
||||||
|
CellStoreCollection::iterator active = mActiveCells.begin();
|
||||||
|
while (active!=mActiveCells.end())
|
||||||
|
unloadCell (active++);
|
||||||
|
assert(mActiveCells.empty());
|
||||||
|
mCurrentCell = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos)
|
void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos)
|
||||||
{
|
{
|
||||||
Nif::NIFFile::CacheLock cachelock;
|
Nif::NIFFile::CacheLock cachelock;
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace MWWorld
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//OEngine::Render::OgreRenderer& mRenderer;
|
//OEngine::Render::OgreRenderer& mRenderer;
|
||||||
CellStore* mCurrentCell; // the cell, the player is in
|
CellStore* mCurrentCell; // the cell the player is in
|
||||||
CellStoreCollection mActiveCells;
|
CellStoreCollection mActiveCells;
|
||||||
bool mCellChanged;
|
bool mCellChanged;
|
||||||
PhysicsSystem *mPhysics;
|
PhysicsSystem *mPhysics;
|
||||||
|
@ -85,6 +85,9 @@ namespace MWWorld
|
||||||
void changeToExteriorCell (const ESM::Position& position);
|
void changeToExteriorCell (const ESM::Position& position);
|
||||||
///< Move to exterior cell.
|
///< Move to exterior cell.
|
||||||
|
|
||||||
|
void changeToVoid();
|
||||||
|
///< Change into a void
|
||||||
|
|
||||||
void markCellAsUnchanged();
|
void markCellAsUnchanged();
|
||||||
|
|
||||||
void update (float duration, bool paused);
|
void update (float duration, bool paused);
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace MWWorld
|
||||||
virtual void load(ESM::ESMReader &esm, const std::string &id) = 0;
|
virtual void load(ESM::ESMReader &esm, const std::string &id) = 0;
|
||||||
|
|
||||||
virtual bool eraseStatic(const std::string &id) {return false;}
|
virtual bool eraseStatic(const std::string &id) {return false;}
|
||||||
|
virtual void clearDynamic() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -106,6 +107,13 @@ namespace MWWorld
|
||||||
|
|
||||||
typedef SharedIterator<T> iterator;
|
typedef SharedIterator<T> iterator;
|
||||||
|
|
||||||
|
// setUp needs to be called again after
|
||||||
|
virtual void clearDynamic()
|
||||||
|
{
|
||||||
|
mDynamic.clear();
|
||||||
|
mShared.clear();
|
||||||
|
}
|
||||||
|
|
||||||
const T *search(const std::string &id) const {
|
const T *search(const std::string &id) const {
|
||||||
T item;
|
T item;
|
||||||
item.mId = Misc::StringUtils::lowerCase(id);
|
item.mId = Misc::StringUtils::lowerCase(id);
|
||||||
|
|
|
@ -160,12 +160,12 @@ namespace MWWorld
|
||||||
World::World (OEngine::Render::OgreRenderer& renderer,
|
World::World (OEngine::Render::OgreRenderer& renderer,
|
||||||
const Files::Collections& fileCollections,
|
const Files::Collections& fileCollections,
|
||||||
const std::vector<std::string>& master, const std::vector<std::string>& plugins,
|
const std::vector<std::string>& master, const std::vector<std::string>& plugins,
|
||||||
const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame,
|
const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir,
|
||||||
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
||||||
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||||
mSky (true), mCells (mStore, mEsm),
|
mSky (true), mCells (mStore, mEsm),
|
||||||
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),
|
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),
|
||||||
mFallback(fallbackMap), mNewGame(newGame)
|
mFallback(fallbackMap), mPlayIntro(0)
|
||||||
{
|
{
|
||||||
mPhysics = new PhysicsSystem(renderer);
|
mPhysics = new PhysicsSystem(renderer);
|
||||||
mPhysEngine = mPhysics->getEngine();
|
mPhysEngine = mPhysics->getEngine();
|
||||||
|
@ -215,22 +215,71 @@ namespace MWWorld
|
||||||
if (mEsm[0].getFormat() == 0)
|
if (mEsm[0].getFormat() == 0)
|
||||||
ensureNeededRecords();
|
ensureNeededRecords();
|
||||||
|
|
||||||
|
mStore.movePlayerRecord();
|
||||||
mStore.setUp();
|
mStore.setUp();
|
||||||
|
|
||||||
// global variables
|
|
||||||
mGlobalVariables = new Globals (mStore);
|
mGlobalVariables = new Globals (mStore);
|
||||||
|
|
||||||
if (mNewGame)
|
mWorldScene = new Scene(*mRendering, mPhysics);
|
||||||
{
|
}
|
||||||
// set new game mark
|
|
||||||
mGlobalVariables->setInt ("chargenstate", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void World::startNewGame()
|
||||||
|
{
|
||||||
|
|
||||||
|
mWorldScene->changeToVoid();
|
||||||
|
|
||||||
|
mStore.clearDynamic();
|
||||||
|
mStore.setUp();
|
||||||
|
|
||||||
|
mCells.clear();
|
||||||
|
|
||||||
|
// Rebuild player
|
||||||
|
setupPlayer();
|
||||||
|
const ESM::NPC* playerNpc = mStore.get<ESM::NPC>().find("player");
|
||||||
|
MWWorld::Ptr player = mPlayer->getPlayer();
|
||||||
|
|
||||||
|
// removes NpcStats, ContainerStore etc
|
||||||
|
player.getRefData().setCustomData(NULL);
|
||||||
|
|
||||||
|
// make sure to do this so that local scripts from items that were in the players inventory are removed
|
||||||
|
mLocalScripts.clear();
|
||||||
|
|
||||||
|
MWWorld::Class::get(player).getContainerStore(player).fill(playerNpc->mInventory, "", mStore);
|
||||||
|
MWWorld::Class::get(player).getInventoryStore(player).autoEquip(player);
|
||||||
|
|
||||||
|
MWBase::Environment::get().getWindowManager()->updatePlayer();
|
||||||
|
|
||||||
|
ESM::Position pos;
|
||||||
|
const int cellSize = 8192;
|
||||||
|
pos.pos[0] = cellSize/2;
|
||||||
|
pos.pos[1] = cellSize/2;
|
||||||
|
pos.pos[2] = 0;
|
||||||
|
pos.rot[0] = 0;
|
||||||
|
pos.rot[1] = 0;
|
||||||
|
pos.rot[2] = 0;
|
||||||
|
mWorldScene->changeToExteriorCell(pos);
|
||||||
|
|
||||||
|
|
||||||
|
// enable collision
|
||||||
|
if(!mPhysics->toggleCollisionMode())
|
||||||
|
mPhysics->toggleCollisionMode();
|
||||||
|
|
||||||
|
// FIXME: should be set to 1, but the sound manager won't pause newly started sounds
|
||||||
|
mPlayIntro = 2;
|
||||||
|
|
||||||
|
// global variables
|
||||||
|
delete mGlobalVariables;
|
||||||
|
mGlobalVariables = new Globals (mStore);
|
||||||
|
|
||||||
|
// set new game mark
|
||||||
|
mGlobalVariables->setInt ("chargenstate", 1);
|
||||||
mGlobalVariables->setInt ("pcrace", 3);
|
mGlobalVariables->setInt ("pcrace", 3);
|
||||||
|
|
||||||
mWorldScene = new Scene(*mRendering, mPhysics);
|
// we don't want old weather to persist on a new game
|
||||||
|
delete mWeatherManager;
|
||||||
|
mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback);
|
||||||
|
|
||||||
lastTick = mTimer.getMilliseconds();
|
MWBase::Environment::get().getScriptManager()->resetGlobalScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -754,7 +803,7 @@ namespace MWWorld
|
||||||
|
|
||||||
CellStore *currCell = ptr.getCell();
|
CellStore *currCell = ptr.getCell();
|
||||||
bool isPlayer = ptr == mPlayer->getPlayer();
|
bool isPlayer = ptr == mPlayer->getPlayer();
|
||||||
bool haveToMove = mWorldScene->isCellActive(*currCell) || isPlayer;
|
bool haveToMove = isPlayer || mWorldScene->isCellActive(*currCell);
|
||||||
|
|
||||||
if (*currCell != newCell)
|
if (*currCell != newCell)
|
||||||
{
|
{
|
||||||
|
@ -950,9 +999,9 @@ namespace MWWorld
|
||||||
float terrainHeight = mRendering->getTerrainHeightAt(pos);
|
float terrainHeight = mRendering->getTerrainHeightAt(pos);
|
||||||
|
|
||||||
if (pos.z < terrainHeight)
|
if (pos.z < terrainHeight)
|
||||||
pos.z = terrainHeight+5; // place slightly above. will snap down to ground with code below
|
pos.z = terrainHeight;
|
||||||
|
|
||||||
ptr.getRefData().getPosition().pos[2] = pos.z;
|
ptr.getRefData().getPosition().pos[2] = pos.z + 20; // place slightly above. will snap down to ground with code below
|
||||||
|
|
||||||
if (!isFlying(ptr))
|
if (!isFlying(ptr))
|
||||||
{
|
{
|
||||||
|
@ -961,7 +1010,7 @@ namespace MWWorld
|
||||||
pos.z = traced.z;
|
pos.z = traced.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
moveObject(ptr, pos.x, pos.y, pos.z);
|
moveObject(ptr, *ptr.getCell(), pos.x, pos.y, pos.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::rotateObject (const Ptr& ptr,float x,float y,float z, bool adjust)
|
void World::rotateObject (const Ptr& ptr,float x,float y,float z, bool adjust)
|
||||||
|
@ -1193,6 +1242,13 @@ namespace MWWorld
|
||||||
|
|
||||||
void World::update (float duration, bool paused)
|
void World::update (float duration, bool paused)
|
||||||
{
|
{
|
||||||
|
if (mPlayIntro)
|
||||||
|
{
|
||||||
|
--mPlayIntro;
|
||||||
|
if (mPlayIntro == 0)
|
||||||
|
mRendering->playVideo("mw_intro.bik", true);
|
||||||
|
}
|
||||||
|
|
||||||
mWeatherManager->update (duration);
|
mWeatherManager->update (duration);
|
||||||
|
|
||||||
mWorldScene->update (duration, paused);
|
mWorldScene->update (duration, paused);
|
||||||
|
@ -1547,23 +1603,19 @@ namespace MWWorld
|
||||||
void World::setupPlayer()
|
void World::setupPlayer()
|
||||||
{
|
{
|
||||||
const ESM::NPC *player = mStore.get<ESM::NPC>().find("player");
|
const ESM::NPC *player = mStore.get<ESM::NPC>().find("player");
|
||||||
mPlayer = new MWWorld::Player(player, *this);
|
if (!mPlayer)
|
||||||
|
mPlayer = new MWWorld::Player(player, *this);
|
||||||
|
else
|
||||||
|
mPlayer->set(player);
|
||||||
|
|
||||||
Ptr ptr = mPlayer->getPlayer();
|
Ptr ptr = mPlayer->getPlayer();
|
||||||
mRendering->setupPlayer(ptr);
|
mRendering->setupPlayer(ptr);
|
||||||
if (mNewGame)
|
|
||||||
{
|
|
||||||
MWWorld::Class::get(ptr).getContainerStore(ptr).fill(player->mInventory, "", mStore);
|
|
||||||
MWWorld::Class::get(ptr).getInventoryStore(ptr).autoEquip(ptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::renderPlayer()
|
void World::renderPlayer()
|
||||||
{
|
{
|
||||||
mRendering->renderPlayer(mPlayer->getPlayer());
|
mRendering->renderPlayer(mPlayer->getPlayer());
|
||||||
mPhysics->addActor(mPlayer->getPlayer());
|
mPhysics->addActor(mPlayer->getPlayer());
|
||||||
if (mNewGame)
|
|
||||||
toggleCollisionMode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setupExternalRendering (MWRender::ExternalRendering& rendering)
|
void World::setupExternalRendering (MWRender::ExternalRendering& rendering)
|
||||||
|
|
|
@ -85,14 +85,9 @@ namespace MWWorld
|
||||||
float mFaced2Distance;
|
float mFaced2Distance;
|
||||||
int mNumFacing;
|
int mNumFacing;
|
||||||
|
|
||||||
bool mNewGame;
|
|
||||||
|
|
||||||
std::map<MWWorld::Ptr, int> mDoorStates;
|
std::map<MWWorld::Ptr, int> mDoorStates;
|
||||||
///< only holds doors that are currently moving. 0 means closing, 1 opening
|
///< only holds doors that are currently moving. 0 means closing, 1 opening
|
||||||
|
|
||||||
unsigned long lastTick;
|
|
||||||
Ogre::Timer mTimer;
|
|
||||||
|
|
||||||
int getDaysPerMonth (int month) const;
|
int getDaysPerMonth (int month) const;
|
||||||
|
|
||||||
void rotateObjectImp (const Ptr& ptr, Ogre::Vector3 rot, bool adjust);
|
void rotateObjectImp (const Ptr& ptr, Ogre::Vector3 rot, bool adjust);
|
||||||
|
@ -120,16 +115,20 @@ namespace MWWorld
|
||||||
|
|
||||||
void ensureNeededRecords();
|
void ensureNeededRecords();
|
||||||
|
|
||||||
|
int mPlayIntro;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
World (OEngine::Render::OgreRenderer& renderer,
|
World (OEngine::Render::OgreRenderer& renderer,
|
||||||
const Files::Collections& fileCollections,
|
const Files::Collections& fileCollections,
|
||||||
const std::vector<std::string>& master, const std::vector<std::string>& plugins,
|
const std::vector<std::string>& master, const std::vector<std::string>& plugins,
|
||||||
const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame,
|
const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir,
|
||||||
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride);
|
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride);
|
||||||
|
|
||||||
virtual ~World();
|
virtual ~World();
|
||||||
|
|
||||||
|
virtual void startNewGame();
|
||||||
|
|
||||||
virtual OEngine::Render::Fader* getFader();
|
virtual OEngine::Render::Fader* getFader();
|
||||||
///< \ŧodo remove this function. Rendering details should not be exposed.
|
///< \ŧodo remove this function. Rendering details should not be exposed.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue