forked from teamnwah/openmw-tes3coop
Fixes #772: Give scripts a chance to run before updating map, so that disabled objects are not visible
This commit is contained in:
parent
ac8abd3398
commit
961c4d4dc4
4 changed files with 36 additions and 7 deletions
|
@ -465,7 +465,18 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::cellExplored(int x, int y)
|
void MapWindow::cellExplored(int x, int y)
|
||||||
{
|
{
|
||||||
mGlobalMapRender->exploreCell(x,y);
|
mQueuedToExplore.push_back(std::make_pair(x,y));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapWindow::onFrame(float dt)
|
||||||
|
{
|
||||||
|
for (std::vector<CellId>::iterator it = mQueuedToExplore.begin(); it != mQueuedToExplore.end(); ++it)
|
||||||
|
{
|
||||||
|
mGlobalMapRender->exploreCell(it->first, it->second);
|
||||||
|
}
|
||||||
|
mQueuedToExplore.clear();
|
||||||
|
|
||||||
|
NoDrop::onFrame(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
void MapWindow::onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
|
||||||
|
|
|
@ -97,14 +97,17 @@ namespace MWGui
|
||||||
|
|
||||||
void renderGlobalMap(Loading::Listener* loadingListener);
|
void renderGlobalMap(Loading::Listener* loadingListener);
|
||||||
|
|
||||||
void addVisitedLocation(const std::string& name, int x, int y); // adds the marker to the global map
|
// adds the marker to the global map
|
||||||
|
void addVisitedLocation(const std::string& name, int x, int y);
|
||||||
|
|
||||||
|
// reveals this cell's map on the global map
|
||||||
void cellExplored(int x, int y);
|
void cellExplored(int x, int y);
|
||||||
|
|
||||||
void setGlobalMapPlayerPosition (float worldX, float worldY);
|
void setGlobalMapPlayerPosition (float worldX, float worldY);
|
||||||
|
|
||||||
virtual void open();
|
virtual void open();
|
||||||
|
|
||||||
void onFrame(float dt) { NoDrop::onFrame(dt); }
|
void onFrame(float dt);
|
||||||
|
|
||||||
/// Clear all savegame-specific data
|
/// Clear all savegame-specific data
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -132,6 +135,10 @@ namespace MWGui
|
||||||
typedef std::pair<int, int> CellId;
|
typedef std::pair<int, int> CellId;
|
||||||
std::vector<CellId> mMarkers;
|
std::vector<CellId> mMarkers;
|
||||||
|
|
||||||
|
// Cells that should be explored in the next frame (i.e. their map revealed on the global map)
|
||||||
|
// We can't do this immediately, because the map update is not immediate either (see mNeedMapUpdate in scene.cpp)
|
||||||
|
std::vector<CellId> mQueuedToExplore;
|
||||||
|
|
||||||
MyGUI::Button* mEventBoxGlobal;
|
MyGUI::Button* mEventBoxGlobal;
|
||||||
MyGUI::Button* mEventBoxLocal;
|
MyGUI::Button* mEventBoxLocal;
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,15 @@ namespace
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
|
|
||||||
void Scene::update (float duration, bool paused){
|
void Scene::update (float duration, bool paused)
|
||||||
|
{
|
||||||
|
if (mNeedMapUpdate)
|
||||||
|
{
|
||||||
|
for (CellStoreCollection::iterator active = mActiveCells.begin(); active!=mActiveCells.end(); ++active)
|
||||||
|
mRendering.requestMap(*active);
|
||||||
|
mNeedMapUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
mRendering.update (duration, paused);
|
mRendering.update (duration, paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,8 +205,9 @@ namespace MWWorld
|
||||||
|
|
||||||
mRendering.updateTerrain();
|
mRendering.updateTerrain();
|
||||||
|
|
||||||
for (CellStoreCollection::iterator active = mActiveCells.begin(); active!=mActiveCells.end(); ++active)
|
// Delay the map update until scripts have been given a chance to run.
|
||||||
mRendering.requestMap(*active);
|
// If we don't do this, objects that should be disabled will still appear on the map.
|
||||||
|
mNeedMapUpdate = true;
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
||||||
}
|
}
|
||||||
|
@ -342,7 +351,7 @@ namespace MWWorld
|
||||||
|
|
||||||
//We need the ogre renderer and a scene node.
|
//We need the ogre renderer and a scene node.
|
||||||
Scene::Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics)
|
Scene::Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics)
|
||||||
: mCurrentCell (0), mCellChanged (false), mPhysics(physics), mRendering(rendering)
|
: mCurrentCell (0), mCellChanged (false), mPhysics(physics), mRendering(rendering), mNeedMapUpdate(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,8 @@ namespace MWWorld
|
||||||
PhysicsSystem *mPhysics;
|
PhysicsSystem *mPhysics;
|
||||||
MWRender::RenderingManager& mRendering;
|
MWRender::RenderingManager& mRendering;
|
||||||
|
|
||||||
|
bool mNeedMapUpdate;
|
||||||
|
|
||||||
void playerCellChange (CellStore *cell, const ESM::Position& position,
|
void playerCellChange (CellStore *cell, const ESM::Position& position,
|
||||||
bool adjustPlayerPos = true);
|
bool adjustPlayerPos = true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue