summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2006-11-04 23:56:30 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2006-11-04 23:56:30 +0000
commitf7716b5c9946462b885223cd89d9aea97372de0c (patch)
tree8a16ad410029228a804e7e3d076f44bdd7b05e82 /src
parent205decb772ed62df6a16a06d7a75b71aaba46af1 (diff)
downloadmana-f7716b5c9946462b885223cd89d9aea97372de0c.tar.gz
mana-f7716b5c9946462b885223cd89d9aea97372de0c.tar.bz2
mana-f7716b5c9946462b885223cd89d9aea97372de0c.tar.xz
mana-f7716b5c9946462b885223cd89d9aea97372de0c.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp14
-rw-r--r--src/being.h2
-rw-r--r--src/player.cpp31
-rw-r--r--src/player.h3
4 files changed, 47 insertions, 3 deletions
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