From 8714de88fe9715b5a4014f16d15bc55f8860cdcf Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Tue, 1 Aug 2006 19:05:34 +0000 Subject: animations and directions are now passed and stored as enums and no longer as strings. --- src/being.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/being.cpp') 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++) -- cgit v1.2.3-70-g09d2