Merge remote-tracking branch 'kunesj/master'

sceneinput
Marc Zinnschlag 10 years ago
commit 964cd44e96

@ -23,6 +23,7 @@ namespace MWWorld
{
class Ptr;
class CellStore;
class CellRef;
}
namespace Loading
@ -211,6 +212,8 @@ namespace MWBase
/// Has the player stolen this item from the given owner?
virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid) = 0;
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim) = 0;
};
}

@ -518,7 +518,21 @@ namespace MWGui
{
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)
{
mHealth->setVisible(visible);

@ -47,6 +47,7 @@ namespace MWGui
void unsetSelectedWeapon();
void setCrosshairVisible(bool visible);
void setCrosshairOwned(bool owned);
void onFrame(float dt);

@ -346,6 +346,25 @@ namespace MWGui
return tooltipSize;
}
bool ToolTips::checkOwned()
{
if(!mFocusObject.isEmpty())
{
const MWWorld::CellRef& cellref = mFocusObject.getCellRef();
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Ptr victim;
MWBase::MechanicsManager* mm = MWBase::Environment::get().getMechanicsManager();
bool allowed = mm->isAllowedToUse(ptr, cellref, victim);
return !allowed;
}
else
{
return false;
}
}
MyGUI::IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
{

@ -87,7 +87,10 @@ namespace MWGui
static void createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace);
static void createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playerClass);
static void createMagicEffectToolTip(MyGUI::Widget* widget, short id);
bool checkOwned();
/// Returns True if taking mFocusObject would be crime
private:
MyGUI::Widget* mDynamicToolTipBox;

@ -187,6 +187,7 @@ namespace MWGui
, mRestAllowed(true)
, mFPS(0.0f)
, mFallbackMap(fallbackMap)
, mShowOwned(false)
{
float uiScale = Settings::Manager::getFloat("scaling factor", "GUI");
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getTextureManager(), uiScale);
@ -261,6 +262,8 @@ namespace MWGui
MyGUI::ClipboardManager::getInstance().eventClipboardChanged += MyGUI::newDelegate(this, &WindowManager::onClipboardChanged);
MyGUI::ClipboardManager::getInstance().eventClipboardRequested += MyGUI::newDelegate(this, &WindowManager::onClipboardRequested);
mShowOwned = Settings::Manager::getBool("show owned", "Game");
}
void WindowManager::initUI()
@ -1038,6 +1041,12 @@ namespace MWGui
void WindowManager::setFocusObject(const MWWorld::Ptr& focus)
{
mToolTips->setFocusObject(focus);
if(mShowOwned && mHud)
{
bool owned = mToolTips->checkOwned();
mHud->setCrosshairOwned(owned);
}
}
void WindowManager::setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y)

@ -486,6 +486,8 @@ namespace MWGui
float mFPS;
std::map<std::string, std::string> mFallbackMap;
bool mShowOwned;
/**
* Called when MyGUI tries to retrieve a tag's value. Tags must be denoted in #{tag} notation and will be replaced upon setting a user visible text/property.

@ -175,13 +175,15 @@ namespace MWMechanics
/// Has the player stolen this item from the given owner?
virtual bool isItemStolenFrom(const std::string& itemid, const std::string& ownerid);
/// @return is \a ptr allowed to take/use \a cellref or is it a crime?
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim);
private:
void reportCrime (const MWWorld::Ptr& ptr, const MWWorld::Ptr& victim,
OffenseType type, int arg=0);
/// @return is \a ptr allowed to take/use \a cellref or is it a crime?
virtual bool isAllowedToUse (const MWWorld::Ptr& ptr, const MWWorld::CellRef& cellref, MWWorld::Ptr& victim);
};
}

@ -162,6 +162,9 @@ best attack = false
difficulty = 0
# change crosshair color when pointing on owned object
show owned = false
[Saves]
character =
# Save when resting

Loading…
Cancel
Save