summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actor.h6
-rw-r--r--src/animatedsprite.h3
-rw-r--r--src/being.cpp5
-rw-r--r--src/being.h8
-rw-r--r--src/compoundsprite.cpp6
-rw-r--r--src/compoundsprite.h2
-rw-r--r--src/map.cpp9
-rw-r--r--src/particle.h6
8 files changed, 8 insertions, 37 deletions
diff --git a/src/actor.h b/src/actor.h
index 8384593d..cd0da7fb 100644
--- a/src/actor.h
+++ b/src/actor.h
@@ -110,12 +110,6 @@ public:
virtual int getTileY() const;
/**
- * Returns the number of Image layers used to draw the actor.
- */
- virtual int getNumberOfLayers() const
- { return 0; }
-
- /**
* Returns the current alpha value used to draw the actor.
*/
virtual float getAlpha() const = 0;
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index 51544a48..34655bff 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -73,9 +73,6 @@ class AnimatedSprite final : public Sprite
bool setDirection(SpriteDirection direction) override;
- virtual bool drawnWhenBehind() const
- { return true; }
-
int getDuration() const override;
private:
diff --git a/src/being.cpp b/src/being.cpp
index 1ab13250..5e869662 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -1148,9 +1148,10 @@ void Being::setSpriteColor(unsigned slot, const std::string &color)
setSprite(slot, mSpriteStates[slot].id, color);
}
-int Being::getNumberOfLayers() const
+bool Being::drawnWhenBehind() const
{
- return CompoundSprite::getNumberOfLayers();
+ // For now, just draw actors with only one layer when obscured
+ return CompoundSprite::getNumberOfLayers() == 1;
}
void Being::updateName()
diff --git a/src/being.h b/src/being.h
index 6636af7b..b8c5a0f3 100644
--- a/src/being.h
+++ b/src/being.h
@@ -270,13 +270,7 @@ class Being : public ActorSprite, public EventListener
void setSpriteColor(unsigned slot,
const std::string &color = std::string());
- /**
- * Get the number of layers used to draw the being
- */
- int getNumberOfLayers() const override;
-
- bool drawnWhenBehind() const override
- { return CompoundSprite::drawnWhenBehind(); }
+ bool drawnWhenBehind() const override;
/**
* Performs being logic.
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index 115cd0f6..2e39fb47 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -141,12 +141,6 @@ int CompoundSprite::getNumberOfLayers() const
return size();
}
-bool CompoundSprite::drawnWhenBehind() const
-{
- // For now, just draw actors with only one layer when obscured
- return getNumberOfLayers() == 1;
-}
-
void CompoundSprite::addSprite(Sprite *sprite)
{
mSprites.push_back(sprite);
diff --git a/src/compoundsprite.h b/src/compoundsprite.h
index 7760da8c..4daffccb 100644
--- a/src/compoundsprite.h
+++ b/src/compoundsprite.h
@@ -66,8 +66,6 @@ public:
int getNumberOfLayers() const;
- virtual bool drawnWhenBehind() const;
-
int getDuration() const final;
size_t size() const
diff --git a/src/map.cpp b/src/map.cpp
index e38149d3..5d7fa053 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -296,11 +296,6 @@ void Map::addTileset(Tileset *tileset)
mMaxTileWidth = tileset->getWidth();
}
-bool actorCompare(const Actor *a, const Actor *b)
-{
- return a->getDrawOrder() < b->getDrawOrder();
-}
-
void Map::update(int dt)
{
// Update animated tiles
@@ -322,7 +317,9 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
// Make sure actors are sorted ascending by Y-coordinate
// so that they overlap correctly
- mActors.sort(actorCompare);
+ mActors.sort([] (const Actor *a, const Actor *b) {
+ return a->getDrawOrder() < b->getDrawOrder();
+ });
// update scrolling of all ambient layers
updateAmbientLayers(scrollX, scrollY);
diff --git a/src/particle.h b/src/particle.h
index eece1f85..1c991878 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -91,7 +91,7 @@ class Particle : public Actor
bool draw(Graphics *graphics, int offsetX, int offsetY) const override;
/**
- * Do not draw particles when beind other objects
+ * Do not draw particles when behind other objects.
*/
bool drawnWhenBehind() const override
{ return false; }
@@ -248,10 +248,6 @@ class Particle : public Actor
void disableAutoDelete()
{ mAutoDelete = false; }
- /** We consider particles (at least for now) to be one layer-sprites */
- int getNumberOfLayers() const override
- { return 1; }
-
float getAlpha() const override
{ return 1.0f; }