summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-07-26 13:48:36 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-07-26 13:48:36 +0000
commit4af405cd9dc675ef63ac4d993468f4868de85f6a (patch)
treedd6a4e9cd129d5f8713d548f3ae40262d274c1b7
parent9516197b54715a660ea86d3d1c85f21f8a7cd918 (diff)
downloadmana-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.
-rw-r--r--ChangeLog2
-rw-r--r--src/being.cpp4
-rw-r--r--src/being.h2
-rw-r--r--src/player.cpp17
4 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 8504b238..c3bb966b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
* data/graphics/sprites/Makefile.am, data/graphics/tiles/Makefile.am,
data/maps/Makefile.am, data/maps/new_13-1.tmx.gz: Added map with inside
of snow village buildings and fixed makefiles.
+ * src/being.cpp, src/being.h, src/player.cpp: Fixed direction and
+ action issues when changing appeareance, frames are still out of sync.
2006-07-26 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/being.cpp b/src/being.cpp
index 8a55f2e2..4256bdc7 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -164,9 +164,9 @@ Being::setMap(Map *map)
}
void
-Being::setAction(Action action)
+Being::setAction(Uint8 action)
{
- if (action != mAction)
+ //if (action != mAction)
{
std::string currentAction = "stand";
switch (action)
diff --git a/src/being.h b/src/being.h
index 478bc018..01b4fded 100644
--- a/src/being.h
+++ b/src/being.h
@@ -290,7 +290,7 @@ class Being : public Sprite
/**
* Sets the current action.
*/
- void setAction(Action action);
+ void setAction(Uint8 action);
/**
* Sets the current direction.
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);
}