1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-22 23:09:43 +00:00

Merge branch 'enchanting' into companion

This commit is contained in:
scrawl 2013-03-31 11:52:55 +02:00
commit 69099c11a2
35 changed files with 236 additions and 83 deletions

View file

@ -31,7 +31,7 @@ add_openmw_dir (mwgui
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu
itemselection spellbuyingwindow loadingscreen levelupdialog waitdialog spellcreationdialog itemselection spellbuyingwindow loadingscreen levelupdialog waitdialog spellcreationdialog
enchantingdialog trainingwindow travelwindow imagebutton exposedwindow cursor spellicons enchantingdialog trainingwindow travelwindow imagebutton exposedwindow cursor spellicons
merchantrepair repair merchantrepair repair soulgemdialog
) )
add_openmw_dir (mwdialogue add_openmw_dir (mwdialogue
@ -54,7 +54,7 @@ add_openmw_dir (mwworld
containerstore actiontalk actiontake manualref player cellfunctors failedaction containerstore actiontalk actiontake manualref player cellfunctors failedaction
cells localscripts customdata weather inventorystore ptr actionopen actionread cells localscripts customdata weather inventorystore ptr actionopen actionread
actionequip timestamp actionalchemy cellstore actionapply actioneat actionequip timestamp actionalchemy cellstore actionapply actioneat
esmstore store recordcmp fallback actionrepair esmstore store recordcmp fallback actionrepair actionsoulgem
) )
add_openmw_dir (mwclass add_openmw_dir (mwclass

View file

@ -237,10 +237,13 @@ namespace MWBase
virtual void startSpellMaking(MWWorld::Ptr actor) = 0; virtual void startSpellMaking(MWWorld::Ptr actor) = 0;
virtual void startEnchanting(MWWorld::Ptr actor) = 0; virtual void startEnchanting(MWWorld::Ptr actor) = 0;
virtual void startSelfEnchanting(MWWorld::Ptr soulgem) = 0;
virtual void startTraining(MWWorld::Ptr actor) = 0; virtual void startTraining(MWWorld::Ptr actor) = 0;
virtual void startRepair(MWWorld::Ptr actor) = 0; virtual void startRepair(MWWorld::Ptr actor) = 0;
virtual void startRepairItem(MWWorld::Ptr item) = 0; virtual void startRepairItem(MWWorld::Ptr item) = 0;
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
virtual void changePointer (const std::string& name) = 0; virtual void changePointer (const std::string& name) = 0;
virtual const Translation::Storage& getTranslationDataStorage() const = 0; virtual const Translation::Storage& getTranslationDataStorage() const = 0;

View file

@ -115,7 +115,7 @@ namespace MWClass
if (needKey && hasKey) if (needKey && hasKey)
{ {
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}");
ptr.getCellRef().mLockLevel = 0; ptr.getCellRef().mLockLevel = 0;
// using a key disarms the trap // using a key disarms the trap
ptr.getCellRef().mTrap = ""; ptr.getCellRef().mTrap = "";

View file

@ -98,7 +98,7 @@ namespace MWClass
if (needKey && hasKey) if (needKey && hasKey)
{ {
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}");
ptr.getCellRef().mLockLevel = 0; ptr.getCellRef().mLockLevel = 0;
// using a key disarms the trap // using a key disarms the trap
ptr.getCellRef().mTrap = ""; ptr.getCellRef().mTrap = "";

View file

@ -15,6 +15,7 @@
#include "../mwworld/physicssystem.hpp" #include "../mwworld/physicssystem.hpp"
#include "../mwworld/manualref.hpp" #include "../mwworld/manualref.hpp"
#include "../mwworld/nullaction.hpp" #include "../mwworld/nullaction.hpp"
#include "../mwworld/actionsoulgem.hpp"
#include "../mwgui/tooltips.hpp" #include "../mwgui/tooltips.hpp"
@ -238,4 +239,13 @@ namespace MWClass
} }
return newPtr; return newPtr;
} }
boost::shared_ptr<MWWorld::Action> Miscellaneous::use (const MWWorld::Ptr& ptr) const
{
if (ptr.getCellRef().mSoul == "")
return boost::shared_ptr<MWWorld::Action>(new MWWorld::NullAction());
else
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionSoulgem(ptr));
}
} }

View file

@ -49,6 +49,10 @@ namespace MWClass
///< Return name of inventory icon. ///< Return name of inventory icon.
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::Ptr &ptr) const;
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const;
///< Generate action for using via inventory menu
}; };
} }

View file

