1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-29 00:06:43 +00:00

Merge branch 'master' into alchemy

This commit is contained in:
scrawl 2012-05-25 13:14:27 +02:00
commit 9b623a79ff
21 changed files with 223 additions and 163 deletions

View file

@ -15,7 +15,7 @@ include (OpenMWMacros)
# Version # Version
set (OPENMW_VERSION_MAJOR 0) set (OPENMW_VERSION_MAJOR 0)
set (OPENMW_VERSION_MINOR 14) set (OPENMW_VERSION_MINOR 15)
set (OPENMW_VERSION_RELEASE 0) set (OPENMW_VERSION_RELEASE 0)
set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}") set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")

View file

@ -105,7 +105,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
// frame. // frame.
// passing of time // passing of time
if (MWBase::Environment::get().getWindowManager()->getMode()==MWGui::GM_Game) if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
MWBase::Environment::get().getWorld()->advanceTime ( MWBase::Environment::get().getWorld()->advanceTime (
mEnvironment.getFrameDuration()*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600); mEnvironment.getFrameDuration()*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
@ -116,9 +116,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
// update actors // update actors
std::vector<std::pair<std::string, Ogre::Vector3> > movement; std::vector<std::pair<std::string, Ogre::Vector3> > movement;
MWBase::Environment::get().getMechanicsManager()->update (movement, mEnvironment.getFrameDuration(), MWBase::Environment::get().getMechanicsManager()->update (movement, mEnvironment.getFrameDuration(),
MWBase::Environment::get().getWindowManager()->getMode()!=MWGui::GM_Game); MWBase::Environment::get().getWindowManager()->isGuiMode());
if (MWBase::Environment::get().getWindowManager()->getMode()==MWGui::GM_Game) if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration()); MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration());
// update world // update world
@ -413,7 +413,7 @@ void OMW::Engine::go()
void OMW::Engine::activate() void OMW::Engine::activate()
{ {
if (MWBase::Environment::get().getWindowManager()->getMode()!=MWGui::GM_Game) if (MWBase::Environment::get().getWindowManager()->isGuiMode())
return; return;
std::string handle = MWBase::Environment::get().getWorld()->getFacedHandle(); std::string handle = MWBase::Environment::get().getWorld()->getFacedHandle();

View file

@ -635,7 +635,7 @@ namespace MWDialogue
actorKnownTopics.clear(); actorKnownTopics.clear();
//initialise the GUI //initialise the GUI
MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Dialogue); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Dialogue);
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->startDialogue(actor, MWWorld::Class::get (actor).getName (actor)); win->startDialogue(actor, MWWorld::Class::get (actor).getName (actor));
@ -843,7 +843,7 @@ namespace MWDialogue
void DialogueManager::goodbyeSelected() void DialogueManager::goodbyeSelected()
{ {
MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Game); MWBase::Environment::get().getWindowManager()->popGuiMode();
} }
void DialogueManager::questionAnswered(std::string answere) void DialogueManager::questionAnswered(std::string answere)

View file

@ -1,13 +1,14 @@
#include "bookwindow.hpp" #include "bookwindow.hpp"
#include "formatting.hpp" #include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwinput/inputmanager.hpp" #include "../mwinput/inputmanager.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include <boost/lexical_cast.hpp> #include "formatting.hpp"
#include "window_manager.hpp"
using namespace MWGui; using namespace MWGui;
@ -91,7 +92,7 @@ void BookWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
// no 3d sounds because the object could be in a container. // no 3d sounds because the object could be in a container.
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
MWBase::Environment::get().getInputManager()->setGuiMode(MWGui::GM_Game); mWindowManager.popGuiMode();
} }
void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender) void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
@ -101,7 +102,7 @@ void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
MWWorld::ActionTake take(mBook); MWWorld::ActionTake take(mBook);
take.execute(); take.execute();
MWBase::Environment::get().getInputManager()->setGuiMode (GM_Game); mWindowManager.popGuiMode();
} }
void BookWindow::onNextPageButtonClicked (MyGUI::Widget* _sender) void BookWindow::onNextPageButtonClicked (MyGUI::Widget* _sender)

View file

