summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2006-08-01 19:05:34 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2006-08-01 19:05:34 +0000
commit8714de88fe9715b5a4014f16d15bc55f8860cdcf (patch)
tree9bd100d9d50bcf1357be375ba7b61fd4d136ce54 /src/being.cpp
parent7b599fad6cdbaa40f1cb496218dcd5546de7f520 (diff)
downloadmana-8714de88fe9715b5a4014f16d15bc55f8860cdcf.tar.gz
mana-8714de88fe9715b5a4014f16d15bc55f8860cdcf.tar.bz2
mana-8714de88fe9715b5a4014f16d15bc55f8860cdcf.tar.xz
mana-8714de88fe9715b5a4014f16d15bc55f8860cdcf.zip
animations and directions are now passed and stored as enums and no longer as strings.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 0295defb..13bcb44a 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -169,42 +169,42 @@ Being::setAction(Uint8 action)
{
//if (action != mAction)
{
- std::string currentAction = "stand";
+ SpriteAction currentAction = ACTION_STAND;
switch (action)
{
case WALK:
- currentAction = "walk";
+ currentAction = ACTION_WALK;
break;
case SIT:
- currentAction = "sit";
+ currentAction = ACTION_SIT;
break;
case ATTACK:
if (getType() == MONSTER)
{
- currentAction = "dead";
+ currentAction = ACTION_DEAD;
}else{
switch (getWeapon())
{
case 2:
- currentAction = "attack_bow";
+ currentAction = ACTION_ATTACK_BOW;
break;
case 1:
- currentAction = "attack_stab";
+ currentAction = ACTION_ATTACK_STAB;
break;
case 0:
- currentAction = "attack";
+ currentAction = ACTION_ATTACK;
break;
}
};
break;
case MONSTER_ATTACK:
- currentAction = "attack";
+ currentAction = ACTION_ATTACK;
break;
case DEAD:
- currentAction = "dead";
+ currentAction = ACTION_DEAD;
break;
default:
- currentAction = "stand";
+ currentAction = ACTION_STAND;
break;
}
@@ -212,9 +212,9 @@ Being::setAction(Uint8 action)
{
if (mSprites[i] != NULL)
{
- if (currentAction == "attack" ||
- currentAction == "attack_stab" ||
- currentAction == "attack_bow")
+ if (currentAction == ACTION_ATTACK ||
+ currentAction == ACTION_ATTACK_STAB ||
+ currentAction == ACTION_ATTACK_BOW)
{
mSprites[i]->play(currentAction, mAttackSpeed);
}
@@ -232,23 +232,23 @@ void
Being::setDirection(Uint8 direction)
{
mDirection = direction;
- std::string dir;
+ SpriteDirection dir;
if (direction & UP)
{
- dir = "up";
+ dir = DIRECTION_UP;
}
else if (direction & RIGHT)
{
- dir = "right";
+ dir = DIRECTION_RIGHT;
}
else if (direction & DOWN)
{
- dir = "down";
+ dir = DIRECTION_DOWN;
}
else
{
- dir = "left";
+ dir = DIRECTION_LEFT;
}
for (int i = 0; i < VECTOREND_SPRITE; i++)