summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2009-09-17 02:14:12 +0200
committerBertram <bertram@cegetel.net>2009-09-17 02:14:12 +0200
commitfde41392cde408af9ea269e00336e503294dfdd2 (patch)
treefbdda716c1d441b7d85e686e054e3346396a144d /src/being.cpp
parent78134dc88b0b39b0d051392fa937418bcd384404 (diff)
downloadmana-fde41392cde408af9ea269e00336e503294dfdd2.tar.gz
mana-fde41392cde408af9ea269e00336e503294dfdd2.tar.bz2
mana-fde41392cde408af9ea269e00336e503294dfdd2.tar.xz
mana-fde41392cde408af9ea269e00336e503294dfdd2.zip
Partially (but mainly) resolved Mantis #753 by making monsters, NPC, and Floor Items visible even covered.
Next Step would be to add a caching system for multi-layered sprites + copy functions for SDL and OpenGL. Then, I'll be able to finish this, by making also players visible when covered... But Kage asked me (each and every hour) to do something else first ;)
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 37ae2200..32a3b5c3 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -82,6 +82,8 @@ Being::Being(int id, int job, Map *map):
mEquippedWeapon(NULL),
mText(0),
mStunMode(0),
+ mAlpha(1.0f),
+ mNumberOfLayers(0),
mStatusParticleEffects(&mStunParticleEffects, false),
mChildParticleEffects(&mStatusParticleEffects, false),
mMustResetParticles(false),
@@ -605,7 +607,11 @@ void Being::draw(Graphics *graphics, int offsetX, int offsetY) const
for (SpriteConstIterator it = mSprites.begin(); it != mSprites.end(); it++)
if (*it)
+ {
+ if ((*it)->getAlpha() != mAlpha)
+ (*it)->setAlpha(mAlpha);
(*it)->draw(graphics, px, py);
+ }
}
void Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY)
@@ -910,3 +916,15 @@ void Being::load()
mNumberOfHairstyles = hairstyles;
}
+
+void Being::_updateNumberOfLayers()
+{
+ SpriteConstIterator si = mSprites.begin();
+ mNumberOfLayers = 0;
+ while (si != mSprites.end())
+ {
+ if (*si)
+ mNumberOfLayers++;
+ si++;
+ }
+}