@ -77,40 +77,40 @@ namespace MWGui
if (result == MWMechanics::Alchemy::Result_NoName) if (result == MWMechanics::Alchemy::Result_NoName)
{ {
mWindowManager.messageBox("#{sNotifyMessage37}", std::vector<std::string>()); mWindowManager.messageBox("#{sNotifyMessage37}");
return; return;
} }
// check if mortar & pestle is available (always needed) // check if mortar & pestle is available (always needed)
if (result == MWMechanics::Alchemy::Result_NoMortarAndPestle) if (result == MWMechanics::Alchemy::Result_NoMortarAndPestle)
{ {
mWindowManager.messageBox("#{sNotifyMessage45}", std::vector<std::string>()); mWindowManager.messageBox("#{sNotifyMessage45}");
return; return;
} }
// make sure 2 or more ingredients were selected // make sure 2 or more ingredients were selected
if (result == MWMechanics::Alchemy::Result_LessThanTwoIngredients) if (result == MWMechanics::Alchemy::Result_LessThanTwoIngredients)
{ {
mWindowManager.messageBox("#{sNotifyMessage6a}", std::vector<std::string>()); mWindowManager.messageBox("#{sNotifyMessage6a}");
return; return;
} }
if (result == MWMechanics::Alchemy::Result_NoEffects) if (result == MWMechanics::Alchemy::Result_NoEffects)
{ {
mWindowManager.messageBox("#{sNotifyMessage8}", std::vector<std::string>()); mWindowManager.messageBox("#{sNotifyMessage8}");
MWBase::Environment::get().getSoundManager()->playSound("potion fail", 1.f, 1.f); MWBase::Environment::get().getSoundManager()->playSound("potion fail", 1.f, 1.f);
return; return;
} }
if (result == MWMechanics::Alchemy::Result_Success) if (result == MWMechanics::Alchemy::Result_Success)
{ {
mWindowManager.messageBox("#{sPotionSuccess}", std::vector<std::string>()); mWindowManager.messageBox("#{sPotionSuccess}");
MWBase::Environment::get().getSoundManager()->playSound("potion success", 1.f, 1.f); MWBase::Environment::get().getSoundManager()->playSound("potion success", 1.f, 1.f);
} }
else if (result == MWMechanics::Alchemy::Result_RandomFailure) else if (result == MWMechanics::Alchemy::Result_RandomFailure)
{ {
// potion failed // potion failed
mWindowManager.messageBox("#{sNotifyMessage8}", std::vector<std::string>()); mWindowManager.messageBox("#{sNotifyMessage8}");
MWBase::Environment::get().getSoundManager()->playSound("potion fail", 1.f, 1.f); MWBase::Environment::get().getSoundManager()->playSound("potion fail", 1.f, 1.f);
} }

View file

@ -150,7 +150,7 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
{ {
// user notification "i don't buy this item" // user notification "i don't buy this item"
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sBarterDialog4}", std::vector<std::string>()); messageBox("#{sBarterDialog4}");
return; return;
} }
} }
@ -294,7 +294,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
{ {
// user notification // user notification
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sContentsMessage2}", std::vector<std::string>()); messageBox("#{sContentsMessage2}");
return; return;
} }
@ -318,7 +318,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
object.getRefData().setCount(origCount); object.getRefData().setCount(origCount);
// user notification // user notification
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sContentsMessage3}", std::vector<std::string>()); messageBox("#{sContentsMessage3}");
return; return;
} }

View file

@ -92,6 +92,11 @@ namespace MWGui
startEditing (); startEditing ();
} }
void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem)
{
/// \todo
}
void EnchantingDialog::onReferenceUnavailable () void EnchantingDialog::onReferenceUnavailable ()
{ {
mWindowManager.removeGuiMode (GM_Dialogue); mWindowManager.removeGuiMode (GM_Dialogue);
@ -158,7 +163,7 @@ namespace MWGui
if(mEnchanting.getGemCharge()==0) if(mEnchanting.getGemCharge()==0)
{ {
mWindowManager.messageBox ("#{sNotifyMessage32}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage32}");
return; return;
} }
@ -222,31 +227,37 @@ namespace MWGui
{ {
if (mEffects.size() <= 0) if (mEffects.size() <= 0)
{ {
mWindowManager.messageBox ("#{sNotifyMessage30}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage30}");
return; return;
} }
if (mName->getCaption ().empty()) if (mName->getCaption ().empty())
{ {
mWindowManager.messageBox ("#{sNotifyMessage10}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage10}");
return; return;
} }
if (boost::lexical_cast<int>(mPrice->getCaption()) > mWindowManager.getInventoryWindow()->getPlayerGold()) if (boost::lexical_cast<int>(mPrice->getCaption()) > mWindowManager.getInventoryWindow()->getPlayerGold())
{ {
mWindowManager.messageBox ("#{sNotifyMessage18}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage18}");
return; return;
} }
if (mEnchanting.soulEmpty()) if (mEnchanting.soulEmpty())
{ {
mWindowManager.messageBox ("#{sNotifyMessage52}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage52}");
return; return;
} }
if (mEnchanting.itemEmpty()) if (mEnchanting.itemEmpty())
{ {
mWindowManager.messageBox ("#{sNotifyMessage11}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage11}");
return;
}
if (mEnchanting.getEnchantCost() > mEnchanting.getMaxEnchantValue())
{
mWindowManager.messageBox ("#{sNotifyMessage29}");
return; return;
} }
@ -254,7 +265,7 @@ namespace MWGui
mEnchanting.setEffect(mEffectList); mEnchanting.setEffect(mEffectList);
mEnchanting.create(); mEnchanting.create();
mWindowManager.messageBox ("#{sEnchantmentMenu12}", std::vector<std::string>()); mWindowManager.messageBox ("#{sEnchantmentMenu12}");
mWindowManager.removeGuiMode (GM_Enchanting); mWindowManager.removeGuiMode (GM_Enchanting);
} }
} }

