summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-26 21:40:47 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-26 23:23:32 +0300
commitb0167b595a952e1decc48c239c95c52e1bc057d7 (patch)
tree1dd53eae094689873ab90313748b67f58f54b574 /src/map.cpp
parent0380eec2d9d03a2541e4f89640f452fb96a7914a (diff)
downloadManaVerse-b0167b595a952e1decc48c239c95c52e1bc057d7.tar.gz
ManaVerse-b0167b595a952e1decc48c239c95c52e1bc057d7.tar.bz2
ManaVerse-b0167b595a952e1decc48c239c95c52e1bc057d7.tar.xz
ManaVerse-b0167b595a952e1decc48c239c95c52e1bc057d7.zip
show main layers based on map mask.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 362693722..3c0c9f4a4 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -172,6 +172,7 @@ Map::Map(const int width, const int height,
mDrawY(-1),
mDrawScrollX(-1),
mDrawScrollY(-1),
+ mMask(1),
mAtlas(nullptr),
mHeights(nullptr),
mRedrawMap(true),
@@ -430,6 +431,9 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
layeri != layeri_end && !overFringe; ++ layeri)
{
MapLayer *const layer = *layeri;
+ if (!(layer->mMask & mMask))
+ continue;
+
if (layer->isFringeLayer())
{
layer->setSpecialLayer(mSpecialLayer);
@@ -597,6 +601,8 @@ void Map::updateAmbientLayers(const float scrollX, const float scrollY)
const float dy = scrollY - mLastAScrollY;
const int timePassed = get_elapsed_time(lastTick);
+ // need check mask to update or not to update
+
FOR_EACH (AmbientLayerVectorCIter, i, mBackgrounds)
(*i)->update(timePassed, dx, dy);
@@ -637,6 +643,7 @@ void Map::drawAmbientLayers(Graphics *const graphics, const LayerType type,
// Draw overlays
FOR_EACHP (AmbientLayerVectorCIter, i, layers)
{
+ // need check mask to draw or not to draw
if (*i)
(*i)->draw(graphics, graphics->mWidth, graphics->mHeight);
@@ -1603,4 +1610,7 @@ uint8_t Map::getHeightOffset(const int x, const int y) const
void Map::setMask(const int mask)
{
+ if (mask != mMask)
+ mRedrawMap = true;
+ mMask = mask;
}