You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.0 KiB

#ifndef THING_H
#define THING_H
#include <global.h>
#include "position.h"
enum ThingAttributesGroup {
THING_GROUP_NONE = 0,
THING_GROUP_GROUND,
THING_GROUP_CONTAINER,
THING_GROUP_WEAPON,
THING_GROUP_AMMUNITION,
THING_GROUP_ARMOR,
THING_GROUP_RUNE,
THING_GROUP_TELEPORT,
THING_GROUP_MAGICFIELD,
THING_GROUP_WRITEABLE,
THING_GROUP_KEY,
THING_GROUP_SPLASH,
THING_GROUP_FLUID,
THING_GROUP_DOOR,
THING_GROUP_LAST
};
struct ThingAttributes
{
ThingAttributes();
~ThingAttributes();
bool stackable, alwaysOnTop, useable, readable, moveable, blockSolid, blockProjectile, blockPathFind, pickupable,
isHangable, isHorizontal, isVertical, rotable, hasHeight, lookThrough, hasMiniMapColor;
uint8 alwaysOnTopOrder, width, height, blendframes, xdiv, ydiv, zdiv, animcount, xOffset, yOffset;
uint16 id, speed, subParam07, subParam08, lightLevel, lightColor, miniMapColor;
uint16 *sprites;
ThingAttributesGroup group;
};
class Creature;
class Item;
class Thing;
typedef std::shared_ptr<Thing> ThingPtr;
class Thing
{
public:
Thing();
enum Type {
TYPE_NONE,
TYPE_ITEM,
TYPE_CREATURE,
TYPE_EFFECT,
TYPE_SHOT
};
void setId(uint32 id) { m_id = id; }
uint32 getId() { return m_id; }
void setType(Type type) { m_type = type; }
Type getType() const { return m_type; }
void setPosition(const Position& position) { m_position = position; }
Position *getPosition() { return &m_position; }
virtual void draw(int, int) {}
virtual ThingAttributes *getAttributes() { return NULL; }
virtual Item* getItem() { return NULL; }
virtual const Item *getItem() const { return NULL; }
virtual Creature *getCreature() { return NULL; }
virtual const Creature *getCreature() const { return NULL; }
protected:
void internalDraw(int x, int y, int blendframes, int xdiv, int ydiv, int zdiv, int anim);
uint32 m_id;
Type m_type;
Position m_position;
};
#endif // THING_H