@ -110,7 +110,6 @@ using namespace MWGui;
CharacterCreation::CharacterCreation(WindowManager* _wm) CharacterCreation::CharacterCreation(WindowManager* _wm)
: mNameDialog(0) : mNameDialog(0)
, mRaceDialog(0) , mRaceDialog(0)
, mDialogueWindow(0)
, mClassChoiceDialog(0) , mClassChoiceDialog(0)
, mGenerateClassQuestionDialog(0) , mGenerateClassQuestionDialog(0)
, mGenerateClassResultDialog(0) , mGenerateClassResultDialog(0)
@ -253,7 +252,7 @@ void CharacterCreation::onReviewDialogDone(WindowBase* parWindow)
if (mReviewDialog) if (mReviewDialog)
mWM->removeDialog(mReviewDialog); mWM->removeDialog(mReviewDialog);
mWM->setGuiMode(GM_Game); mWM->popGuiMode();
} }
void CharacterCreation::onReviewDialogBack() void CharacterCreation::onReviewDialogBack()
@ -261,7 +260,7 @@ void CharacterCreation::onReviewDialogBack()
if (mReviewDialog) if (mReviewDialog)
mWM->removeDialog(mReviewDialog); mWM->removeDialog(mReviewDialog);
mWM->setGuiMode(GM_Birth); mWM->pushGuiMode(GM_Birth);
} }
void CharacterCreation::onReviewActivateDialog(int parDialog) void CharacterCreation::onReviewActivateDialog(int parDialog)
@ -270,19 +269,21 @@ void CharacterCreation::onReviewActivateDialog(int parDialog)
mWM->removeDialog(mReviewDialog); mWM->removeDialog(mReviewDialog);
mCreationStage = CSE_ReviewNext; mCreationStage = CSE_ReviewNext;
mWM->popGuiMode();
switch(parDialog) switch(parDialog)
{ {
case ReviewDialog::NAME_DIALOG: case ReviewDialog::NAME_DIALOG:
mWM->setGuiMode(GM_Name); mWM->pushGuiMode(GM_Name);
break; break;
case ReviewDialog::RACE_DIALOG: case ReviewDialog::RACE_DIALOG:
mWM->setGuiMode(GM_Race); mWM->pushGuiMode(GM_Race);
break; break;
case ReviewDialog::CLASS_DIALOG: case ReviewDialog::CLASS_DIALOG:
mWM->setGuiMode(GM_Class); mWM->pushGuiMode(GM_Class);
break; break;
case ReviewDialog::BIRTHSIGN_DIALOG: case ReviewDialog::BIRTHSIGN_DIALOG:
mWM->setGuiMode(GM_Birth); mWM->pushGuiMode(GM_Birth);
}; };
} }
@ -304,13 +305,19 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
//TODO This bit gets repeated a few times; wrap it in a function //TODO This bit gets repeated a few times; wrap it in a function
if (mCreationStage == CSE_ReviewNext) if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen) else if (mCreationStage >= CSE_ClassChosen)
mWM->setGuiMode(GM_Birth); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Birth);
}
else else
{ {
mCreationStage = CSE_ClassChosen; mCreationStage = CSE_ClassChosen;
mWM->setGuiMode(GM_Game); mWM->popGuiMode();
} }
} }
@ -324,7 +331,8 @@ void CharacterCreation::onPickClassDialogBack()
mWM->removeDialog(mPickClassDialog); mWM->removeDialog(mPickClassDialog);
} }
mWM->setGuiMode(GM_Class); mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
} }
void CharacterCreation::onClassChoice(int _index) void CharacterCreation::onClassChoice(int _index)
@ -334,19 +342,21 @@ void CharacterCreation::onClassChoice(int _index)
mWM->removeDialog(mClassChoiceDialog); mWM->removeDialog(mClassChoiceDialog);
} }
mWM->popGuiMode();
switch(_index) switch(_index)
{ {
case ClassChoiceDialog::Class_Generate: case ClassChoiceDialog::Class_Generate:
mWM->setGuiMode(GM_ClassGenerate); mWM->pushGuiMode(GM_ClassGenerate);
break; break;
case ClassChoiceDialog::Class_Pick: case ClassChoiceDialog::Class_Pick:
mWM->setGuiMode(GM_ClassPick); mWM->pushGuiMode(GM_ClassPick);
break; break;
case ClassChoiceDialog::Class_Create: case ClassChoiceDialog::Class_Create:
mWM->setGuiMode(GM_ClassCreate); mWM->pushGuiMode(GM_ClassCreate);
break; break;
case ClassChoiceDialog::Class_Back: case ClassChoiceDialog::Class_Back:
mWM->setGuiMode(GM_Race); mWM->pushGuiMode(GM_Race);
break; break;
}; };
@ -363,13 +373,19 @@ void CharacterCreation::onNameDialogDone(WindowBase* parWindow)
} }
if (mCreationStage == CSE_ReviewNext) if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_NameChosen) else if (mCreationStage >= CSE_NameChosen)
mWM->setGuiMode(GM_Race); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Race);
}
else else
{ {
mCreationStage = CSE_NameChosen; mCreationStage = CSE_NameChosen;
mWM->setGuiMode(GM_Game); mWM->popGuiMode();
} }
} }
@ -383,7 +399,8 @@ void CharacterCreation::onRaceDialogBack()
mWM->removeDialog(mRaceDialog); mWM->removeDialog(mRaceDialog);
} }
mWM->setGuiMode(GM_Name); mWM->popGuiMode();
mWM->pushGuiMode(GM_Name);
} }
void CharacterCreation::onRaceDialogDone(WindowBase* parWindow) void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
@ -398,13 +415,19 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
} }
if (mCreationStage == CSE_ReviewNext) if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review); {
else if(mCreationStage >= CSE_RaceChosen) mWM->popGuiMode();
mWM->setGuiMode(GM_Class); mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_NameChosen)
{
mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
}
else else
{ {
mCreationStage = CSE_RaceChosen; mCreationStage = CSE_NameChosen;
mWM->setGuiMode(GM_Game); mWM->popGuiMode();
} }
} }
@ -419,11 +442,14 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
} }
if (mCreationStage >= CSE_BirthSignChosen) if (mCreationStage >= CSE_BirthSignChosen)
mWM->setGuiMode(GM_Review); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else else
{ {
mCreationStage = CSE_BirthSignChosen; mCreationStage = CSE_BirthSignChosen;
mWM->setGuiMode(GM_Game); mWM->popGuiMode();
} }
} }
@ -435,7 +461,8 @@ void CharacterCreation::onBirthSignDialogBack()
mWM->removeDialog(mBirthSignDialog); mWM->removeDialog(mBirthSignDialog);
} }
mWM->setGuiMode(GM_Class); mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
} }
void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow) void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
@ -470,13 +497,19 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
} }
if (mCreationStage == CSE_ReviewNext) if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen) else if (mCreationStage >= CSE_ClassChosen)
mWM->setGuiMode(GM_Birth); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Birth);
}
else else
{ {
mCreationStage = CSE_ClassChosen; mCreationStage = CSE_ClassChosen;
mWM->setGuiMode(GM_Game); mWM->popGuiMode();
} }
} }
@ -485,7 +518,8 @@ void CharacterCreation::onCreateClassDialogBack()
if (mCreateClassDialog) if (mCreateClassDialog)
mWM->removeDialog(mCreateClassDialog); mWM->removeDialog(mCreateClassDialog);
mWM->setGuiMode(GM_Class); mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
} }
void CharacterCreation::onClassQuestionChosen(int _index) void CharacterCreation::onClassQuestionChosen(int _index)
@ -496,7 +530,8 @@ void CharacterCreation::onClassQuestionChosen(int _index)
mWM->removeDialog(mGenerateClassQuestionDialog); mWM->removeDialog(mGenerateClassQuestionDialog);
if (_index < 0 || _index >= 3) if (_index < 0 || _index >= 3)
{ {
mWM->setGuiMode(GM_Class); mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
return; return;
} }
@ -581,7 +616,8 @@ void CharacterCreation::showClassQuestionDialog()
if (mGenerateClassStep > sGenerateClassSteps.size()) if (mGenerateClassStep > sGenerateClassSteps.size())
{ {
mWM->setGuiMode(GM_Class); mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
return; return;
} }
@ -610,7 +646,8 @@ void CharacterCreation::onGenerateClassBack()
mWM->removeDialog(mGenerateClassResultDialog); mWM->removeDialog(mGenerateClassResultDialog);
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass); MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
mWM->setGuiMode(GM_Class); mWM->popGuiMode();
mWM->pushGuiMode(GM_Class);
} }
void CharacterCreation::onGenerateClassDone(WindowBase* parWindow) void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
@ -620,13 +657,19 @@ void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass); MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
if (mCreationStage == CSE_ReviewNext) if (mCreationStage == CSE_ReviewNext)
mWM->setGuiMode(GM_Review); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Review);
}
else if (mCreationStage >= CSE_ClassChosen) else if (mCreationStage >= CSE_ClassChosen)
mWM->setGuiMode(GM_Birth); {
mWM->popGuiMode();
mWM->pushGuiMode(GM_Birth);
}
else else
{ {
mCreationStage = CSE_ClassChosen; mCreationStage = CSE_ClassChosen;
mWM->setGuiMode(GM_Game); mWM->popGuiMode();
} }
} }
@ -634,7 +677,6 @@ CharacterCreation::~CharacterCreation()
{ {
delete mNameDialog; delete mNameDialog;
delete mRaceDialog; delete mRaceDialog;
delete mDialogueWindow;
delete mClassChoiceDialog; delete mClassChoiceDialog;
delete mGenerateClassQuestionDialog; delete mGenerateClassQuestionDialog;
delete mGenerateClassResultDialog; delete mGenerateClassResultDialog;

View file

@ -46,7 +46,6 @@ namespace MWGui
//Dialogs //Dialogs
TextInputDialog* mNameDialog; TextInputDialog* mNameDialog;
RaceDialog* mRaceDialog; RaceDialog* mRaceDialog;
DialogueWindow* mDialogueWindow;
ClassChoiceDialog* mClassChoiceDialog; ClassChoiceDialog* mClassChoiceDialog;
InfoBoxDialog* mGenerateClassQuestionDialog; InfoBoxDialog* mGenerateClassQuestionDialog;
GenerateClassResultDialog* mGenerateClassResultDialog; GenerateClassResultDialog* mGenerateClassResultDialog;

View file

@ -636,7 +636,7 @@ void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
{ {
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop) if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
{ {
MWBase::Environment::get().getWindowManager()->setGuiMode(GM_Game); MWBase::Environment::get().getWindowManager()->popGuiMode();
} }
} }
@ -667,6 +667,6 @@ void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
containerStore.clear(); containerStore.clear();
MWBase::Environment::get().getWindowManager()->setGuiMode(GM_Game); MWBase::Environment::get().getWindowManager()->popGuiMode();
} }
} }

