summaryrefslogtreecommitdiff
path: root/src/monster.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-02-06 07:27:58 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-02-06 07:27:58 +0000
commitb0bc59179bd64ad6b1f006f8e109cbeb16ad7094 (patch)
tree179a50164d79d12f5c14e4b7172a5f514d97b1f1 /src/monster.cpp
parent323b0e57c673035ad8065c7daf399124f15c24d4 (diff)
downloadmana-b0bc59179bd64ad6b1f006f8e109cbeb16ad7094.tar.gz
mana-b0bc59179bd64ad6b1f006f8e109cbeb16ad7094.tar.bz2
mana-b0bc59179bd64ad6b1f006f8e109cbeb16ad7094.tar.xz
mana-b0bc59179bd64ad6b1f006f8e109cbeb16ad7094.zip
Unify some of the drawing code for beings.
Diffstat (limited to 'src/monster.cpp')
-rw-r--r--src/monster.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/monster.cpp b/src/monster.cpp
index f3b58d46..f07f7447 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -26,13 +26,11 @@
#include <sstream>
#include "game.h"
-#include "graphics.h"
#include "log.h"
-#include "graphic/spriteset.h"
-
#include "resources/resourcemanager.h"
+class Spriteset;
extern std::map<int, Spriteset*> monsterset;
Monster::Monster(Uint32 id, Uint16 job, Map *map):
@@ -54,6 +52,7 @@ Monster::Monster(Uint32 id, Uint16 job, Map *map):
monsterset[job - 1002] = tmp;
}
}
+ mSpriteset = monsterset[job-1002];
}
void Monster::logic()
@@ -78,24 +77,17 @@ Being::Type Monster::getType() const
void Monster::draw(Graphics *graphics, int offsetX, int offsetY)
{
- unsigned char dir = direction / 2;
- int px = mPx + offsetX;
- int py = mPy + offsetY;
- int frame;
-
if (mFrame >= 4)
{
mFrame = 3;
}
- frame = action;
+ mSpriteFrame = action;
if (action != MONSTER_DEAD) {
- frame += mFrame;
+ mSpriteFrame += mFrame;
}
- graphics->drawImage(
- monsterset[job-1002]->spriteset[dir + 4 * frame],
- px - 12, py - 25);
+ mSpriteFrame = direction / 2 + 4 * mSpriteFrame;
- Being::draw(graphics, offsetX, offsetY);
+ Being::draw(graphics, offsetX - 12, offsetY - 25);
}