diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2006-12-29 12:22:02 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2006-12-29 12:22:02 +0000 |
commit | 3d404e743105bb9168c89e3451cf35d7d59120b1 (patch) | |
tree | 39389b921d054d508a5dee7d0ed7f4f3c5e7d29e /src/object.h | |
parent | 4bfa5b213257416f997d01b087c9e8bbb91cb3b9 (diff) | |
download | manaserv-3d404e743105bb9168c89e3451cf35d7d59120b1.tar.gz manaserv-3d404e743105bb9168c89e3451cf35d7d59120b1.tar.bz2 manaserv-3d404e743105bb9168c89e3451cf35d7d59120b1.tar.xz manaserv-3d404e743105bb9168c89e3451cf35d7d59120b1.zip |
Implemented basic attack hit detection and damage notification.
Diffstat (limited to 'src/object.h')
-rw-r--r-- | src/object.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/object.h b/src/object.h index 63d6c115..0b019239 100644 --- a/src/object.h +++ b/src/object.h @@ -30,6 +30,8 @@ #include "point.h" #include "utils/countedptr.h" +class MapComposite; + enum { NEW_ON_MAP = 1, @@ -37,6 +39,7 @@ enum ATTACK = 4 }; + /** * Generic in-game object definition. * Base class for in-game objects. @@ -133,10 +136,20 @@ class MovingObject: public Object { public: /** + * Directions, to be used as bitmask values + */ + static const char DOWN = 1; + static const char LEFT = 2; + static const char UP = 4; + static const char RIGHT = 8; + + /** * Proxy constructor. */ MovingObject(int type, int id) - : Object(type), mPublicID(id), + : Object(type), + mDirection(DOWN), + mPublicID(id), mActionTime(0) {} @@ -159,6 +172,19 @@ class MovingObject: public Object { return mOld; } /** + * Sete object direction + */ + void setDirection(unsigned char direction) + { mDirection = direction; } + + /** + * Gets object direction + */ + + unsigned char getDirection() const + { return mDirection; } + + /** * Sets object speed. */ void setSpeed(unsigned s) @@ -170,6 +196,11 @@ class MovingObject: public Object void move(); /** + * Performs an attack + */ + virtual void performAttack (MapComposite* map) = 0; + + /** * Get public ID. * * @return the public ID, 65535 if none yet. @@ -186,6 +217,7 @@ class MovingObject: public Object protected: unsigned short mActionTime; /**< delay until next action */ + unsigned char mDirection; /**< Facing direction */ private: unsigned short mPublicID; /**< Object ID sent to clients (unique with respect to the map) */ |