diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-11-26 14:20:50 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-11-26 14:20:50 +0000 |
commit | 7f819e46b584145e2cf2ea742ced9fab0ffc233e (patch) | |
tree | 9aa8ee99a4b4dd653917155282e82e6b9a64f718 /src/player.cpp | |
parent | cc86266f4b59420a155df8c1aa01b9ce20b6585d (diff) | |
download | mana-7f819e46b584145e2cf2ea742ced9fab0ffc233e.tar.gz mana-7f819e46b584145e2cf2ea742ced9fab0ffc233e.tar.bz2 mana-7f819e46b584145e2cf2ea742ced9fab0ffc233e.tar.xz mana-7f819e46b584145e2cf2ea742ced9fab0ffc233e.zip |
Made Being::mDirection protected, forcing the use of setDirection. Defaulted
variant argument to 0 since this is the most common situation. Some SpriteDef
refactoring, splitting up the loading into several methods, in preparation of
adding support for including other sprites.
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/player.cpp b/src/player.cpp index d6bd42f1..cd6986b3 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -94,12 +94,12 @@ Player::setSex(Uint8 sex) if (sex == 0) { mSprites[BASE_SPRITE] = new AnimatedSprite( - "graphics/sprites/player_male_base.xml", 0); + "graphics/sprites/player_male_base.xml"); } else { mSprites[BASE_SPRITE] = new AnimatedSprite( - "graphics/sprites/player_female_base.xml", 0); + "graphics/sprites/player_female_base.xml"); } //reload equipment @@ -109,8 +109,8 @@ Player::setSex(Uint8 sex) { delete mSprites[i]; mSprites[i] = new AnimatedSprite( - "graphics/sprites/" + EquipmentDB::get(mEquipmentSpriteIDs.at(i))->getSprite(sex), - 0); + "graphics/sprites/" + EquipmentDB::get( + mEquipmentSpriteIDs.at(i))->getSprite(sex)); } } } @@ -130,16 +130,20 @@ Player::setWeapon(Uint16 weapon) switch (weapon) { case 0: - mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-fist.xml", 0); + mSprites[WEAPON_SPRITE] = + new AnimatedSprite("graphics/sprites/weapon-fist.xml"); break; case 1: - mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-dagger.xml", 0); + mSprites[WEAPON_SPRITE] = + new AnimatedSprite("graphics/sprites/weapon-dagger.xml"); break; case 2: - mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-bow.xml", 0); + mSprites[WEAPON_SPRITE] = + new AnimatedSprite("graphics/sprites/weapon-bow.xml"); break; case 3: - mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-scythe.xml", 0); + mSprites[WEAPON_SPRITE] = + new AnimatedSprite("graphics/sprites/weapon-scythe.xml"); break; } } @@ -215,13 +219,11 @@ Player::setVisibleEquipment(Uint8 slot, int id) if (mSex == 0) { equipmentSprite = new AnimatedSprite( - "graphics/sprites/" + EquipmentDB::get(id)->getSprite(0), - 0); + "graphics/sprites/" + EquipmentDB::get(id)->getSprite(0)); } else { equipmentSprite = new AnimatedSprite( - "graphics/sprites/" + EquipmentDB::get(id)->getSprite(1), - 0); + "graphics/sprites/" + EquipmentDB::get(id)->getSprite(1)); } equipmentSprite->setDirection(getSpriteDirection()); |