View file

@ -112,15 +112,6 @@ void DialogueWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
history->setVScrollPosition(history->getVScrollPosition() - _rel*0.3); history->setVScrollPosition(history->getVScrollPosition() - _rel*0.3);
} }
void DialogueWindow::open()
{
topicsList->clear();
pTopicsText.clear();
history->eraseText(0,history->getTextLength());
updateOptions();
setVisible(true);
}
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender) void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
{ {
MWBase::Environment::get().getDialogueManager()->goodbyeSelected(); MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
@ -133,7 +124,7 @@ void DialogueWindow::onSelectTopic(std::string topic)
if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str) if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str)
{ {
/// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)? /// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
mWindowManager.setGuiMode(GM_Barter); mWindowManager.pushGuiMode(GM_Barter);
mWindowManager.getTradeWindow()->startTrade(mActor); mWindowManager.getTradeWindow()->startTrade(mActor);
} }
@ -147,6 +138,11 @@ void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName)
mActor = actor; mActor = actor;
topicsList->setEnabled(true); topicsList->setEnabled(true);
setTitle(npcName); setTitle(npcName);
topicsList->clear();
pTopicsText.clear();
history->eraseText(0,history->getTextLength());
updateOptions();
} }
void DialogueWindow::setKeywords(std::list<std::string> keyWords) void DialogueWindow::setKeywords(std::list<std::string> keyWords)

