summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorunknown <Philipp@.(none)>2011-08-21 00:02:06 +0800
committerYohann Ferreira <yohann.ferreira@orange.fr>2011-09-05 16:20:35 +0800
commit8666a98554813434e842cdb15671538c5c2ae6db (patch)
tree42967cacb2787a9ff0541e623a30fc704052db66 /src/map.cpp
parent76edea844ffd5f03bc1ad44e1e87ce2aafe6041f (diff)
downloadmana-8666a98554813434e842cdb15671538c5c2ae6db.tar.gz
mana-8666a98554813434e842cdb15671538c5c2ae6db.tar.bz2
mana-8666a98554813434e842cdb15671538c5c2ae6db.tar.xz
mana-8666a98554813434e842cdb15671538c5c2ae6db.zip
The draw order of particles is now Y - 16 pixels.
This means that the order point of the sprites relative to the particles is no longer the lowest point of the image but instead a point which is approximately between the feet of the characters. The intent of the latest commits to treat sprites as perpendicular to the ground instead of perpendicular to the view line is retained by this approach. I tested this with various particle effects and it results in exactly the expected behavior. Note that this does NOT fix the current problems on TMW with the snail slime effect, because the TMW content team accidently placed this one 10px in the air. Sorry, garbage in, garbage out. getDrawPixelY was re-renamed to getPixelY to be consistent with getPixelX, while getPixelY was renamed to getDrawOrder, to make its purpose clear. Further, particles are no longer drawn when behind other objects. This is implemented by adding a drawnWhenBehind member function to Actor, which currently returns true for everything except particles and compound- sprites with more than one sub-sprites (the later case is consistent with the previous behavior of them). An exception are text particles which are excempt from this exception and whose drawing order is also biased by 16 pixels south instead of north to make them more visible. Plus some minor changes from Bertram. Reviewed-by: Bertram. Resolves: Mana-Mantis #362.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/map.cpp b/src/map.cpp
index f95284b4..ac287be4 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -325,7 +325,7 @@ void Map::addTileset(Tileset *tileset)
bool actorCompare(const Actor *a, const Actor *b)
{
- return a->getPixelY() < b->getPixelY();
+ return a->getDrawOrder() < b->getDrawOrder();
}
void Map::update(int ticks)
@@ -403,7 +403,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
if (Actor *actor = *ai)
{
// For now, just draw actors with only one layer.
- if (actor->getNumberOfLayers() == 1)
+ if (actor->drawnWhenBehind())
{
actor->setAlpha(0.3f);
actor->draw(graphics, -scrollX, -scrollY);