mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Add enemy health bar fading and use relevant GMSTs
This commit is contained in:
parent
1910327469
commit
307b84e9f6
@ -618,6 +618,11 @@ namespace MWGui
|
||||
// Health is usually cast to int before displaying. Actors die whenever they are < 1 health.
|
||||
// Therefore any value < 1 should show as an empty health bar. We do the same in statswindow :)
|
||||
mEnemyHealth->setProgressPosition(int(stats.getHealth().getCurrent()) / stats.getHealth().getModified() * 100);
|
||||
|
||||
static const float fNPCHealthBarFade = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCHealthBarFade")->getFloat();
|
||||
if (fNPCHealthBarFade > 0.f)
|
||||
mEnemyHealth->setAlpha(std::max(0.f, std::min(1.f, mEnemyHealthTimer/fNPCHealthBarFade)));
|
||||
|
||||
}
|
||||
|
||||
void HUD::update()
|
||||
@ -639,7 +644,7 @@ namespace MWGui
|
||||
void HUD::setEnemy(const MWWorld::Ptr &enemy)
|
||||
{
|
||||
mEnemyActorId = enemy.getClass().getCreatureStats(enemy).getActorId();
|
||||
mEnemyHealthTimer = 5;
|
||||
mEnemyHealthTimer = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCHealthBarTime")->getFloat();
|
||||
if (!mEnemyHealth->getVisible())
|
||||
mWeaponSpellBox->setPosition(mWeaponSpellBox->getPosition() - MyGUI::IntPoint(0,20));
|
||||
mEnemyHealth->setVisible(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user