mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-07 13:20:25 +00:00
Do not update doors markers at each frame, only when needed
This commit is contained in:
parent
ee1ec53cd9
commit
b0b60b05b8
@ -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));
|
||||||
|
|
||||||
@ -544,7 +549,11 @@ namespace MWGui
|
|||||||
|
|
||||||
void LocalMapBase::onFrame(float dt)
|
void LocalMapBase::onFrame(float dt)
|
||||||
{
|
{
|
||||||
updateDoorMarkers();
|
if (mNeedDoorMarkersUpdate)
|
||||||
|
{
|
||||||
|
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…
x
Reference in New Issue
Block a user