summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/progs/manaplus/gui/viewport.cpp2
-rw-r--r--src/resources/map/map.cpp19
-rw-r--r--src/resources/map/map.h3
-rw-r--r--src/resources/mapreader.cpp4
4 files changed, 27 insertions, 1 deletions
diff --git a/src/progs/manaplus/gui/viewport.cpp b/src/progs/manaplus/gui/viewport.cpp
index 7552ab8be..73a8db226 100644
--- a/src/progs/manaplus/gui/viewport.cpp
+++ b/src/progs/manaplus/gui/viewport.cpp
@@ -1147,4 +1147,6 @@ void Viewport::videoResized()
{
updateMidVars();
updateMaxVars();
+ if (mMap != nullptr)
+ mMap->screenResized();
}
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index ae7570cda..2128cdcd3 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -163,7 +163,8 @@ Map::Map(const std::string &name,
mCachedDraw(false),
#endif // USE_OPENGL
mCustom(false),
- mDrawOnlyFringe(false)
+ mDrawOnlyFringe(false),
+ mClear(false)
{
config.addListener("OverlayDetail", this);
config.addListener("guialpha", this);
@@ -340,6 +341,9 @@ void Map::draw(Graphics *restrict const graphics,
if (localPlayer == nullptr)
return;
+ if (mClear)
+ mainGraphics->clearScreen();
+
BLOCK_START("Map::draw")
// Calculate range of tiles which are on-screen
const int endPixelY = graphics->mHeight + scrollY + mTileHeight - 1
@@ -1799,6 +1803,19 @@ int Map::calcMemoryChilds(const int level) const
return sz;
}
+void Map::screenResized()
+{
+ if (mWidth * mapTileSize < mainGraphics->mWidth ||
+ mHeight * mapTileSize < mainGraphics->mHeight)
+ {
+ mClear = true;
+ }
+ else
+ {
+ mClear = false;
+ }
+}
+
#ifdef USE_OPENGL
int Map::getAtlasCount() const restrict2
{
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index 74ffdb8ef..6659d7a13 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -372,6 +372,8 @@ class Map final : public Properties,
std::string getCounterName() const override final
{ return mName; }
+ void screenResized();
+
protected:
friend class Actor;
friend class Minimap;
@@ -500,6 +502,7 @@ class Map final : public Properties,
bool mCachedDraw;
bool mCustom;
bool mDrawOnlyFringe;
+ bool mClear;
};
#endif // RESOURCES_MAP_MAP_H
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index c74521817..390fb9e3d 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -35,6 +35,8 @@
#include "fs/virtfs/fs.h"
+#include "render/graphics.h"
+
#include "resources/map/map.h"
#include "resources/map/mapheights.h"
#include "resources/map/maplayer.h"
@@ -360,6 +362,8 @@ Map *MapReader::readMap(XmlNodePtrConst node, const std::string &path)
w, h,
tilew, tileh);
+ map->screenResized();
+
const std::string fileName = path.substr(path.rfind(dirSeparator) + 1);
map->setProperty("shortName", fileName);