mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:53:51 +00:00
Merge remote-tracking branch 'scrawl/videoplayback' into videoplayback
This commit is contained in:
commit
9c805483b0
11 changed files with 66 additions and 36 deletions
|
@ -125,7 +125,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)
|
||||||
|
@ -237,11 +236,6 @@ void OMW::Engine::setScriptsVerbosity(bool scriptsVerbosity)
|
||||||
mVerboseScripts = scriptsVerbosity;
|
mVerboseScripts = scriptsVerbosity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMW::Engine::setNewGame(bool newGame)
|
|
||||||
{
|
|
||||||
mNewGame = newGame;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialise and enter main loop.
|
// Initialise and enter main loop.
|
||||||
|
|
||||||
void OMW::Engine::go()
|
void OMW::Engine::go()
|
||||||
|
@ -332,13 +326,13 @@ void OMW::Engine::go()
|
||||||
|
|
||||||
// Create the world
|
// Create the world
|
||||||
mEnvironment.setWorld (new MWWorld::World (*mOgre, mFileCollections, mMaster,
|
mEnvironment.setWorld (new MWWorld::World (*mOgre, mFileCollections, mMaster,
|
||||||
mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoding, mFallbackMap));
|
mResDir, mCfgMgr.getCachePath(), mEncoding, mFallbackMap));
|
||||||
|
|
||||||
// Create window manager - this manages all the MW-specific GUI windows
|
// Create window manager - this manages all the MW-specific GUI windows
|
||||||
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));
|
mCfgMgr.getCachePath ().string(), mScriptConsoleMode));
|
||||||
|
|
||||||
// Create sound system
|
// Create sound system
|
||||||
|
|
|
@ -68,7 +68,6 @@ namespace OMW
|
||||||
int mFpsLevel;
|
int mFpsLevel;
|
||||||
bool mDebug;
|
bool mDebug;
|
||||||
bool mVerboseScripts;
|
bool mVerboseScripts;
|
||||||
bool mNewGame;
|
|
||||||
bool mUseSound;
|
bool mUseSound;
|
||||||
bool mCompileAll;
|
bool mCompileAll;
|
||||||
std::string mFocusName;
|
std::string mFocusName;
|
||||||
|
@ -138,9 +137,6 @@ namespace OMW
|
||||||
/// Disable or enable all sounds
|
/// Disable or enable all sounds
|
||||||
void setSoundUsage(bool soundUsage);
|
void setSoundUsage(bool soundUsage);
|
||||||
|
|
||||||
/// Start as a new game.
|
|
||||||
void setNewGame(bool newGame);
|
|
||||||
|
|
||||||
/// Initialise and enter main loop.
|
/// Initialise and enter main loop.
|
||||||
void go();
|
void go();
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,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)")
|
||||||
|
|
||||||
|
@ -238,7 +235,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>());
|
||||||
|
|
|
@ -79,6 +79,8 @@ namespace MWBase
|
||||||
*/
|
*/
|
||||||
virtual void update() = 0;
|
virtual void update() = 0;
|
||||||
|
|
||||||
|
virtual void newGame() = 0;
|
||||||
|
|
||||||
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
||||||
virtual void popGuiMode() = 0;
|
virtual void popGuiMode() = 0;
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ namespace MWBase
|
||||||
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.
|
||||||
|
|
||||||
|
virtual void newGame() = 0;
|
||||||
|
|
||||||
virtual MWWorld::CellStore *getExterior (int x, int y) = 0;
|
virtual MWWorld::CellStore *getExterior (int x, int y) = 0;
|
||||||
|
|
||||||
virtual MWWorld::CellStore *getInterior (const std::string& name) = 0;
|
virtual MWWorld::CellStore *getInterior (const std::string& name) = 0;
|
||||||
|
|
|
@ -6,12 +6,15 @@
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
#include "confirmationdialog.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
MainMenu::MainMenu(int w, int h)
|
MainMenu::MainMenu(MWBase::WindowManager& parWindowManager, int w, int h)
|
||||||
: OEngine::GUI::Layout("openmw_mainmenu.layout")
|
: OEngine::GUI::Layout("openmw_mainmenu.layout")
|
||||||
, mButtonBox(0)
|
, mButtonBox(0)
|
||||||
|
, mDialog(parWindowManager)
|
||||||
{
|
{
|
||||||
onResChange(w,h);
|
onResChange(w,h);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +23,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
setCoord(0,0,w,h);
|
setCoord(0,0,w,h);
|
||||||
|
|
||||||
int height = 64 * 3;
|
int height = 64 * 4;
|
||||||
|
|
||||||
if (mButtonBox)
|
if (mButtonBox)
|
||||||
MyGUI::Gui::getInstance ().destroyWidget(mButtonBox);
|
MyGUI::Gui::getInstance ().destroyWidget(mButtonBox);
|
||||||
|
@ -33,12 +36,11 @@ namespace MWGui
|
||||||
mReturn->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::returnToGame);
|
mReturn->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::returnToGame);
|
||||||
curH += 64;
|
curH += 64;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
mNewGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
mNewGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||||
|
mNewGame->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::newGame);
|
||||||
mNewGame->setImageResource ("Menu_NewGame");
|
mNewGame->setImageResource ("Menu_NewGame");
|
||||||
curH += 64;
|
curH += 64;
|
||||||
|
/*
|
||||||
mLoadGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
mLoadGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||||
mLoadGame->setImageResource ("Menu_LoadGame");
|
mLoadGame->setImageResource ("Menu_LoadGame");
|
||||||
curH += 64;
|
curH += 64;
|
||||||
|
@ -81,4 +83,18 @@ namespace MWGui
|
||||||
Ogre::Root::getSingleton ().queueEndRendering ();
|
Ogre::Root::getSingleton ().queueEndRendering ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainMenu::newGame(MyGUI::Widget* sender)
|
||||||
|
{
|
||||||
|
mDialog.open ("#{sNotifyMessage54}");
|
||||||
|
mDialog.eventOkClicked.clear();
|
||||||
|
mDialog.eventCancelClicked.clear();
|
||||||
|
mDialog.eventOkClicked += MyGUI::newDelegate(this, &MainMenu::newGameConfirmed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainMenu::newGameConfirmed()
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager ()->removeGuiMode (GM_MainMenu);
|
||||||
|
MWBase::Environment::get().getWindowManager ()->newGame ();
|
||||||
|
MWBase::Environment::get().getWorld ()->newGame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
#include <openengine/gui/layout.hpp>
|
#include <openengine/gui/layout.hpp>
|
||||||
|
|
||||||
|
#include "confirmationdialog.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
class MainMenu : public OEngine::GUI::Layout
|
class MainMenu : public OEngine::GUI::Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MainMenu(int w, int h);
|
MainMenu(MWBase::WindowManager& parWindowManager, int w, int h);
|
||||||
|
|
||||||
void onResChange(int w, int h);
|
void onResChange(int w, int h);
|
||||||
|
|
||||||
|
@ -24,6 +26,10 @@ namespace MWGui
|
||||||
void returnToGame(MyGUI::Widget* sender);
|
void returnToGame(MyGUI::Widget* sender);
|
||||||
void showOptions(MyGUI::Widget* sender);
|
void showOptions(MyGUI::Widget* sender);
|
||||||
void exitGame(MyGUI::Widget* sender);
|
void exitGame(MyGUI::Widget* sender);
|
||||||
|
void newGame(MyGUI::Widget* sender);
|
||||||
|
void newGameConfirmed();
|
||||||
|
|
||||||
|
ConfirmationDialog mDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
WindowManager::WindowManager(
|
WindowManager::WindowManager(
|
||||||
const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre,
|
const Compiler::Extensions& extensions, int fpsLevel, OEngine::Render::OgreRenderer *mOgre,
|
||||||
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts)
|
const std::string& logpath, const std::string& cacheDir, bool consoleOnlyScripts)
|
||||||
: mGuiManager(NULL)
|
: mGuiManager(NULL)
|
||||||
, mHud(NULL)
|
, mHud(NULL)
|
||||||
|
@ -95,8 +95,8 @@ WindowManager::WindowManager(
|
||||||
, 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)
|
||||||
|
@ -139,7 +139,7 @@ WindowManager::WindowManager(
|
||||||
mDragAndDrop->mDraggedWidget = 0;
|
mDragAndDrop->mDraggedWidget = 0;
|
||||||
mDragAndDrop->mDragAndDropWidget = dragAndDropWidget;
|
mDragAndDrop->mDragAndDropWidget = dragAndDropWidget;
|
||||||
|
|
||||||
mMenu = new MainMenu(w,h);
|
mMenu = new MainMenu(*this, w,h);
|
||||||
mMap = new MapWindow(*this, cacheDir);
|
mMap = new MapWindow(*this, cacheDir);
|
||||||
mStatsWindow = new StatsWindow(*this);
|
mStatsWindow = new StatsWindow(*this);
|
||||||
mConsole = new Console(w,h, consoleOnlyScripts);
|
mConsole = new Console(w,h, consoleOnlyScripts);
|
||||||
|
@ -1041,3 +1041,9 @@ void WindowManager::startTraining(MWWorld::Ptr actor)
|
||||||
{
|
{
|
||||||
mTrainingWindow->startTraining(actor);
|
mTrainingWindow->startTraining(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::newGame ()
|
||||||
|
{
|
||||||
|
mAllowed = GW_None;
|
||||||
|
mRestAllowed = false;
|
||||||
|
}
|
||||||
|
|
|
@ -74,7 +74,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);
|
||||||
virtual ~WindowManager();
|
virtual ~WindowManager();
|
||||||
|
@ -86,6 +86,8 @@ namespace MWGui
|
||||||
*/
|
*/
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
||||||
|
virtual void 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
|
||||||
|
|
|
@ -167,10 +167,10 @@ namespace MWWorld
|
||||||
|
|
||||||
World::World (OEngine::Render::OgreRenderer& renderer,
|
World::World (OEngine::Render::OgreRenderer& renderer,
|
||||||
const Files::Collections& fileCollections,
|
const Files::Collections& fileCollections,
|
||||||
const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame,
|
const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir,
|
||||||
const std::string& encoding, std::map<std::string,std::string> fallbackMap)
|
const std::string& encoding, std::map<std::string,std::string> fallbackMap)
|
||||||
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||||
mSky (true), mCells (mStore, mEsm),
|
mSky (true), mCells (mStore, mEsm), mNewGameStarted(false),
|
||||||
mNumFacing(0)
|
mNumFacing(0)
|
||||||
{
|
{
|
||||||
mPhysics = new PhysicsSystem(renderer);
|
mPhysics = new PhysicsSystem(renderer);
|
||||||
|
@ -197,12 +197,6 @@ namespace MWWorld
|
||||||
// global variables
|
// global variables
|
||||||
mGlobalVariables = new Globals (mStore);
|
mGlobalVariables = new Globals (mStore);
|
||||||
|
|
||||||
if (newGame)
|
|
||||||
{
|
|
||||||
// set new game mark
|
|
||||||
mGlobalVariables->setInt ("chargenstate", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
mGlobalVariables->setInt ("pcrace", 3);
|
mGlobalVariables->setInt ("pcrace", 3);
|
||||||
|
|
||||||
mWorldScene = new Scene(*mRendering, mPhysics);
|
mWorldScene = new Scene(*mRendering, mPhysics);
|
||||||
|
@ -1015,6 +1009,12 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mNewGameStarted)
|
||||||
|
{
|
||||||
|
playVideo ("mw_intro.bik");
|
||||||
|
mNewGameStarted = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::isCellExterior() const
|
bool World::isCellExterior() const
|
||||||
|
@ -1296,4 +1296,11 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
mRendering->stopVideo();
|
mRendering->stopVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::newGame ()
|
||||||
|
{
|
||||||
|
// set new game mark
|
||||||
|
mGlobalVariables->setInt ("chargenstate", 1);
|
||||||
|
mNewGameStarted = true; // in order to play the intro video at the end of the next frame
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ namespace MWWorld
|
||||||
MWWorld::Globals *mGlobalVariables;
|
MWWorld::Globals *mGlobalVariables;
|
||||||
MWWorld::PhysicsSystem *mPhysics;
|
MWWorld::PhysicsSystem *mPhysics;
|
||||||
bool mSky;
|
bool mSky;
|
||||||
|
bool mNewGameStarted;
|
||||||
|
|
||||||
Cells mCells;
|
Cells mCells;
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ namespace MWWorld
|
||||||
|
|
||||||
World (OEngine::Render::OgreRenderer& renderer,
|
World (OEngine::Render::OgreRenderer& renderer,
|
||||||
const Files::Collections& fileCollections,
|
const Files::Collections& fileCollections,
|
||||||
const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame,
|
const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir,
|
||||||
const std::string& encoding, std::map<std::string,std::string> fallbackMap);
|
const std::string& encoding, std::map<std::string,std::string> fallbackMap);
|
||||||
|
|
||||||
virtual ~World();
|
virtual ~World();
|
||||||
|
@ -102,6 +103,8 @@ namespace MWWorld
|
||||||
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.
|
||||||
|
|
||||||
|
virtual void newGame();
|
||||||
|
|
||||||
virtual CellStore *getExterior (int x, int y);
|
virtual CellStore *getExterior (int x, int y);
|
||||||
|
|
||||||
virtual CellStore *getInterior (const std::string& name);
|
virtual CellStore *getInterior (const std::string& name);
|
||||||
|
|
Loading…
Reference in a new issue