diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-15 18:29:15 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-15 18:29:15 +0100 |
commit | 83bbc5cc3afeea0f0b248cd755e1011f4760a298 (patch) | |
tree | 1207131c234ad7c5ae6a5849d1d5d53de45b1b0b /src/map.cpp | |
parent | 7b3b60f86c545e0c5b6b8cb1ab7b1cbbf22d5e02 (diff) | |
parent | 38708de52f00689088eda29f9b6ee257ce7038ad (diff) | |
download | mana-client-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.gz mana-client-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.bz2 mana-client-83bbc5cc3afeea0f0b248cd755e1011f4760a298.tar.xz mana-client-83bbc5cc3afeea0f0b248cd755e1011f4760a298.zip |
Merge commit 'aethyra/master'
Conflicts:
CMakeLists.txt
configure.ac
data/help/header.txt
packaging/windows/setup.nsi
po/POTFILES.in
src/being.cpp
src/being.h
src/game.cpp
src/gui/color.cpp
src/gui/color.h
src/gui/equipmentwindow.h
src/gui/popupmenu.cpp
src/gui/recorder.cpp
src/gui/setup_colors.h
src/gui/setup_keyboard.cpp
src/gui/setup_keyboard.h
src/gui/skill.cpp
src/gui/speechbubble.cpp
src/gui/speechbubble.h
src/gui/table.cpp
src/keyboardconfig.cpp
src/keyboardconfig.h
src/localplayer.cpp
src/main.cpp
src/main.h
src/map.cpp
src/resources/colordb.cpp
src/resources/colordb.h
src/resources/emotedb.cpp
src/resources/emotedb.h
src/text.cpp
src/text.h
src/tmw.rc
src/winver.h
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/map.cpp b/src/map.cpp index b5e815f3..4bbde186 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -25,9 +25,9 @@ #include "configuration.h" #include "game.h" #include "graphics.h" -#include "localplayer.h" #include "map.h" #include "particle.h" +#include "simpleanimation.h" #include "sprite.h" #include "tileset.h" @@ -63,30 +63,35 @@ struct Location }; TileAnimation::TileAnimation(Animation *ani): - mAnimation(ani), mLastImage(NULL) { + mAnimation = new SimpleAnimation(ani); } +TileAnimation::~TileAnimation() +{ + delete mAnimation; +} void TileAnimation::update() { + if (!mAnimation) + return; + //update animation - mAnimation.update(1); + mAnimation->update(1); // exchange images - Image *img = mAnimation.getCurrentImage(); + Image *img = mAnimation->getCurrentImage(); if (img != mLastImage) { - for (std::list<std::pair<MapLayer*, int> >::iterator i = mAffected.begin(); - i != mAffected.end(); - i++) + for (std::list<std::pair<MapLayer*, int> >::iterator i = + mAffected.begin(); i != mAffected.end(); i++) { i->first->setTile(i->second, img); } mLastImage = img; } - } MapLayer::MapLayer(int x, int y, int width, int height, bool isFringeLayer): @@ -136,9 +141,10 @@ void MapLayer::draw(Graphics *graphics, { // If drawing the fringe layer, make sure all sprites above this row of // tiles have been drawn - if (mIsFringeLayer) { - player_node->drawTargetCursor(graphics, scrollX, scrollY); - while (si != sprites.end() && (*si)->getPixelY() <= y * 32 - 32) { + if (mIsFringeLayer) + { + while (si != sprites.end() && (*si)->getPixelY() <= y * 32 - 32) + { (*si)->draw(graphics, -scrollX, -scrollY); si++; } @@ -147,7 +153,8 @@ void MapLayer::draw(Graphics *graphics, for (int x = startX; x < endX; x++) { Image *img = getTile(x, y); - if (img) { + if (img) + { const int px = (x + mX) * 32 - scrollX; const int py = (y + mY) * 32 - scrollY + 32 - img->getHeight(); graphics->drawImage(img, px, py); |