View file

@ -22,6 +22,7 @@ namespace MWGui
virtual void open(); virtual void open();
void startEnchanting(MWWorld::Ptr actor); void startEnchanting(MWWorld::Ptr actor);
void startSelfEnchanting(MWWorld::Ptr soulgem);
protected: protected:
virtual void onReferenceUnavailable(); virtual void onReferenceUnavailable();

View file

@ -162,7 +162,7 @@ namespace MWGui
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player); MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
if (mSpentAttributes.size() < 3) if (mSpentAttributes.size() < 3)
MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage36}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage36}");
else else
{ {
// increase attributes // increase attributes

View file

@ -3,6 +3,7 @@
#include "messagebox.hpp" #include "messagebox.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/inputmanager.hpp"
using namespace MWGui; using namespace MWGui;
@ -62,7 +63,8 @@ void MessageBoxManager::onFrame (float frameDuration)
if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) { if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) {
delete mInterMessageBoxe; delete mInterMessageBoxe;
mInterMessageBoxe = NULL; mInterMessageBoxe = NULL;
mWindowManager->removeGuiMode(GM_InterMessageBox); MWBase::Environment::get().getInputManager()->changeInputMode(
MWBase::Environment::get().getWindowManager()->isGuiMode());
} }
} }
@ -90,11 +92,8 @@ void MessageBoxManager::createMessageBox (const std::string& message)
bool MessageBoxManager::createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons) bool MessageBoxManager::createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons)
{ {
/// \todo Don't write this kind of error message to cout. Either discard the old message box
/// silently or throw an exception.
if(mInterMessageBoxe != NULL) { if(mInterMessageBoxe != NULL) {
std::cout << "there is a MessageBox already" << std::endl; throw std::runtime_error("There is a message box already");
return false;
} }
mInterMessageBoxe = new InteractiveMessageBox(*this, message, buttons); mInterMessageBoxe = new InteractiveMessageBox(*this, message, buttons);
@ -139,7 +138,8 @@ void MessageBoxManager::setMessageBoxSpeed (int speed)
void MessageBoxManager::enterPressed () void MessageBoxManager::enterPressed ()
{ {
mInterMessageBoxe->enterPressed(); if(mInterMessageBoxe != NULL)
mInterMessageBoxe->enterPressed();
} }
int MessageBoxManager::readPressedButton () int MessageBoxManager::readPressedButton ()
@ -213,10 +213,12 @@ int MessageBox::getHeight ()
InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons) InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
: Layout("openmw_interactive_messagebox.layout") : WindowModal("openmw_interactive_messagebox.layout", *MWBase::Environment::get().getWindowManager())
, mMessageBoxManager(parMessageBoxManager) , mMessageBoxManager(parMessageBoxManager)
, mButtonPressed(-1) , mButtonPressed(-1)
{ {
WindowModal::open();
int fixedWidth = 500; int fixedWidth = 500;
int textPadding = 10; // padding between text-widget and main-widget int textPadding = 10; // padding between text-widget and main-widget
int textButtonPadding = 20; // padding between the text-widget und the button-widget int textButtonPadding = 20; // padding between the text-widget und the button-widget
@ -232,7 +234,7 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
getWidget(mButtonsWidget, "buttons"); getWidget(mButtonsWidget, "buttons");
mMessageWidget->setOverflowToTheLeft(true); mMessageWidget->setOverflowToTheLeft(true);
mMessageWidget->addText(message); mMessageWidget->setCaptionWithReplacing(message);
MyGUI::IntSize textSize = mMessageWidget->getTextSize(); MyGUI::IntSize textSize = mMessageWidget->getTextSize();
@ -252,7 +254,7 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
std::string("MW_Button"), std::string("MW_Button"),
dummyCoord, dummyCoord,
MyGUI::Align::Default); MyGUI::Align::Default);
button->setCaption(*it); button->setCaptionWithReplacing(*it);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &InteractiveMessageBox::mousePressed); button->eventMouseButtonClick += MyGUI::newDelegate(this, &InteractiveMessageBox::mousePressed);
@ -399,6 +401,7 @@ void InteractiveMessageBox::buttonActivated (MyGUI::Widget* pressed)
if(*button == pressed) if(*button == pressed)
{ {
mButtonPressed = index; mButtonPressed = index;
mMessageBoxManager.onButtonPressed(mButtonPressed);
return; return;
} }
index++; index++;

View file

