From b89fdcfd27ef371b6e7036ec7fd400cab87a9229 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 24 Mar 2017 09:41:18 +0400 Subject: [PATCH] Vanilla style drowning widget (partially fixes bug #3801). --- apps/openmw/mwgui/hud.cpp | 5 ++-- .../mwmechanics/mechanicsmanagerimp.cpp | 3 +++ files/mygui/openmw_hud.layout | 9 ++++--- files/mygui/openmw_progress.skin.xml | 25 +++++++++++-------- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 19e032ff4..7ce2dfa8b 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -609,8 +609,9 @@ namespace MWGui if (mIsDrowning) { - float intensity = (cos(mDrowningFlashTheta) + 1.0f) / 2.0f; - mDrowningFlash->setColour(MyGUI::Colour(intensity, 0, 0)); + float intensity = (cos(mDrowningFlashTheta) + 2.0f) / 3.0f; + + mDrowningFlash->setAlpha(intensity); } } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index ca5d40b4a..0fbc5f494 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -324,6 +324,9 @@ namespace MWMechanics winMgr->setValue(fbar, stats.getFatigue()); } + // FIXME: if game is just started and actor is already drowning (on savegame loading), + // drowning bar will be hidden, because + // getTimeToStartDrowning = mWatchedTimeToStartDrowning = 0. if(stats.getTimeToStartDrowning() != mWatchedTimeToStartDrowning) { const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get() diff --git a/files/mygui/openmw_hud.layout b/files/mygui/openmw_hud.layout index 0412860ea..8fe25a5dc 100644 --- a/files/mygui/openmw_hud.layout +++ b/files/mygui/openmw_hud.layout @@ -32,18 +32,19 @@ - + - + - + + - + diff --git a/files/mygui/openmw_progress.skin.xml b/files/mygui/openmw_progress.skin.xml index 95f5b378c..67ffeca5b 100644 --- a/files/mygui/openmw_progress.skin.xml +++ b/files/mygui/openmw_progress.skin.xml @@ -39,8 +39,18 @@ - - + + + + + + + + + + + + @@ -76,19 +86,12 @@ - - + + - - - - - - -