View file

@ -30,8 +30,6 @@ namespace MWGui
public: public:
DialogueWindow(WindowManager& parWindowManager); DialogueWindow(WindowManager& parWindowManager);
void open();
// Events // Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void; typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

View file

@ -58,7 +58,7 @@ void MessageBoxManager::onFrame (float frameDuration)
if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) { if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) {
delete mInterMessageBoxe; delete mInterMessageBoxe;
mInterMessageBoxe = NULL; mInterMessageBoxe = NULL;
mWindowManager->setNextMode(GM_Game); mWindowManager->popGuiMode();
} }
} }

View file

@ -5,7 +5,6 @@ namespace MWGui
{ {
enum GuiMode enum GuiMode
{ {
GM_Game, // Game mode, only HUD
GM_Inventory, // Inventory mode GM_Inventory, // Inventory mode
GM_Container, GM_Container,
GM_MainMenu, // Main menu mode GM_MainMenu, // Main menu mode

View file

@ -1,12 +1,13 @@
#include "scrollwindow.hpp" #include "scrollwindow.hpp"
#include "formatting.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwinput/inputmanager.hpp" #include "../mwinput/inputmanager.hpp"
#include "../mwworld/actiontake.hpp" #include "../mwworld/actiontake.hpp"
#include "../mwsound/soundmanager.hpp" #include "../mwsound/soundmanager.hpp"
#include "formatting.hpp"
#include "window_manager.hpp"
using namespace MWGui; using namespace MWGui;
ScrollWindow::ScrollWindow (WindowManager& parWindowManager) : ScrollWindow::ScrollWindow (WindowManager& parWindowManager) :
@ -55,7 +56,7 @@ void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
{ {
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0); MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
MWBase::Environment::get().getInputManager()->setGuiMode (GM_Game); mWindowManager.popGuiMode();
} }
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender) void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
@ -65,5 +66,5 @@ void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
MWWorld::ActionTake take(mScroll); MWWorld::ActionTake take(mScroll);
take.execute(); take.execute();
MWBase::Environment::get().getInputManager()->setGuiMode (GM_Game); mWindowManager.popGuiMode();
} }

