2014-03-16 23:38:51 +01:00
|
|
|
#ifndef OPENMW_GAME_MWGUI_HUD_H
|
|
|
|
#define OPENMW_GAME_MWGUI_HUD_H
|
|
|
|
|
2022-08-31 18:03:46 +02:00
|
|
|
#include <memory>
|
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
#include "mapwindow.hpp"
|
2022-09-01 17:20:15 +02:00
|
|
|
#include "spellicons.hpp"
|
2020-06-05 18:22:53 +04:00
|
|
|
#include "statswatcher.hpp"
|
2015-01-10 03:56:06 +01:00
|
|
|
|
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
2012-05-13 18:14:03 +02:00
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2012-05-13 18:35:56 +02:00
|
|
|
class DragAndDrop;
|
2014-06-05 22:13:18 +02:00
|
|
|
class ItemWidget;
|
2019-01-24 22:16:42 +04:00
|
|
|
class SpellWidget;
|
2012-05-13 18:35:56 +02:00
|
|
|
|
2020-06-05 18:22:53 +04:00
|
|
|
class HUD : public WindowBase, public LocalMapBase, public StatsListener
|
2012-05-13 18:14:03 +02:00
|
|
|
{
|
|
|
|
public:
|
2015-11-07 00:13:13 +01:00
|
|
|
HUD(CustomMarkerCollection& customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender);
|
2013-03-03 12:01:19 +01:00
|
|
|
virtual ~HUD();
|
2022-10-02 23:16:43 +02:00
|
|
|
void setValue(std::string_view id, const MWMechanics::DynamicStat<float>& value) override;
|
2012-08-27 19:18:55 +02:00
|
|
|
|
2013-08-07 15:34:11 +02:00
|
|
|
/// Set time left for the player to start drowning
|
2014-04-27 04:27:26 +02:00
|
|
|
/// @param time time left to start drowning
|
|
|
|
/// @param maxTime how long we can be underwater (in total) until drowning starts
|
|
|
|
void setDrowningTimeLeft(float time, float maxTime);
|
2013-08-07 15:34:11 +02:00
|
|
|
void setDrowningBarVisible(bool visible);
|
|
|
|
|
2012-08-27 19:18:55 +02:00
|
|
|
void setHmsVisible(bool visible);
|
|
|
|
void setWeapVisible(bool visible);
|
|
|
|
void setSpellVisible(bool visible);
|
2013-08-03 02:43:56 +02:00
|
|
|
void setSneakVisible(bool visible);
|
2012-08-27 19:18:55 +02:00
|
|
|
|
|
|
|
void setEffectVisible(bool visible);
|
|
|
|
void setMinimapVisible(bool visible);
|
|
|
|
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
void setSelectedSpell(const ESM::RefId& spellId, int successChancePercent);
|
2012-05-29 18:33:01 +02:00
|
|
|
void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent);
|
2017-02-15 00:55:35 +01:00
|
|
|
const MWWorld::Ptr& getSelectedEnchantItem();
|
2012-05-29 18:33:01 +02:00
|
|
|
void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent);
|
|
|
|
void unsetSelectedSpell();
|
|
|
|
void unsetSelectedWeapon();
|
|
|
|
|
2012-08-27 19:18:55 +02:00
|
|
|
void setCrosshairVisible(bool visible);
|
2015-07-17 17:29:00 +02:00
|
|
|
void setCrosshairOwned(bool owned);
|
2012-08-27 19:18:55 +02:00
|
|
|
|
2020-07-04 10:36:02 +04:00
|
|
|
void onFrame(float dt) override;
|
2012-05-26 23:06:15 +02:00
|
|
|
|
|
|
|
void setCellName(const std::string& cellName);
|
|
|
|
|
2012-06-02 12:25:24 +02:00
|
|
|
bool getWorldMouseOver() { return mWorldMouseOver; }
|
|
|
|
|
2013-03-03 12:01:19 +01:00
|
|
|
MyGUI::Widget* getEffectBox() { return mEffectBox; }
|
|
|
|
|
2013-07-30 06:00:20 +02:00
|
|
|
void setEnemy(const MWWorld::Ptr& enemy);
|
2014-04-23 19:49:09 +02:00
|
|
|
void resetEnemy();
|
2013-07-30 06:00:20 +02:00
|
|
|
|
2020-07-04 10:36:02 +04:00
|
|
|
void clear() override;
|
2017-09-23 22:16:56 +02:00
|
|
|
|
2012-08-27 19:18:55 +02:00
|
|
|
private:
|
2013-08-07 15:34:11 +02:00
|
|
|
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning;
|
2012-05-29 15:36:48 +02:00
|
|
|
MyGUI::Widget* mHealthFrame;
|
2013-08-03 02:43:56 +02:00
|
|
|
MyGUI::Widget *mWeapBox, *mSpellBox, *mSneakBox;
|
2019-01-24 22:16:42 +04:00
|
|
|
ItemWidget* mWeapImage;
|
|
|
|
SpellWidget* mSpellImage;
|
2013-07-30 06:00:20 +02:00
|
|
|
MyGUI::ProgressBar *mWeapStatus, *mSpellStatus;
|
2012-07-13 03:51:58 -07:00
|
|
|
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
2012-08-28 17:30:34 +02:00
|
|
|
MyGUI::Button* mMinimapButton;
|
2012-07-13 03:51:58 -07:00
|
|
|
MyGUI::ScrollView* mMinimap;
|
|
|
|
MyGUI::ImageBox* mCrosshair;
|
2012-05-26 23:06:15 +02:00
|
|
|
MyGUI::TextBox* mCellNameBox;
|
2012-05-29 18:33:01 +02:00
|
|
|
MyGUI::TextBox* mWeaponSpellBox;
|
2021-12-02 17:01:40 +00:00
|
|
|
MyGUI::Widget *mDrowningBar, *mDrowningFrame, *mDrowningFlash;
|
2012-05-13 18:14:03 +02:00
|
|
|
|
|
|
|
// bottom left elements
|
2013-08-03 02:43:56 +02:00
|
|
|
int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft, mSneakBoxBaseLeft;
|
2012-05-13 18:14:03 +02:00
|
|
|
// bottom right elements
|
2012-07-13 03:51:58 -07:00
|
|
|
int mMinimapBoxBaseRight, mEffectBoxBaseRight;
|
2012-05-13 18:35:56 +02:00
|
|
|
|
|
|
|
DragAndDrop* mDragAndDrop;
|
|
|
|
|
2012-05-26 23:06:15 +02:00
|
|
|
std::string mCellName;
|
|
|
|
float mCellNameTimer;
|
|
|
|
|
2012-05-29 18:33:01 +02:00
|
|
|
std::string mWeaponName;
|
|
|
|
std::string mSpellName;
|
|
|
|
float mWeaponSpellTimer;
|
|
|
|
|
2012-05-28 12:34:29 +02:00
|
|
|
bool mMapVisible;
|
2012-05-29 18:59:11 +02:00
|
|
|
bool mWeaponVisible;
|
|
|
|
bool mSpellVisible;
|
2012-05-28 12:34:29 +02:00
|
|
|
|
2012-06-02 12:25:24 +02:00
|
|
|
bool mWorldMouseOver;
|
|
|
|
|
2022-08-31 18:03:46 +02:00
|
|
|
std::unique_ptr<SpellIcons> mSpellIcons;
|
2013-03-03 12:01:19 +01:00
|
|
|
|
2014-07-23 22:04:18 +02:00
|
|
|
int mEnemyActorId;
|
2013-07-30 06:00:20 +02:00
|
|
|
float mEnemyHealthTimer;
|
|
|
|
|
2013-10-27 04:05:01 -04:00
|
|
|
bool mIsDrowning;
|
|
|
|
float mDrowningFlashTheta;
|
|
|
|
|
2012-05-13 18:35:56 +02:00
|
|
|
void onWorldClicked(MyGUI::Widget* _sender);
|
2012-05-15 16:47:23 +02:00
|
|
|
void onWorldMouseOver(MyGUI::Widget* _sender, int x, int y);
|
2012-05-17 14:13:35 +02:00
|
|
|
void onWorldMouseLostFocus(MyGUI::Widget* _sender, MyGUI::Widget* _new);
|
2012-05-26 21:09:21 +02:00
|
|
|
void onHMSClicked(MyGUI::Widget* _sender);
|
|
|
|
void onWeaponClicked(MyGUI::Widget* _sender);
|
|
|
|
void onMagicClicked(MyGUI::Widget* _sender);
|
|
|
|
void onMapClicked(MyGUI::Widget* _sender);
|
2012-08-27 19:18:55 +02:00
|
|
|
|
2015-02-20 00:00:13 +01:00
|
|
|
// LocalMapBase
|
2020-10-16 22:18:54 +04:00
|
|
|
void customMarkerCreated(MyGUI::Widget* marker) override;
|
|
|
|
void doorMarkerCreated(MyGUI::Widget* marker) override;
|
2015-02-20 00:00:13 +01:00
|
|
|
|
2014-03-15 20:48:54 +01:00
|
|
|
void updateEnemyHealthBar();
|
|
|
|
|
2012-08-27 19:18:55 +02:00
|
|
|
void updatePositions();
|
2012-05-13 18:14:03 +02:00
|
|
|
};
|
|
|
|
}
|
2014-03-16 23:38:51 +01:00
|
|
|
|
|
|
|
#endif
|