diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 4 | ||||
-rw-r--r-- | src/being.h | 4 | ||||
-rw-r--r-- | src/localplayer.cpp | 3 | ||||
-rw-r--r-- | src/localplayer.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 5 | ||||
-rw-r--r-- | src/player.cpp | 9 |
6 files changed, 22 insertions, 5 deletions
diff --git a/src/being.cpp b/src/being.cpp index a74efe5f..9e2e3d7d 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -22,6 +22,7 @@ */ #include "being.h" +#include "equipment.h" #include "game.h" #include "graphics.h" #include "log.h" @@ -56,7 +57,8 @@ Being::Being(Uint32 id, Uint16 job, Map *map): mSpeechTime(0), mDamageTime(0), mShowSpeech(false), mShowDamage(false), - mSpriteset(NULL), mSpriteFrame(0) + mSpriteset(NULL), mSpriteFrame(0), + mEquipment(new Equipment()) { setMap(map); } diff --git a/src/being.h b/src/being.h index 7aeb40a3..0dd8cd65 100644 --- a/src/being.h +++ b/src/being.h @@ -34,6 +34,8 @@ #define NR_HAIR_STYLES 6 #define NR_HAIR_COLORS 10 +class Equipment; +class Item; class Map; class Graphics; class Spriteset; @@ -287,6 +289,8 @@ class Being : public Sprite */ int getYOffset() const { return getOffset(UP, DOWN); } + + std::auto_ptr<Equipment> mEquipment; protected: /** diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 3d12c7c1..0313fe81 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -23,9 +23,9 @@ #include "localplayer.h" -#include "game.h" #include "equipment.h" #include "floor_item.h" +#include "game.h" #include "inventory.h" #include "item.h" #include "main.h" @@ -39,7 +39,6 @@ LocalPlayer *player_node = NULL; LocalPlayer::LocalPlayer(Uint32 id, Uint16 job, Map *map): Player(id, job, map), mInventory(new Inventory()), - mEquipment(new Equipment()), mTarget(NULL), mPickUpTarget(NULL), mTrading(false), mLastAction(-1) { diff --git a/src/localplayer.h b/src/localplayer.h index 38e05f4f..1f8c836f 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -31,7 +31,6 @@ // TODO move into some sane place... #define MAX_SLOT 2 -class Equipment; class FloorItem; class Inventory; class Item; @@ -144,7 +143,6 @@ class LocalPlayer : public Player float mLastAttackTime; /**< Used to synchronize the charge dialog */ std::auto_ptr<Inventory> mInventory; - std::auto_ptr<Equipment> mEquipment; protected: Network *mNetwork; diff --git a/src/main.cpp b/src/main.cpp index 9202654a..f7c36b18 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -84,6 +84,7 @@ char n_server, n_character; std::vector<Spriteset *> hairset; Spriteset *playerset = NULL; +Spriteset *equipmentset = NULL; Graphics *graphics; // TODO Anyone knows a good location for this? Or a way to make it non-global? @@ -250,6 +251,9 @@ void init_engine() playerset = resman->createSpriteset( "graphics/sprites/player_male_base.png", 64, 64); if (!playerset) logger->error("Couldn't load player spriteset!"); + equipmentset = resman->createSpriteset( + "graphics/sprites/item1202.png", 64, 64); + if (!equipmentset) logger->error("Couldn't load player equipmentset!"); for (int i=0; i < NR_HAIR_STYLES; i++) { @@ -290,6 +294,7 @@ void exit_engine() for_each(hairset.begin(), hairset.end(), make_dtor(hairset)); hairset.clear(); delete playerset; + delete equipmentset; // Shutdown libxml xmlCleanupParser(); diff --git a/src/player.cpp b/src/player.cpp index d13cd2f4..54075206 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -23,6 +23,7 @@ #include "player.h" +#include "equipment.h" #include "game.h" #include "graphics.h" @@ -33,6 +34,7 @@ extern std::vector<Spriteset *> hairset; extern Spriteset *playerset; extern std::vector<Spriteset *> weaponset; +extern Spriteset *equipmentset; signed char hairtable[19][4][2] = { // S(x,y) W(x,y) N(x,y) E(x,y) @@ -129,6 +131,13 @@ void Player::draw(Graphics *graphics, int offsetX, int offsetY) graphics->drawImage(playerset->get(frame + 18 * dir), px - 16, py - 32); + Item *item = mEquipment->getEquipment(3); + if (item) + { + graphics->drawImage(equipmentset->get(frame + 18 * dir), + px - 16, py - 32); + } + if (getWeapon() != 0 && mAction == ATTACK) { int frames = 4; |