View file

@ -210,7 +210,7 @@ namespace MWGui
std::string sound = "Item Gold Up"; std::string sound = "Item Gold Up";
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
mWindowManager.setGuiMode(GM_Game); mWindowManager.popGuiMode();
} }
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender) void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
@ -220,7 +220,7 @@ namespace MWGui
// now gimme back my stuff! // now gimme back my stuff!
mWindowManager.getInventoryWindow()->returnBoughtItems(MWWorld::Class::get(mContainer).getContainerStore(mContainer)); mWindowManager.getInventoryWindow()->returnBoughtItems(MWWorld::Class::get(mContainer).getContainerStore(mContainer));
mWindowManager.setGuiMode(GM_Game); mWindowManager.popGuiMode();
} }
void TradeWindow::updateLabels() void TradeWindow::updateLabels()

View file

@ -62,9 +62,6 @@ WindowManager::WindowManager(
, playerMagicka() , playerMagicka()
, playerFatigue() , playerFatigue()
, gui(NULL) , gui(NULL)
, mode(GM_Game)
, nextMode(GM_Game)
, needModeChange(false)
, garbageDialogs() , garbageDialogs()
, shown(GW_ALL) , shown(GW_ALL)
, allowed(newGame ? GW_None : GW_ALL) , allowed(newGame ? GW_None : GW_ALL)
@ -178,12 +175,6 @@ void WindowManager::cleanupGarbage()
void WindowManager::update() void WindowManager::update()
{ {
cleanupGarbage(); cleanupGarbage();
if (needModeChange)
{
needModeChange = false;
MWBase::Environment::get().getInputManager()->setGuiMode(nextMode);
nextMode = GM_Game;
}
if (showFPSLevel > 0) if (showFPSLevel > 0)
{ {
hud->setFPS(mFPS); hud->setFPS(mFPS);
@ -192,17 +183,6 @@ void WindowManager::update()
} }
} }
void WindowManager::setNextMode(GuiMode newMode)
{
nextMode = newMode;
needModeChange = true;
}
void WindowManager::setGuiMode(GuiMode newMode)
{
MWBase::Environment::get().getInputManager()->setGuiMode(newMode);
}
void WindowManager::updateVisible() void WindowManager::updateVisible()
{ {
// Start out by hiding everything except the HUD // Start out by hiding everything except the HUD
@ -221,15 +201,20 @@ void WindowManager::updateVisible()
// Mouse is visible whenever we're not in game mode // Mouse is visible whenever we're not in game mode
MyGUI::PointerManager::getInstance().setVisible(isGuiMode()); MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
if (mode == GM_Game) bool gameMode = !isGuiMode();
if (gameMode)
mToolTips->enterGameMode(); mToolTips->enterGameMode();
else else
mToolTips->enterGuiMode(); mToolTips->enterGuiMode();
// If in game mode, don't show anything.
if (gameMode)
return;
GuiMode mode = mGuiModes.back();
switch(mode) { switch(mode) {
case GM_Game:
// If in game mode, don't show anything.
break;
case GM_MainMenu: case GM_MainMenu:
menu->setVisible(true); menu->setVisible(true);
break; break;
@ -273,7 +258,7 @@ void WindowManager::updateVisible()
mInventoryWindow->openInventory(); mInventoryWindow->openInventory();
break; break;
case GM_Dialogue: case GM_Dialogue:
mDialogueWindow->open(); mDialogueWindow->setVisible(true);
break; break;
case GM_Barter: case GM_Barter:
mInventoryWindow->setVisible(true); mInventoryWindow->setVisible(true);
@ -281,9 +266,6 @@ void WindowManager::updateVisible()
mTradeWindow->setVisible(true); mTradeWindow->setVisible(true);
break; break;
case GM_InterMessageBox: case GM_InterMessageBox:
if(!mMessageBoxManager->isInteractiveMessageBox()) {
setGuiMode(GM_Game);
}
break; break;
case GM_Journal: case GM_Journal:
mJournal->setVisible(true); mJournal->setVisible(true);
@ -291,9 +273,6 @@ void WindowManager::updateVisible()
break; break;
default: default:
// Unsupported mode, switch back to game // Unsupported mode, switch back to game
// Note: The call will eventually end up this method again but
// will stop at the check if mode is GM_Game.
setGuiMode(GM_Game);
break; break;
} }
} }
@ -427,7 +406,7 @@ void WindowManager::messageBox (const std::string& message, const std::vector<st
else else
{ {
mMessageBoxManager->createInteractiveMessageBox(message, buttons); mMessageBoxManager->createInteractiveMessageBox(message, buttons);
setGuiMode(GM_InterMessageBox); pushGuiMode(GM_InterMessageBox);
} }
} }
@ -452,7 +431,7 @@ void WindowManager::onDialogueWindowBye()
//removeDialog(dialogueWindow); //removeDialog(dialogueWindow);
mDialogueWindow->setVisible(false); mDialogueWindow->setVisible(false);
} }
setGuiMode(GM_Game); popGuiMode();
} }
void WindowManager::onFrame (float frameDuration) void WindowManager::onFrame (float frameDuration)
@ -597,3 +576,27 @@ void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _r
if (setting && setting->type == ESM::VT_String) if (setting && setting->type == ESM::VT_String)
_result = setting->str; _result = setting->str;
} }
void WindowManager::pushGuiMode(GuiMode mode)
{
if (mode==GM_Inventory && allowed==GW_None)
return;
mGuiModes.push_back(mode);
bool gameMode = !isGuiMode();
MWBase::Environment::get().getInputManager()->changeInputMode(!gameMode);
updateVisible();
}
void WindowManager::popGuiMode()
{
if (mGuiModes.size())
mGuiModes.pop_back();
bool gameMode = !isGuiMode();
MWBase::Environment::get().getInputManager()->changeInputMode(!gameMode);
updateVisible();
}

