Clear global map overlay when starting/loading a game

actorid
scrawl 11 years ago
parent 03cf383be7
commit f09328ca84

@ -285,6 +285,9 @@ namespace MWBase
/// Should the cursor be visible?
virtual bool getCursorVisible() = 0;
/// Clear all savegame-specific data
virtual void clear() = 0;
};
}

@ -434,7 +434,7 @@ namespace MWGui
static int _counter=0;
MyGUI::Button* markerWidget = mGlobalMapImage->createWidget<MyGUI::Button>("ButtonImage",
MyGUI::Button* markerWidget = mGlobalMapOverlay->createWidget<MyGUI::Button>("ButtonImage",
widgetCoord, MyGUI::Align::Default, "Door" + boost::lexical_cast<std::string>(_counter));
markerWidget->setImageResource("DoorMarker");
markerWidget->setUserString("ToolTipType", "Layout");
@ -499,10 +499,11 @@ namespace MWGui
mGlobalMap->setCanvasSize (mGlobalMapRender->getWidth(), mGlobalMapRender->getHeight());
mGlobalMapImage->setSize(mGlobalMapRender->getWidth(), mGlobalMapRender->getHeight());
for (unsigned int i=0; i<mGlobalMapImage->getChildCount (); ++i)
// force markers to foreground
for (unsigned int i=0; i<mGlobalMapOverlay->getChildCount (); ++i)
{
if (mGlobalMapImage->getChildAt (i)->getName().substr(0,4) == "Door")
mGlobalMapImage->getChildAt (i)->castType<MyGUI::Button>()->setImageResource("DoorMarker");
if (mGlobalMapOverlay->getChildAt (i)->getName().substr(0,4) == "Door")
mGlobalMapOverlay->getChildAt (i)->castType<MyGUI::Button>()->setImageResource("DoorMarker");
}
globalMapUpdatePlayer();
@ -573,4 +574,14 @@ namespace MWGui
mGlobalMap->setViewOffset(viewoffs);
}
void MapWindow::clear()
{
mGlobalMapRender->clear();
while (mEventBoxGlobal->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mEventBoxGlobal->getChildAt(0));
while (mGlobalMapOverlay->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mGlobalMapOverlay->getChildAt(0));
}
}

@ -92,6 +92,9 @@ namespace MWGui
virtual void open();
/// Clear all savegame-specific data
void clear();
private:
void onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
void onMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);

@ -1381,4 +1381,9 @@ namespace MWGui
Settings::Manager::setFloat(setting + " h", "Windows", h);
}
void WindowManager::clear()
{
mMap->clear();
}
}

@ -280,6 +280,9 @@ namespace MWGui
virtual bool getCursorVisible();
/// Clear all savegame-specific data
virtual void clear();
private:
bool mConsoleOnlyScripts;

@ -170,21 +170,10 @@ namespace MWRender
tex->load();
mOverlayTexture = Ogre::TextureManager::getSingleton().createManual("GlobalMapOverlay", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, mWidth, mHeight, 0, Ogre::PF_A8B8G8R8, Ogre::TU_DYNAMIC_WRITE_ONLY);
std::vector<Ogre::uint32> buffer;
buffer.resize(mWidth * mHeight);
// initialize to (0, 0, 0, 0)
for (int p=0; p<mWidth * mHeight; ++p)
buffer[p] = 0;
memcpy(mOverlayTexture->getBuffer()->lock(Ogre::HardwareBuffer::HBL_DISCARD), &buffer[0], mWidth*mHeight*4);
mOverlayTexture->getBuffer()->unlock();
clear();
loadingListener->loadingOff();
}
@ -227,9 +216,19 @@ namespace MWRender
if (!localMapTexture.isNull())
{
mOverlayTexture->getBuffer()->blit(localMapTexture->getBuffer(), Ogre::Image::Box(0,0,512,512),
Ogre::Image::Box(originX,originY,originX+24,originY+24));
}
}
void GlobalMap::clear()
{
std::vector<Ogre::uint32> buffer;
// initialize to (0,0,0,0)
buffer.resize(mWidth * mHeight, 0);
Ogre::PixelBox pb(mWidth, mHeight, 1, Ogre::PF_A8B8G8R8, &buffer[0]);
mOverlayTexture->getBuffer()->blitFromMemory(pb);
}
}

@ -31,6 +31,9 @@ namespace MWRender
void exploreCell (int cellX, int cellY);
/// Clears the overlay
void clear();
private:
std::string mCacheDir;

@ -290,9 +290,6 @@ void RenderingManager::rotateObject(const MWWorld::Ptr &ptr)
void
RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur)
{
Ogre::Image im;
im.encode(".jpg");
Ogre::SceneNode *child =
mRendering.getScene()->getSceneNode(old.getRefData().getHandle());

@ -35,6 +35,7 @@ void MWState::StateManager::cleanup (bool force)
MWBase::Environment::get().getJournal()->clear();
MWBase::Environment::get().getScriptManager()->getGlobalScripts().clear();
MWBase::Environment::get().getWorld()->clear();
MWBase::Environment::get().getWindowManager()->clear();
mState = State_NoGame;
mCharacterManager.clearCurrentCharacter();
@ -73,8 +74,8 @@ void MWState::StateManager::askLoadRecent()
{
MWState::Slot lastSave = *getCurrentCharacter()->begin();
std::vector<std::string> buttons;
buttons.push_back("Yes");
buttons.push_back("No");
buttons.push_back("#{sYes}");
buttons.push_back("#{sNo}");
std::string tag("%s");
std::string message = MWBase::Environment::get().getWindowManager()->getGameSettingString("sLoadLastSaveMsg", tag);
size_t pos = message.find(tag);
@ -257,6 +258,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
Settings::Manager::setString ("character", "Saves",
slot->mPath.parent_path().filename().string());
MWBase::Environment::get().getWindowManager()->setNewGame(false);
MWBase::Environment::get().getWorld()->setupPlayer();
MWBase::Environment::get().getWorld()->renderPlayer();
MWBase::Environment::get().getWindowManager()->updatePlayer();

@ -248,6 +248,7 @@ namespace MWWorld
MWBase::Environment::get().getWindowManager()->updatePlayer();
// FIXME: this will add cell 0,0 as visible on the global map
ESM::Position pos;
const int cellSize = 8192;
pos.pos[0] = cellSize/2;

Loading…
Cancel
Save