summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net/ea/maprecv.cpp1
-rw-r--r--src/resources/map/maplayer.cpp49
-rw-r--r--src/resources/map/tileinfo.h4
3 files changed, 36 insertions, 18 deletions
diff --git a/src/net/ea/maprecv.cpp b/src/net/ea/maprecv.cpp
index a42af3e9b..b2dd5615b 100644
--- a/src/net/ea/maprecv.cpp
+++ b/src/net/ea/maprecv.cpp
@@ -52,6 +52,7 @@ void MapRecv::processSetTilesType(Net::MessageIn &msg)
map->setBlockMask(x, y, mask);
}
map->updateConditionLayers();
+ map->preCacheLayers();
}
}
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index 84ee5d63b..58d8a3a08 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -150,18 +150,20 @@ void MapLayer::draw(Graphics *const graphics,
if (mSpecialFlag ||
img->mBounds.h <= mapTileSize)
{
- int width = 0;
// here need not draw over player position
- c = getTileDrawWidth(tilePtr, endX - x, width);
+ c = tilePtr->count;
- if (!c)
+ if (c == 0)
{
graphics->drawImage(img, px, py);
}
else
{
- graphics->drawPattern(img, px, py,
- width, img->mBounds.h);
+ graphics->drawPattern(img,
+ px,
+ py,
+ tilePtr->width,
+ img->mBounds.h);
}
}
@@ -513,18 +515,20 @@ void MapLayer::drawFringe(Graphics *const graphics,
{
const int px = x32 + dx;
const int py = py0 - img->mBounds.h;
- int width = 0;
// here need not draw over player position
- c = getTileDrawWidth(tilePtr, endX - x, width);
+ c = tilePtr->count;
- if (!c)
+ if (c == 0)
{
graphics->drawImage(img, px, py);
}
else
{
- graphics->drawPattern(img, px, py,
- width, img->mBounds.h);
+ graphics->drawPattern(img,
+ px,
+ py,
+ tilePtr->width,
+ img->mBounds.h);
}
}
}
@@ -598,20 +602,19 @@ void MapLayer::drawFringe(Graphics *const graphics,
if (mSpecialFlag ||
img->mBounds.h <= mapTileSize)
{
- int width = 0;
- // here need not draw over player position
- const int c = getTileDrawWidth(tilePtr,
- endX - x,
- width);
+ const int c = tilePtr->count;
- if (!c)
+ if (c == 0)
{
graphics->drawImage(img, px, py);
}
else
{
- graphics->drawPattern(img, px, py,
- width, img->mBounds.h);
+ graphics->drawPattern(img,
+ px,
+ py,
+ tilePtr->width,
+ img->mBounds.h);
x += c;
tilePtr += c;
}
@@ -740,7 +743,17 @@ void MapLayer::updateCache(const int width,
for (int x = mX; x < width1; x ++, tilePtr ++)
{
if (tilePtr->image == nullptr)
+ {
tilePtr->isEnabled = false;
+ }
+ else
+ {
+ int tileWidth = 0;
+ tilePtr->count = getTileDrawWidth(tilePtr,
+ width1 - x,
+ tileWidth);
+ tilePtr->width = tileWidth;
+ }
}
}
}
diff --git a/src/resources/map/tileinfo.h b/src/resources/map/tileinfo.h
index 6f31d8eb2..764df0fb4 100644
--- a/src/resources/map/tileinfo.h
+++ b/src/resources/map/tileinfo.h
@@ -29,11 +29,15 @@ struct TileInfo final
{
TileInfo() :
image(nullptr),
+ width(0),
+ count(1),
isEnabled(true)
{
}
Image *image;
+ int width;
+ int count;
bool isEnabled;
};