mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Merge remote-tracking branch 'rainChu/drowning-gauge'
This commit is contained in:
commit
c2bbbef637
@ -28,6 +28,7 @@ namespace MWGui
|
||||
, mStamina(NULL)
|
||||
, mDrowning(NULL)
|
||||
, mDrowningFrame(NULL)
|
||||
, mDrowningFlash(NULL)
|
||||
, mWeapImage(NULL)
|
||||
, mSpellImage(NULL)
|
||||
, mWeapStatus(NULL)
|
||||
@ -53,6 +54,7 @@ namespace MWGui
|
||||
, mSpellVisible(true)
|
||||
, mWorldMouseOver(false)
|
||||
, mEnemyHealthTimer(0)
|
||||
, mIsDrowning(false)
|
||||
{
|
||||
setCoord(0,0, width, height);
|
||||
|
||||
@ -75,6 +77,7 @@ namespace MWGui
|
||||
//Drowning bar
|
||||
getWidget(mDrowningFrame, "DrowningFrame");
|
||||
getWidget(mDrowning, "Drowning");
|
||||
getWidget(mDrowningFlash, "Flash");
|
||||
mDrowning->setProgressRange(200);
|
||||
|
||||
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
@ -207,7 +210,15 @@ namespace MWGui
|
||||
|
||||
void HUD::setDrowningTimeLeft(float time)
|
||||
{
|
||||
mDrowning->setProgressPosition(time/20.0*200.0);
|
||||
size_t progress = time/20.0*200.0;
|
||||
mDrowning->setProgressPosition(progress);
|
||||
|
||||
bool isDrowning = (progress == 0);
|
||||
if (isDrowning && !mIsDrowning) // Just started drowning
|
||||
mDrowningFlashTheta = 0.0f; // Start out on bright red every time.
|
||||
|
||||
mDrowningFlash->setVisible(isDrowning);
|
||||
mIsDrowning = isDrowning;
|
||||
}
|
||||
|
||||
void HUD::setDrowningBarVisible(bool visible)
|
||||
@ -367,6 +378,9 @@ namespace MWGui
|
||||
mEnemyHealth->setVisible(false);
|
||||
mWeaponSpellBox->setPosition(mWeaponSpellBox->getPosition() + MyGUI::IntPoint(0,20));
|
||||
}
|
||||
|
||||
if (mIsDrowning)
|
||||
mDrowningFlashTheta += dt * Ogre::Math::TWO_PI;
|
||||
}
|
||||
|
||||
void HUD::onResChange(int width, int height)
|
||||
@ -609,6 +623,12 @@ namespace MWGui
|
||||
mEnemyHealth->setProgressRange(100);
|
||||
mEnemyHealth->setProgressPosition(stats.getHealth().getCurrent() / stats.getHealth().getModified() * 100);
|
||||
}
|
||||
|
||||
if (mIsDrowning)
|
||||
{
|
||||
float intensity = (cos(mDrowningFlashTheta) + 1.0f) / 2.0f;
|
||||
mDrowningFlash->setColour(MyGUI::Colour(intensity, intensity, intensity));
|
||||
}
|
||||
}
|
||||
|
||||
void HUD::setEnemy(const MWWorld::Ptr &enemy)
|
||||
|
@ -67,7 +67,7 @@ namespace MWGui
|
||||
MyGUI::ImageBox* mCrosshair;
|
||||
MyGUI::TextBox* mCellNameBox;
|
||||
MyGUI::TextBox* mWeaponSpellBox;
|
||||
MyGUI::Widget* mDrowningFrame;
|
||||
MyGUI::Widget *mDrowningFrame, *mDrowningFlash;
|
||||
|
||||
MyGUI::Widget* mDummy;
|
||||
|
||||
@ -101,6 +101,9 @@ namespace MWGui
|
||||
MWWorld::Ptr mEnemy;
|
||||
float mEnemyHealthTimer;
|
||||
|
||||
bool mIsDrowning;
|
||||
float mDrowningFlashTheta;
|
||||
|
||||
void onWorldClicked(MyGUI::Widget* _sender);
|
||||
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
||||
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
||||
|
@ -45,6 +45,7 @@
|
||||
<Widget type="ProgressBar" skin="MW_Progress_Loading" position="12 36 196 8" align="Center Top" name="Drowning">
|
||||
<Property key="NeedMouse" value="false"/>
|
||||
</Widget>
|
||||
<Widget type="Widget" skin="MW_Progress_Drowning" position="14 38 192 4" align="Center Top" name="Flash"/>
|
||||
</Widget>
|
||||
|
||||
<!-- Equipped weapon/selected spell name display for a few seconds after it changes -->
|
||||
|
@ -17,6 +17,11 @@
|
||||
<State name="normal" offset="0 28 2 14"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="MW_BigTrack_Progress_Red_Small" size="2 6" texture="smallbars.png" >
|
||||
<BasisSkin type="MainSkin" offset="0 0 2 6" align="Stretch">
|
||||
<State name="normal" offset="0 0 2 8"/>
|
||||
</BasisSkin>
|
||||
</Skin>
|
||||
<Skin name="MW_BigTrack_Progress_Blue_Small" size="2 6" texture="smallbars.png" >
|
||||
<BasisSkin type="MainSkin" offset="0 0 2 6" align="Stretch">
|
||||
<State name="normal" offset="0 26 2 6"/>
|
||||
@ -65,6 +70,10 @@
|
||||
<Child type="Widget" skin="BlackBG" offset="2 2 60 2" align="Stretch" name="Client"/>
|
||||
</Skin>
|
||||
|
||||
<Skin name="MW_Progress_Drowning" size="64 6">
|
||||
<Child type="Widget" skin="MW_BigTrack_Progress_Red_Small" offset="0 0 64 6" align="Stretch"/>
|
||||
</Skin>
|
||||
|
||||
<Skin name="MW_ProgressScroll_Loading" size="64 6">
|
||||
<Property key="TrackWidth" value="1"/>
|
||||
<Property key="TrackRangeMargins" value="0 0"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user