@ -44,6 +44,13 @@ namespace MWGui
void enterPressed(); void enterPressed();
int readPressedButton (); int readPressedButton ();
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
// Note: this delegate unassigns itself after it was fired, i.e. works once.
EventHandle_Int eventButtonPressed;
void onButtonPressed(int button) { eventButtonPressed(button); eventButtonPressed.clear(); }
MWBase::WindowManager *mWindowManager; MWBase::WindowManager *mWindowManager;
private: private:
@ -73,7 +80,7 @@ namespace MWGui
int mNextBoxPadding; int mNextBoxPadding;
}; };
class InteractiveMessageBox : public OEngine::GUI::Layout class InteractiveMessageBox : public WindowModal
{ {
public: public:
InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons); InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons);

View file

@ -5,6 +5,7 @@ namespace MWGui
{ {
enum GuiMode enum GuiMode
{ {
GM_None,
GM_Settings, // Settings window GM_Settings, // Settings window
GM_Inventory, // Inventory mode GM_Inventory, // Inventory mode
GM_Container, GM_Container,
@ -41,9 +42,6 @@ namespace MWGui
GM_ClassCreate, GM_ClassCreate,
GM_Review, GM_Review,
// interactive MessageBox
GM_InterMessageBox,
GM_Loading, GM_Loading,
GM_LoadingWallpaper, GM_LoadingWallpaper,

View file

@ -291,7 +291,7 @@ namespace MWGui
if (item.getRefData ().getCount() == 0) if (item.getRefData ().getCount() == 0)
{ {
MWBase::Environment::get().getWindowManager ()->messageBox ( MWBase::Environment::get().getWindowManager ()->messageBox (
"#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item), std::vector<std::string>()); "#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item));
return; return;
} }
@ -317,7 +317,7 @@ namespace MWGui
if (item.getRefData ().getCount() == 0) if (item.getRefData ().getCount() == 0)
{ {
MWBase::Environment::get().getWindowManager ()->messageBox ( MWBase::Environment::get().getWindowManager ()->messageBox (
"#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item), std::vector<std::string>()); "#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item));
return; return;
} }

View file

@ -362,7 +362,7 @@ namespace MWGui
{ {
std::string msg = "This resolution is not supported in Fullscreen mode. Please select a resolution from the list."; std::string msg = "This resolution is not supported in Fullscreen mode. Please select a resolution from the list.";
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox(msg, std::vector<std::string>()); messageBox(msg);
_sender->castType<MyGUI::Button>()->setCaption(off); _sender->castType<MyGUI::Button>()->setCaption(off);
} }
else else
@ -593,7 +593,7 @@ namespace MWGui
static_cast<MyGUI::Button*>(_sender)->setCaptionWithReplacing("#{sNone}"); static_cast<MyGUI::Button*>(_sender)->setCaptionWithReplacing("#{sNone}");
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sControlsMenu3}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager ()->messageBox ("#{sControlsMenu3}");
MWBase::Environment::get().getWindowManager ()->disallowMouse(); MWBase::Environment::get().getWindowManager ()->disallowMouse();
MWBase::Environment::get().getInputManager ()->enableDetectingBindingMode (actionId); MWBase::Environment::get().getInputManager ()->enableDetectingBindingMode (actionId);

View file

@ -0,0 +1,34 @@
#include "soulgemdialog.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp"
#include "messagebox.hpp"
namespace MWGui
{
void SoulgemDialog::show(const MWWorld::Ptr &soulgem)
{
mSoulgem = soulgem;
std::vector<std::string> buttons;
buttons.push_back("#{sRechargeEnchantment}");
buttons.push_back("#{sMake Enchantment}");
mManager->createInteractiveMessageBox("#{sDoYouWantTo}", buttons);
mManager->eventButtonPressed += MyGUI::newDelegate(this, &SoulgemDialog::onButtonPressed);
}
void SoulgemDialog::onButtonPressed(int button)
{
if (button == 0)
{
/// \todo show recharge enchanted item dialog here
}
else
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting);
MWBase::Environment::get().getWindowManager()->startSelfEnchanting(mSoulgem);
}
}
}

View file

@ -0,0 +1,28 @@
#ifndef OPENMW_MWGUI_SOULGEMDIALOG_H
#define OPENMW_MWGUI_SOULGEMDIALOG_H
#include "../mwworld/ptr.hpp"
namespace MWGui
{
class MessageBoxManager;
class SoulgemDialog
{
public:
SoulgemDialog (MessageBoxManager* manager)
: mManager(manager) {}
void show (const MWWorld::Ptr& soulgem);
void onButtonPressed(int button);
private:
MessageBoxManager* mManager;
MWWorld::Ptr mSoulgem;
};
}
#endif

View file

@ -310,25 +310,25 @@ namespace MWGui
{ {
if (mEffects.size() <= 0) if (mEffects.size() <= 0)
{ {
mWindowManager.messageBox ("#{sNotifyMessage30}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage30}");
return; return;
} }
if (mNameEdit->getCaption () == "") if (mNameEdit->getCaption () == "")
{ {
mWindowManager.messageBox ("#{sNotifyMessage10}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage10}");
return; return;
} }
if (mMagickaCost->getCaption() == "0") if (mMagickaCost->getCaption() == "0")
{ {
mWindowManager.messageBox ("#{sEnchantmentMenu8}", std::vector<std::string>()); mWindowManager.messageBox ("#{sEnchantmentMenu8}");
return; return;
} }
if (boost::lexical_cast<int>(mPriceLabel->getCaption()) > mWindowManager.getInventoryWindow()->getPlayerGold()) if (boost::lexical_cast<int>(mPriceLabel->getCaption()) > mWindowManager.getInventoryWindow()->getPlayerGold())
{ {
mWindowManager.messageBox ("#{sNotifyMessage18}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage18}");
return; return;
} }
@ -517,7 +517,7 @@ namespace MWGui
{ {
if (mEffects.size() >= 8) if (mEffects.size() >= 8)
{ {
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage28}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage28}");
return; return;
} }
@ -528,7 +528,7 @@ namespace MWGui
{ {
if (it->mEffectID == effectId) if (it->mEffectID == effectId)
{ {
MWBase::Environment::get().getWindowManager()->messageBox ("#{sOnetypeEffectMessage}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager()->messageBox ("#{sOnetypeEffectMessage}");
return; return;
} }
} }

View file

@ -404,7 +404,7 @@ namespace MWGui
if (spell->mData.mFlags & ESM::Spell::F_Always if (spell->mData.mFlags & ESM::Spell::F_Always
|| spell->mData.mType == ESM::Spell::ST_Power) || spell->mData.mType == ESM::Spell::ST_Power)
{ {
mWindowManager.messageBox("#{sDeleteSpellError}", std::vector<std::string>()); mWindowManager.messageBox("#{sDeleteSpellError}");
} }
else else
{ {

View file

@ -50,7 +50,7 @@ void TextInputDialog::onOkClicked(MyGUI::Widget* _sender)
{ {
if (mTextEdit->getCaption() == "") if (mTextEdit->getCaption() == "")
{ {
mWindowManager.messageBox ("#{sNotifyMessage37}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage37}");
MyGUI::InputManager::getInstance ().setKeyFocusWidget (mTextEdit); MyGUI::InputManager::getInstance ().setKeyFocusWidget (mTextEdit);
} }
else else
@ -61,7 +61,7 @@ void TextInputDialog::onTextAccepted(MyGUI::Edit* _sender)
{ {
if (mTextEdit->getCaption() == "") if (mTextEdit->getCaption() == "")
{ {
mWindowManager.messageBox ("#{sNotifyMessage37}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage37}");
MyGUI::InputManager::getInstance ().setKeyFocusWidget (mTextEdit); MyGUI::InputManager::getInstance ().setKeyFocusWidget (mTextEdit);
} }
else else

View file

@ -181,7 +181,7 @@ namespace MWGui
{ {
// user notification // user notification
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sBarterDialog11}", std::vector<std::string>()); messageBox("#{sBarterDialog11}");
return; return;
} }
@ -190,7 +190,7 @@ namespace MWGui
{ {
// user notification // user notification
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sBarterDialog1}", std::vector<std::string>()); messageBox("#{sBarterDialog1}");
return; return;
} }
@ -199,7 +199,7 @@ namespace MWGui
{ {
// user notification // user notification
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sBarterDialog2}", std::vector<std::string>()); messageBox("#{sBarterDialog2}");
return; return;
} }
@ -209,7 +209,7 @@ namespace MWGui
if (mPtr.getTypeName() != typeid(ESM::NPC).name()) if (mPtr.getTypeName() != typeid(ESM::NPC).name())
{ {
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sNotifyMessage9}", std::vector<std::string>()); messageBox("#{sNotifyMessage9}");
return; return;
} }
@ -245,7 +245,7 @@ namespace MWGui
if(roll > x) //trade refused if(roll > x) //trade refused
{ {
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sNotifyMessage9}", std::vector<std::string>()); messageBox("#{sNotifyMessage9}");
int iBarterFailDisposition = gmst.find("iBarterFailDisposition")->getInt(); int iBarterFailDisposition = gmst.find("iBarterFailDisposition")->getInt();
MWBase::Environment::get().getDialogueManager()->applyTemporaryDispositionChange(iBarterFailDisposition); MWBase::Environment::get().getDialogueManager()->applyTemporaryDispositionChange(iBarterFailDisposition);

View file

@ -129,7 +129,7 @@ namespace MWGui
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr); MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr);
if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ()) if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ())
{ {
mWindowManager.messageBox ("#{sServiceTrainingWords}", std::vector<std::string>()); mWindowManager.messageBox ("#{sServiceTrainingWords}");
return; return;
} }

View file

@ -83,7 +83,7 @@ namespace MWGui
if (canRest == 2) if (canRest == 2)
{ {
// resting underwater or mid-air not allowed // resting underwater or mid-air not allowed
mWindowManager.messageBox ("#{sNotifyMessage1}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage1}");
mWindowManager.popGuiMode (); mWindowManager.popGuiMode ();
} }

View file

@ -57,6 +57,7 @@
#include "spellicons.hpp" #include "spellicons.hpp"
#include "merchantrepair.hpp" #include "merchantrepair.hpp"
#include "repair.hpp" #include "repair.hpp"
#include "soulgemdialog.hpp"
using namespace MWGui; using namespace MWGui;
@ -94,6 +95,7 @@ WindowManager::WindowManager(
, mTrainingWindow(NULL) , mTrainingWindow(NULL)
, mMerchantRepair(NULL) , mMerchantRepair(NULL)
, mRepair(NULL) , mRepair(NULL)
, mSoulgemDialog(NULL)
, mPlayerName() , mPlayerName()
, mPlayerRaceId() , mPlayerRaceId()
, mPlayerAttributes() , mPlayerAttributes()
@ -186,6 +188,7 @@ WindowManager::WindowManager(
mTrainingWindow = new TrainingWindow(*this); mTrainingWindow = new TrainingWindow(*this);
mMerchantRepair = new MerchantRepair(*this); mMerchantRepair = new MerchantRepair(*this);
mRepair = new Repair(*this); mRepair = new Repair(*this);
mSoulgemDialog = new SoulgemDialog(mMessageBoxManager);
mLoadingScreen = new LoadingScreen(mRendering->getScene (), mRendering->getWindow (), *this); mLoadingScreen = new LoadingScreen(mRendering->getScene (), mRendering->getWindow (), *this);
mLoadingScreen->onResChange (w,h); mLoadingScreen->onResChange (w,h);
@ -253,6 +256,7 @@ WindowManager::~WindowManager()
delete mQuickKeysMenu; delete mQuickKeysMenu;
delete mMerchantRepair; delete mMerchantRepair;
delete mRepair; delete mRepair;
delete mSoulgemDialog;
delete mCursor; delete mCursor;
cleanupGarbage(); cleanupGarbage();
@ -316,9 +320,6 @@ void WindowManager::updateVisible()
mHud->setVisible(mHudEnabled); mHud->setVisible(mHudEnabled);
// Mouse is visible whenever we're not in game mode
mCursor->setVisible(isGuiMode());
bool gameMode = !isGuiMode(); bool gameMode = !isGuiMode();
mInputBlocker->setVisible (gameMode); mInputBlocker->setVisible (gameMode);
@ -444,8 +445,6 @@ void WindowManager::updateVisible()
case GM_Repair: case GM_Repair:
mRepair->setVisible(true); mRepair->setVisible(true);
break; break;
case GM_InterMessageBox:
break;
case GM_Journal: case GM_Journal:
mJournal->setVisible(true); mJournal->setVisible(true);
break; break;
@ -609,7 +608,7 @@ void WindowManager::messageBox (const std::string& message, const std::vector<st
else else
{ {
mMessageBoxManager->createInteractiveMessageBox(message, buttons); mMessageBoxManager->createInteractiveMessageBox(message, buttons);
pushGuiMode(GM_InterMessageBox); MWBase::Environment::get().getInputManager()->changeInputMode(isGuiMode());
} }
} }
@ -648,6 +647,7 @@ void WindowManager::onDialogueWindowBye()
void WindowManager::onFrame (float frameDuration) void WindowManager::onFrame (float frameDuration)
{ {
mMessageBoxManager->onFrame(frameDuration); mMessageBoxManager->onFrame(frameDuration);
mToolTips->onFrame(frameDuration); mToolTips->onFrame(frameDuration);
if (mDragAndDrop->mIsOnDragAndDrop) if (mDragAndDrop->mIsOnDragAndDrop)
@ -1033,12 +1033,12 @@ void WindowManager::toggleVisible (GuiWindow wnd)
bool WindowManager::isGuiMode() const bool WindowManager::isGuiMode() const
{ {
return !mGuiModes.empty(); return !mGuiModes.empty() || mMessageBoxManager->isInteractiveMessageBox();
} }
bool WindowManager::isConsoleMode() const bool WindowManager::isConsoleMode() const
{ {
if (mGuiModes.back()==GM_Console) if (!mGuiModes.empty() && mGuiModes.back()==GM_Console)
return true; return true;
return false; return false;
} }
@ -1046,8 +1046,7 @@ bool WindowManager::isConsoleMode() const
MWGui::GuiMode WindowManager::getMode() const MWGui::GuiMode WindowManager::getMode() const
{ {
if (mGuiModes.empty()) if (mGuiModes.empty())
throw std::runtime_error ("getMode() called, but there is no active mode"); return GM_None;
return mGuiModes.back(); return mGuiModes.back();
} }
@ -1143,6 +1142,11 @@ void WindowManager::startEnchanting (MWWorld::Ptr actor)
mEnchantingDialog->startEnchanting (actor); mEnchantingDialog->startEnchanting (actor);
} }
void WindowManager::startSelfEnchanting(MWWorld::Ptr soulgem)
{
mEnchantingDialog->startSelfEnchanting(soulgem);
}
void WindowManager::startTraining(MWWorld::Ptr actor) void WindowManager::startTraining(MWWorld::Ptr actor)
{ {
mTrainingWindow->startTraining(actor); mTrainingWindow->startTraining(actor);
@ -1167,3 +1171,8 @@ void WindowManager::changePointer(const std::string &name)
{ {
mCursor->onCursorChange(name); mCursor->onCursorChange(name);
} }
void WindowManager::showSoulgemDialog(MWWorld::Ptr item)
{
mSoulgemDialog->show(item);
}

View file

@ -76,6 +76,7 @@ namespace MWGui
class SpellIcons; class SpellIcons;
class MerchantRepair; class MerchantRepair;
class Repair; class Repair;
class SoulgemDialog;
class WindowManager : public MWBase::WindowManager class WindowManager : public MWBase::WindowManager
{ {
@ -230,14 +231,19 @@ namespace MWGui
virtual void startSpellMaking(MWWorld::Ptr actor); virtual void startSpellMaking(MWWorld::Ptr actor);
virtual void startEnchanting(MWWorld::Ptr actor); virtual void startEnchanting(MWWorld::Ptr actor);
virtual void startSelfEnchanting(MWWorld::Ptr soulgem);
virtual void startTraining(MWWorld::Ptr actor); virtual void startTraining(MWWorld::Ptr actor);
virtual void startRepair(MWWorld::Ptr actor); virtual void startRepair(MWWorld::Ptr actor);
virtual void startRepairItem(MWWorld::Ptr item); virtual void startRepairItem(MWWorld::Ptr item);
virtual void showSoulgemDialog (MWWorld::Ptr item);
virtual void changePointer (const std::string& name); virtual void changePointer (const std::string& name);
virtual const Translation::Storage& getTranslationDataStorage() const; virtual const Translation::Storage& getTranslationDataStorage() const;
void onSoulgemDialogButtonPressed (int button);
private: private:
OEngine::GUI::MyGUIManager *mGuiManager; OEngine::GUI::MyGUIManager *mGuiManager;
OEngine::Render::OgreRenderer *mRendering; OEngine::Render::OgreRenderer *mRendering;
@ -271,6 +277,7 @@ namespace MWGui
EnchantingDialog* mEnchantingDialog; EnchantingDialog* mEnchantingDialog;
TrainingWindow* mTrainingWindow; TrainingWindow* mTrainingWindow;
MerchantRepair* mMerchantRepair; MerchantRepair* mMerchantRepair;
SoulgemDialog* mSoulgemDialog;
Repair* mRepair; Repair* mRepair;
Translation::Storage& mTranslationDataStorage; Translation::Storage& mTranslationDataStorage;

View file

@ -181,8 +181,7 @@ namespace MWInput
break; break;
case A_Activate: case A_Activate:
resetIdleTime(); resetIdleTime();
if( MWBase::Environment::get().getWindowManager()->isGuiMode() if( MWBase::Environment::get().getWindowManager()->isGuiMode()) {
&& MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox ) {
// Pressing the activation key when a messagebox is prompting for "ok" will activate the ok button // Pressing the activation key when a messagebox is prompting for "ok" will activate the ok button
MWBase::Environment::get().getWindowManager()->enterPressed(); MWBase::Environment::get().getWindowManager()->enterPressed();
} }
@ -378,7 +377,7 @@ namespace MWInput
void InputManager::changeInputMode(bool guiMode) void InputManager::changeInputMode(bool guiMode)
{ {
// Are we in GUI mode now? MWBase::Environment::get().getWindowManager()->setMouseVisible(guiMode);
if(guiMode) if(guiMode)
{ {
// Disable mouse look // Disable mouse look
@ -462,8 +461,7 @@ namespace MWInput
bool InputManager::keyPressed( const OIS::KeyEvent &arg ) bool InputManager::keyPressed( const OIS::KeyEvent &arg )
{ {
if(arg.key == OIS::KC_RETURN if(arg.key == OIS::KC_RETURN
&& MWBase::Environment::get().getWindowManager()->isGuiMode() && MWBase::Environment::get().getWindowManager()->isGuiMode())
&& MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox )
{ {
// Pressing enter when a messagebox is prompting for "ok" will activate the ok button // Pressing enter when a messagebox is prompting for "ok" will activate the ok button
MWBase::Environment::get().getWindowManager()->enterPressed(); MWBase::Environment::get().getWindowManager()->enterPressed();

View file

@ -256,7 +256,7 @@ namespace MWMechanics
if(MWWorld::Class::get(iter->first).isEssential(iter->first)) if(MWWorld::Class::get(iter->first).isEssential(iter->first))
MWBase::Environment::get().getWindowManager()->messageBox( MWBase::Environment::get().getWindowManager()->messageBox(
"#{sKilledEssential}", std::vector<std::string>()); "#{sKilledEssential}");
} }
} }

View file

@ -221,12 +221,12 @@ void MWMechanics::NpcStats::increaseSkill(int skillIndex, const ESM::Class &clas
message << boost::format(MWBase::Environment::get().getWindowManager ()->getGameSettingString ("sNotifyMessage39", "")) message << boost::format(MWBase::Environment::get().getWindowManager ()->getGameSettingString ("sNotifyMessage39", ""))
% std::string("#{" + ESM::Skill::sSkillNameIds[skillIndex] + "}") % std::string("#{" + ESM::Skill::sSkillNameIds[skillIndex] + "}")
% static_cast<int> (base); % static_cast<int> (base);
MWBase::Environment::get().getWindowManager ()->messageBox(message.str(), std::vector<std::string>()); MWBase::Environment::get().getWindowManager ()->messageBox(message.str());
if (mLevelProgress >= 10) if (mLevelProgress >= 10)
{ {
// levelup is possible now // levelup is possible now
MWBase::Environment::get().getWindowManager ()->messageBox ("#{sLevelUpMsg}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager ()->messageBox ("#{sLevelUpMsg}");
} }
getSkill (skillIndex).setBase (base); getSkill (skillIndex).setBase (base);

View file

@ -83,7 +83,7 @@ namespace MWScript
msgBox = boost::str(boost::format(msgBox) % count % itemName); msgBox = boost::str(boost::format(msgBox) % count % itemName);
} }
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, std::vector<std::string>()); MWBase::Environment::get().getWindowManager()->messageBox(msgBox);
} }
} }
}; };
@ -179,7 +179,7 @@ namespace MWScript
} }
if (numRemoved > 0) if (numRemoved > 0)
MWBase::Environment::get().getWindowManager()->messageBox(msgBox, std::vector<std::string>()); MWBase::Environment::get().getWindowManager()->messageBox(msgBox);
} }
} }
}; };

View file

@ -62,7 +62,7 @@ namespace MWWorld
if((*itr).mPart == ESM::PRT_Head) if((*itr).mPart == ESM::PRT_Head)
{ {
if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() ) if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage13}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage13}");
allow = false; allow = false;
break; break;
@ -90,12 +90,12 @@ namespace MWWorld
if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() ) if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() )
{ {
if(it.getType() == MWWorld::ContainerStore::Type_Clothing){ // It's shoes if(it.getType() == MWWorld::ContainerStore::Type_Clothing){ // It's shoes
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage15}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage15}");
} }
else // It's boots else // It's boots
{ {
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage14}", std::vector<std::string>()); MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage14}");
} }
} }
break; break;

