mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 07:36:44 +00:00
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 isGuiMode() const = 0;
|
||||||
|
|
||||||
|
virtual bool isConsoleMode() const = 0;
|
||||||
|
|
||||||
virtual void toggleVisible (MWGui::GuiWindow wnd) = 0;
|
virtual void toggleVisible (MWGui::GuiWindow wnd) = 0;
|
||||||
|
|
||||||
/// Disallow all inventory mode windows
|
/// Disallow all inventory mode windows
|
||||||
|
|
|
@ -81,8 +81,33 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
{
|
{
|
||||||
const MyGUI::IntPoint& mousePos = InputManager::getInstance().getMousePosition();
|
const MyGUI::IntPoint& mousePos = InputManager::getInstance().getMousePosition();
|
||||||
|
|
||||||
if (mWindowManager->getWorldMouseOver() && ((mWindowManager->getMode() == GM_Console)
|
if (mWindowManager->getWorldMouseOver() && (mWindowManager->getMode() == GM_Console))
|
||||||
|| (mWindowManager->getMode() == GM_Container)
|
{
|
||||||
|
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)))
|
|| (mWindowManager->getMode() == GM_Inventory)))
|
||||||
{
|
{
|
||||||
mFocusObject = MWBase::Environment::get().getWorld()->getFacedObject();
|
mFocusObject = MWBase::Environment::get().getWorld()->getFacedObject();
|
||||||
|
@ -90,7 +115,7 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
if (mFocusObject.isEmpty ())
|
if (mFocusObject.isEmpty ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MyGUI::IntSize tooltipSize = getToolTipViaPtr(true);
|
IntSize tooltipSize = getToolTipViaPtr(true);
|
||||||
|
|
||||||
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);
|
IntPoint tooltipPosition = InputManager::getInstance().getMousePosition() + IntPoint(0, 24);
|
||||||
|
|
||||||
|
|
|
@ -1020,6 +1020,13 @@ bool WindowManager::isGuiMode() const
|
||||||
return !mGuiModes.empty();
|
return !mGuiModes.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WindowManager::isConsoleMode() const
|
||||||
|
{
|
||||||
|
if (mGuiModes.back()==GM_Console)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
MWGui::GuiMode WindowManager::getMode() const
|
MWGui::GuiMode WindowManager::getMode() const
|
||||||
{
|
{
|
||||||
if (mGuiModes.empty())
|
if (mGuiModes.empty())
|
||||||
|
|
|
@ -102,6 +102,8 @@ namespace MWGui
|
||||||
|
|
||||||
virtual bool isGuiMode() const;
|
virtual bool isGuiMode() const;
|
||||||
|
|
||||||
|
virtual bool isConsoleMode() const;
|
||||||
|
|
||||||
virtual void toggleVisible(GuiWindow wnd);
|
virtual void toggleVisible(GuiWindow wnd);
|
||||||
|
|
||||||
// Disallow all inventory mode windows
|
// Disallow all inventory mode windows
|
||||||
|
|
|
@ -671,11 +671,12 @@ namespace MWWorld
|
||||||
return MWWorld::Ptr ();
|
return MWWorld::Ptr ();
|
||||||
|
|
||||||
MWWorld::Ptr object = searchPtrViaHandle (result.second);
|
MWWorld::Ptr object = searchPtrViaHandle (result.second);
|
||||||
|
|
||||||
float ActivationDistance;
|
float ActivationDistance;
|
||||||
|
|
||||||
if (object.getTypeName ().find("NPC") != std::string::npos)
|
if (object.getTypeName ().find("NPC") != std::string::npos)
|
||||||
ActivationDistance = getNpcActivationDistance ();
|
ActivationDistance = getNpcActivationDistance ();
|
||||||
|
else if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||||
|
ActivationDistance = getObjectActivationDistance ()*50;
|
||||||
else
|
else
|
||||||
ActivationDistance = getObjectActivationDistance ();
|
ActivationDistance = getObjectActivationDistance ();
|
||||||
|
|
||||||
|
@ -1010,6 +1011,8 @@ namespace MWWorld
|
||||||
float x, y;
|
float x, y;
|
||||||
MWBase::Environment::get().getWindowManager()->getMousePosition(x, y);
|
MWBase::Environment::get().getWindowManager()->getMousePosition(x, y);
|
||||||
results = mPhysics->getFacedHandles(x, y, getMaxActivationDistance ());
|
results = mPhysics->getFacedHandles(x, y, getMaxActivationDistance ());
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||||
|
results = mPhysics->getFacedHandles(x, y, getMaxActivationDistance ()*50);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue