|
|
|
@ -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);
|
|
|
|
|