summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-07-11 12:58:11 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-07-11 12:58:11 +0000
commit84aafd27dad40f4033561052164c21fe68cf78ad (patch)
tree77fb9224634f95b1ede62c6605976feb4ee9455b /src/player.cpp
parent8dd7eef0402cc6e22642f045e3cfde7f5b011d5b (diff)
downloadmana-client-84aafd27dad40f4033561052164c21fe68cf78ad.tar.gz
mana-client-84aafd27dad40f4033561052164c21fe68cf78ad.tar.bz2
mana-client-84aafd27dad40f4033561052164c21fe68cf78ad.tar.xz
mana-client-84aafd27dad40f4033561052164c21fe68cf78ad.zip
Weapon sprites are now (almost) threated like other equipment sprites through the equipment sprite database. (use -u to ignore updates)
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp44
1 files changed, 7 insertions, 37 deletions
diff --git a/src/player.cpp b/src/player.cpp
index ad19fe06..de3bc760 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -36,7 +36,6 @@
Player::Player(Uint32 id, Uint16 job, Map *map):
Being(id, job, map)
{
- setWeapon(0);
}
void
@@ -52,7 +51,8 @@ Player::logic()
case ATTACK:
int frames = 4;
- if (getWeapon() == 2)
+ if ( mEquippedWeapon
+ && mEquippedWeapon->getAttackType() == ACTION_ATTACK_BOW)
{
frames = 5;
}
@@ -120,41 +120,6 @@ Player::setSex(Uint8 sex)
Being::setSex(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)
{
@@ -221,6 +186,11 @@ Player::setVisibleEquipment(Uint8 slot, int id)
delete mSprites[slot];
mSprites[slot] = equipmentSprite;
+ if (slot == WEAPON_SPRITE)
+ {
+ mEquippedWeapon = EquipmentDB::get(id);
+ }
+
setAction(mAction);
}