summaryrefslogtreecommitdiff
path: root/src/monster.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-07-19 15:12:06 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-07-19 15:12:06 +0000
commit4050f8c0bced625a95d542d30647c3f8bbf2267b (patch)
tree420d65a5ed6a2155762b4e13a4c90ab2df9f888e /src/monster.cpp
parentda3a1fd114dd7b8e5e8c880bd987506acc16ac42 (diff)
downloadmana-4050f8c0bced625a95d542d30647c3f8bbf2267b.tar.gz
mana-4050f8c0bced625a95d542d30647c3f8bbf2267b.tar.bz2
mana-4050f8c0bced625a95d542d30647c3f8bbf2267b.tar.xz
mana-4050f8c0bced625a95d542d30647c3f8bbf2267b.zip
Merged new_animation branch until r2415 into trunk.
Diffstat (limited to 'src/monster.cpp')
-rw-r--r--src/monster.cpp41
1 files changed, 5 insertions, 36 deletions
diff --git a/src/monster.cpp b/src/monster.cpp
index af84b25e..43823e50 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -30,28 +30,15 @@
#include "utils/tostring.h"
-class Spriteset;
-extern std::map<int, Spriteset*> monsterset;
Monster::Monster(Uint32 id, Uint16 job, Map *map):
Being(id, job, map)
{
- // Load monster spriteset, if necessary
- if (monsterset.find(job - 1002) == monsterset.end())
- {
- Spriteset *tmp = ResourceManager::getInstance()->createSpriteset(
- "graphics/sprites/monster" + toString(job - 1002) + ".png",
- 60, 60);
- if (!tmp) {
- logger->error("Unable to load monster spriteset!");
- } else {
- monsterset[job - 1002] = tmp;
- }
- }
- mSpriteset = monsterset[job-1002];
+ mSprites[BASE_SPRITE] = new AnimatedSprite("graphics/sprites/monster" + toString(job - 1002) + ".xml", 0);
}
-void Monster::logic()
+void
+Monster::logic()
{
if (mAction != STAND)
{
@@ -66,27 +53,9 @@ void Monster::logic()
Being::logic();
}
-Being::Type Monster::getType() const
+Being::Type
+Monster::getType() const
{
return MONSTER;
}
-void Monster::draw(Graphics *graphics, int offsetX, int offsetY)
-{
- if (mFrame >= 4)
- {
- mFrame = 3;
- }
-
- mSpriteFrame = mAction;
- if (mAction != MONSTER_DEAD) {
- mSpriteFrame += mFrame;
- }
-
- unsigned char dir = 0;
- while (!(mDirection & (1 << dir))) dir++;
-
- mSpriteFrame = dir + 4 * mSpriteFrame;
-
- Being::draw(graphics, offsetX - 12, offsetY - 25);
-}