forked from mirror/openmw-tes3mp
Feature #535: Console object selection improvements
This commit is contained in:
parent
4711135e7f
commit
a07c910d0b
5 changed files with 43 additions and 4 deletions
|
@ -91,6 +91,8 @@ namespace MWBase
|
|||
|
||||
virtual bool isGuiMode() const = 0;
|
||||
|
||||
virtual bool isConsoleMode() const = 0;
|
||||
|
||||
virtual void toggleVisible (MWGui::GuiWindow wnd) = 0;
|
||||
|
||||
/// Disallow all inventory mode windows
|
||||
|
|
|
@ -81,8 +81,33 @@ void ToolTips::onFrame(float frameDuration)
|
|||
{
|
||||
const MyGUI::IntPoint& mousePos = InputManager::getInstance().getMousePosition();
|
||||
|
||||
if (mWindowManager->getWorldMouseOver() && ((mWindowManager->getMode() == GM_Console)
|
||||
|| (mWindowManager->getMode() == GM_Container)
|
||||
if (mWindowManager->getWorldMouseOver() && (mWindowManager->getMode() == GM_Console))
|
||||
{
|
||||
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
|
||||
if (!object.isEmpty())
|
||||
{
|
||||
setCoord(0, 0, 300, 300);
|
||||
mDynamicToolTipBox->setVisible(true);
|
||||
ToolTipInfo info;
|
||||
info.caption=object.getCellRef().mRefID;
|
||||
info.icon="";
|
||||
IntSize tooltipSize = createToolTip(info);
|
||||
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);
|
||||
|
||||
if ((tooltipPosition.left + tooltipSize.width) > viewSize.width)
|
||||
{
|
||||
tooltipPosition.left = viewSize.width - tooltipSize.width;
|
||||
}
|
||||
if ((tooltipPosition.top + tooltipSize.height) > viewSize.height)
|
||||
{
|
||||
tooltipPosition.top = viewSize.height - tooltipSize.height;
|
||||
}
|
||||
|
||||
setCoord(tooltipPosition.left, tooltipPosition.top, tooltipSize.width, tooltipSize.height);
|
||||
}
|
||||
}
|
||||
|
||||
if (mWindowManager->getWorldMouseOver() && ((mWindowManager->getMode() == GM_Container)
|
||||
|| (mWindowManager->getMode() == GM_Inventory)))
|
||||
{
|
||||
mFocusObject = MWBase::Environment::get().getWorld()->getFacedObject();
|
||||
|
@ -90,7 +115,7 @@ void ToolTips::onFrame(float frameDuration)
|
|||
if (mFocusObject.isEmpty ())
|
||||
return;
|
||||
|
||||
MyGUI::IntSize tooltipSize = getToolTipViaPtr(true);
|
||||
IntSize tooltipSize = getToolTipViaPtr(true);
|
||||
|
||||
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);
|
||||
|
||||
|
|
|
@ -1020,6 +1020,13 @@ bool WindowManager::isGuiMode() const
|
|||
return !mGuiModes.empty();
|
||||
}
|
||||
|
||||
bool WindowManager::isConsoleMode() const
|
||||
{
|
||||
if (mGuiModes.back()==GM_Console)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
MWGui::GuiMode WindowManager::getMode() const
|
||||
{
|
||||
if (mGuiModes.empty())
|
||||
|
|
|
@ -102,6 +102,8 @@ namespace MWGui
|
|||
|
||||
virtual bool isGuiMode() const;
|
||||
|
||||
virtual bool isConsoleMode() const;
|
||||
|
||||
virtual void toggleVisible(GuiWindow wnd);
|
||||
|
||||
// Disallow all inventory mode windows
|
||||
|
|
|
@ -671,11 +671,12 @@ namespace MWWorld
|
|||
return MWWorld::Ptr ();
|
||||
|
||||
MWWorld::Ptr object = searchPtrViaHandle (result.second);
|
||||
|
||||
float ActivationDistance;
|
||||
|
||||
if (object.getTypeName ().find("NPC") != std::string::npos)
|
||||
ActivationDistance = getNpcActivationDistance ();
|
||||
else if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||
ActivationDistance = getObjectActivationDistance ()*50;
|
||||
else
|
||||
ActivationDistance = getObjectActivationDistance ();
|
||||
|
||||
|
@ -1010,6 +1011,8 @@ namespace MWWorld
|
|||
float x, y;
|
||||
MWBase::Environment::get().getWindowManager()->getMousePosition(x, y);
|
||||
results = mPhysics->getFacedHandles(x, y, getMaxActivationDistance ());
|
||||
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||
results = mPhysics->getFacedHandles(x, y, getMaxActivationDistance ()*50);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue