mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 10:23:53 +00:00
Merge branch 'master' into gui
This commit is contained in:
commit
d91129ed49
3 changed files with 108 additions and 28 deletions
|
@ -31,13 +31,10 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
{
|
{
|
||||||
/// \todo Store a MWWorld::Ptr in the widget user data, retrieve it here and construct a tooltip dynamically
|
/// \todo Store a MWWorld::Ptr in the widget user data, retrieve it here and construct a tooltip dynamically
|
||||||
|
|
||||||
/// \todo we are destroying/creating the tooltip widgets every frame here,
|
MyGUI::Gui::getInstance().destroyWidget(mDynamicToolTipBox);
|
||||||
/// because the tooltip might change (e.g. when trap is activated)
|
mDynamicToolTipBox = mMainWidget->createWidget<Widget>("HUD_Box",
|
||||||
/// is there maybe a better way (listener when the object changes)?
|
IntCoord(0, 0, mMainWidget->getCoord().width, mMainWidget->getCoord().height),
|
||||||
for (size_t i=0; i<mDynamicToolTipBox->getChildCount(); ++i)
|
Align::Stretch, "DynamicToolTipBox");
|
||||||
{
|
|
||||||
mDynamicToolTipBox->_destroyChildWidget(mDynamicToolTipBox->getChildAt(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
const IntSize &viewSize = RenderManager::getInstance().getViewSize();
|
const IntSize &viewSize = RenderManager::getInstance().getViewSize();
|
||||||
|
|
||||||
|
@ -56,7 +53,6 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
std::string text = focus->getUserString("ToolTipText");
|
std::string text = focus->getUserString("ToolTipText");
|
||||||
|
|
||||||
ToolTipInfo info;
|
ToolTipInfo info;
|
||||||
|
|
||||||
if (type == "")
|
if (type == "")
|
||||||
{
|
{
|
||||||
mDynamicToolTipBox->setVisible(false);
|
mDynamicToolTipBox->setVisible(false);
|
||||||
|
@ -64,7 +60,7 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
}
|
}
|
||||||
else if (type == "Text")
|
else if (type == "Text")
|
||||||
{
|
{
|
||||||
info.caption = text;
|
info.text = text;
|
||||||
}
|
}
|
||||||
else if (type == "CaptionText")
|
else if (type == "CaptionText")
|
||||||
{
|
{
|
||||||
|
@ -200,8 +196,8 @@ IntSize ToolTips::createToolTip(const ToolTipInfo& info)
|
||||||
|
|
||||||
const IntPoint padding(8, 8);
|
const IntPoint padding(8, 8);
|
||||||
|
|
||||||
const int imageCaptionHPadding = 8;
|
const int imageCaptionHPadding = (caption != "" ? 8 : 0);
|
||||||
const int imageCaptionVPadding = 4;
|
const int imageCaptionVPadding = (caption != "" ? 4 : 0);
|
||||||
|
|
||||||
std::string realImage = "icons\\" + image;
|
std::string realImage = "icons\\" + image;
|
||||||
findImageExtension(realImage);
|
findImageExtension(realImage);
|
||||||
|
@ -211,7 +207,7 @@ IntSize ToolTips::createToolTip(const ToolTipInfo& info)
|
||||||
captionWidget->setCaption(caption);
|
captionWidget->setCaption(caption);
|
||||||
IntSize captionSize = captionWidget->getTextSize();
|
IntSize captionSize = captionWidget->getTextSize();
|
||||||
|
|
||||||
int captionHeight = std::max(captionSize.height, imageSize);
|
int captionHeight = std::max(caption != "" ? captionSize.height : 0, imageSize);
|
||||||
|
|
||||||
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");
|
||||||
|
|
|
@ -356,18 +356,6 @@ void MWSpellEffect::updateWidgets()
|
||||||
if (!mWindowManager)
|
if (!mWindowManager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// lists effects that have no magnitude (e.g. invisiblity)
|
|
||||||
/// \todo this list is probably incomplete
|
|
||||||
std::vector<std::string> effectsWithoutMagnitude;
|
|
||||||
effectsWithoutMagnitude.push_back("sEffectInvisibility");
|
|
||||||
effectsWithoutMagnitude.push_back("sEffectStuntedMagicka");
|
|
||||||
effectsWithoutMagnitude.push_back("sEffectParalyze");
|
|
||||||
|
|
||||||
// lists effects that have no duration (e.g. open lock)
|
|
||||||
/// \todo this list is probably incomplete
|
|
||||||
std::vector<std::string> effectsWithoutDuration;
|
|
||||||
effectsWithoutDuration.push_back("sEffectOpen");
|
|
||||||
|
|
||||||
const ESMS::ESMStore &store = mWindowManager->getStore();
|
const ESMS::ESMStore &store = mWindowManager->getStore();
|
||||||
const ESM::MagicEffect *magicEffect = store.magicEffects.search(effect.effectID);
|
const ESM::MagicEffect *magicEffect = store.magicEffects.search(effect.effectID);
|
||||||
if (textWidget)
|
if (textWidget)
|
||||||
|
@ -401,8 +389,7 @@ void MWSpellEffect::updateWidgets()
|
||||||
spellLine += " " + mWindowManager->getGameSettingString(attributes[effect.attribute], "");
|
spellLine += " " + mWindowManager->getGameSettingString(attributes[effect.attribute], "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasMagnitude = (std::find(effectsWithoutMagnitude.begin(), effectsWithoutMagnitude.end(), effectIDStr) == effectsWithoutMagnitude.end());
|
if ((effect.magnMin >= 0 || effect.magnMax >= 0) && effectHasMagnitude(effectIDStr))
|
||||||
if ((effect.magnMin >= 0 || effect.magnMax >= 0) && hasMagnitude)
|
|
||||||
{
|
{
|
||||||
if (effect.magnMin == effect.magnMax)
|
if (effect.magnMin == effect.magnMax)
|
||||||
spellLine += " " + boost::lexical_cast<std::string>(effect.magnMin) + " " + ((effect.magnMin == 1) ? pt : pts);
|
spellLine += " " + boost::lexical_cast<std::string>(effect.magnMin) + " " + ((effect.magnMin == 1) ? pt : pts);
|
||||||
|
@ -415,8 +402,7 @@ void MWSpellEffect::updateWidgets()
|
||||||
// constant effects have no duration and no target
|
// constant effects have no duration and no target
|
||||||
if (!(mFlags & MWEffectList::EF_Constant))
|
if (!(mFlags & MWEffectList::EF_Constant))
|
||||||
{
|
{
|
||||||
bool hasDuration = (std::find(effectsWithoutDuration.begin(), effectsWithoutDuration.end(), effectIDStr) == effectsWithoutDuration.end());
|
if (effect.duration >= 0 && effectHasDuration(effectIDStr))
|
||||||
if (effect.duration >= 0 && hasDuration)
|
|
||||||
{
|
{
|
||||||
spellLine += " " + mWindowManager->getGameSettingString("sfor", "") + " " + boost::lexical_cast<std::string>(effect.duration) + ((effect.duration == 1) ? sec : secs);
|
spellLine += " " + mWindowManager->getGameSettingString("sfor", "") + " " + boost::lexical_cast<std::string>(effect.duration) + ((effect.duration == 1) ? sec : secs);
|
||||||
}
|
}
|
||||||
|
@ -590,11 +576,107 @@ std::string MWSpellEffect::effectIDToString(const short effectID)
|
||||||
names[35] ="sEffectWeaknesstoPoison";
|
names[35] ="sEffectWeaknesstoPoison";
|
||||||
names[30] ="sEffectWeaknesstoShock";
|
names[30] ="sEffectWeaknesstoShock";
|
||||||
|
|
||||||
|
// bloodmoon
|
||||||
|
names[138] ="sEffectSummonCreature01";
|
||||||
|
names[139] ="sEffectSummonCreature02";
|
||||||
|
names[140] ="sEffectSummonCreature03";
|
||||||
|
names[141] ="sEffectSummonCreature04";
|
||||||
|
names[142] ="sEffectSummonCreature05";
|
||||||
|
|
||||||
|
// tribunal
|
||||||
|
names[137] ="sEffectSummonFabricant";
|
||||||
|
|
||||||
assert(names.find(effectID) != names.end() && "Unimplemented effect type");
|
assert(names.find(effectID) != names.end() && "Unimplemented effect type");
|
||||||
|
|
||||||
return names[effectID];
|
return names[effectID];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MWSpellEffect::effectHasDuration(const std::string& effect)
|
||||||
|
{
|
||||||
|
// lists effects that have no duration (e.g. open lock)
|
||||||
|
std::vector<std::string> effectsWithoutDuration;
|
||||||
|
effectsWithoutDuration.push_back("sEffectOpen");
|
||||||
|
effectsWithoutDuration.push_back("sEffectLock");
|
||||||
|
effectsWithoutDuration.push_back("sEffectDispel");
|
||||||
|
effectsWithoutDuration.push_back("sEffectSunDamage");
|
||||||
|
effectsWithoutDuration.push_back("sEffectCorpus");
|
||||||
|
effectsWithoutDuration.push_back("sEffectVampirism");
|
||||||
|
effectsWithoutDuration.push_back("sEffectMark");
|
||||||
|
effectsWithoutDuration.push_back("sEffectRecall");
|
||||||
|
effectsWithoutDuration.push_back("sEffectDivineIntervention");
|
||||||
|
effectsWithoutDuration.push_back("sEffectAlmsiviIntervention");
|
||||||
|
effectsWithoutDuration.push_back("sEffectCureCommonDisease");
|
||||||
|
effectsWithoutDuration.push_back("sEffectCureBlightDisease");
|
||||||
|
effectsWithoutDuration.push_back("sEffectCureCorprusDisease");
|
||||||
|
effectsWithoutDuration.push_back("sEffectCurePoison");
|
||||||
|
effectsWithoutDuration.push_back("sEffectCureParalyzation");
|
||||||
|
effectsWithoutDuration.push_back("sEffectRemoveCurse");
|
||||||
|
effectsWithoutDuration.push_back("sEffectRestoreAttribute");
|
||||||
|
|
||||||
|
return (std::find(effectsWithoutDuration.begin(), effectsWithoutDuration.end(), effect) == effectsWithoutDuration.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MWSpellEffect::effectHasMagnitude(const std::string& effect)
|
||||||
|
{
|
||||||
|
// lists effects that have no magnitude (e.g. invisiblity)
|
||||||
|
std::vector<std::string> effectsWithoutMagnitude;
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectInvisibility");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectStuntedMagicka");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectParalyze");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSoultrap");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSilence");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectParalyze");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectInvisibility");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectWaterWalking");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectWaterBreathing");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonScamp");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonClannfear");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonDaedroth");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonDremora");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonAncestralGhost");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonSkeletalMinion");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonBonewalker");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonGreaterBonewalker");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonBonelord");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonWingedTwilight");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonHunger");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonGoldenSaint");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonFlameAtronach");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonFrostAtronach");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonStormAtronach");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonCenturionSphere");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundDagger");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundLongsword");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundMace");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundBattleAxe");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundSpear");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundLongbow");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundCuirass");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundHelm");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundBoots");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundShield");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectBoundGloves");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectStuntedMagicka");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectMark");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectRecall");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectDivineIntervention");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectAlmsiviIntervention");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectCureCommonDisease");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectCureBlightDisease");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectCureCorprusDisease");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectCurePoison");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectCureParalyzation");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectRemoveCurse");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonCreature01");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonCreature02");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonCreature03");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonCreature04");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonCreature05");
|
||||||
|
effectsWithoutMagnitude.push_back("sEffectSummonFabricant");
|
||||||
|
|
||||||
|
return (std::find(effectsWithoutMagnitude.begin(), effectsWithoutMagnitude.end(), effect) == effectsWithoutMagnitude.end());
|
||||||
|
}
|
||||||
|
|
||||||
MWSpellEffect::~MWSpellEffect()
|
MWSpellEffect::~MWSpellEffect()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,8 @@ namespace MWGui
|
||||||
void setFlags(int flags) { mFlags = flags; }
|
void setFlags(int flags) { mFlags = flags; }
|
||||||
|
|
||||||
std::string effectIDToString(const short effectID);
|
std::string effectIDToString(const short effectID);
|
||||||
|
bool effectHasMagnitude (const std::string& effect);
|
||||||
|
bool effectHasDuration (const std::string& effect);
|
||||||
|
|
||||||
const SpellEffectValue &getSpellEffect() const { return effect; }
|
const SpellEffectValue &getSpellEffect() const { return effect; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue