diff options
Diffstat (limited to 'src/flooritem.h')
| -rw-r--r-- | src/flooritem.h | 90 |
1 files changed, 20 insertions, 70 deletions
diff --git a/src/flooritem.h b/src/flooritem.h index ec8c37cd..37fed4b2 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -22,102 +22,52 @@ #ifndef FLOORITEM_H #define FLOORITEM_H -#include "map.h" -#include "sprite.h" +#include "actorsprite.h" -#include <list> - -class Graphics; -class Image; -class Item; +class ItemInfo; /** * An item lying on the floor. */ -class FloorItem : public Sprite +class FloorItem : public ActorSprite { public: /** * Constructor. * - * @param id the unique ID of this item instance - * @param itemId the item ID - * @param x the x position in tiles - * @param y the y position in tiles - * @param map the map this item is on + * @param id the unique ID of this item instance + * @param itemId the item ID + * @param position the position in pixels + * @param map the map this item is on */ FloorItem(int id, int itemId, - int x, - int y, + const Vector &position, 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; - - /** - * Returns the item object. Useful for adding an item link for the - * floor item to chat. - */ - Item *getItem() const; - - /** - * Returns the x coordinate in tiles. - */ - int getX() const { return mX; } + int getItemId() const + { return mItemId; } /** - * Returns the y coordinate in tiles. + * Returns the item info for this floor item. Useful for adding an item + * link for the floor item to chat. */ - int getY() const { return mY; } + const ItemInfo &getInfo() const; - /** - * Returns the pixel y coordinate. - * - * @see Sprite::getPixelY() - */ - int getPixelY() const - { return mY * mMap->getTileHeight() + mMap->getTileHeight() / 2; } - - /** - * Draws this floor item to the given graphics context. - * - * @see Sprite::draw(Graphics, int, int) - */ - void draw(Graphics *graphics, int offsetX, int offsetY) const; - - /** - * Sets the alpha value of the floor item - */ - void setAlpha(float alpha) - { mAlpha = alpha; } - - /** - * Returns the current alpha opacity of the floor item. - */ - virtual float getAlpha() const - { return mAlpha; } + 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; + int mItemId; int mX, mY; - Item *mItem; - MapSprite mMapSprite; - Map *mMap; - float mAlpha; }; -#endif +#endif // FLOORITEM_H |