summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-09-19 17:28:33 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-09-19 17:28:33 +0000
commit1a9320fafb23940d0463e6f384713d0f99fc0c61 (patch)
treed152680dbdc8febf0b5a445ba760255068d72f04 /src/player.cpp
parent2f027ebcf8f0ad78f7edf58af7dda94d89034c85 (diff)
downloadmana-1a9320fafb23940d0463e6f384713d0f99fc0c61.tar.gz
mana-1a9320fafb23940d0463e6f384713d0f99fc0c61.tar.bz2
mana-1a9320fafb23940d0463e6f384713d0f99fc0c61.tar.xz
mana-1a9320fafb23940d0463e6f384713d0f99fc0c61.zip
Merged 0.0 changes from revision 3362 to 3580 to trunk.
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp50
1 files changed, 11 insertions, 39 deletions
diff --git a/src/player.cpp b/src/player.cpp
index d3c27aa0..b63dcd5b 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -28,7 +28,8 @@
#include "graphics.h"
#include "log.h"
-#include "resources/equipmentdb.h"
+#include "resources/itemdb.h"
+#include "resources/iteminfo.h"
#include "utils/tostring.h"
@@ -37,7 +38,6 @@
Player::Player(Uint16 id, Uint16 job, Map *map):
Being(id, job, map)
{
- setWeapon(0);
}
Being::Type
@@ -93,8 +93,8 @@ Player::setSex(Uint8 sex)
if (i != HAIR_SPRITE && mEquipmentSpriteIDs.at(i) != 0)
{
AnimatedSprite *newEqSprite = new AnimatedSprite(
- "graphics/sprites/" + EquipmentDB::get(
- mEquipmentSpriteIDs.at(i))->getSprite(sex));
+ "graphics/sprites/" + ItemDB::get(
+ mEquipmentSpriteIDs.at(i)).getSprite(sex));
delete mSprites[i];
mSprites[i] = newEqSprite;
}
@@ -103,39 +103,6 @@ Player::setSex(Uint8 sex)
}
void
-Player::setWeapon(Uint16 weapon)
-{
- if (weapon != mWeapon)
- {
- AnimatedSprite *newWeaponSprite = NULL;
-
- switch (weapon)
- {
- case 0:
- newWeaponSprite =
- new AnimatedSprite("graphics/sprites/weapon-fist.xml");
- break;
- case 1:
- newWeaponSprite =
- new AnimatedSprite("graphics/sprites/weapon-dagger.xml");
- break;
- case 2:
- newWeaponSprite =
- new AnimatedSprite("graphics/sprites/weapon-bow.xml");
- break;
- case 3:
- newWeaponSprite =
- new AnimatedSprite("graphics/sprites/weapon-scythe.xml");
- break;
- }
-
- delete mSprites[WEAPON_SPRITE];
- mSprites[WEAPON_SPRITE] = newWeaponSprite;
- }
- Being::setWeapon(weapon);
-}
-
-void
Player::setHairColor(Uint16 color)
{
if (color != mHairColor)
@@ -189,11 +156,11 @@ Player::setVisibleEquipment(Uint8 slot, int id)
if (mSex == 0)
{
equipmentSprite = new AnimatedSprite(
- "graphics/sprites/" + EquipmentDB::get(id)->getSprite(0));
+ "graphics/sprites/" + ItemDB::get(id).getSprite(0));
}
else {
equipmentSprite = new AnimatedSprite(
- "graphics/sprites/" + EquipmentDB::get(id)->getSprite(1));
+ "graphics/sprites/" + ItemDB::get(id).getSprite(1));
}
equipmentSprite->setDirection(getSpriteDirection());
@@ -201,6 +168,11 @@ Player::setVisibleEquipment(Uint8 slot, int id)
delete mSprites[slot];
mSprites[slot] = equipmentSprite;
+ if (slot == WEAPON_SPRITE)
+ {
+ mEquippedWeapon = &ItemDB::get(id);
+ }
+
setAction(mAction);
}