diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-05-02 14:43:40 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-05-06 22:21:57 -0600 |
commit | 9baedc27191c82bbf1fedee2a7e738bc5b267c0e (patch) | |
tree | f0986c6839d1e79b402d5d4ec36e4994741955ea /src/flooritem.h | |
parent | 844e9a7a72faca6a212e788a3adc45e17f41dca6 (diff) | |
download | mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.gz mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.bz2 mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.xz mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.zip |
Add support for floor item sprites
This commit adds a sprite hierarchy (Sprite->ImageSprite,AnimatedSprite,CompundSprite;
CompoundSprite,Actor->ActorSprite;ActorSprite->Being,FloorItem) to collect common
functionailty into new base classes which will make other Mantis tickets easier to do.
Also allows monsters to use particle effects.
Reviewed-by: Bertram
Diffstat (limited to 'src/flooritem.h')
-rw-r--r-- | src/flooritem.h | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/src/flooritem.h b/src/flooritem.h index 17b7b54d..e599c939 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -22,16 +22,14 @@ #ifndef FLOORITEM_H #define FLOORITEM_H -#include "map.h" +#include "actorsprite.h" -class Graphics; -class Image; -class Item; +class ItemInfo; /** * An item lying on the floor. */ -class FloorItem : public Actor +class FloorItem : public ActorSprite { public: /** @@ -49,39 +47,29 @@ class FloorItem : public Actor int y, Map *map); - ~FloorItem(); - - /** - * Returns instance ID of this item. - */ - int getId() const - { return mId; } + Type getType() const { return FLOOR_ITEM; } /** * Returns the item ID. */ - int getItemId() const; + int getItemId() const + { return mItemId; } /** - * Returns the item object. Useful for adding an item link for the - * floor item to chat. + * Returns the item info for this floor item. Useful for adding an item + * link for the floor item to chat. */ - Item *getItem() const; + const ItemInfo &getInfo() const; - /** - * Draws this floor item to the given graphics context. - * - * @see Actor::draw(Graphics, int, int) - */ - void draw(Graphics *graphics, int offsetX, int offsetY) const; + virtual int getTileX() const + { return mX; } - /** We consider flooritems (at least for now) to be one layer-sprites */ - virtual int getNumberOfLayers() const - { return 1; } + virtual int getTileY() const + { return mY; } private: - int mId; - Item *mItem; + int mItemId; + int mX, mY; }; #endif |