summaryrefslogtreecommitdiff
path: root/src/monster.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-03-09 20:41:27 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-03-09 20:41:27 +0000
commit4e2ced304a2013808b2481cceb7622848b073e5b (patch)
tree2cc2c6cbc3f6e17842919530d583f91256dc86e1 /src/monster.cpp
parent15014d358424bf5f74a2d9b7afd08692b591a448 (diff)
downloadmana-4e2ced304a2013808b2481cceb7622848b073e5b.tar.gz
mana-4e2ced304a2013808b2481cceb7622848b073e5b.tar.bz2
mana-4e2ced304a2013808b2481cceb7622848b073e5b.tar.xz
mana-4e2ced304a2013808b2481cceb7622848b073e5b.zip
Implemented possibility to rotate particle emitters. Implemented interpretation of the attacktype parameter of attack messages and visualize monster attacks other than id 1 with a particle effect. Prepared to get attack particle effects and animation types from the monster database.
Diffstat (limited to 'src/monster.cpp')
-rw-r--r--src/monster.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/monster.cpp b/src/monster.cpp
index ae749017..5fbcfaea 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -25,6 +25,7 @@
#include "animatedsprite.h"
#include "game.h"
+#include "particle.h"
#include "sound.h"
#include "resources/monsterdb.h"
@@ -50,9 +51,11 @@ Monster::getType() const
}
void
-Monster::setAction(Action action)
+Monster::setAction(Action action, int attackType)
{
SpriteAction currentAction = ACTION_INVALID;
+ int rotation = 0;
+ std::string particleEffect;
switch (action)
{
@@ -64,8 +67,26 @@ Monster::setAction(Action action)
sound.playSfx(getInfo().getSound(MONSTER_EVENT_DIE));
break;
case ATTACK:
- currentAction = ACTION_ATTACK;
- mSprites[BASE_SPRITE]->reset();
+ currentAction = getInfo().getAttackAction(attackType);
+
+ //attack particle effect
+ particleEffect = getInfo().getAttackParticleEffect(attackType);
+ if (particleEffect != "")
+ {
+ switch (mDirection)
+ {
+ case DOWN: rotation = 0; break;
+ case LEFT: rotation = 90; break;
+ case UP: rotation = 180; break;
+ case RIGHT: rotation = 270; break;
+ default: break;
+ }
+ mSprites[BASE_SPRITE]->reset();
+ Particle *p;
+ p = particleEngine->addEffect(
+ particleEffect, 0, 0, rotation);
+ controlParticle(p);
+ }
break;
case STAND:
currentAction = ACTION_STAND;