summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-12-24 12:31:02 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-12-24 12:31:02 +0000
commiteaa16c5602d7f9081ef16c799f4492b68cc81a9c (patch)
tree5ff83fa26f7675dd6feb66c0bca2138a90ee4bf7 /src/map.cpp
parent3134c856230ad9d84a009ae7ed4d08a56aecaad7 (diff)
downloadmana-eaa16c5602d7f9081ef16c799f4492b68cc81a9c.tar.gz
mana-eaa16c5602d7f9081ef16c799f4492b68cc81a9c.tar.bz2
mana-eaa16c5602d7f9081ef16c799f4492b68cc81a9c.tar.xz
mana-eaa16c5602d7f9081ef16c799f4492b68cc81a9c.zip
Fringe layer draw fix and change in policy on when using OpenGL is the default.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 449f72e9..5150bcff 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -96,18 +96,23 @@ bool spriteCompare(const Sprite *a, const Sprite *b)
void
Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
{
+ int startX = scrollX / 32;
+ int startY = scrollY / 32;
+ int endX = (graphics->getWidth() + scrollX + 31) / 32;
+ int endY = (graphics->getHeight() + scrollY + 31) / 32;
+
// If drawing the fringe layer, make sure sprites are sorted
Sprites::iterator si;
if (layer == 1)
{
mSprites.sort(spriteCompare);
si = mSprites.begin();
- }
- int startX = scrollX / 32;
- int startY = scrollY / 32;
- int endX = (graphics->getWidth() + scrollX + 31) / 32;
- int endY = (graphics->getHeight() + scrollY + 31) / 32;
+ // Increase endY to account for high fringe tiles
+ // TODO: Improve this hack so that it'll dynamically account for the
+ // highest tile.
+ endY += 2;
+ }
if (startX < 0) startX = 0;
if (startY < 0) startY = 0;