1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge branch 'fix_hud' into 'master'

Fix HUD cleanup from main menu

See merge request OpenMW/openmw!3596
This commit is contained in:
jvoisin 2023-11-25 15:02:13 +00:00
commit 881f41cf79
2 changed files with 21 additions and 8 deletions

View File

@ -421,6 +421,7 @@ namespace MWGui
mSpellBox->setUserString("ToolTipType", "Spell"); mSpellBox->setUserString("ToolTipType", "Spell");
mSpellBox->setUserString("Spell", spellId.serialize()); mSpellBox->setUserString("Spell", spellId.serialize());
mSpellBox->setUserData(MyGUI::Any::Null);
// use the icon of the first effect // use the icon of the first effect
const ESM::MagicEffect* effect = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find( const ESM::MagicEffect* effect = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(
@ -491,6 +492,7 @@ namespace MWGui
mSpellStatus->setProgressPosition(0); mSpellStatus->setProgressPosition(0);
mSpellImage->setItem(MWWorld::Ptr()); mSpellImage->setItem(MWWorld::Ptr());
mSpellBox->clearUserStrings(); mSpellBox->clearUserStrings();
mSpellBox->setUserData(MyGUI::Any::Null);
} }
void HUD::unsetSelectedWeapon() void HUD::unsetSelectedWeapon()
@ -520,6 +522,7 @@ namespace MWGui
mWeapBox->setUserString("ToolTipLayout", "HandToHandToolTip"); mWeapBox->setUserString("ToolTipLayout", "HandToHandToolTip");
mWeapBox->setUserString("Caption_HandToHandText", itemName); mWeapBox->setUserString("Caption_HandToHandText", itemName);
mWeapBox->setUserString("ImageTexture_HandToHandImage", icon); mWeapBox->setUserString("ImageTexture_HandToHandImage", icon);
mWeapBox->setUserData(MyGUI::Any::Null);
} }
void HUD::setCrosshairVisible(bool visible) void HUD::setCrosshairVisible(bool visible)
@ -650,17 +653,28 @@ namespace MWGui
updateEnemyHealthBar(); updateEnemyHealthBar();
} }
void HUD::resetEnemy() void HUD::clear()
{ {
mEnemyActorId = -1; mEnemyActorId = -1;
mEnemyHealthTimer = -1; mEnemyHealthTimer = -1;
}
void HUD::clear() mWeaponSpellTimer = 0.f;
{ mWeaponName = std::string();
unsetSelectedSpell(); mSpellName = std::string();
unsetSelectedWeapon(); mWeaponSpellBox->setVisible(false);
resetEnemy();
mWeapStatus->setProgressRange(100);
mWeapStatus->setProgressPosition(0);
mSpellStatus->setProgressRange(100);
mSpellStatus->setProgressPosition(0);
mWeapImage->setItem(MWWorld::Ptr());
mSpellImage->setItem(MWWorld::Ptr());
mWeapBox->clearUserStrings();
mWeapBox->setUserData(MyGUI::Any::Null);
mSpellBox->clearUserStrings();
mSpellBox->setUserData(MyGUI::Any::Null);
} }
void HUD::customMarkerCreated(MyGUI::Widget* marker) void HUD::customMarkerCreated(MyGUI::Widget* marker)

View File

@ -58,7 +58,6 @@ namespace MWGui
MyGUI::Widget* getEffectBox() { return mEffectBox; } MyGUI::Widget* getEffectBox() { return mEffectBox; }
void setEnemy(const MWWorld::Ptr& enemy); void setEnemy(const MWWorld::Ptr& enemy);
void resetEnemy();
void clear() override; void clear() override;