mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 16:41:33 +00:00
Merge branch 'Map-door-markers-flicker-in-some-cells' into 'master'
Do not update doors markers at each frame, only when needed Closes #6214 See merge request OpenMW/openmw!1168
This commit is contained in:
commit
d852b10227
2 changed files with 18 additions and 1 deletions
|
@ -192,6 +192,7 @@ namespace MWGui
|
||||||
, mMarkerUpdateTimer(0.0f)
|
, mMarkerUpdateTimer(0.0f)
|
||||||
, mLastDirectionX(0.0f)
|
, mLastDirectionX(0.0f)
|
||||||
, mLastDirectionY(0.0f)
|
, mLastDirectionY(0.0f)
|
||||||
|
, mNeedDoorMarkersUpdate(false)
|
||||||
{
|
{
|
||||||
mCustomMarkers.eventMarkersChanged += MyGUI::newDelegate(this, &LocalMapBase::updateCustomMarkers);
|
mCustomMarkers.eventMarkersChanged += MyGUI::newDelegate(this, &LocalMapBase::updateCustomMarkers);
|
||||||
}
|
}
|
||||||
|
@ -440,6 +441,10 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delay the door markers update until scripts have been given a chance to run.
|
||||||
|
// If we don't do this, door markers that should be disabled will still appear on the map.
|
||||||
|
mNeedDoorMarkersUpdate = true;
|
||||||
|
|
||||||
for (MyGUI::Widget* widget : currentDoorMarkersWidgets())
|
for (MyGUI::Widget* widget : currentDoorMarkersWidgets())
|
||||||
widget->setCoord(getMarkerCoordinates(widget, 8));
|
widget->setCoord(getMarkerCoordinates(widget, 8));
|
||||||
|
|
||||||
|
@ -543,8 +548,12 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalMapBase::onFrame(float dt)
|
void LocalMapBase::onFrame(float dt)
|
||||||
|
{
|
||||||
|
if (mNeedDoorMarkersUpdate)
|
||||||
{
|
{
|
||||||
updateDoorMarkers();
|
updateDoorMarkers();
|
||||||
|
mNeedDoorMarkersUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
mMarkerUpdateTimer += dt;
|
mMarkerUpdateTimer += dt;
|
||||||
|
|
||||||
|
@ -950,6 +959,9 @@ namespace MWGui
|
||||||
zoomOnCursor(zoomRatio);
|
zoomOnCursor(zoomRatio);
|
||||||
return; //the zoom out is too big, we switch to the global map
|
return; //the zoom out is too big, we switch to the global map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (zoomOut)
|
||||||
|
mNeedDoorMarkersUpdate = true;
|
||||||
}
|
}
|
||||||
zoomOnCursor(speedDiff);
|
zoomOnCursor(speedDiff);
|
||||||
}
|
}
|
||||||
|
@ -1172,7 +1184,10 @@ namespace MWGui
|
||||||
MyGUI::IntPoint diff = MyGUI::IntPoint(_left, _top) - mLastDragPos;
|
MyGUI::IntPoint diff = MyGUI::IntPoint(_left, _top) - mLastDragPos;
|
||||||
|
|
||||||
if (!mGlobal)
|
if (!mGlobal)
|
||||||
|
{
|
||||||
|
mNeedDoorMarkersUpdate = true;
|
||||||
mLocalMap->setViewOffset( mLocalMap->getViewOffset() + diff );
|
mLocalMap->setViewOffset( mLocalMap->getViewOffset() + diff );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
mGlobalMap->setViewOffset( mGlobalMap->getViewOffset() + diff );
|
mGlobalMap->setViewOffset( mGlobalMap->getViewOffset() + diff );
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,8 @@ namespace MWGui
|
||||||
float mLastDirectionX;
|
float mLastDirectionX;
|
||||||
float mLastDirectionY;
|
float mLastDirectionY;
|
||||||
|
|
||||||
|
bool mNeedDoorMarkersUpdate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDoorMarkers();
|
void updateDoorMarkers();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue