mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 19:36:43 +00:00
change collor of crosshair
This commit is contained in:
parent
72728b9c01
commit
66edae9b93
7 changed files with 47 additions and 17 deletions
|
@ -219,6 +219,7 @@ namespace MWBase
|
||||||
virtual void unsetSelectedWeapon() = 0;
|
virtual void unsetSelectedWeapon() = 0;
|
||||||
|
|
||||||
virtual void showCrosshair(bool show) = 0;
|
virtual void showCrosshair(bool show) = 0;
|
||||||
|
virtual void setCrosshairOwned(bool owned) = 0;
|
||||||
virtual bool getSubtitlesEnabled() = 0;
|
virtual bool getSubtitlesEnabled() = 0;
|
||||||
virtual bool toggleGui() = 0;
|
virtual bool toggleGui() = 0;
|
||||||
|
|
||||||
|
|
|
@ -519,6 +519,20 @@ namespace MWGui
|
||||||
mCrosshair->setVisible (visible);
|
mCrosshair->setVisible (visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HUD::setCrosshairOwned(bool owned)
|
||||||
|
{
|
||||||
|
MyGUI::Colour red = MyGUI::Colour(1.0, 0, 0);
|
||||||
|
MyGUI::Colour white = MyGUI::Colour(1.0, 1.0, 1.0);
|
||||||
|
if(owned)
|
||||||
|
{
|
||||||
|
mCrosshair->setColour(red);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCrosshair->setColour(white);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HUD::setHmsVisible(bool visible)
|
void HUD::setHmsVisible(bool visible)
|
||||||
{
|
{
|
||||||
mHealth->setVisible(visible);
|
mHealth->setVisible(visible);
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace MWGui
|
||||||
void unsetSelectedWeapon();
|
void unsetSelectedWeapon();
|
||||||
|
|
||||||
void setCrosshairVisible(bool visible);
|
void setCrosshairVisible(bool visible);
|
||||||
|
void setCrosshairOwned(bool owned);
|
||||||
|
|
||||||
void onFrame(float dt);
|
void onFrame(float dt);
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,10 @@ namespace MWGui
|
||||||
tooltipSize.height);
|
tooltipSize.height);
|
||||||
|
|
||||||
mDynamicToolTipBox->setVisible(true);
|
mDynamicToolTipBox->setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkOwned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +347,17 @@ namespace MWGui
|
||||||
info.icon = "";
|
info.icon = "";
|
||||||
tooltipSize = createToolTip(info);
|
tooltipSize = createToolTip(info);
|
||||||
|
|
||||||
// start owned check
|
}
|
||||||
|
|
||||||
|
return tooltipSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToolTips::checkOwned()
|
||||||
|
{
|
||||||
|
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
||||||
|
|
||||||
|
if(!mFocusObject.isEmpty())
|
||||||
|
{
|
||||||
MWWorld::CellRef& cellref = mFocusObject.getCellRef();
|
MWWorld::CellRef& cellref = mFocusObject.getCellRef();
|
||||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
MWWorld::Ptr victim;
|
MWWorld::Ptr victim;
|
||||||
|
@ -352,21 +365,12 @@ namespace MWGui
|
||||||
MWMechanics::MechanicsManager* mm = new MWMechanics::MechanicsManager;
|
MWMechanics::MechanicsManager* mm = new MWMechanics::MechanicsManager;
|
||||||
bool allowed = mm->isAllowedToUse(ptr, cellref, victim); // 0 - owned, 1 - not owned
|
bool allowed = mm->isAllowedToUse(ptr, cellref, victim); // 0 - owned, 1 - not owned
|
||||||
|
|
||||||
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
wm->setCrosshairOwned(!allowed);
|
||||||
if(allowed)
|
}
|
||||||
{
|
else
|
||||||
// if 'item' is not owned
|
{
|
||||||
wm->showCrosshair(true);
|
wm->setCrosshairOwned(false);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// if 'item' is owned
|
|
||||||
wm->showCrosshair(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tooltipSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
MyGUI::IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
||||||
|
|
|
@ -96,6 +96,9 @@ namespace MWGui
|
||||||
MyGUI::IntSize getToolTipViaPtr (bool image=true);
|
MyGUI::IntSize getToolTipViaPtr (bool image=true);
|
||||||
///< @return requested tooltip size
|
///< @return requested tooltip size
|
||||||
|
|
||||||
|
void checkOwned();
|
||||||
|
/// Checks if object is owned and sets correct crosshair mode
|
||||||
|
|
||||||
MyGUI::IntSize createToolTip(const ToolTipInfo& info);
|
MyGUI::IntSize createToolTip(const ToolTipInfo& info);
|
||||||
///< @return requested tooltip size
|
///< @return requested tooltip size
|
||||||
|
|
||||||
|
|
|
@ -1424,6 +1424,12 @@ namespace MWGui
|
||||||
mHud->setCrosshairVisible (show && mCrosshairEnabled);
|
mHud->setCrosshairVisible (show && mCrosshairEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::setCrosshairOwned (bool owned)
|
||||||
|
{
|
||||||
|
if (mHud)
|
||||||
|
mHud->setCrosshairOwned (owned);
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::activateQuickKey (int index)
|
void WindowManager::activateQuickKey (int index)
|
||||||
{
|
{
|
||||||
mQuickKeysMenu->activateQuickKey(index);
|
mQuickKeysMenu->activateQuickKey(index);
|
||||||
|
|
|
@ -233,6 +233,7 @@ namespace MWGui
|
||||||
virtual void unsetSelectedWeapon();
|
virtual void unsetSelectedWeapon();
|
||||||
|
|
||||||
virtual void showCrosshair(bool show);
|
virtual void showCrosshair(bool show);
|
||||||
|
virtual void setCrosshairOwned(bool owned);
|
||||||
virtual bool getSubtitlesEnabled();
|
virtual bool getSubtitlesEnabled();
|
||||||
|
|
||||||
/// Turn visibility of *all* GUI elements on or off (HUD and all windows, except the console)
|
/// Turn visibility of *all* GUI elements on or off (HUD and all windows, except the console)
|
||||||
|
|
Loading…
Reference in a new issue