View file

@ -0,0 +1,21 @@
#include "actionsoulgem.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp"
namespace MWWorld
{
ActionSoulgem::ActionSoulgem(const Ptr &object)
: Action(false, object)
{
}
void ActionSoulgem::executeImp(const Ptr &actor)
{
MWBase::Environment::get().getWindowManager()->showSoulgemDialog(getTarget());
}
}

View file

@ -0,0 +1,19 @@
#ifndef GAME_MWWORLD_ACTIONSOULGEM_H
#define GAME_MWWORLD_ACTIONSOULGEM_H
#include "action.hpp"
#include "ptr.hpp"
namespace MWWorld
{
class ActionSoulgem : public Action
{
virtual void executeImp (const MWWorld::Ptr& actor);
public:
/// @param soulgem to use
ActionSoulgem (const Ptr& object);
};
}
#endif

View file

@ -15,7 +15,7 @@ namespace MWWorld
{ {
if ( actor.getRefData().getHandle()=="player" && !(message.empty())) if ( actor.getRefData().getHandle()=="player" && !(message.empty()))
{ {
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>()); MWBase::Environment::get().getWindowManager() ->messageBox(message);
} }
} }
} }

View file

@ -70,18 +70,18 @@
<!-- Available effects --> <!-- Available effects -->
<Widget type="TextBox" skin="NormalText" position="12 148 300 24"> <Widget type="TextBox" skin="NormalText" position="12 108 300 24">
<Property key="Caption" value="#{sMagicEffects}"/> <Property key="Caption" value="#{sMagicEffects}"/>
</Widget> </Widget>
<Widget type="MWList" skin="MW_SimpleList" position="12 176 202 169" name="AvailableEffects"> <Widget type="MWList" skin="MW_SimpleList" position="12 136 202 209" name="AvailableEffects">
</Widget> </Widget>
<!-- Used effects --> <!-- Used effects -->
<Widget type="TextBox" skin="NormalText" position="226 148 300 24"> <Widget type="TextBox" skin="NormalText" position="226 108 300 24">
<Property key="Caption" value="#{sEffects}"/> <Property key="Caption" value="#{sEffects}"/>
</Widget> </Widget>
<Widget type="Widget" skin="MW_Box" position="226 176 316 169"> <Widget type="Widget" skin="MW_Box" position="226 136 316 209">
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 308 161" name="UsedEffects"> <Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 308 201" name="UsedEffects">
<Property key="CanvasAlign" value="Left Top"/> <Property key="CanvasAlign" value="Left Top"/>
</Widget> </Widget>
</Widget> </Widget>