From fe474eb4fae9d89e3797d0ceaae6613798ce491f Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Thu, 13 Mar 2008 07:29:30 +0000 Subject: Synchronized pathfinding algorithmns with those used by the server to avoid asynchronisation. --- src/being.h | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'src/being.h') 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. @@ -264,6 +263,13 @@ class Being : public Sprite virtual void 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. */ @@ -297,6 +303,17 @@ class Being : public Sprite int 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. */ @@ -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) */ -- cgit v1.2.3-60-g2f50