From 84aafd27dad40f4033561052164c21fe68cf78ad Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Wed, 11 Jul 2007 12:58:11 +0000 Subject: Weapon sprites are now (almost) threated like other equipment sprites through the equipment sprite database. (use -u to ignore updates) --- src/player.cpp | 44 +++++++------------------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'src/player.cpp') 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); } -- cgit v1.2.3-70-g09d2