mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +00:00
New Game button
This commit is contained in:
parent
3829bbfeca
commit
c5dd0e1968
6 changed files with 47 additions and 8 deletions
|
@ -82,6 +82,8 @@ namespace MWBase
|
|||
virtual OEngine::Render::Fader* getFader() = 0;
|
||||
///< \ŧ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 *getInterior (const std::string& name) = 0;
|
||||
|
|
|
@ -6,12 +6,15 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "confirmationdialog.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
MainMenu::MainMenu(int w, int h)
|
||||
MainMenu::MainMenu(MWBase::WindowManager& parWindowManager, int w, int h)
|
||||
: OEngine::GUI::Layout("openmw_mainmenu.layout")
|
||||
, mButtonBox(0)
|
||||
, mDialog(parWindowManager)
|
||||
{
|
||||
onResChange(w,h);
|
||||
}
|
||||
|
@ -20,7 +23,7 @@ namespace MWGui
|
|||
{
|
||||
setCoord(0,0,w,h);
|
||||
|
||||
int height = 64 * 3;
|
||||
int height = 64 * 4;
|
||||
|
||||
if (mButtonBox)
|
||||
MyGUI::Gui::getInstance ().destroyWidget(mButtonBox);
|
||||
|
@ -33,12 +36,11 @@ namespace MWGui
|
|||
mReturn->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::returnToGame);
|
||||
curH += 64;
|
||||
|
||||
|
||||
/*
|
||||
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");
|
||||
curH += 64;
|
||||
|
||||
/*
|
||||
mLoadGame = mButtonBox->createWidget<MyGUI::Button> ("ButtonImage", MyGUI::IntCoord(0, curH, 128, 64), MyGUI::Align::Default);
|
||||
mLoadGame->setImageResource ("Menu_LoadGame");
|
||||
curH += 64;
|
||||
|
@ -81,4 +83,17 @@ namespace MWGui
|
|||
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().getWorld ()->newGame();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
#include <openengine/gui/layout.hpp>
|
||||
|
||||
#include "confirmationdialog.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
class MainMenu : public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
MainMenu(int w, int h);
|
||||
MainMenu(MWBase::WindowManager& parWindowManager, int w, int h);
|
||||
|
||||
void onResChange(int w, int h);
|
||||
|
||||
|
@ -24,6 +26,10 @@ namespace MWGui
|
|||
void returnToGame(MyGUI::Widget* sender);
|
||||
void showOptions(MyGUI::Widget* sender);
|
||||
void exitGame(MyGUI::Widget* sender);
|
||||
void newGame(MyGUI::Widget* sender);
|
||||
void newGameConfirmed();
|
||||
|
||||
ConfirmationDialog mDialog;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ WindowManager::WindowManager(
|
|||
mDragAndDrop->mDraggedWidget = 0;
|
||||
mDragAndDrop->mDragAndDropWidget = dragAndDropWidget;
|
||||
|
||||
mMenu = new MainMenu(w,h);
|
||||
mMenu = new MainMenu(*this, w,h);
|
||||
mMap = new MapWindow(*this, cacheDir);
|
||||
mStatsWindow = new StatsWindow(*this);
|
||||
mConsole = new Console(w,h, consoleOnlyScripts);
|
||||
|
|
|
@ -170,7 +170,7 @@ namespace MWWorld
|
|||
const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame,
|
||||
const std::string& encoding, std::map<std::string,std::string> fallbackMap)
|
||||
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||
mSky (true), mCells (mStore, mEsm),
|
||||
mSky (true), mCells (mStore, mEsm), mNewGameStarted(false),
|
||||
mNumFacing(0)
|
||||
{
|
||||
mPhysics = new PhysicsSystem(renderer);
|
||||
|
@ -1015,6 +1015,12 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mNewGameStarted)
|
||||
{
|
||||
playVideo ("mw_intro.bik");
|
||||
mNewGameStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool World::isCellExterior() const
|
||||
|
@ -1296,4 +1302,11 @@ namespace MWWorld
|
|||
{
|
||||
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::PhysicsSystem *mPhysics;
|
||||
bool mSky;
|
||||
bool mNewGameStarted;
|
||||
|
||||
Cells mCells;
|
||||
|
||||
|
@ -102,6 +103,8 @@ namespace MWWorld
|
|||
virtual OEngine::Render::Fader* getFader();
|
||||
///< \ŧodo remove this function. Rendering details should not be exposed.
|
||||
|
||||
virtual void newGame();
|
||||
|
||||
virtual CellStore *getExterior (int x, int y);
|
||||
|
||||
virtual CellStore *getInterior (const std::string& name);
|
||||
|
|
Loading…
Reference in a new issue