summaryrefslogtreecommitdiff
path: root/src/resources/map/maplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/map/maplayer.cpp')
-rw-r--r--src/resources/map/maplayer.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index 5239403ed..249e67fdd 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -402,24 +402,39 @@ void MapLayer::drawSpecialLayer(Graphics *const graphics,
endX1 = specialWidth;
if (endX1 < 0)
endX1 = 0;
-
- for (int x = startX; x < endX1; x++)
+ int x0 = startX;
+ const MapItem *item0 = mSpecialLayer->mTiles[ptr + startX];
+ if (!item0 || item0->mType == MapItemType::EMPTY)
+ {
+ x0 += mSpecialLayer->mCache[ptr + startX];
+ }
+ for (int x = x0; x < endX1; x++)
{
const int px1 = x * mapTileSize - scrollX;
-
- const MapItem *item = mSpecialLayer->mTiles[ptr + x];
+ const MapItem *const item = mSpecialLayer->mTiles[ptr + x];
if (item)
{
item->draw(graphics, px1, py1,
mapTileSize, mapTileSize);
}
+ x += mSpecialLayer->mCache[ptr + x];
+ }
- item = mTempLayer->mTiles[ptr + x];
+ item0 = mTempLayer->mTiles[ptr + startX];
+ if (!item0 || item0->mType == MapItemType::EMPTY)
+ {
+ x0 += mTempLayer->mCache[ptr + startX];
+ }
+ for (int x = x0; x < endX1; x++)
+ {
+ const int px1 = x * mapTileSize - scrollX;
+ const MapItem *const item = mTempLayer->mTiles[ptr + x];
if (item)
{
item->draw(graphics, px1, py1,
mapTileSize, mapTileSize);
}
+ x += mSpecialLayer->mCache[ptr + x];
}
}