diff options
-rw-r--r-- | src/resources/map/map.cpp | 20 | ||||
-rw-r--r-- | src/resources/map/map.h | 3 | ||||
-rw-r--r-- | src/resources/map/maplayer.cpp | 12 | ||||
-rw-r--r-- | src/resources/map/maplayer.h | 7 |
4 files changed, 27 insertions, 15 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 49006a5b2..4927485d4 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -393,8 +393,11 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY) { mFringeLayer->setSpecialLayer(mSpecialLayer); mFringeLayer->setTempLayer(mTempLayer); - mFringeLayer->drawFringe(graphics, startX, startY, endX, endY, - scrollX, scrollY, &mActors, mActorFixY); + mFringeLayer->drawFringe(graphics, + startX, startY, + endX, endY, + scrollX, scrollY, + &mActors); } } else @@ -423,8 +426,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY) startX, startY, endX, endY, scrollX, scrollY, - &mActors, - mActorFixY); + &mActors); } FOR_EACH (Layers::iterator, it, mDrawOverLayers) @@ -459,7 +461,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY) startX, startY, endX, endY, scrollX, scrollY, - &mActors, mActorFixY); + &mActors); } FOR_EACH (Layers::iterator, it, mDrawOverLayers) @@ -1611,3 +1613,11 @@ void Map::setDrawLayersFlags(const MapType::MapType &n) layer->setDrawLayerFlags(mDrawLayersFlags); } } + +void Map::setActorsFix(const int x, const int y) +{ + mActorFixX = x; + mActorFixY = y; + if (mFringeLayer) + mFringeLayer->setActorsFix(y); +} diff --git a/src/resources/map/map.h b/src/resources/map/map.h index 3afd6d8ef..a051961a3 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -282,8 +282,7 @@ class Map final : public Properties, public ConfigListener void clearIndexedTilesets(); - void setActorsFix(const int x, const int y) - { mActorFixX = x; mActorFixY = y; } + void setActorsFix(const int x, const int y); int getVersion() const A_WARN_UNUSED { return mVersion; } diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index ae012cb8e..ef1c1961c 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -56,6 +56,7 @@ MapLayer::MapLayer(const int x, const int y, mTempLayer(nullptr), mTempRows(), mMask(mask), + mActorsFix(0), mIsFringeLayer(fringeLayer), mHighlightAttackRange(config.getBoolValue("highlightAttackRange")), mSpecialFlag(true) @@ -354,8 +355,7 @@ void MapLayer::drawOGL(Graphics *const graphics) const void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY, int endX, int endY, const int scrollX, const int scrollY, - const Actors *const actors, - const int yFix) const + const Actors *const actors) const { BLOCK_START("MapLayer::drawFringe") if (!localPlayer || !mSpecialLayer || !mTempLayer) @@ -398,7 +398,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY, for (int y = startY; y < minEndY; y ++) { const int y32 = y * mapTileSize; - const int y32s = (y + yFix) * mapTileSize; + const int y32s = (y + mActorsFix) * mapTileSize; BLOCK_START("MapLayer::drawFringe drawmobs") // If drawing the fringe layer, make sure all actors above this row of @@ -443,7 +443,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY, for (int y = minEndY; y < endY; y++) { - const int y32s = (y + yFix) * mapTileSize; + const int y32s = (y + mActorsFix) * mapTileSize; BLOCK_START("MapLayer::drawFringe drawmobs") // If drawing the fringe layer, make sure all actors above this row of @@ -461,7 +461,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY, for (int y = startY; y < minEndY; y ++) { const int y32 = y * mapTileSize; - const int y32s = (y + yFix) * mapTileSize; + const int y32s = (y + mActorsFix) * mapTileSize; const int yWidth = y * mWidth; BLOCK_START("MapLayer::drawFringe drawmobs") @@ -547,7 +547,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY, for (int y = minEndY; y < endY; y++) { const int y32 = y * mapTileSize; - const int y32s = (y + yFix) * mapTileSize; + const int y32s = (y + mActorsFix) * mapTileSize; const int yWidth = y * mWidth; BLOCK_START("MapLayer::drawFringe drawmobs") diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h index d02f4f7b1..25773ebb2 100644 --- a/src/resources/map/maplayer.h +++ b/src/resources/map/maplayer.h @@ -110,8 +110,7 @@ class MapLayer final: public ConfigListener int startX, int startY, int endX, int endY, const int scrollX, const int scrollY, - const Actors *const actors, - const int yFix) const; + const Actors *const actors) const; bool isFringeLayer() const A_WARN_UNUSED { return mIsFringeLayer; } @@ -132,6 +131,9 @@ class MapLayer final: public ConfigListener void setDrawLayerFlags(const MapType::MapType &n); + void setActorsFix(const int y) + { mActorsFix = y; } + protected: static int getTileDrawWidth(const Image *img, const int endX, @@ -149,6 +151,7 @@ class MapLayer final: public ConfigListener typedef std::vector<MapRowVertexes*> MapRows; MapRows mTempRows; int mMask; + int mActorsFix; const bool mIsFringeLayer; /**< Whether the actors are drawn. */ bool mHighlightAttackRange; bool mSpecialFlag; |