summaryrefslogtreecommitdiff
path: root/src/being.h
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-03-13 07:29:30 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-03-13 07:29:30 +0000
commitfe474eb4fae9d89e3797d0ceaae6613798ce491f (patch)
tree2a91b2f17636ae7b20eea06a28a89942f6f36d39 /src/being.h
parent3a275cc81fe9aa1cb6736cdf12211e13e93cf2cf (diff)
downloadmana-fe474eb4fae9d89e3797d0ceaae6613798ce491f.tar.gz
mana-fe474eb4fae9d89e3797d0ceaae6613798ce491f.tar.bz2
mana-fe474eb4fae9d89e3797d0ceaae6613798ce491f.tar.xz
mana-fe474eb4fae9d89e3797d0ceaae6613798ce491f.zip
Synchronized pathfinding algorithmns with those used by the server to avoid asynchronisation.
Diffstat (limited to 'src/being.h')
-rw-r--r--src/being.h39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/being.h b/src/being.h
index 0b56994e..f4cdc743 100644
--- a/src/being.h
+++ b/src/being.h
@@ -112,14 +112,13 @@ class Being : public Sprite
enum { DOWN = 1, LEFT = 2, UP = 4, RIGHT = 8 };
std::string mName; /**< Name of character */
- Uint16 mJob; /**< Job (player job, npc, monster, ) */
- Uint16 mX, mY; /**< Pixel coordinates (tile center) */
- Action mAction; /**< Action the being is performing */
- Uint16 mWalkTime;
+ Uint16 mX, mY; /**< Pixel coordinates of tile center */
Uint8 mEmotion; /**< Currently showing emotion */
Uint8 mEmotionTime; /**< Time until emotion disappears */
-
Uint16 mAttackSpeed; /**< Attack speed */
+ Uint16 mWalkTime;
+ Action mAction; /**< Action the being is performing */
+ Uint16 mJob; /**< Job (player job, npc, monster, ) */
/**
* Constructor.
@@ -265,6 +264,13 @@ class Being : public Sprite
setAction(Action action, int attackType = 0);
/**
+ * Gets the current action.
+ */
+ bool isAlive() { return mAction != DEAD; }
+
+ int getWalkTime() { return mWalkTime; }
+
+ /**
* Returns the direction the being is facing.
*/
SpriteDirection getSpriteDirection() const
@@ -298,6 +304,17 @@ class Being : public Sprite
getPixelY() const { return mPy; }
/**
+ * sets the position in pixels using pixel coordinates
+ */
+ void setPositionInPixels(int x, int y);
+
+ /**
+ * sets the position in pixels using tile coordinates
+ */
+ void setPositionInTiles(int x, int y)
+ { setPositionInPixels(x * 32 + 16, y * 32 + 16); }
+
+ /**
* Get the current X pixel offset.
*/
int
@@ -332,12 +349,24 @@ class Being : public Sprite
*/
void controlParticle(Particle *particle);
+ /**
+ * Gets the way the object is blocked by other objects
+ */
+ virtual unsigned char getWalkMask() const
+ { return 0x00; } //can walk through everything
+
protected:
/**
* Sets the new path for this being.
*/
void setPath(const Path &path, int mod = 1024);
+ /**
+ * Gets the way the object blocks pathfinding for other objects
+ */
+ virtual Map::BlockType getBlockType() const
+ { return Map::BLOCKTYPE_NONE; }
+
Uint16 mId; /**< Unique being id */
Uint16 mWalkSpeed; /**< Walking speed */
Uint16 mSpeedModifier; /**< Modifier to keep course on sync (1024 = normal speed) */