diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-03 21:43:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-03 21:43:25 +0300 |
commit | 4039ef116901d4513c3535cc119dc40abd8e14df (patch) | |
tree | 238a2e6734adf42186871a9884a69af12fe8de66 /src/resources/map/maplayer.cpp | |
parent | bccb486d184b26638d3e47507bc6260383950b8b (diff) | |
download | manaverse-4039ef116901d4513c3535cc119dc40abd8e14df.tar.gz manaverse-4039ef116901d4513c3535cc119dc40abd8e14df.tar.bz2 manaverse-4039ef116901d4513c3535cc119dc40abd8e14df.tar.xz manaverse-4039ef116901d4513c3535cc119dc40abd8e14df.zip |
Improve a bit pixel calculation in map layers.
Diffstat (limited to 'src/resources/map/maplayer.cpp')
-rw-r--r-- | src/resources/map/maplayer.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 6567b2177..0c18bf289 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -55,6 +55,8 @@ MapLayer::MapLayer(const int x, const int tileCondition) : mX(x), mY(y), + mPixelX(mX * mapTileSize), + mPixelY(mY * mapTileSize + mapTileSize), mWidth(width), mHeight(height), mTiles(new TileInfo[mWidth * mHeight]), @@ -125,8 +127,8 @@ void MapLayer::draw(Graphics *const graphics, if (endY > mHeight) endY = mHeight; - const int dx = (mX * mapTileSize) - scrollX; - const int dy = (mY * mapTileSize) - scrollY + mapTileSize; + const int dx = mPixelX - scrollX; + const int dy = mPixelY - scrollY; for (int y = startY; y < endY; y++) { @@ -222,8 +224,8 @@ void MapLayer::updateSDL(const Graphics *const graphics, if (endY > mHeight) endY = mHeight; - const int dx = (mX * mapTileSize) - scrollX; - const int dy = (mY * mapTileSize) - scrollY + mapTileSize; + const int dx = mPixelX - scrollX; + const int dy = mPixelY - scrollY; for (int y = startY; y < endY; y++) { @@ -290,8 +292,8 @@ void MapLayer::updateOGL(Graphics *const graphics, if (endY > mHeight) endY = mHeight; - const int dx = (mX * mapTileSize) - scrollX; - const int dy = (mY * mapTileSize) - scrollY + mapTileSize; + const int dx = mPixelX - scrollX; + const int dy = mPixelY - scrollY; MapRowVertexes *const row = new MapRowVertexes(); mTempRows.push_back(row); @@ -412,8 +414,8 @@ void MapLayer::drawFringe(Graphics *const graphics, ActorsCIter ai = actors.begin(); const ActorsCIter ai_end = actors.end(); - const int dx = (mX * mapTileSize) - scrollX; - const int dy = (mY * mapTileSize) - scrollY + mapTileSize; + const int dx = mPixelX - scrollX; + const int dy = mPixelY - scrollY; const int specialWidth = mSpecialLayer->mWidth; const int specialHeight = mSpecialLayer->mHeight; |