View file

@ -96,8 +96,6 @@ namespace MWGui
WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath); WindowManager(const Compiler::Extensions& extensions, int fpsLevel, bool newGame, OEngine::Render::OgreRenderer *mOgre, const std::string logpath);
virtual ~WindowManager(); virtual ~WindowManager();
void setGuiMode(GuiMode newMode);
/** /**
* Should be called each frame to update windows/gui elements. * Should be called each frame to update windows/gui elements.
* This could mean updating sizes of gui elements or opening * This could mean updating sizes of gui elements or opening
@ -105,19 +103,17 @@ namespace MWGui
*/ */
void update(); void update();
void setMode(GuiMode newMode) void pushGuiMode(GuiMode mode);
void popGuiMode();
GuiMode getMode() const
{ {
if (newMode==GM_Inventory && allowed==GW_None) if (mGuiModes.empty())
return; throw std::runtime_error ("getMode() called, but there is no active mode");
return mGuiModes.back();
mode = newMode;
updateVisible();
} }
void setNextMode(GuiMode newMode);
GuiMode getMode() const { return mode; } bool isGuiMode() const { return !mGuiModes.empty(); }
bool isGuiMode() const { return getMode() != GM_Game; } // Everything that is not game mode is considered "gui mode"
// Disallow all inventory mode windows // Disallow all inventory mode windows
void disallowAll() void disallowAll()
@ -244,9 +240,7 @@ namespace MWGui
MyGUI::Gui *gui; // Gui MyGUI::Gui *gui; // Gui
GuiMode mode; // Current gui mode std::vector<GuiMode> mGuiModes;
GuiMode nextMode; // Next mode to activate in update()
bool needModeChange; //Whether a mode change is needed in update() [will use nextMode]
std::vector<OEngine::GUI::Layout*> garbageDialogs; std::vector<OEngine::GUI::Layout*> garbageDialogs;
void cleanupGarbage(); void cleanupGarbage();

