diff options
author | Bertram <bertram@cegetel.net> | 2009-09-17 02:14:12 +0200 |
---|---|---|
committer | Bertram <bertram@cegetel.net> | 2009-09-17 02:14:12 +0200 |
commit | fde41392cde408af9ea269e00336e503294dfdd2 (patch) | |
tree | fbdda716c1d441b7d85e686e054e3346396a144d /src/flooritem.cpp | |
parent | 78134dc88b0b39b0d051392fa937418bcd384404 (diff) | |
download | mana-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/flooritem.cpp')
-rw-r--r-- | src/flooritem.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 9376dd73..b2f6376b 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -35,7 +35,8 @@ FloorItem::FloorItem(int id, mId(id), mX(x), mY(y), - mMap(map) + mMap(map), + mAlpha(1.0f) { // Create a corresponding item instance mItem = new Item(itemId); @@ -64,7 +65,13 @@ Item *FloorItem::getItem() const void FloorItem::draw(Graphics *graphics, int offsetX, int offsetY) const { - graphics->drawImage(mItem->getImage(), - mX * 32 + offsetX, - mY * 32 + offsetY); + if (mItem) + { + if (mAlpha != mItem->getImage()->getAlpha()) + mItem->getImage()->setAlpha(mAlpha); + + graphics->drawImage(mItem->getImage(), + mX * 32 + offsetX, + mY * 32 + offsetY); + } } |