From f7716b5c9946462b885223cd89d9aea97372de0c Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Sat, 4 Nov 2006 23:56:30 +0000 Subject: added scythe as a permanent weapon. When you want to test it: either spawn an item with the id 623 or uncomment the lines 439-441 in being.cpp to use the sharp knive as scythe. --- ChangeLog | 13 +++++++++++++ src/being.cpp | 14 +++++++++++++- src/being.h | 2 +- src/player.cpp | 31 ++++++++++++++++++++++++++++++- src/player.h | 3 +++ 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2103207..a5e54371 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-11-05 Philipp Sehmisch + + *data/graphics/sprites/weapon0.png, + data/graphics/sprites/weapon2.png, + data/graphics/sprites/weapon-bow.xml, + data/graphics/sprites/weapon-dagger.xml, + data/graphics/sprites/weapon-fist.xml, + data/graphics/sprites/weapon-scythe.xml, + data/graphics/items/weapon-polearm-scythe.png, + src/player.cpp, src/player.h, src/being.cpp, src/being.h, + data/items.xml: + Added scythe as a permanent weapon (ID: 623) + 2006-11-04 Bjørn Lindeijer * data/maps/new_1-1.tmx.gz, data/maps/new_10-1.tmx.gz, diff --git a/src/being.cpp b/src/being.cpp index dd0554cc..bf85b6e5 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -180,6 +180,9 @@ Being::setAction(Uint8 action) else { switch (getWeapon()) { + case 3: + currentAction = ACTION_ATTACK; + break; case 2: currentAction = ACTION_ATTACK_BOW; break; @@ -414,19 +417,28 @@ Being::getType() const void Being::setWeaponById(Uint16 weapon) { + //TODO: Use an external file to map weapon IDs to weapon types switch (weapon) { case 529: // iron arrows case 1199: // arrows break; + case 623: //scythe + setWeapon(3); + break; + case 1200: // bow case 530: // short bow case 545: // forest bow setWeapon(2); break; - case 521: // sharp knife + case 521: // sharp knive + /* UNCOMMENT TO TEST SHARP KNIVE AS SCYTHE + * setWeapon(3) + * break; + */ case 522: // dagger case 536: // short sword case 1201: // knife diff --git a/src/being.h b/src/being.h index 0735efe9..42f37058 100644 --- a/src/being.h +++ b/src/being.h @@ -248,7 +248,7 @@ class Being : public Sprite * * @param weapon the picture id */ - void + virtual void setWeapon(Uint16 weapon) { mWeapon = weapon; } /** 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) { diff --git a/src/player.h b/src/player.h index 21870fb0..e23110be 100644 --- a/src/player.h +++ b/src/player.h @@ -58,6 +58,9 @@ class Player : public Being virtual void setVisibleEquipment(Uint8 slot, Uint8 id); + virtual void + setWeapon(Uint16 weapon); + private: /** * Resets all animations associated with this player. This is used to -- cgit v1.2.3-70-g09d2