summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2006-11-26 10:12:14 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2006-11-26 10:12:14 +0000
commit78f7e290e46e6084bc51023ae3c8619b0695b7b6 (patch)
tree86c72dc0e278ba3a49565284d8d58755ed61b31f /src/player.cpp
parenteb6a3dfd09f88414ba1bae9ffe1cf4440db7565d (diff)
downloadmana-78f7e290e46e6084bc51023ae3c8619b0695b7b6.tar.gz
mana-78f7e290e46e6084bc51023ae3c8619b0695b7b6.tar.bz2
mana-78f7e290e46e6084bc51023ae3c8619b0695b7b6.tar.xz
mana-78f7e290e46e6084bc51023ae3c8619b0695b7b6.zip
Equipment database namespace and support for gender specific equipment sprites
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/player.cpp b/src/player.cpp
index df9b74f6..d6bd42f1 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -27,6 +27,8 @@
#include "game.h"
#include "graphics.h"
+#include "resources/equipmentdb.h"
+
#include "utils/tostring.h"
#include "gui/gui.h"
@@ -87,6 +89,7 @@ Player::setSex(Uint8 sex)
{
if (sex != mSex)
{
+ //reload base sprite
delete mSprites[BASE_SPRITE];
if (sex == 0)
{
@@ -98,7 +101,20 @@ Player::setSex(Uint8 sex)
mSprites[BASE_SPRITE] = new AnimatedSprite(
"graphics/sprites/player_female_base.xml", 0);
}
+
+ //reload equipment
+ for (int i=1; i<VECTOREND_SPRITE ; i++)
+ {
+ if (i != HAIR_SPRITE && mEquipmentSpriteIDs.at(i) != 0)
+ {
+ delete mSprites[i];
+ mSprites[i] = new AnimatedSprite(
+ "graphics/sprites/" + EquipmentDB::get(mEquipmentSpriteIDs.at(i))->getSprite(sex),
+ 0);
+ }
+ }
}
+
Being::setSex(sex);
}
@@ -170,7 +186,7 @@ Player::setHairStyle(Uint16 style)
}
void
-Player::setVisibleEquipment(Uint8 slot, Uint8 id)
+Player::setVisibleEquipment(Uint8 slot, int id)
{
// Translate eAthena specific slot
Uint8 position = 0;
@@ -194,11 +210,20 @@ Player::setVisibleEquipment(Uint8 slot, Uint8 id)
}
else
{
- char stringId[4];
- sprintf(stringId, "%03i", id);
+ AnimatedSprite *equipmentSprite;
+
+ if (mSex == 0)
+ {
+ equipmentSprite = new AnimatedSprite(
+ "graphics/sprites/" + EquipmentDB::get(id)->getSprite(0),
+ 0);
+ }
+ else {
+ equipmentSprite = new AnimatedSprite(
+ "graphics/sprites/" + EquipmentDB::get(id)->getSprite(1),
+ 0);
+ }
- AnimatedSprite *equipmentSprite = new AnimatedSprite(
- "graphics/sprites/item" + toString(stringId) + ".xml", 0);
equipmentSprite->setDirection(getSpriteDirection());
delete mSprites[position];