forked from teamnwah/openmw-tes3coop
Merge branch 'master' of git://github.com/zinnschlag/openmw into graphics
This commit is contained in:
commit
5341bf9504
47 changed files with 612 additions and 190 deletions
|
@ -30,7 +30,7 @@ add_openmw_dir (mwgui
|
||||||
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
||||||
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
|
enchantingdialog trainingwindow travelwindow imagebutton exposedwindow cursor spellicons
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwdialogue
|
add_openmw_dir (mwdialogue
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/objects.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||||
|
@ -138,6 +140,23 @@ namespace MWClass
|
||||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||||
|
|
||||||
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->mBase->mEffects);
|
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->mBase->mEffects);
|
||||||
|
|
||||||
|
// hide effects the player doesnt know about
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer();
|
||||||
|
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||||
|
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
|
||||||
|
int i=0;
|
||||||
|
for (MWGui::Widgets::SpellEffectList::iterator it = info.effects.begin(); it != info.effects.end(); ++it)
|
||||||
|
{
|
||||||
|
/// \todo this code is duplicated from mwclass/ingredient, put it in a helper function
|
||||||
|
it->mKnown = ( (i == 0 && alchemySkill >= 15)
|
||||||
|
|| (i == 1 && alchemySkill >= 30)
|
||||||
|
|| (i == 2 && alchemySkill >= 45)
|
||||||
|
|| (i == 3 && alchemySkill >= 60));
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
info.isPotion = true;
|
info.isPotion = true;
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
|
|
|
@ -237,7 +237,7 @@ namespace MWGui
|
||||||
Widgets::SpellEffectList _list = Widgets::MWEffectList::effectListFromESM(&list);
|
Widgets::SpellEffectList _list = Widgets::MWEffectList::effectListFromESM(&list);
|
||||||
effectsWidget->setEffectList(_list);
|
effectsWidget->setEffectList(_list);
|
||||||
|
|
||||||
std::vector<MyGUI::WidgetPtr> effectItems;
|
std::vector<MyGUI::Widget*> effectItems;
|
||||||
effectsWidget->createEffectWidgets(effectItems, mEffectsBox, coord, false, 0);
|
effectsWidget->createEffectWidgets(effectItems, mEffectsBox, coord, false, 0);
|
||||||
effectsWidget->setCoord(coord);
|
effectsWidget->setCoord(coord);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,11 +40,11 @@ BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
||||||
mBirthList->eventListMouseItemActivate += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
mBirthList->eventListMouseItemActivate += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
||||||
mBirthList->eventListChangePosition += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
mBirthList->eventListChangePosition += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
||||||
|
|
||||||
MyGUI::ButtonPtr backButton;
|
MyGUI::Button* backButton;
|
||||||
getWidget(backButton, "BackButton");
|
getWidget(backButton, "BackButton");
|
||||||
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onBackClicked);
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onBackClicked);
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
|
||||||
|
@ -55,7 +55,7 @@ BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
||||||
|
|
||||||
void BirthDialog::setNextButtonShow(bool shown)
|
void BirthDialog::setNextButtonShow(bool shown)
|
||||||
{
|
{
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
|
|
||||||
if (shown)
|
if (shown)
|
||||||
|
@ -82,7 +82,7 @@ void BirthDialog::setBirthId(const std::string &birthId)
|
||||||
if (boost::iequals(*mBirthList->getItemDataAt<std::string>(i), birthId))
|
if (boost::iequals(*mBirthList->getItemDataAt<std::string>(i), birthId))
|
||||||
{
|
{
|
||||||
mBirthList->setIndexSelected(i);
|
mBirthList->setIndexSelected(i);
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ void BirthDialog::onSelectBirth(MyGUI::ListBox* _sender, size_t _index)
|
||||||
if (_index == MyGUI::ITEM_NONE)
|
if (_index == MyGUI::ITEM_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
|
|
||||||
const std::string *birthId = mBirthList->getItemDataAt<std::string>(_index);
|
const std::string *birthId = mBirthList->getItemDataAt<std::string>(_index);
|
||||||
|
@ -159,7 +159,7 @@ void BirthDialog::updateBirths()
|
||||||
|
|
||||||
void BirthDialog::updateSpells()
|
void BirthDialog::updateSpells()
|
||||||
{
|
{
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = mSpellItems.begin(); it != mSpellItems.end(); ++it)
|
for (std::vector<MyGUI::Widget*>::iterator it = mSpellItems.begin(); it != mSpellItems.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,9 @@ namespace MWGui
|
||||||
void updateSpells();
|
void updateSpells();
|
||||||
|
|
||||||
MyGUI::ListBox* mBirthList;
|
MyGUI::ListBox* mBirthList;
|
||||||
MyGUI::WidgetPtr mSpellArea;
|
MyGUI::Widget* mSpellArea;
|
||||||
MyGUI::ImageBox* mBirthImage;
|
MyGUI::ImageBox* mBirthImage;
|
||||||
std::vector<MyGUI::WidgetPtr> mSpellItems;
|
std::vector<MyGUI::Widget*> mSpellItems;
|
||||||
|
|
||||||
std::string mCurrentBirthId;
|
std::string mCurrentBirthId;
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,11 +31,11 @@ GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parW
|
||||||
getWidget(mClassImage, "ClassImage");
|
getWidget(mClassImage, "ClassImage");
|
||||||
getWidget(mClassName, "ClassName");
|
getWidget(mClassName, "ClassName");
|
||||||
|
|
||||||
MyGUI::ButtonPtr backButton;
|
MyGUI::Button* backButton;
|
||||||
getWidget(backButton, "BackButton");
|
getWidget(backButton, "BackButton");
|
||||||
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onBackClicked);
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onBackClicked);
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
|
||||||
|
@ -97,11 +97,11 @@ PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
|
||||||
|
|
||||||
getWidget(mClassImage, "ClassImage");
|
getWidget(mClassImage, "ClassImage");
|
||||||
|
|
||||||
MyGUI::ButtonPtr backButton;
|
MyGUI::Button* backButton;
|
||||||
getWidget(backButton, "BackButton");
|
getWidget(backButton, "BackButton");
|
||||||
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onBackClicked);
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onBackClicked);
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
|
||||||
|
|
||||||
void PickClassDialog::setNextButtonShow(bool shown)
|
void PickClassDialog::setNextButtonShow(bool shown)
|
||||||
{
|
{
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
|
|
||||||
if (shown)
|
if (shown)
|
||||||
|
@ -138,7 +138,7 @@ void PickClassDialog::setClassId(const std::string &classId)
|
||||||
if (boost::iequals(*mClassList->getItemDataAt<std::string>(i), classId))
|
if (boost::iequals(*mClassList->getItemDataAt<std::string>(i), classId))
|
||||||
{
|
{
|
||||||
mClassList->setIndexSelected(i);
|
mClassList->setIndexSelected(i);
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ void PickClassDialog::onSelectClass(MyGUI::ListBox* _sender, size_t _index)
|
||||||
if (_index == MyGUI::ITEM_NONE)
|
if (_index == MyGUI::ITEM_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
|
|
||||||
const std::string *classId = mClassList->getItemDataAt<std::string>(_index);
|
const std::string *classId = mClassList->getItemDataAt<std::string>(_index);
|
||||||
|
@ -256,7 +256,7 @@ void InfoBoxDialog::fitToText(MyGUI::TextBox* widget)
|
||||||
widget->setSize(size);
|
widget->setSize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
|
void InfoBoxDialog::layoutVertically(MyGUI::Widget* widget, int margin)
|
||||||
{
|
{
|
||||||
size_t count = widget->getChildCount();
|
size_t count = widget->getChildCount();
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
@ -264,7 +264,7 @@ void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
|
||||||
int width = 0;
|
int width = 0;
|
||||||
for (unsigned i = 0; i < count; ++i)
|
for (unsigned i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
MyGUI::WidgetPtr child = widget->getChildAt(i);
|
MyGUI::Widget* child = widget->getChildAt(i);
|
||||||
if (!child->getVisible())
|
if (!child->getVisible())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ std::string InfoBoxDialog::getText() const
|
||||||
|
|
||||||
void InfoBoxDialog::setButtons(ButtonList &buttons)
|
void InfoBoxDialog::setButtons(ButtonList &buttons)
|
||||||
{
|
{
|
||||||
for (std::vector<MyGUI::ButtonPtr>::iterator it = this->mButtons.begin(); it != this->mButtons.end(); ++it)
|
for (std::vector<MyGUI::Button*>::iterator it = this->mButtons.begin(); it != this->mButtons.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ void InfoBoxDialog::setButtons(ButtonList &buttons)
|
||||||
mCurrentButton = -1;
|
mCurrentButton = -1;
|
||||||
|
|
||||||
// TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget
|
// TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget
|
||||||
MyGUI::ButtonPtr button;
|
MyGUI::Button* button;
|
||||||
MyGUI::IntCoord coord = MyGUI::IntCoord(0, 0, mButtonBar->getWidth(), 10);
|
MyGUI::IntCoord coord = MyGUI::IntCoord(0, 0, mButtonBar->getWidth(), 10);
|
||||||
ButtonList::const_iterator end = buttons.end();
|
ButtonList::const_iterator end = buttons.end();
|
||||||
for (ButtonList::const_iterator it = buttons.begin(); it != end; ++it)
|
for (ButtonList::const_iterator it = buttons.begin(); it != end; ++it)
|
||||||
|
@ -342,11 +342,11 @@ int InfoBoxDialog::getChosenButton() const
|
||||||
return mCurrentButton;
|
return mCurrentButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBoxDialog::onButtonClicked(MyGUI::WidgetPtr _sender)
|
void InfoBoxDialog::onButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
std::vector<MyGUI::ButtonPtr>::const_iterator end = mButtons.end();
|
std::vector<MyGUI::Button*>::const_iterator end = mButtons.end();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (std::vector<MyGUI::ButtonPtr>::const_iterator it = mButtons.begin(); it != end; ++it)
|
for (std::vector<MyGUI::Button*>::const_iterator it = mButtons.begin(); it != end; ++it)
|
||||||
{
|
{
|
||||||
if (*it == _sender)
|
if (*it == _sender)
|
||||||
{
|
{
|
||||||
|
@ -376,10 +376,10 @@ ClassChoiceDialog::ClassChoiceDialog(MWBase::WindowManager& parWindowManager)
|
||||||
|
|
||||||
CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
|
CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
|
||||||
: WindowModal("openmw_chargen_create_class.layout", parWindowManager)
|
: WindowModal("openmw_chargen_create_class.layout", parWindowManager)
|
||||||
, mSpecDialog(nullptr)
|
, mSpecDialog(NULL)
|
||||||
, mAttribDialog(nullptr)
|
, mAttribDialog(NULL)
|
||||||
, mSkillDialog(nullptr)
|
, mSkillDialog(NULL)
|
||||||
, mDescDialog(nullptr)
|
, mDescDialog(NULL)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -420,15 +420,15 @@ CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
|
||||||
// Make sure the edit box has focus
|
// Make sure the edit box has focus
|
||||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mEditName);
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(mEditName);
|
||||||
|
|
||||||
MyGUI::ButtonPtr descriptionButton;
|
MyGUI::Button* descriptionButton;
|
||||||
getWidget(descriptionButton, "DescriptionButton");
|
getWidget(descriptionButton, "DescriptionButton");
|
||||||
descriptionButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionClicked);
|
descriptionButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionClicked);
|
||||||
|
|
||||||
MyGUI::ButtonPtr backButton;
|
MyGUI::Button* backButton;
|
||||||
getWidget(backButton, "BackButton");
|
getWidget(backButton, "BackButton");
|
||||||
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onBackClicked);
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onBackClicked);
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onOkClicked);
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMinorSkills() const
|
||||||
|
|
||||||
void CreateClassDialog::setNextButtonShow(bool shown)
|
void CreateClassDialog::setNextButtonShow(bool shown)
|
||||||
{
|
{
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
|
|
||||||
if (shown)
|
if (shown)
|
||||||
|
@ -544,7 +544,7 @@ void CreateClassDialog::onDialogCancel()
|
||||||
mDescDialog = 0;
|
mDescDialog = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
|
void CreateClassDialog::onSpecializationClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
delete mSpecDialog;
|
delete mSpecDialog;
|
||||||
mSpecDialog = new SelectSpecializationDialog(mWindowManager);
|
mSpecDialog = new SelectSpecializationDialog(mWindowManager);
|
||||||
|
@ -694,7 +694,7 @@ SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& pa
|
||||||
ToolTips::createSpecializationToolTip(mSpecialization1, magic, ESM::Class::Magic);
|
ToolTips::createSpecializationToolTip(mSpecialization1, magic, ESM::Class::Magic);
|
||||||
ToolTips::createSpecializationToolTip(mSpecialization2, stealth, ESM::Class::Stealth);
|
ToolTips::createSpecializationToolTip(mSpecialization2, stealth, ESM::Class::Stealth);
|
||||||
|
|
||||||
MyGUI::ButtonPtr cancelButton;
|
MyGUI::Button* cancelButton;
|
||||||
getWidget(cancelButton, "CancelButton");
|
getWidget(cancelButton, "CancelButton");
|
||||||
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
||||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
|
||||||
|
@ -706,7 +706,7 @@ SelectSpecializationDialog::~SelectSpecializationDialog()
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
|
||||||
void SelectSpecializationDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
|
void SelectSpecializationDialog::onSpecializationClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
if (_sender == mSpecialization0)
|
if (_sender == mSpecialization0)
|
||||||
mSpecializationId = ESM::Class::Combat;
|
mSpecializationId = ESM::Class::Combat;
|
||||||
|
@ -747,7 +747,7 @@ SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowMan
|
||||||
ToolTips::createAttributeToolTip(attribute, attribute->getAttributeId());
|
ToolTips::createAttributeToolTip(attribute, attribute->getAttributeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::ButtonPtr cancelButton;
|
MyGUI::Button* cancelButton;
|
||||||
getWidget(cancelButton, "CancelButton");
|
getWidget(cancelButton, "CancelButton");
|
||||||
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
||||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
|
||||||
|
@ -840,7 +840,7 @@ SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::ButtonPtr cancelButton;
|
MyGUI::Button* cancelButton;
|
||||||
getWidget(cancelButton, "CancelButton");
|
getWidget(cancelButton, "CancelButton");
|
||||||
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
|
||||||
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSkillDialog::onCancelClicked);
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSkillDialog::onCancelClicked);
|
||||||
|
@ -873,7 +873,7 @@ DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
||||||
|
|
||||||
getWidget(mTextEdit, "TextEdit");
|
getWidget(mTextEdit, "TextEdit");
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DescriptionDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DescriptionDialog::onOkClicked);
|
||||||
okButton->setCaption(mWindowManager.getGameSettingString("sInputMenu1", ""));
|
okButton->setCaption(mWindowManager.getGameSettingString("sInputMenu1", ""));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef MWGUI_CLASS_H
|
#ifndef MWGUI_CLASS_H
|
||||||
#define MWGUI_CLASS_H
|
#define MWGUI_CLASS_H
|
||||||
|
|
||||||
#include <MyGUI.h>
|
|
||||||
#include "widgets.hpp"
|
#include "widgets.hpp"
|
||||||
#include "window_base.hpp"
|
#include "window_base.hpp"
|
||||||
|
|
||||||
|
@ -35,17 +35,17 @@ namespace MWGui
|
||||||
EventHandle_Int eventButtonSelected;
|
EventHandle_Int eventButtonSelected;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onButtonClicked(MyGUI::WidgetPtr _sender);
|
void onButtonClicked(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void fitToText(MyGUI::TextBox* widget);
|
void fitToText(MyGUI::TextBox* widget);
|
||||||
void layoutVertically(MyGUI::WidgetPtr widget, int margin);
|
void layoutVertically(MyGUI::Widget* widget, int margin);
|
||||||
int mCurrentButton;
|
int mCurrentButton;
|
||||||
MyGUI::WidgetPtr mTextBox;
|
MyGUI::Widget* mTextBox;
|
||||||
MyGUI::TextBox* mText;
|
MyGUI::TextBox* mText;
|
||||||
MyGUI::WidgetPtr mButtonBar;
|
MyGUI::Widget* mButtonBar;
|
||||||
std::vector<MyGUI::ButtonPtr> mButtons;
|
std::vector<MyGUI::Button*> mButtons;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Lets the player choose between 3 ways of creating a class
|
// Lets the player choose between 3 ways of creating a class
|
||||||
|
@ -235,7 +235,7 @@ namespace MWGui
|
||||||
void onOkClicked(MyGUI::Widget* _sender);
|
void onOkClicked(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::EditPtr mTextEdit;
|
MyGUI::EditBox* mTextEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CreateClassDialog : public WindowModal
|
class CreateClassDialog : public WindowModal
|
||||||
|
@ -265,7 +265,7 @@ namespace MWGui
|
||||||
void onOkClicked(MyGUI::Widget* _sender);
|
void onOkClicked(MyGUI::Widget* _sender);
|
||||||
void onBackClicked(MyGUI::Widget* _sender);
|
void onBackClicked(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
void onSpecializationClicked(MyGUI::WidgetPtr _sender);
|
void onSpecializationClicked(MyGUI::Widget* _sender);
|
||||||
void onSpecializationSelected();
|
void onSpecializationSelected();
|
||||||
void onAttributeClicked(Widgets::MWAttributePtr _sender);
|
void onAttributeClicked(Widgets::MWAttributePtr _sender);
|
||||||
void onAttributeSelected();
|
void onAttributeSelected();
|
||||||
|
@ -280,7 +280,7 @@ namespace MWGui
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::EditPtr mEditName;
|
MyGUI::EditBox* mEditName;
|
||||||
MyGUI::TextBox* mSpecializationName;
|
MyGUI::TextBox* mSpecializationName;
|
||||||
Widgets::MWAttributePtr mFavoriteAttribute0, mFavoriteAttribute1;
|
Widgets::MWAttributePtr mFavoriteAttribute0, mFavoriteAttribute1;
|
||||||
Widgets::MWSkillPtr mMajorSkill[5];
|
Widgets::MWSkillPtr mMajorSkill[5];
|
||||||
|
|
|
@ -216,7 +216,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::keyPress(MyGUI::WidgetPtr _sender,
|
void Console::keyPress(MyGUI::Widget* _sender,
|
||||||
MyGUI::KeyCode key,
|
MyGUI::KeyCode key,
|
||||||
MyGUI::Char _char)
|
MyGUI::Char _char)
|
||||||
{
|
{
|
||||||
|
@ -266,7 +266,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::acceptCommand(MyGUI::EditPtr _sender)
|
void Console::acceptCommand(MyGUI::EditBox* _sender)
|
||||||
{
|
{
|
||||||
const std::string &cm = command->getCaption();
|
const std::string &cm = command->getCaption();
|
||||||
if(cm.empty()) return;
|
if(cm.empty()) return;
|
||||||
|
|
|
@ -55,8 +55,8 @@ namespace MWGui
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyGUI::EditPtr command;
|
MyGUI::EditBox* command;
|
||||||
MyGUI::EditPtr history;
|
MyGUI::EditBox* history;
|
||||||
|
|
||||||
typedef std::list<std::string> StringList;
|
typedef std::list<std::string> StringList;
|
||||||
|
|
||||||
|
@ -95,11 +95,11 @@ namespace MWGui
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void keyPress(MyGUI::WidgetPtr _sender,
|
void keyPress(MyGUI::Widget* _sender,
|
||||||
MyGUI::KeyCode key,
|
MyGUI::KeyCode key,
|
||||||
MyGUI::Char _char);
|
MyGUI::Char _char);
|
||||||
|
|
||||||
void acceptCommand(MyGUI::EditPtr _sender);
|
void acceptCommand(MyGUI::EditBox* _sender);
|
||||||
|
|
||||||
std::string complete( std::string input, std::vector<std::string> &matches );
|
std::string complete( std::string input, std::vector<std::string> &matches );
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MWGui
|
||||||
|
|
||||||
|
|
||||||
ResourceImageSetPointerFix::ResourceImageSetPointerFix() :
|
ResourceImageSetPointerFix::ResourceImageSetPointerFix() :
|
||||||
mImageSet(nullptr)
|
mImageSet(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace MWGui
|
||||||
|
|
||||||
void ResourceImageSetPointerFix::setImage(MyGUI::ImageBox* _image)
|
void ResourceImageSetPointerFix::setImage(MyGUI::ImageBox* _image)
|
||||||
{
|
{
|
||||||
if (mImageSet != nullptr)
|
if (mImageSet != NULL)
|
||||||
_image->setItemResourceInfo(mImageSet->getIndexInfo(0, 0));
|
_image->setItemResourceInfo(mImageSet->getIndexInfo(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ DialogueWindow::DialogueWindow(MWBase::WindowManager& parWindowManager)
|
||||||
getWidget(mTopicsList, "TopicsList");
|
getWidget(mTopicsList, "TopicsList");
|
||||||
mTopicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
mTopicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||||
|
|
||||||
MyGUI::ButtonPtr byeButton;
|
MyGUI::Button* byeButton;
|
||||||
getWidget(byeButton, "ByeButton");
|
getWidget(byeButton, "ByeButton");
|
||||||
byeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
|
byeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ DialogueWindow::DialogueWindow(MWBase::WindowManager& parWindowManager)
|
||||||
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
MyGUI::ISubWidgetText* t = mHistory->getClient()->getSubWidgetText();
|
MyGUI::ISubWidgetText* t = mHistory->getClient()->getSubWidgetText();
|
||||||
if(t == nullptr)
|
if(t == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const MyGUI::IntPoint& lastPressed = MyGUI::InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);
|
const MyGUI::IntPoint& lastPressed = MyGUI::InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);
|
||||||
|
@ -381,7 +381,7 @@ std::string DialogueWindow::parseText(const std::string& text)
|
||||||
std::vector<MWDialogue::HyperTextToken> hypertext = MWDialogue::ParseHyperText(text);
|
std::vector<MWDialogue::HyperTextToken> hypertext = MWDialogue::ParseHyperText(text);
|
||||||
|
|
||||||
size_t historySize = 0;
|
size_t historySize = 0;
|
||||||
if(mHistory->getClient()->getSubWidgetText() != nullptr)
|
if(mHistory->getClient()->getSubWidgetText() != NULL)
|
||||||
{
|
{
|
||||||
historySize = mHistory->getOnlyText().size();
|
historySize = mHistory->getOnlyText().size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace MWGui
|
||||||
DialogueHistory* mHistory;
|
DialogueHistory* mHistory;
|
||||||
Widgets::MWList* mTopicsList;
|
Widgets::MWList* mTopicsList;
|
||||||
MyGUI::ProgressPtr mDispositionBar;
|
MyGUI::ProgressPtr mDispositionBar;
|
||||||
MyGUI::EditPtr mDispositionText;
|
MyGUI::EditBox* mDispositionText;
|
||||||
|
|
||||||
PersuasionDialog mPersuasionDialog;
|
PersuasionDialog mPersuasionDialog;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "exposedwindow.hpp"
|
#include "exposedwindow.hpp"
|
||||||
|
|
||||||
#include "MyGUI_Window.h"
|
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
MyGUI::VectorWidgetPtr ExposedWindow::getSkinWidgetsByName (const std::string &name)
|
MyGUI::VectorWidgetPtr ExposedWindow::getSkinWidgetsByName (const std::string &name)
|
||||||
|
@ -16,7 +14,7 @@ namespace MWGui
|
||||||
if (widgets.empty())
|
if (widgets.empty())
|
||||||
{
|
{
|
||||||
MYGUI_ASSERT( ! _throw, "widget name '" << _name << "' not found in skin of layout '" << getName() << "'");
|
MYGUI_ASSERT( ! _throw, "widget name '" << _name << "' not found in skin of layout '" << getName() << "'");
|
||||||
return nullptr;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef MWGUI_EXPOSEDWINDOW_H
|
#ifndef MWGUI_EXPOSEDWINDOW_H
|
||||||
#define MWGUI_EXPOSEDWINDOW_H
|
#define MWGUI_EXPOSEDWINDOW_H
|
||||||
|
|
||||||
#include "MyGUI_Window.h"
|
#include <MyGUI_Window.h>
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <MyGUI.h>
|
#include <MyGUI_Widget.h>
|
||||||
|
#include <MyGUI_RenderManager.h>
|
||||||
|
#include <MyGUI_PointerManager.h>
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
@ -19,6 +21,7 @@
|
||||||
#include "inventorywindow.hpp"
|
#include "inventorywindow.hpp"
|
||||||
#include "container.hpp"
|
#include "container.hpp"
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
|
#include "spellicons.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
|
@ -32,7 +35,6 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
, mWeapStatus(NULL)
|
, mWeapStatus(NULL)
|
||||||
, mSpellStatus(NULL)
|
, mSpellStatus(NULL)
|
||||||
, mEffectBox(NULL)
|
, mEffectBox(NULL)
|
||||||
, mEffect1(NULL)
|
|
||||||
, mMinimap(NULL)
|
, mMinimap(NULL)
|
||||||
, mCompass(NULL)
|
, mCompass(NULL)
|
||||||
, mCrosshair(NULL)
|
, mCrosshair(NULL)
|
||||||
|
@ -86,9 +88,7 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
||||||
|
|
||||||
getWidget(mEffectBox, "EffectBox");
|
getWidget(mEffectBox, "EffectBox");
|
||||||
getWidget(mEffect1, "Effect1");
|
|
||||||
mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();
|
mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();
|
||||||
mEffectBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
|
||||||
|
|
||||||
getWidget(mMinimapBox, "MiniMapBox");
|
getWidget(mMinimapBox, "MiniMapBox");
|
||||||
mMinimapBoxBaseRight = viewSize.width - mMinimapBox->getRight();
|
mMinimapBoxBaseRight = viewSize.width - mMinimapBox->getRight();
|
||||||
|
@ -107,13 +107,18 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||||
getWidget(mTriangleCounter, "TriangleCounter");
|
getWidget(mTriangleCounter, "TriangleCounter");
|
||||||
getWidget(mBatchCounter, "BatchCounter");
|
getWidget(mBatchCounter, "BatchCounter");
|
||||||
|
|
||||||
setEffect("icons\\s\\tx_s_chameleon.dds");
|
|
||||||
|
|
||||||
LocalMapBase::init(mMinimap, mCompass, this);
|
LocalMapBase::init(mMinimap, mCompass, this);
|
||||||
|
|
||||||
mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked);
|
mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked);
|
||||||
mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver);
|
mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver);
|
||||||
mMainWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &HUD::onWorldMouseLostFocus);
|
mMainWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &HUD::onWorldMouseLostFocus);
|
||||||
|
|
||||||
|
mSpellIcons = new SpellIcons();
|
||||||
|
}
|
||||||
|
|
||||||
|
HUD::~HUD()
|
||||||
|
{
|
||||||
|
delete mSpellIcons;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUD::setFpsLevel(int level)
|
void HUD::setFpsLevel(int level)
|
||||||
|
@ -156,11 +161,6 @@ void HUD::setBatchCount(unsigned int count)
|
||||||
mBatchCounter->setCaption(boost::lexical_cast<std::string>(count));
|
mBatchCounter->setCaption(boost::lexical_cast<std::string>(count));
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUD::setEffect(const char *img)
|
|
||||||
{
|
|
||||||
mEffect1->setImageTexture(img);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
static const char *ids[] =
|
static const char *ids[] =
|
||||||
|
@ -542,3 +542,8 @@ void HUD::updatePositions()
|
||||||
mMapVisible = mMinimapBox->getVisible ();
|
mMapVisible = mMinimapBox->getVisible ();
|
||||||
mEffectBox->setPosition((viewSize.width - mEffectBoxBaseRight) - mEffectBox->getWidth() + effectsDx, mEffectBox->getTop());
|
mEffectBox->setPosition((viewSize.width - mEffectBoxBaseRight) - mEffectBox->getWidth() + effectsDx, mEffectBox->getTop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HUD::update()
|
||||||
|
{
|
||||||
|
mSpellIcons->updateWidgets(mEffectBox, true);
|
||||||
|
}
|
||||||
|
|
|
@ -8,12 +8,13 @@
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class DragAndDrop;
|
class DragAndDrop;
|
||||||
|
class SpellIcons;
|
||||||
|
|
||||||
class HUD : public OEngine::GUI::Layout, public LocalMapBase
|
class HUD : public OEngine::GUI::Layout, public LocalMapBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop);
|
HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop);
|
||||||
void setEffect(const char *img);
|
virtual ~HUD();
|
||||||
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
|
void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
|
||||||
void setFPS(float fps);
|
void setFPS(float fps);
|
||||||
void setTriangleCount(unsigned int count);
|
void setTriangleCount(unsigned int count);
|
||||||
|
@ -43,6 +44,10 @@ namespace MWGui
|
||||||
|
|
||||||
bool getWorldMouseOver() { return mWorldMouseOver; }
|
bool getWorldMouseOver() { return mWorldMouseOver; }
|
||||||
|
|
||||||
|
MyGUI::Widget* getEffectBox() { return mEffectBox; }
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::ProgressPtr mHealth, mMagicka, mStamina;
|
MyGUI::ProgressPtr mHealth, mMagicka, mStamina;
|
||||||
MyGUI::Widget* mHealthFrame;
|
MyGUI::Widget* mHealthFrame;
|
||||||
|
@ -51,7 +56,6 @@ namespace MWGui
|
||||||
MyGUI::ProgressPtr mWeapStatus, mSpellStatus;
|
MyGUI::ProgressPtr mWeapStatus, mSpellStatus;
|
||||||
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
||||||
MyGUI::Button* mMinimapButton;
|
MyGUI::Button* mMinimapButton;
|
||||||
MyGUI::ImageBox* mEffect1;
|
|
||||||
MyGUI::ScrollView* mMinimap;
|
MyGUI::ScrollView* mMinimap;
|
||||||
MyGUI::ImageBox* mCompass;
|
MyGUI::ImageBox* mCompass;
|
||||||
MyGUI::ImageBox* mCrosshair;
|
MyGUI::ImageBox* mCrosshair;
|
||||||
|
@ -60,7 +64,7 @@ namespace MWGui
|
||||||
|
|
||||||
MyGUI::Widget* mDummy;
|
MyGUI::Widget* mDummy;
|
||||||
|
|
||||||
MyGUI::WidgetPtr mFpsBox;
|
MyGUI::Widget* mFpsBox;
|
||||||
MyGUI::TextBox* mFpsCounter;
|
MyGUI::TextBox* mFpsCounter;
|
||||||
MyGUI::TextBox* mTriangleCounter;
|
MyGUI::TextBox* mTriangleCounter;
|
||||||
MyGUI::TextBox* mBatchCounter;
|
MyGUI::TextBox* mBatchCounter;
|
||||||
|
@ -85,6 +89,8 @@ namespace MWGui
|
||||||
|
|
||||||
bool mWorldMouseOver;
|
bool mWorldMouseOver;
|
||||||
|
|
||||||
|
SpellIcons* mSpellIcons;
|
||||||
|
|
||||||
void onWorldClicked(MyGUI::Widget* _sender);
|
void onWorldClicked(MyGUI::Widget* _sender);
|
||||||
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
||||||
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef MWGUI_IMAGEBUTTON_H
|
#ifndef MWGUI_IMAGEBUTTON_H
|
||||||
#define MWGUI_IMAGEBUTTON_H
|
#define MWGUI_IMAGEBUTTON_H
|
||||||
|
|
||||||
#include "MyGUI_ImageBox.h"
|
#include <MyGUI_ImageBox.h>
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,8 +29,8 @@ namespace MWGui
|
||||||
void notifyNextPage(MyGUI::Widget* _sender);
|
void notifyNextPage(MyGUI::Widget* _sender);
|
||||||
void notifyPrevPage(MyGUI::Widget* _sender);
|
void notifyPrevPage(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
MyGUI::EditPtr mLeftTextWidget;
|
MyGUI::EditBox* mLeftTextWidget;
|
||||||
MyGUI::EditPtr mRightTextWidget;
|
MyGUI::EditBox* mRightTextWidget;
|
||||||
MWGui::ImageButton* mPrevBtn;
|
MWGui::ImageButton* mPrevBtn;
|
||||||
MWGui::ImageButton* mNextBtn;
|
MWGui::ImageButton* mNextBtn;
|
||||||
std::vector<std::string> mLeftPages;
|
std::vector<std::string> mLeftPages;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#include "list.hpp"
|
#include "list.hpp"
|
||||||
|
|
||||||
#include <MyGUI.h>
|
#include <MyGUI_ScrollView.h>
|
||||||
|
#include <MyGUI_Gui.h>
|
||||||
|
#include <MyGUI_Button.h>
|
||||||
|
#include <MyGUI_ImageBox.h>
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
using namespace MWGui::Widgets;
|
using namespace MWGui::Widgets;
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
#ifndef MWGUI_LIST_HPP
|
#ifndef MWGUI_LIST_HPP
|
||||||
#define MWGUI_LIST_HPP
|
#define MWGUI_LIST_HPP
|
||||||
|
|
||||||
#include <MyGUI.h>
|
#include <MyGUI_Widget.h>
|
||||||
|
|
||||||
|
namespace MyGUI
|
||||||
|
{
|
||||||
|
class ScrollView;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
|
@ -247,7 +247,7 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
|
||||||
std::vector<std::string>::const_iterator it;
|
std::vector<std::string>::const_iterator it;
|
||||||
for(it = buttons.begin(); it != buttons.end(); ++it)
|
for(it = buttons.begin(); it != buttons.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::ButtonPtr button = mButtonsWidget->createWidget<MyGUI::Button>(
|
MyGUI::Button* button = mButtonsWidget->createWidget<MyGUI::Button>(
|
||||||
MyGUI::WidgetStyle::Child,
|
MyGUI::WidgetStyle::Child,
|
||||||
std::string("MW_Button"),
|
std::string("MW_Button"),
|
||||||
dummyCoord,
|
dummyCoord,
|
||||||
|
@ -301,7 +301,7 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
|
||||||
MyGUI::IntSize buttonSize(0, buttonHeight);
|
MyGUI::IntSize buttonSize(0, buttonHeight);
|
||||||
int left = (mainWidgetSize.width - buttonsWidth)/2 + buttonPadding;
|
int left = (mainWidgetSize.width - buttonsWidth)/2 + buttonPadding;
|
||||||
|
|
||||||
std::vector<MyGUI::ButtonPtr>::const_iterator button;
|
std::vector<MyGUI::Button*>::const_iterator button;
|
||||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
{
|
{
|
||||||
buttonCord.left = left;
|
buttonCord.left = left;
|
||||||
|
@ -349,7 +349,7 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
|
||||||
|
|
||||||
int top = textButtonPadding + buttonTopPadding + textSize.height;
|
int top = textButtonPadding + buttonTopPadding + textSize.height;
|
||||||
|
|
||||||
std::vector<MyGUI::ButtonPtr>::const_iterator button;
|
std::vector<MyGUI::Button*>::const_iterator button;
|
||||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
{
|
{
|
||||||
buttonSize.width = (*button)->getTextSize().width + buttonPadding*2;
|
buttonSize.width = (*button)->getTextSize().width + buttonPadding*2;
|
||||||
|
@ -371,7 +371,7 @@ void InteractiveMessageBox::enterPressed()
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
|
std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
|
||||||
std::vector<MyGUI::ButtonPtr>::const_iterator button;
|
std::vector<MyGUI::Button*>::const_iterator button;
|
||||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
{
|
{
|
||||||
if(Misc::StringUtils::lowerCase((*button)->getCaption()) == ok)
|
if(Misc::StringUtils::lowerCase((*button)->getCaption()) == ok)
|
||||||
|
@ -393,7 +393,7 @@ void InteractiveMessageBox::buttonActivated (MyGUI::Widget* pressed)
|
||||||
{
|
{
|
||||||
mMarkedToDelete = true;
|
mMarkedToDelete = true;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
std::vector<MyGUI::ButtonPtr>::const_iterator button;
|
std::vector<MyGUI::Button*>::const_iterator button;
|
||||||
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
for(button = mButtons.begin(); button != mButtons.end(); ++button)
|
||||||
{
|
{
|
||||||
if(*button == pressed)
|
if(*button == pressed)
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define MWGUI_MESSAGE_BOX_H
|
#define MWGUI_MESSAGE_BOX_H
|
||||||
|
|
||||||
#include <openengine/gui/layout.hpp>
|
#include <openengine/gui/layout.hpp>
|
||||||
#include <MyGUI.h>
|
|
||||||
|
|
||||||
#include "window_base.hpp"
|
#include "window_base.hpp"
|
||||||
|
|
||||||
|
@ -10,6 +9,13 @@
|
||||||
|
|
||||||
#undef MessageBox
|
#undef MessageBox
|
||||||
|
|
||||||
|
namespace MyGUI
|
||||||
|
{
|
||||||
|
class Widget;
|
||||||
|
class Button;
|
||||||
|
class EditBox;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class InteractiveMessageBox;
|
class InteractiveMessageBox;
|
||||||
|
@ -61,7 +67,7 @@ namespace MWGui
|
||||||
MessageBoxManager& mMessageBoxManager;
|
MessageBoxManager& mMessageBoxManager;
|
||||||
int mHeight;
|
int mHeight;
|
||||||
const std::string& mMessage;
|
const std::string& mMessage;
|
||||||
MyGUI::EditPtr mMessageWidget;
|
MyGUI::EditBox* mMessageWidget;
|
||||||
int mFixedWidth;
|
int mFixedWidth;
|
||||||
int mBottomPadding;
|
int mBottomPadding;
|
||||||
int mNextBoxPadding;
|
int mNextBoxPadding;
|
||||||
|
@ -81,9 +87,9 @@ namespace MWGui
|
||||||
void buttonActivated (MyGUI::Widget* _widget);
|
void buttonActivated (MyGUI::Widget* _widget);
|
||||||
|
|
||||||
MessageBoxManager& mMessageBoxManager;
|
MessageBoxManager& mMessageBoxManager;
|
||||||
MyGUI::EditPtr mMessageWidget;
|
MyGUI::EditBox* mMessageWidget;
|
||||||
MyGUI::WidgetPtr mButtonsWidget;
|
MyGUI::Widget* mButtonsWidget;
|
||||||
std::vector<MyGUI::ButtonPtr> mButtons;
|
std::vector<MyGUI::Button*> mButtons;
|
||||||
|
|
||||||
int mTextButtonPadding;
|
int mTextButtonPadding;
|
||||||
int mButtonPressed;
|
int mButtonPressed;
|
||||||
|
|
|
@ -41,7 +41,7 @@ RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
|
||||||
mHeadRotate->eventScrollChangePosition += MyGUI::newDelegate(this, &RaceDialog::onHeadRotate);
|
mHeadRotate->eventScrollChangePosition += MyGUI::newDelegate(this, &RaceDialog::onHeadRotate);
|
||||||
|
|
||||||
// Set up next/previous buttons
|
// Set up next/previous buttons
|
||||||
MyGUI::ButtonPtr prevButton, nextButton;
|
MyGUI::Button *prevButton, *nextButton;
|
||||||
|
|
||||||
setText("GenderChoiceT", mWindowManager.getGameSettingString("sRaceMenu2", "Change Sex"));
|
setText("GenderChoiceT", mWindowManager.getGameSettingString("sRaceMenu2", "Change Sex"));
|
||||||
getWidget(prevButton, "PrevGenderButton");
|
getWidget(prevButton, "PrevGenderButton");
|
||||||
|
@ -73,11 +73,11 @@ RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
|
||||||
setText("SpellPowerT", mWindowManager.getGameSettingString("sRaceMenu7", "Specials"));
|
setText("SpellPowerT", mWindowManager.getGameSettingString("sRaceMenu7", "Specials"));
|
||||||
getWidget(mSpellPowerList, "SpellPowerList");
|
getWidget(mSpellPowerList, "SpellPowerList");
|
||||||
|
|
||||||
MyGUI::ButtonPtr backButton;
|
MyGUI::Button* backButton;
|
||||||
getWidget(backButton, "BackButton");
|
getWidget(backButton, "BackButton");
|
||||||
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onBackClicked);
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onBackClicked);
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
|
||||||
|
@ -89,7 +89,7 @@ RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
|
||||||
|
|
||||||
void RaceDialog::setNextButtonShow(bool shown)
|
void RaceDialog::setNextButtonShow(bool shown)
|
||||||
{
|
{
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
|
|
||||||
if (shown)
|
if (shown)
|
||||||
|
@ -134,7 +134,7 @@ void RaceDialog::setRaceId(const std::string &raceId)
|
||||||
if (boost::iequals(*mRaceList->getItemDataAt<std::string>(i), raceId))
|
if (boost::iequals(*mRaceList->getItemDataAt<std::string>(i), raceId))
|
||||||
{
|
{
|
||||||
mRaceList->setIndexSelected(i);
|
mRaceList->setIndexSelected(i);
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ void RaceDialog::onSelectRace(MyGUI::ListBox* _sender, size_t _index)
|
||||||
if (_index == MyGUI::ITEM_NONE)
|
if (_index == MyGUI::ITEM_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
const std::string *raceId = mRaceList->getItemDataAt<std::string>(_index);
|
const std::string *raceId = mRaceList->getItemDataAt<std::string>(_index);
|
||||||
if (boost::iequals(mCurrentRaceId, *raceId))
|
if (boost::iequals(mCurrentRaceId, *raceId))
|
||||||
|
@ -331,7 +331,7 @@ void RaceDialog::updateRaces()
|
||||||
|
|
||||||
void RaceDialog::updateSkills()
|
void RaceDialog::updateSkills()
|
||||||
{
|
{
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = mSkillItems.begin(); it != mSkillItems.end(); ++it)
|
for (std::vector<MyGUI::Widget*>::iterator it = mSkillItems.begin(); it != mSkillItems.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ void RaceDialog::updateSkills()
|
||||||
|
|
||||||
void RaceDialog::updateSpellPowers()
|
void RaceDialog::updateSpellPowers()
|
||||||
{
|
{
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = mSpellPowerItems.begin(); it != mSpellPowerItems.end(); ++it)
|
for (std::vector<MyGUI::Widget*>::iterator it = mSpellPowerItems.begin(); it != mSpellPowerItems.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,11 @@ namespace MWGui
|
||||||
MyGUI::ListBox* mRaceList;
|
MyGUI::ListBox* mRaceList;
|
||||||
MyGUI::ScrollBar* mHeadRotate;
|
MyGUI::ScrollBar* mHeadRotate;
|
||||||
|
|
||||||
MyGUI::WidgetPtr mSkillList;
|
MyGUI::Widget* mSkillList;
|
||||||
std::vector<MyGUI::WidgetPtr> mSkillItems;
|
std::vector<MyGUI::Widget*> mSkillItems;
|
||||||
|
|
||||||
MyGUI::WidgetPtr mSpellPowerList;
|
MyGUI::Widget* mSpellPowerList;
|
||||||
std::vector<MyGUI::WidgetPtr> mSpellPowerItems;
|
std::vector<MyGUI::Widget*> mSpellPowerItems;
|
||||||
|
|
||||||
int mGenderIndex, mFaceIndex, mHairIndex;
|
int mGenderIndex, mFaceIndex, mHairIndex;
|
||||||
int mFaceCount, mHairCount;
|
int mFaceCount, mHairCount;
|
||||||
|
|
|
@ -86,11 +86,11 @@ ReviewDialog::ReviewDialog(MWBase::WindowManager& parWindowManager)
|
||||||
mSkillWidgetMap.insert(std::make_pair(i, static_cast<MyGUI::TextBox*> (0)));
|
mSkillWidgetMap.insert(std::make_pair(i, static_cast<MyGUI::TextBox*> (0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::ButtonPtr backButton;
|
MyGUI::Button* backButton;
|
||||||
getWidget(backButton, "BackButton");
|
getWidget(backButton, "BackButton");
|
||||||
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onBackClicked);
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onBackClicked);
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ void ReviewDialog::addSkills(const SkillList &skills, const std::string &titleId
|
||||||
|
|
||||||
void ReviewDialog::updateSkillArea()
|
void ReviewDialog::updateSkillArea()
|
||||||
{
|
{
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = mSkillWidgets.begin(); it != mSkillWidgets.end(); ++it)
|
for (std::vector<MyGUI::Widget*>::iterator it = mSkillWidgets.begin(); it != mSkillWidgets.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace MWGui
|
||||||
std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
|
std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
|
||||||
std::string mName, mRaceId, mBirthSignId;
|
std::string mName, mRaceId, mBirthSignId;
|
||||||
ESM::Class mKlass;
|
ESM::Class mKlass;
|
||||||
std::vector<MyGUI::WidgetPtr> mSkillWidgets; //< Skills and other information
|
std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
293
apps/openmw/mwgui/spellicons.cpp
Normal file
293
apps/openmw/mwgui/spellicons.cpp
Normal file
|
@ -0,0 +1,293 @@
|
||||||
|
#include "spellicons.hpp"
|
||||||
|
|
||||||
|
#include <MyGUI_Widget.h>
|
||||||
|
#include <MyGUI_Gui.h>
|
||||||
|
#include <MyGUI_ImageBox.h>
|
||||||
|
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/activespells.hpp"
|
||||||
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
|
||||||
|
#include "tooltips.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
void SpellIcons::updateWidgets(MyGUI::Widget *parent, bool adjustSize)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||||
|
const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||||
|
|
||||||
|
std::map <int, std::vector<MagicEffectInfo> > effects;
|
||||||
|
|
||||||
|
// add permanent item enchantments
|
||||||
|
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
|
||||||
|
for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot)
|
||||||
|
{
|
||||||
|
MWWorld::ContainerStoreIterator it = store.getSlot(slot);
|
||||||
|
if (it == store.end())
|
||||||
|
continue;
|
||||||
|
std::string enchantment = MWWorld::Class::get(*it).getEnchantment(*it);
|
||||||
|
if (enchantment.empty())
|
||||||
|
continue;
|
||||||
|
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(enchantment);
|
||||||
|
if (enchant->mData.mType != ESM::Enchantment::ConstantEffect)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const ESM::EffectList& list = enchant->mEffects;
|
||||||
|
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = list.mList.begin();
|
||||||
|
effectIt != list.mList.end(); ++effectIt)
|
||||||
|
{
|
||||||
|
const ESM::MagicEffect* magicEffect =
|
||||||
|
MWBase::Environment::get().getWorld ()->getStore ().get<ESM::MagicEffect>().find(effectIt->mEffectID);
|
||||||
|
|
||||||
|
MagicEffectInfo effectInfo;
|
||||||
|
effectInfo.mSource = MWWorld::Class::get(*it).getName(*it);
|
||||||
|
effectInfo.mKey = MWMechanics::EffectKey (effectIt->mEffectID);
|
||||||
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
||||||
|
effectInfo.mKey.mArg = effectIt->mSkill;
|
||||||
|
else if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
||||||
|
effectInfo.mKey.mArg = effectIt->mAttribute;
|
||||||
|
// just using the min magnitude here, permanent enchantments with a random magnitude just wouldn't make any sense
|
||||||
|
effectInfo.mMagnitude = effectIt->mMagnMin;
|
||||||
|
effectInfo.mPermanent = true;
|
||||||
|
effects[effectIt->mEffectID].push_back (effectInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add permanent spells
|
||||||
|
const MWMechanics::Spells& spells = stats.getSpells();
|
||||||
|
for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
||||||
|
{
|
||||||
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(it->first);
|
||||||
|
|
||||||
|
// these are the spell types that are permanently in effect
|
||||||
|
if (!(spell->mData.mType == ESM::Spell::ST_Ability)
|
||||||
|
&& !(spell->mData.mType == ESM::Spell::ST_Disease)
|
||||||
|
&& !(spell->mData.mType == ESM::Spell::ST_Curse)
|
||||||
|
&& !(spell->mData.mType == ESM::Spell::ST_Blight))
|
||||||
|
continue;
|
||||||
|
const ESM::EffectList& list = spell->mEffects;
|
||||||
|
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = list.mList.begin();
|
||||||
|
effectIt != list.mList.end(); ++effectIt)
|
||||||
|
{
|
||||||
|
const ESM::MagicEffect* magicEffect =
|
||||||
|
MWBase::Environment::get().getWorld ()->getStore ().get<ESM::MagicEffect>().find(effectIt->mEffectID);
|
||||||
|
MagicEffectInfo effectInfo;
|
||||||
|
effectInfo.mSource = getSpellDisplayName (it->first);
|
||||||
|
effectInfo.mKey = MWMechanics::EffectKey (effectIt->mEffectID);
|
||||||
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
||||||
|
effectInfo.mKey.mArg = effectIt->mSkill;
|
||||||
|
else if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
||||||
|
effectInfo.mKey.mArg = effectIt->mAttribute;
|
||||||
|
// just using the min magnitude here, permanent spells with a random magnitude just wouldn't make any sense
|
||||||
|
effectInfo.mMagnitude = effectIt->mMagnMin;
|
||||||
|
effectInfo.mPermanent = true;
|
||||||
|
|
||||||
|
effects[effectIt->mEffectID].push_back (effectInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// add lasting effect spells/potions etc
|
||||||
|
const MWMechanics::ActiveSpells::TContainer& activeSpells = stats.getActiveSpells().getActiveSpells();
|
||||||
|
for (MWMechanics::ActiveSpells::TContainer::const_iterator it = activeSpells.begin();
|
||||||
|
it != activeSpells.end(); ++it)
|
||||||
|
{
|
||||||
|
const ESM::EffectList& list = getSpellEffectList(it->first);
|
||||||
|
|
||||||
|
float timeScale = MWBase::Environment::get().getWorld()->getTimeScaleFactor();
|
||||||
|
|
||||||
|
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = list.mList.begin();
|
||||||
|
effectIt != list.mList.end(); ++effectIt)
|
||||||
|
{
|
||||||
|
const ESM::MagicEffect* magicEffect =
|
||||||
|
MWBase::Environment::get().getWorld ()->getStore ().get<ESM::MagicEffect>().find(effectIt->mEffectID);
|
||||||
|
|
||||||
|
MagicEffectInfo effectInfo;
|
||||||
|
effectInfo.mSource = getSpellDisplayName (it->first);
|
||||||
|
effectInfo.mKey = MWMechanics::EffectKey (effectIt->mEffectID);
|
||||||
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
||||||
|
effectInfo.mKey.mArg = effectIt->mSkill;
|
||||||
|
else if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
||||||
|
effectInfo.mKey.mArg = effectIt->mAttribute;
|
||||||
|
effectInfo.mMagnitude = effectIt->mMagnMin + (effectIt->mMagnMax-effectIt->mMagnMin) * it->second.second;
|
||||||
|
effectInfo.mRemainingTime = effectIt->mDuration +
|
||||||
|
(it->second.first - MWBase::Environment::get().getWorld()->getTimeStamp())*3600/timeScale;
|
||||||
|
|
||||||
|
// ingredients need special casing for their magnitude / duration
|
||||||
|
/// \todo duplicated from ActiveSpells, helper function?
|
||||||
|
if (MWBase::Environment::get().getWorld()->getStore().get<ESM::Ingredient>().search (it->first))
|
||||||
|
{
|
||||||
|
effectInfo.mRemainingTime = effectIt->mDuration * it->second.second +
|
||||||
|
(it->second.first - MWBase::Environment::get().getWorld()->getTimeStamp())*3600/timeScale;
|
||||||
|
|
||||||
|
effectInfo.mMagnitude = static_cast<int> (0.05*it->second.second / (0.1 * magicEffect->mData.mBaseCost));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
effects[effectIt->mEffectID].push_back (effectInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parent->setVisible(effects.size() != 0);
|
||||||
|
|
||||||
|
int w=2;
|
||||||
|
if (adjustSize)
|
||||||
|
{
|
||||||
|
int s = effects.size() * 16+4;
|
||||||
|
int diff = parent->getWidth() - s;
|
||||||
|
parent->setSize(s, parent->getHeight());
|
||||||
|
parent->setPosition(parent->getLeft()+diff, parent->getTop());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (std::map <int, std::vector<MagicEffectInfo> >::const_iterator it = effects.begin(); it != effects.end(); ++it)
|
||||||
|
{
|
||||||
|
MyGUI::ImageBox* image;
|
||||||
|
if (mWidgetMap.find(it->first) == mWidgetMap.end())
|
||||||
|
image = parent->createWidget<MyGUI::ImageBox>
|
||||||
|
("ImageBox", MyGUI::IntCoord(w,2,16,16), MyGUI::Align::Default);
|
||||||
|
else
|
||||||
|
image = mWidgetMap[it->first];
|
||||||
|
mWidgetMap[it->first] = image;
|
||||||
|
image->setPosition(w,2);
|
||||||
|
image->setVisible(true);
|
||||||
|
|
||||||
|
const ESM::MagicEffect* effect =
|
||||||
|
MWBase::Environment::get().getWorld ()->getStore ().get<ESM::MagicEffect>().find(it->first);
|
||||||
|
|
||||||
|
std::string icon = effect->mIcon;
|
||||||
|
icon[icon.size()-3] = 'd';
|
||||||
|
icon[icon.size()-2] = 'd';
|
||||||
|
icon[icon.size()-1] = 's';
|
||||||
|
icon = "icons\\" + icon;
|
||||||
|
|
||||||
|
image->setImageTexture(icon);
|
||||||
|
w += 16;
|
||||||
|
|
||||||
|
float remainingDuration = 0;
|
||||||
|
|
||||||
|
std::string sourcesDescription;
|
||||||
|
|
||||||
|
const float fadeTime = 5.f;
|
||||||
|
|
||||||
|
for (std::vector<MagicEffectInfo>::const_iterator effectIt = it->second.begin();
|
||||||
|
effectIt != it->second.end(); ++effectIt)
|
||||||
|
{
|
||||||
|
if (effectIt != it->second.begin())
|
||||||
|
sourcesDescription += "\n";
|
||||||
|
|
||||||
|
// if at least one of the effect sources is permanent, the effect will never wear off
|
||||||
|
if (effectIt->mPermanent)
|
||||||
|
remainingDuration = fadeTime;
|
||||||
|
else
|
||||||
|
remainingDuration = std::max(remainingDuration, effectIt->mRemainingTime);
|
||||||
|
|
||||||
|
sourcesDescription += effectIt->mSource;
|
||||||
|
|
||||||
|
if (effect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
||||||
|
sourcesDescription += " (" +
|
||||||
|
MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
||||||
|
ESM::Skill::sSkillNameIds[effectIt->mKey.mArg], "") + ")";
|
||||||
|
if (effect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
||||||
|
sourcesDescription += " (" +
|
||||||
|
MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
||||||
|
ESM::Attribute::sGmstAttributeIds[effectIt->mKey.mArg], "") + ")";
|
||||||
|
|
||||||
|
if (!(effect->mData.mFlags & ESM::MagicEffect::NoMagnitude))
|
||||||
|
{
|
||||||
|
std::string pt = MWBase::Environment::get().getWindowManager()->getGameSettingString("spoint", "");
|
||||||
|
std::string pts = MWBase::Environment::get().getWindowManager()->getGameSettingString("spoints", "");
|
||||||
|
|
||||||
|
sourcesDescription += ": " + boost::lexical_cast<std::string>(effectIt->mMagnitude);
|
||||||
|
sourcesDescription += " " + ((effectIt->mMagnitude > 1) ? pts : pt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string name = ESM::MagicEffect::effectIdToString (it->first);
|
||||||
|
|
||||||
|
ToolTipInfo tooltipInfo;
|
||||||
|
tooltipInfo.caption = "#{" + name + "}";
|
||||||
|
tooltipInfo.icon = effect->mIcon;
|
||||||
|
tooltipInfo.text = sourcesDescription;
|
||||||
|
tooltipInfo.imageSize = 16;
|
||||||
|
tooltipInfo.wordWrap = false;
|
||||||
|
|
||||||
|
image->setUserData(tooltipInfo);
|
||||||
|
image->setUserString("ToolTipType", "ToolTipInfo");
|
||||||
|
|
||||||
|
// Fade out during the last 5 seconds
|
||||||
|
image->setAlpha(std::min(remainingDuration/fadeTime, 1.f));
|
||||||
|
}
|
||||||
|
|
||||||
|
// hide inactive effects
|
||||||
|
for (std::map<int, MyGUI::ImageBox*>::iterator it = mWidgetMap.begin(); it != mWidgetMap.end(); ++it)
|
||||||
|
{
|
||||||
|
if (effects.find(it->first) == effects.end())
|
||||||
|
it->second->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string SpellIcons::getSpellDisplayName (const std::string& id)
|
||||||
|
{
|
||||||
|
if (const ESM::Spell *spell =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search (id))
|
||||||
|
return spell->mName;
|
||||||
|
|
||||||
|
if (const ESM::Potion *potion =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>().search (id))
|
||||||
|
return potion->mName;
|
||||||
|
|
||||||
|
if (const ESM::Ingredient *ingredient =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Ingredient>().search (id))
|
||||||
|
return ingredient->mName;
|
||||||
|
|
||||||
|
throw std::runtime_error ("ID " + id + " has no display name");
|
||||||
|
}
|
||||||
|
|
||||||
|
ESM::EffectList SpellIcons::getSpellEffectList (const std::string& id)
|
||||||
|
{
|
||||||
|
if (const ESM::Spell *spell =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search (id))
|
||||||
|
return spell->mEffects;
|
||||||
|
|
||||||
|
if (const ESM::Potion *potion =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>().search (id))
|
||||||
|
return potion->mEffects;
|
||||||
|
|
||||||
|
if (const ESM::Ingredient *ingredient =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Ingredient>().search (id))
|
||||||
|
{
|
||||||
|
const ESM::MagicEffect *magicEffect =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
||||||
|
ingredient->mData.mEffectID[0]);
|
||||||
|
|
||||||
|
ESM::ENAMstruct effect;
|
||||||
|
effect.mEffectID = ingredient->mData.mEffectID[0];
|
||||||
|
effect.mSkill = ingredient->mData.mSkills[0];
|
||||||
|
effect.mAttribute = ingredient->mData.mAttributes[0];
|
||||||
|
effect.mRange = 0;
|
||||||
|
effect.mArea = 0;
|
||||||
|
effect.mDuration = magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration ? 0 : 1;
|
||||||
|
effect.mMagnMin = 1;
|
||||||
|
effect.mMagnMax = 1;
|
||||||
|
ESM::EffectList result;
|
||||||
|
result.mList.push_back (effect);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
throw std::runtime_error("ID " + id + " does not have effects");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
47
apps/openmw/mwgui/spellicons.hpp
Normal file
47
apps/openmw/mwgui/spellicons.hpp
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#ifndef MWGUI_SPELLICONS_H
|
||||||
|
#define MWGUI_SPELLICONS_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "../mwmechanics/magiceffects.hpp"
|
||||||
|
|
||||||
|
namespace MyGUI
|
||||||
|
{
|
||||||
|
class Widget;
|
||||||
|
class ImageBox;
|
||||||
|
}
|
||||||
|
namespace ESM
|
||||||
|
{
|
||||||
|
struct ENAMstruct;
|
||||||
|
struct EffectList;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWGui
|
||||||
|
{
|
||||||
|
|
||||||
|
// information about a single magic effect source as required for display in the tooltip
|
||||||
|
struct MagicEffectInfo
|
||||||
|
{
|
||||||
|
MagicEffectInfo() : mPermanent(false) {}
|
||||||
|
std::string mSource; // display name for effect source (e.g. potion name)
|
||||||
|
MWMechanics::EffectKey mKey;
|
||||||
|
int mMagnitude;
|
||||||
|
float mRemainingTime;
|
||||||
|
bool mPermanent; // the effect is permanent
|
||||||
|
};
|
||||||
|
|
||||||
|
class SpellIcons
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void updateWidgets(MyGUI::Widget* parent, bool adjustSize);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string getSpellDisplayName (const std::string& id);
|
||||||
|
ESM::EffectList getSpellEffectList (const std::string& id);
|
||||||
|
|
||||||
|
std::map<int, MyGUI::ImageBox*> mWidgetMap;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -19,6 +19,7 @@
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
#include "../mwmechanics/spellsuccess.hpp"
|
#include "../mwmechanics/spellsuccess.hpp"
|
||||||
|
|
||||||
|
#include "spellicons.hpp"
|
||||||
#include "inventorywindow.hpp"
|
#include "inventorywindow.hpp"
|
||||||
#include "confirmationdialog.hpp"
|
#include "confirmationdialog.hpp"
|
||||||
|
|
||||||
|
@ -51,6 +52,8 @@ namespace MWGui
|
||||||
, mHeight(0)
|
, mHeight(0)
|
||||||
, mWidth(0)
|
, mWidth(0)
|
||||||
{
|
{
|
||||||
|
mSpellIcons = new SpellIcons();
|
||||||
|
|
||||||
getWidget(mSpellView, "SpellView");
|
getWidget(mSpellView, "SpellView");
|
||||||
getWidget(mEffectBox, "EffectsBox");
|
getWidget(mEffectBox, "EffectsBox");
|
||||||
|
|
||||||
|
@ -61,6 +64,11 @@ namespace MWGui
|
||||||
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &SpellWindow::onWindowResize);
|
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &SpellWindow::onWindowResize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpellWindow::~SpellWindow()
|
||||||
|
{
|
||||||
|
delete mSpellIcons;
|
||||||
|
}
|
||||||
|
|
||||||
void SpellWindow::onPinToggled()
|
void SpellWindow::onPinToggled()
|
||||||
{
|
{
|
||||||
mWindowManager.setSpellVisibility(!mPinned);
|
mWindowManager.setSpellVisibility(!mPinned);
|
||||||
|
@ -73,6 +81,8 @@ namespace MWGui
|
||||||
|
|
||||||
void SpellWindow::updateSpells()
|
void SpellWindow::updateSpells()
|
||||||
{
|
{
|
||||||
|
mSpellIcons->updateWidgets(mEffectBox, false);
|
||||||
|
|
||||||
const int spellHeight = 18;
|
const int spellHeight = 18;
|
||||||
|
|
||||||
mHeight = 0;
|
mHeight = 0;
|
||||||
|
|
|
@ -5,10 +5,13 @@
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
class SpellIcons;
|
||||||
|
|
||||||
class SpellWindow : public WindowPinnableBase
|
class SpellWindow : public WindowPinnableBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SpellWindow(MWBase::WindowManager& parWindowManager);
|
SpellWindow(MWBase::WindowManager& parWindowManager);
|
||||||
|
virtual ~SpellWindow();
|
||||||
|
|
||||||
void updateSpells();
|
void updateSpells();
|
||||||
|
|
||||||
|
@ -33,6 +36,8 @@ namespace MWGui
|
||||||
|
|
||||||
virtual void onPinToggled();
|
virtual void onPinToggled();
|
||||||
virtual void open();
|
virtual void open();
|
||||||
|
|
||||||
|
SpellIcons* mSpellIcons;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
|
||||||
for (int i = 0; i < ESM::Skill::Length; ++i)
|
for (int i = 0; i < ESM::Skill::Length; ++i)
|
||||||
{
|
{
|
||||||
mSkillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
|
mSkillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
|
||||||
mSkillWidgetMap.insert(std::pair<int, MyGUI::TextBox*>(i, (MyGUI::TextBox*)nullptr));
|
mSkillWidgetMap.insert(std::pair<int, MyGUI::TextBox*>(i, (MyGUI::TextBox*)NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
||||||
|
@ -419,7 +419,7 @@ void StatsWindow::updateSkillArea()
|
||||||
{
|
{
|
||||||
mChanged = false;
|
mChanged = false;
|
||||||
|
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = mSkillWidgets.begin(); it != mSkillWidgets.end(); ++it)
|
for (std::vector<MyGUI::Widget*>::iterator it = mSkillWidgets.begin(); it != mSkillWidgets.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,11 +67,11 @@ namespace MWGui
|
||||||
SkillList mMajorSkills, mMinorSkills, mMiscSkills;
|
SkillList mMajorSkills, mMinorSkills, mMiscSkills;
|
||||||
std::map<int, MWMechanics::Stat<float> > mSkillValues;
|
std::map<int, MWMechanics::Stat<float> > mSkillValues;
|
||||||
std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
|
std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
|
||||||
std::map<std::string, MyGUI::WidgetPtr> mFactionWidgetMap;
|
std::map<std::string, MyGUI::Widget*> mFactionWidgetMap;
|
||||||
FactionList mFactions; ///< Stores a list of factions and the current rank
|
FactionList mFactions; ///< Stores a list of factions and the current rank
|
||||||
std::string mBirthSignId;
|
std::string mBirthSignId;
|
||||||
int mReputation, mBounty;
|
int mReputation, mBounty;
|
||||||
std::vector<MyGUI::WidgetPtr> mSkillWidgets; //< Skills and other information
|
std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
|
||||||
std::set<std::string> mExpelled;
|
std::set<std::string> mExpelled;
|
||||||
|
|
||||||
bool mChanged;
|
bool mChanged;
|
||||||
|
|
|
@ -13,7 +13,7 @@ TextInputDialog::TextInputDialog(MWBase::WindowManager& parWindowManager)
|
||||||
getWidget(mTextEdit, "TextEdit");
|
getWidget(mTextEdit, "TextEdit");
|
||||||
mTextEdit->eventEditSelectAccept += newDelegate(this, &TextInputDialog::onTextAccepted);
|
mTextEdit->eventEditSelectAccept += newDelegate(this, &TextInputDialog::onTextAccepted);
|
||||||
|
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TextInputDialog::onOkClicked);
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TextInputDialog::onOkClicked);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ TextInputDialog::TextInputDialog(MWBase::WindowManager& parWindowManager)
|
||||||
|
|
||||||
void TextInputDialog::setNextButtonShow(bool shown)
|
void TextInputDialog::setNextButtonShow(bool shown)
|
||||||
{
|
{
|
||||||
MyGUI::ButtonPtr okButton;
|
MyGUI::Button* okButton;
|
||||||
getWidget(okButton, "OKButton");
|
getWidget(okButton, "OKButton");
|
||||||
|
|
||||||
if (shown)
|
if (shown)
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace MWGui
|
||||||
void onTextAccepted(MyGUI::Edit* _sender);
|
void onTextAccepted(MyGUI::Edit* _sender);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::EditPtr mTextEdit;
|
MyGUI::EditBox* mTextEdit;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -127,9 +127,7 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
|
|
||||||
Widget* focus = InputManager::getInstance().getMouseFocusWidget();
|
Widget* focus = InputManager::getInstance().getMouseFocusWidget();
|
||||||
if (focus == 0)
|
if (focus == 0)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
IntSize tooltipSize;
|
IntSize tooltipSize;
|
||||||
|
|
||||||
|
@ -168,6 +166,10 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
mFocusObject = *focus->getUserData<MWWorld::Ptr>();
|
mFocusObject = *focus->getUserData<MWWorld::Ptr>();
|
||||||
tooltipSize = getToolTipViaPtr(false);
|
tooltipSize = getToolTipViaPtr(false);
|
||||||
}
|
}
|
||||||
|
else if (type == "ToolTipInfo")
|
||||||
|
{
|
||||||
|
tooltipSize = createToolTip(*focus->getUserData<MWGui::ToolTipInfo>());
|
||||||
|
}
|
||||||
else if (type == "AvatarItemSelection")
|
else if (type == "AvatarItemSelection")
|
||||||
{
|
{
|
||||||
MyGUI::IntCoord avatarPos = mWindowManager->getInventoryWindow ()->getAvatarScreenCoord ();
|
MyGUI::IntCoord avatarPos = mWindowManager->getInventoryWindow ()->getAvatarScreenCoord ();
|
||||||
|
@ -363,7 +365,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
||||||
|
|
||||||
std::string caption = info.caption;
|
std::string caption = info.caption;
|
||||||
std::string image = info.icon;
|
std::string image = info.icon;
|
||||||
int imageSize = (image != "") ? 32 : 0;
|
int imageSize = (image != "") ? info.imageSize : 0;
|
||||||
std::string text = info.text;
|
std::string text = info.text;
|
||||||
|
|
||||||
// remove the first newline (easier this way)
|
// remove the first newline (easier this way)
|
||||||
|
@ -403,7 +405,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
||||||
|
|
||||||
EditBox* captionWidget = mDynamicToolTipBox->createWidget<EditBox>("NormalText", IntCoord(0, 0, 300, 300), Align::Left | Align::Top, "ToolTipCaption");
|
EditBox* captionWidget = mDynamicToolTipBox->createWidget<EditBox>("NormalText", IntCoord(0, 0, 300, 300), Align::Left | Align::Top, "ToolTipCaption");
|
||||||
captionWidget->setProperty("Static", "true");
|
captionWidget->setProperty("Static", "true");
|
||||||
captionWidget->setCaption(caption);
|
captionWidget->setCaptionWithReplacing(caption);
|
||||||
IntSize captionSize = captionWidget->getTextSize();
|
IntSize captionSize = captionWidget->getTextSize();
|
||||||
|
|
||||||
int captionHeight = std::max(caption != "" ? captionSize.height : 0, imageSize);
|
int captionHeight = std::max(caption != "" ? captionSize.height : 0, imageSize);
|
||||||
|
@ -411,7 +413,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
||||||
EditBox* textWidget = mDynamicToolTipBox->createWidget<EditBox>("SandText", IntCoord(0, captionHeight+imageCaptionVPadding, 300, 300-captionHeight-imageCaptionVPadding), Align::Stretch, "ToolTipText");
|
EditBox* textWidget = mDynamicToolTipBox->createWidget<EditBox>("SandText", IntCoord(0, captionHeight+imageCaptionVPadding, 300, 300-captionHeight-imageCaptionVPadding), Align::Stretch, "ToolTipText");
|
||||||
textWidget->setProperty("Static", "true");
|
textWidget->setProperty("Static", "true");
|
||||||
textWidget->setProperty("MultiLine", "true");
|
textWidget->setProperty("MultiLine", "true");
|
||||||
textWidget->setProperty("WordWrap", "true");
|
textWidget->setProperty("WordWrap", info.wordWrap ? "true" : "false");
|
||||||
textWidget->setCaptionWithReplacing(text);
|
textWidget->setCaptionWithReplacing(text);
|
||||||
textWidget->setTextAlign(Align::HCenter | Align::Top);
|
textWidget->setTextAlign(Align::HCenter | Align::Top);
|
||||||
IntSize textSize = textWidget->getTextSize();
|
IntSize textSize = textWidget->getTextSize();
|
||||||
|
@ -439,7 +441,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
||||||
effectsWidget->setWindowManager(mWindowManager);
|
effectsWidget->setWindowManager(mWindowManager);
|
||||||
effectsWidget->setEffectList(info.effects);
|
effectsWidget->setEffectList(info.effects);
|
||||||
|
|
||||||
std::vector<MyGUI::WidgetPtr> effectItems;
|
std::vector<MyGUI::Widget*> effectItems;
|
||||||
effectsWidget->createEffectWidgets(effectItems, effectArea, coord, true, info.isPotion ? Widgets::MWEffectList::EF_NoTarget : 0);
|
effectsWidget->createEffectWidgets(effectItems, effectArea, coord, true, info.isPotion ? Widgets::MWEffectList::EF_NoTarget : 0);
|
||||||
totalSize.height += coord.top-6;
|
totalSize.height += coord.top-6;
|
||||||
totalSize.width = std::max(totalSize.width, coord.width);
|
totalSize.width = std::max(totalSize.width, coord.width);
|
||||||
|
@ -459,7 +461,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
||||||
enchantWidget->setWindowManager(mWindowManager);
|
enchantWidget->setWindowManager(mWindowManager);
|
||||||
enchantWidget->setEffectList(Widgets::MWEffectList::effectListFromESM(&enchant->mEffects));
|
enchantWidget->setEffectList(Widgets::MWEffectList::effectListFromESM(&enchant->mEffects));
|
||||||
|
|
||||||
std::vector<MyGUI::WidgetPtr> enchantEffectItems;
|
std::vector<MyGUI::Widget*> enchantEffectItems;
|
||||||
int flag = (enchant->mData.mType == ESM::Enchantment::ConstantEffect) ? Widgets::MWEffectList::EF_Constant : 0;
|
int flag = (enchant->mData.mType == ESM::Enchantment::ConstantEffect) ? Widgets::MWEffectList::EF_Constant : 0;
|
||||||
enchantWidget->createEffectWidgets(enchantEffectItems, enchantArea, coord, true, flag);
|
enchantWidget->createEffectWidgets(enchantEffectItems, enchantArea, coord, true, flag);
|
||||||
totalSize.height += coord.top-6;
|
totalSize.height += coord.top-6;
|
||||||
|
|
|
@ -15,11 +15,14 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
ToolTipInfo()
|
ToolTipInfo()
|
||||||
: isPotion(false)
|
: isPotion(false)
|
||||||
|
, imageSize(32)
|
||||||
|
, wordWrap(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::string caption;
|
std::string caption;
|
||||||
std::string text;
|
std::string text;
|
||||||
std::string icon;
|
std::string icon;
|
||||||
|
int imageSize;
|
||||||
|
|
||||||
// enchantment (for cloth, armor, weapons)
|
// enchantment (for cloth, armor, weapons)
|
||||||
std::string enchant;
|
std::string enchant;
|
||||||
|
@ -28,6 +31,7 @@ namespace MWGui
|
||||||
Widgets::SpellEffectList effects;
|
Widgets::SpellEffectList effects;
|
||||||
|
|
||||||
bool isPotion; // potions do not show target in the tooltip
|
bool isPotion; // potions do not show target in the tooltip
|
||||||
|
bool wordWrap;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ToolTips : public OEngine::GUI::Layout
|
class ToolTips : public OEngine::GUI::Layout
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <MyGUI_ProgressBar.h>
|
||||||
|
#include <MyGUI_ImageBox.h>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
@ -31,10 +34,10 @@ void MWGui::Widgets::fixTexturePath(std::string &path)
|
||||||
/* MWSkill */
|
/* MWSkill */
|
||||||
|
|
||||||
MWSkill::MWSkill()
|
MWSkill::MWSkill()
|
||||||
: mManager(nullptr)
|
: mManager(NULL)
|
||||||
, mSkillId(ESM::Skill::Length)
|
, mSkillId(ESM::Skill::Length)
|
||||||
, mSkillNameWidget(nullptr)
|
, mSkillNameWidget(NULL)
|
||||||
, mSkillValueWidget(nullptr)
|
, mSkillValueWidget(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +106,7 @@ void MWSkill::initialiseOverride()
|
||||||
assignWidget(mSkillNameWidget, "StatName");
|
assignWidget(mSkillNameWidget, "StatName");
|
||||||
assignWidget(mSkillValueWidget, "StatValue");
|
assignWidget(mSkillValueWidget, "StatValue");
|
||||||
|
|
||||||
MyGUI::ButtonPtr button;
|
MyGUI::Button* button;
|
||||||
assignWidget(button, "StatNameButton");
|
assignWidget(button, "StatNameButton");
|
||||||
if (button)
|
if (button)
|
||||||
{
|
{
|
||||||
|
@ -123,10 +126,10 @@ void MWSkill::initialiseOverride()
|
||||||
/* MWAttribute */
|
/* MWAttribute */
|
||||||
|
|
||||||
MWAttribute::MWAttribute()
|
MWAttribute::MWAttribute()
|
||||||
: mManager(nullptr)
|
: mManager(NULL)
|
||||||
, mId(-1)
|
, mId(-1)
|
||||||
, mAttributeNameWidget(nullptr)
|
, mAttributeNameWidget(NULL)
|
||||||
, mAttributeValueWidget(nullptr)
|
, mAttributeValueWidget(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +198,7 @@ void MWAttribute::initialiseOverride()
|
||||||
assignWidget(mAttributeNameWidget, "StatName");
|
assignWidget(mAttributeNameWidget, "StatName");
|
||||||
assignWidget(mAttributeValueWidget, "StatValue");
|
assignWidget(mAttributeValueWidget, "StatValue");
|
||||||
|
|
||||||
MyGUI::ButtonPtr button;
|
MyGUI::Button* button;
|
||||||
assignWidget(button, "StatNameButton");
|
assignWidget(button, "StatNameButton");
|
||||||
if (button)
|
if (button)
|
||||||
{
|
{
|
||||||
|
@ -215,8 +218,8 @@ void MWAttribute::initialiseOverride()
|
||||||
/* MWSpell */
|
/* MWSpell */
|
||||||
|
|
||||||
MWSpell::MWSpell()
|
MWSpell::MWSpell()
|
||||||
: mWindowManager(nullptr)
|
: mWindowManager(NULL)
|
||||||
, mSpellNameWidget(nullptr)
|
, mSpellNameWidget(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +229,7 @@ void MWSpell::setSpellId(const std::string &spellId)
|
||||||
updateWidgets();
|
updateWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, int flags)
|
void MWSpell::createEffectWidgets(std::vector<MyGUI::Widget*> &effects, MyGUI::Widget* creator, MyGUI::IntCoord &coord, int flags)
|
||||||
{
|
{
|
||||||
const MWWorld::ESMStore &store =
|
const MWWorld::ESMStore &store =
|
||||||
MWBase::Environment::get().getWorld()->getStore();
|
MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
@ -234,7 +237,7 @@ void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI:
|
||||||
const ESM::Spell *spell = store.get<ESM::Spell>().search(mId);
|
const ESM::Spell *spell = store.get<ESM::Spell>().search(mId);
|
||||||
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
|
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
|
||||||
|
|
||||||
MWSpellEffectPtr effect = nullptr;
|
MWSpellEffectPtr effect = NULL;
|
||||||
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
|
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != end; ++it)
|
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != end; ++it)
|
||||||
{
|
{
|
||||||
|
@ -286,7 +289,7 @@ MWSpell::~MWSpell()
|
||||||
/* MWEffectList */
|
/* MWEffectList */
|
||||||
|
|
||||||
MWEffectList::MWEffectList()
|
MWEffectList::MWEffectList()
|
||||||
: mWindowManager(nullptr)
|
: mWindowManager(NULL)
|
||||||
, mEffectList(0)
|
, mEffectList(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -297,11 +300,11 @@ void MWEffectList::setEffectList(const SpellEffectList& list)
|
||||||
updateWidgets();
|
updateWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWEffectList::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, bool center, int flags)
|
void MWEffectList::createEffectWidgets(std::vector<MyGUI::Widget*> &effects, MyGUI::Widget* creator, MyGUI::IntCoord &coord, bool center, int flags)
|
||||||
{
|
{
|
||||||
// We don't know the width of all the elements beforehand, so we do it in
|
// We don't know the width of all the elements beforehand, so we do it in
|
||||||
// 2 steps: first, create all widgets and check their width....
|
// 2 steps: first, create all widgets and check their width....
|
||||||
MWSpellEffectPtr effect = nullptr;
|
MWSpellEffectPtr effect = NULL;
|
||||||
int maxwidth = coord.width;
|
int maxwidth = coord.width;
|
||||||
|
|
||||||
for (SpellEffectList::iterator it=mEffectList.begin();
|
for (SpellEffectList::iterator it=mEffectList.begin();
|
||||||
|
@ -320,7 +323,7 @@ void MWEffectList::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, M
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... then adjust the size for all widgets
|
// ... then adjust the size for all widgets
|
||||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = effects.begin(); it != effects.end(); ++it)
|
for (std::vector<MyGUI::Widget*>::iterator it = effects.begin(); it != effects.end(); ++it)
|
||||||
{
|
{
|
||||||
effect = static_cast<MWSpellEffectPtr>(*it);
|
effect = static_cast<MWSpellEffectPtr>(*it);
|
||||||
bool needcenter = center && (maxwidth > effect->getRequestedWidth());
|
bool needcenter = center && (maxwidth > effect->getRequestedWidth());
|
||||||
|
@ -375,9 +378,9 @@ SpellEffectList MWEffectList::effectListFromESM(const ESM::EffectList* effects)
|
||||||
/* MWSpellEffect */
|
/* MWSpellEffect */
|
||||||
|
|
||||||
MWSpellEffect::MWSpellEffect()
|
MWSpellEffect::MWSpellEffect()
|
||||||
: mWindowManager(nullptr)
|
: mWindowManager(NULL)
|
||||||
, mImageWidget(nullptr)
|
, mImageWidget(NULL)
|
||||||
, mTextWidget(nullptr)
|
, mTextWidget(NULL)
|
||||||
, mRequestedWidth(0)
|
, mRequestedWidth(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -421,17 +424,7 @@ void MWSpellEffect::updateWidgets()
|
||||||
}
|
}
|
||||||
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute)
|
||||||
{
|
{
|
||||||
static const char *attributes[8] = {
|
spellLine += " " + mWindowManager->getGameSettingString(ESM::Attribute::sGmstAttributeIds[mEffectParams.mAttribute], "");
|
||||||
"sAttributeStrength",
|
|
||||||
"sAttributeIntelligence",
|
|
||||||
"sAttributeWillpower",
|
|
||||||
"sAttributeAgility",
|
|
||||||
"sAttributeSpeed",
|
|
||||||
"sAttributeEndurance",
|
|
||||||
"sAttributePersonality",
|
|
||||||
"sAttributeLuck"
|
|
||||||
};
|
|
||||||
spellLine += " " + mWindowManager->getGameSettingString(attributes[mEffectParams.mAttribute], "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mEffectParams.mMagnMin >= 0 || mEffectParams.mMagnMax >= 0) && !(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude))
|
if ((mEffectParams.mMagnMin >= 0 || mEffectParams.mMagnMax >= 0) && !(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude))
|
||||||
|
@ -495,9 +488,9 @@ void MWSpellEffect::initialiseOverride()
|
||||||
MWDynamicStat::MWDynamicStat()
|
MWDynamicStat::MWDynamicStat()
|
||||||
: mValue(0)
|
: mValue(0)
|
||||||
, mMax(1)
|
, mMax(1)
|
||||||
, mTextWidget(nullptr)
|
, mTextWidget(NULL)
|
||||||
, mBarWidget(nullptr)
|
, mBarWidget(NULL)
|
||||||
, mBarTextWidget(nullptr)
|
, mBarTextWidget(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,17 @@
|
||||||
#define MWGUI_WIDGETS_H
|
#define MWGUI_WIDGETS_H
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include <MyGUI.h>
|
|
||||||
|
|
||||||
#include "../mwmechanics/stat.hpp"
|
#include "../mwmechanics/stat.hpp"
|
||||||
|
|
||||||
|
#include <MyGUI_Widget.h>
|
||||||
|
#include <MyGUI_TextBox.h>
|
||||||
|
#include <MyGUI_Button.h>
|
||||||
|
|
||||||
|
namespace MyGUI
|
||||||
|
{
|
||||||
|
class ImageBox;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWBase
|
namespace MWBase
|
||||||
{
|
{
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
|
@ -118,7 +124,8 @@ namespace MWGui
|
||||||
MWBase::WindowManager *mManager;
|
MWBase::WindowManager *mManager;
|
||||||
ESM::Skill::SkillEnum mSkillId;
|
ESM::Skill::SkillEnum mSkillId;
|
||||||
SkillValue mValue;
|
SkillValue mValue;
|
||||||
MyGUI::WidgetPtr mSkillNameWidget, mSkillValueWidget;
|
MyGUI::Widget* mSkillNameWidget;
|
||||||
|
MyGUI::Widget* mSkillValueWidget;
|
||||||
};
|
};
|
||||||
typedef MWSkill* MWSkillPtr;
|
typedef MWSkill* MWSkillPtr;
|
||||||
|
|
||||||
|
@ -160,7 +167,8 @@ namespace MWGui
|
||||||
MWBase::WindowManager *mManager;
|
MWBase::WindowManager *mManager;
|
||||||
int mId;
|
int mId;
|
||||||
AttributeValue mValue;
|
AttributeValue mValue;
|
||||||
MyGUI::WidgetPtr mAttributeNameWidget, mAttributeValueWidget;
|
MyGUI::Widget* mAttributeNameWidget;
|
||||||
|
MyGUI::Widget* mAttributeValueWidget;
|
||||||
};
|
};
|
||||||
typedef MWAttribute* MWAttributePtr;
|
typedef MWAttribute* MWAttributePtr;
|
||||||
|
|
||||||
|
@ -186,7 +194,7 @@ namespace MWGui
|
||||||
* @param spell category, if this is 0, this means the spell effects are permanent and won't display e.g. duration
|
* @param spell category, if this is 0, this means the spell effects are permanent and won't display e.g. duration
|
||||||
* @param various flags, see MWEffectList::EffectFlags
|
* @param various flags, see MWEffectList::EffectFlags
|
||||||
*/
|
*/
|
||||||
void createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, int flags);
|
void createEffectWidgets(std::vector<MyGUI::Widget*> &effects, MyGUI::Widget* creator, MyGUI::IntCoord &coord, int flags);
|
||||||
|
|
||||||
const std::string &getSpellId() const { return mId; }
|
const std::string &getSpellId() const { return mId; }
|
||||||
|
|
||||||
|
@ -230,7 +238,7 @@ namespace MWGui
|
||||||
* @param center the effect widgets horizontally
|
* @param center the effect widgets horizontally
|
||||||
* @param various flags, see MWEffectList::EffectFlags
|
* @param various flags, see MWEffectList::EffectFlags
|
||||||
*/
|
*/
|
||||||
void createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, bool center, int flags);
|
void createEffectWidgets(std::vector<MyGUI::Widget*> &effects, MyGUI::Widget* creator, MyGUI::IntCoord &coord, bool center, int flags);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~MWEffectList();
|
virtual ~MWEffectList();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
#include "MyGUI_UString.h"
|
#include <MyGUI_UString.h>
|
||||||
|
|
||||||
#include <openengine/ogre/renderer.hpp>
|
#include <openengine/ogre/renderer.hpp>
|
||||||
#include <openengine/gui/manager.hpp>
|
#include <openengine/gui/manager.hpp>
|
||||||
|
@ -54,6 +54,7 @@
|
||||||
#include "imagebutton.hpp"
|
#include "imagebutton.hpp"
|
||||||
#include "exposedwindow.hpp"
|
#include "exposedwindow.hpp"
|
||||||
#include "cursor.hpp"
|
#include "cursor.hpp"
|
||||||
|
#include "spellicons.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
|
@ -270,6 +271,8 @@ void WindowManager::update()
|
||||||
mHud->setTriangleCount(mTriangleCount);
|
mHud->setTriangleCount(mTriangleCount);
|
||||||
mHud->setBatchCount(mBatchCount);
|
mHud->setBatchCount(mBatchCount);
|
||||||
|
|
||||||
|
mHud->update();
|
||||||
|
|
||||||
mCursor->update();
|
mCursor->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ namespace MWGui
|
||||||
class EnchantingDialog;
|
class EnchantingDialog;
|
||||||
class TrainingWindow;
|
class TrainingWindow;
|
||||||
class Cursor;
|
class Cursor;
|
||||||
|
class SpellIcons;
|
||||||
|
|
||||||
class WindowManager : public MWBase::WindowManager
|
class WindowManager : public MWBase::WindowManager
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
for (TIterator iter (begin()); iter!=end(); ++iter)
|
for (TIterator iter (begin()); iter!=end(); ++iter)
|
||||||
{
|
{
|
||||||
std::pair<ESM::EffectList, bool> effects = getEffectList (iter->first);
|
std::pair<ESM::EffectList, std::pair<bool, bool> > effects = getEffectList (iter->first);
|
||||||
|
|
||||||
const MWWorld::TimeStamp& start = iter->second.first;
|
const MWWorld::TimeStamp& start = iter->second.first;
|
||||||
float magnitude = iter->second.second;
|
float magnitude = iter->second.second;
|
||||||
|
@ -74,7 +74,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
int duration = iter->mDuration;
|
int duration = iter->mDuration;
|
||||||
|
|
||||||
if (effects.second)
|
if (effects.second.first)
|
||||||
duration *= magnitude;
|
duration *= magnitude;
|
||||||
|
|
||||||
MWWorld::TimeStamp end = start;
|
MWWorld::TimeStamp end = start;
|
||||||
|
@ -85,7 +85,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
EffectParam param;
|
EffectParam param;
|
||||||
|
|
||||||
if (effects.second)
|
if (effects.second.first)
|
||||||
{
|
{
|
||||||
const ESM::MagicEffect *magicEffect =
|
const ESM::MagicEffect *magicEffect =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
||||||
|
@ -113,15 +113,15 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<ESM::EffectList, bool> ActiveSpells::getEffectList (const std::string& id) const
|
std::pair<ESM::EffectList, std::pair<bool, bool> > ActiveSpells::getEffectList (const std::string& id) const
|
||||||
{
|
{
|
||||||
if (const ESM::Spell *spell =
|
if (const ESM::Spell *spell =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search (id))
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search (id))
|
||||||
return std::make_pair (spell->mEffects, false);
|
return std::make_pair (spell->mEffects, std::make_pair(false, false));
|
||||||
|
|
||||||
if (const ESM::Potion *potion =
|
if (const ESM::Potion *potion =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>().search (id))
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>().search (id))
|
||||||
return std::make_pair (potion->mEffects, false);
|
return std::make_pair (potion->mEffects, std::make_pair(false, true));
|
||||||
|
|
||||||
if (const ESM::Ingredient *ingredient =
|
if (const ESM::Ingredient *ingredient =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Ingredient>().search (id))
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Ingredient>().search (id))
|
||||||
|
@ -140,11 +140,12 @@ namespace MWMechanics
|
||||||
effect.mMagnMin = 1;
|
effect.mMagnMin = 1;
|
||||||
effect.mMagnMax = 1;
|
effect.mMagnMax = 1;
|
||||||
|
|
||||||
std::pair<ESM::EffectList, bool> result;
|
std::pair<ESM::EffectList, std::pair<bool, bool> > result;
|
||||||
|
result.second.second = true;
|
||||||
|
result.second.first = true;
|
||||||
|
|
||||||
result.first.mList.push_back (effect);
|
result.first.mList.push_back (effect);
|
||||||
result.second = true;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +158,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool ActiveSpells::addSpell (const std::string& id, const MWWorld::Ptr& actor)
|
bool ActiveSpells::addSpell (const std::string& id, const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
std::pair<ESM::EffectList, bool> effects = getEffectList (id);
|
std::pair<ESM::EffectList, std::pair<bool, bool> > effects = getEffectList (id);
|
||||||
|
bool stacks = effects.second.second;
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
@ -178,7 +180,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
float random = static_cast<float> (std::rand()) / RAND_MAX;
|
float random = static_cast<float> (std::rand()) / RAND_MAX;
|
||||||
|
|
||||||
if (effects.second)
|
if (effects.second.first)
|
||||||
{
|
{
|
||||||
// ingredient -> special treatment required.
|
// ingredient -> special treatment required.
|
||||||
const CreatureStats& creatureStats = MWWorld::Class::get (actor).getCreatureStats (actor);
|
const CreatureStats& creatureStats = MWWorld::Class::get (actor).getCreatureStats (actor);
|
||||||
|
@ -194,7 +196,7 @@ namespace MWMechanics
|
||||||
random *= 0.25 * x;
|
random *= 0.25 * x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iter==mSpells.end())
|
if (iter==mSpells.end() || stacks)
|
||||||
mSpells.insert (std::make_pair (id,
|
mSpells.insert (std::make_pair (id,
|
||||||
std::make_pair (MWBase::Environment::get().getWorld()->getTimeStamp(), random)));
|
std::make_pair (MWBase::Environment::get().getWorld()->getTimeStamp(), random)));
|
||||||
else
|
else
|
||||||
|
@ -236,7 +238,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
double ActiveSpells::timeToExpire (const TIterator& iterator) const
|
double ActiveSpells::timeToExpire (const TIterator& iterator) const
|
||||||
{
|
{
|
||||||
std::pair<ESM::EffectList, bool> effects = getEffectList (iterator->first);
|
std::pair<ESM::EffectList, std::pair<bool, bool> > effects = getEffectList (iterator->first);
|
||||||
|
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
|
|
||||||
|
@ -247,7 +249,7 @@ namespace MWMechanics
|
||||||
duration = iter->mDuration;
|
duration = iter->mDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effects.second)
|
if (effects.second.first)
|
||||||
duration *= iterator->second.second;
|
duration *= iterator->second.second;
|
||||||
|
|
||||||
double scaledDuration = duration *
|
double scaledDuration = duration *
|
||||||
|
@ -274,4 +276,9 @@ namespace MWMechanics
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ActiveSpells::TContainer& ActiveSpells::getActiveSpells() const
|
||||||
|
{
|
||||||
|
return mSpells;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef std::map<std::string, std::pair<MWWorld::TimeStamp, float> > TContainer;
|
typedef std::multimap<std::string, std::pair<MWWorld::TimeStamp, float> > TContainer;
|
||||||
typedef TContainer::const_iterator TIterator;
|
typedef TContainer::const_iterator TIterator;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -44,7 +44,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
void rebuildEffects() const;
|
void rebuildEffects() const;
|
||||||
|
|
||||||
std::pair<ESM::EffectList, bool> getEffectList (const std::string& id) const;
|
std::pair<ESM::EffectList, std::pair<bool, bool> > getEffectList (const std::string& id) const;
|
||||||
|
///< @return (EffectList, (isIngredient, stacks))
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -63,6 +64,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
const MagicEffects& getMagicEffects() const;
|
const MagicEffects& getMagicEffects() const;
|
||||||
|
|
||||||
|
const TContainer& getActiveSpells() const;
|
||||||
|
|
||||||
TIterator begin() const;
|
TIterator begin() const;
|
||||||
|
|
||||||
TIterator end() const;
|
TIterator end() const;
|
||||||
|
|
|
@ -61,10 +61,7 @@
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<!-- Spell effects box -->
|
<!-- Spell effects box -->
|
||||||
<Widget type="Button" skin="HUD_Box" position="199 168 20 20"
|
<Widget type="Widget" skin="HUD_Box_Transparent" position="199 168 20 20" align="Right Bottom" name="EffectBox">
|
||||||
align="Right Bottom" name="EffectBox">
|
|
||||||
<Widget type="ImageBox" skin="ImageBox" position="2 2 16 16" align="Left Bottom"
|
|
||||||
name="Effect1"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<!-- Cell name display when cell changes -->
|
<!-- Cell name display when cell changes -->
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
|
|
||||||
</Skin>
|
</Skin>
|
||||||
|
|
||||||
|
<Skin name="HUD_Box_Transparent" size="40 40">
|
||||||
|
<Child type="Widget" skin="MW_Box" offset="0 0 40 40" align="ALIGN_LEFT Stretch" name="Client"/>
|
||||||
|
</Skin>
|
||||||
|
|
||||||
<Skin name="HUD_Box_NoTransp" size="40 40">
|
<Skin name="HUD_Box_NoTransp" size="40 40">
|
||||||
|
|
||||||
<!-- Borders -->
|
<!-- Borders -->
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 600" name="_Main">
|
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 600" name="_Main">
|
||||||
|
|
||||||
<!-- Effect box-->
|
<!-- Effect box-->
|
||||||
<Widget type="Widget" skin="MW_Box" position="8 8 268 24" align="Left Top HStretch">
|
<Widget type="Widget" skin="MW_Box" position="8 8 268 23" align="Left Top HStretch">
|
||||||
<Widget type="Widget" skin="" position="4 4 260 16" align="Left Top Stretch" name="EffectsBox">
|
<Widget type="Widget" skin="" position="2 1 264 20" align="Left Top Stretch" name="EffectsBox">
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#include <MyGUI.h>
|
|
||||||
#include <MyGUI_OgrePlatform.h>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include "manager.hpp"
|
#include "manager.hpp"
|
||||||
|
|
||||||
|
#include <MyGUI_Gui.h>
|
||||||
|
#include <MyGUI_OgrePlatform.h>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
using namespace OEngine::GUI;
|
using namespace OEngine::GUI;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef OENGINE_MYGUI_MANAGER_H
|
#ifndef OENGINE_MYGUI_MANAGER_H
|
||||||
#define OENGINE_MYGUI_MANAGER_H
|
#define OENGINE_MYGUI_MANAGER_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace MyGUI
|
namespace MyGUI
|
||||||
{
|
{
|
||||||
class Gui;
|
class Gui;
|
||||||
|
|
Loading…
Reference in a new issue