View file

@ -143,20 +143,20 @@ namespace MWInput
/* toggleInventory() is called when the user presses the button to toggle the inventory screen. */ /* toggleInventory() is called when the user presses the button to toggle the inventory screen. */
void toggleInventory() void toggleInventory()
{ {
using namespace MWGui; using namespace MWGui;
if (mDragDrop) if (mDragDrop)
return; return;
GuiMode mode = windows.getMode(); bool gameMode = !windows.isGuiMode();
// Toggle between game mode and inventory mode // Toggle between game mode and inventory mode
if(mode == GM_Game) if(gameMode)
setGuiMode(GM_Inventory); windows.pushGuiMode(GM_Inventory);
else if(mode == GM_Inventory) else if(windows.getMode() == GM_Inventory)
setGuiMode(GM_Game); windows.popGuiMode();
// .. but don't touch any other mode. // .. but don't touch any other mode.
} }
// Toggle console // Toggle console
@ -167,28 +167,33 @@ namespace MWInput
if (mDragDrop) if (mDragDrop)
return; return;
GuiMode mode = windows.getMode(); bool gameMode = !windows.isGuiMode();
// Switch to console mode no matter what mode we are currently // Switch to console mode no matter what mode we are currently
// in, except of course if we are already in console mode // in, except of course if we are already in console mode
if(mode == GM_Console) if (!gameMode)
setGuiMode(GM_Game); {
else setGuiMode(GM_Console); if (windows.getMode() == GM_Console)
windows.popGuiMode();
else
windows.pushGuiMode(GM_Console);
}
else
windows.pushGuiMode(GM_Console);
} }
void toggleJournal() void toggleJournal()
{ {
using namespace MWGui; using namespace MWGui;
GuiMode mode = windows.getMode(); // Toggle between game mode and journal mode
bool gameMode = !windows.isGuiMode();
// Toggle between game mode and journal mode if(gameMode)
if(mode == GM_Game) windows.pushGuiMode(GM_Journal);
setGuiMode(GM_Journal); else if(windows.getMode() == GM_Journal)
else if(mode == GM_Journal) windows.popGuiMode();
setGuiMode(GM_Game); // .. but don't touch any other mode.
// .. but don't touch any other mode.
} }
void activate() void activate()
@ -282,8 +287,7 @@ namespace MWInput
lst->add(guiEvents,Event::EV_ALL); lst->add(guiEvents,Event::EV_ALL);
} }
// Start out in game mode changeInputMode(false);
setGuiMode(MWGui::GM_Game);
/********************************** /**********************************
Key binding section Key binding section
@ -348,6 +352,7 @@ namespace MWInput
windows.update(); windows.update();
// Disable movement in Gui mode // Disable movement in Gui mode
if (windows.isGuiMode()) return; if (windows.isGuiMode()) return;
// Configure player movement according to keyboard input. Actual movement will // Configure player movement according to keyboard input. Actual movement will
@ -388,14 +393,10 @@ namespace MWInput
// Switch between gui modes. Besides controlling the Gui windows // Switch between gui modes. Besides controlling the Gui windows
// this also makes sure input is directed to the right place // this also makes sure input is directed to the right place
void setGuiMode(MWGui::GuiMode mode) void changeInputMode(bool guiMode)
{ {
// Tell the GUI what to show (this also takes care of the mouse
// pointer)
windows.setMode(mode);
// Are we in GUI mode now? // Are we in GUI mode now?
if(windows.isGuiMode()) if(guiMode)
{ {
// Disable mouse look // Disable mouse look
mouse->setCamera(NULL); mouse->setCamera(NULL);
@ -431,11 +432,6 @@ namespace MWInput
delete impl; delete impl;
} }
void MWInputManager::setGuiMode(MWGui::GuiMode mode)
{
impl->setGuiMode(mode);
}
void MWInputManager::update() void MWInputManager::update()
{ {
impl->update(); impl->update();
@ -445,4 +441,9 @@ namespace MWInput
{ {
impl->setDragDrop(dragDrop); impl->setDragDrop(dragDrop);
} }
void MWInputManager::changeInputMode(bool guiMode)
{
impl->changeInputMode(guiMode);
}
} }

View file

@ -50,9 +50,9 @@ namespace MWInput
void update(); void update();
void setDragDrop(bool dragDrop); void changeInputMode(bool guiMode);
void setGuiMode(MWGui::GuiMode mode); void setDragDrop(bool dragDrop);
}; };
} }
#endif #endif

View file

@ -44,7 +44,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime) virtual void execute (Interpreter::Runtime& runtime)
{ {
MWBase::Environment::get().getInputManager()->setGuiMode(mDialogue); MWBase::Environment::get().getWindowManager()->pushGuiMode(mDialogue);
} }
}; };

View file

@ -16,7 +16,7 @@ namespace MWWorld
void ActionOpen::execute () void ActionOpen::execute ()
{ {
MWBase::Environment::get().getWindowManager()->setGuiMode(MWGui::GM_Container); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container);
MWBase::Environment::get().getWindowManager()->getContainerWindow()->open(mContainer); MWBase::Environment::get().getWindowManager()->getContainerWindow()->open(mContainer);
} }
} }

View file

@ -18,12 +18,12 @@ namespace MWWorld
if (ref->base->data.isScroll) if (ref->base->data.isScroll)
{ {
MWBase::Environment::get().getWindowManager()->setGuiMode(MWGui::GM_Scroll); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll);
MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(mObject); MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(mObject);
} }
else else
{ {
MWBase::Environment::get().getWindowManager()->setGuiMode(MWGui::GM_Book); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Book);
MWBase::Environment::get().getWindowManager()->getBookWindow()->open(mObject); MWBase::Environment::get().getWindowManager()->getBookWindow()->open(mObject);
} }
} }

View file

@ -3,7 +3,7 @@ OpenMW: A reimplementation of The Elder Scrolls III: Morrowind
OpenMW is an attempt at recreating the engine for the popular role-playing game OpenMW is an attempt at recreating the engine for the popular role-playing game
Morrowind by Bethesda Softworks. You need to own and install the original game for OpenMW to work. Morrowind by Bethesda Softworks. You need to own and install the original game for OpenMW to work.
Version: 0.14.0 Version: 0.15.0
License: GPL (see GPL3.txt for more information) License: GPL (see GPL3.txt for more information)
Website: http://www.openmw.org Website: http://www.openmw.org
@ -132,6 +132,32 @@ Thanks to Kevin Ryan for kindly providing us with the icon used for the Data Fil
CHANGELOG CHANGELOG
0.15.0
Bug #5: Physics reimplementation (fixes various issues)
Bug #258: Resizing arrow's background is not transparent
Bug #268: Widening the stats window in X direction causes layout problems
Bug #269: Topic pane in dialgoue window is too small for some longer topics
Bug #271: Dialog choices are sorted incorrectly
Bug #281: The single quote character is not rendered on dialog windows
Bug #285: Terrain not handled properly in cells that are not predefined
Bug #289: Dialogue filter isn't doing case smashing/folding for item IDs
Feature #15: Collision with Terrain
Feature #17: Inventory-, Container- and Trade-Windows
Feature #44: Floating Labels above Focussed Objects
Feature #80: Tooltips
Feature #83: Barter Dialogue
Feature #90: Book and Scroll Windows
Feature #156: Item Stacking in Containers
Feature #213: Pulsating lights
Feature #218: Feather & Burden
Feature #256: Implement magic effect bookkeeping
Feature #259: Add missing information to Stats window
Feature #260: Correct case for dialogue topics
Feature #280: GUI texture atlasing
Feature #291: Ability to use GMST strings from GUI layout files
Task #255: Make MWWorld::Environment into a singleton
0.14.0 0.14.0
Bug #1: Meshes rendered with wrong orientation Bug #1: Meshes rendered with wrong orientation