diff options
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/player.cpp b/src/player.cpp index 0ba99fe7..3f0ebfc4 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -37,7 +37,7 @@ Player::Player(Uint32 id, Uint16 job, Map *map): // Load the weapon sprite. // When there are more different weapons this should be moved to the // setWeapon Method. - mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapons.xml", 0); + setWeapon(0); } void @@ -103,6 +103,35 @@ Player::setSex(Uint8 sex) Being::setSex(sex); } + +void +Player::setWeapon(Uint16 weapon) +{ + if (weapon != mWeapon) + { + delete mSprites[WEAPON_SPRITE]; + mSprites[WEAPON_SPRITE] = NULL; + + switch (weapon) + { + case 0: + mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-fist.xml", 0); + break; + case 1: + mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-dagger.xml", 0); + break; + case 2: + mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-bow.xml", 0); + break; + case 3: + mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-scythe.xml", 0); + break; + } + } + Being::setWeapon(weapon); +} + + void Player::setHairColor(Uint16 color) { |