diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-07-26 13:48:36 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-07-26 13:48:36 +0000 |
commit | 4af405cd9dc675ef63ac4d993468f4868de85f6a (patch) | |
tree | dd6a4e9cd129d5f8713d548f3ae40262d274c1b7 /src/player.cpp | |
parent | 9516197b54715a660ea86d3d1c85f21f8a7cd918 (diff) | |
download | mana-4af405cd9dc675ef63ac4d993468f4868de85f6a.tar.gz mana-4af405cd9dc675ef63ac4d993468f4868de85f6a.tar.bz2 mana-4af405cd9dc675ef63ac4d993468f4868de85f6a.tar.xz mana-4af405cd9dc675ef63ac4d993468f4868de85f6a.zip |
Fixed direction and action issues when changing appeareance, frames are still out of sync.
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/player.cpp b/src/player.cpp index 9b7536cf..4e42e3c0 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -106,9 +106,14 @@ Player::setHairColor(Uint16 color) { if (color != mHairColor && mHairStyle > 0) { - delete mSprites[HAIR_SPRITE]; + if (mSprites[HAIR_SPRITE]) + { + delete mSprites[HAIR_SPRITE]; + } mSprites[HAIR_SPRITE] = new AnimatedSprite("graphics/sprites/hairstyle"+toString(mHairStyle)+".xml", color - 1); } + setDirection(mDirection); + setAction(mAction); Being::setHairColor(color); }; @@ -117,9 +122,14 @@ Player::setHairStyle(Uint16 style) { if (style != mHairStyle && mHairColor > 0) { - delete mSprites[HAIR_SPRITE]; + if (mSprites[HAIR_SPRITE]) + { + delete mSprites[HAIR_SPRITE]; + } mSprites[HAIR_SPRITE] = new AnimatedSprite("graphics/sprites/hairstyle"+toString(style)+".xml", mHairColor - 1); } + setDirection(mDirection); + setAction(mAction); Being::setHairStyle(style); }; @@ -147,10 +157,11 @@ Player::setVisibleEquipment(Uint8 slot, Uint8 id) if (id) { char stringId[4]; sprintf(stringId, "%03i", id); - printf("Id: %i %i %s\n", id, slot, stringId); mSprites[position] = new AnimatedSprite( "graphics/sprites/item" + toString(stringId) + ".xml", 0); } + setDirection(mDirection); + setAction(mAction); Being::setVisibleEquipment(slot, id); } |