summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 3237b54a..37b7292a 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -36,8 +36,8 @@ MetaTile::MetaTile():
}
-Location::Location(int x, int y, MetaTile *tile):
- x(x), y(y), tile(tile)
+Location::Location(int iX, int iY, MetaTile *iTile):
+ x(iX), y(iY), tile(iTile)
{
}
@@ -88,7 +88,7 @@ Map::addTileset(Tileset *tileset)
bool spriteCompare(const Sprite *a, const Sprite *b)
{
- return a->getY() < b->getY();
+ return a->getPixelY() < b->getPixelY();
}
void
@@ -118,7 +118,7 @@ Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
// tiles have been drawn
if (layer == 1)
{
- while (si != mSprites.end() && (*si)->getY() < y * 32)
+ while (si != mSprites.end() && (*si)->getPixelY() <= y * 32 - 32)
{
(*si)->draw(graphics, -scrollX, -scrollY);
si++;
@@ -135,6 +135,16 @@ Map::draw(Graphics *graphics, int scrollX, int scrollY, int layer)
}
}
}
+
+ // Draw any remaining sprites
+ if (layer == 1)
+ {
+ while (si != mSprites.end())
+ {
+ (*si)->draw(graphics, -scrollX, -scrollY);
+ si++;
+ }
+ }
}
void