diff options
author | Bertram <bertram@cegetel.net> | 2010-01-27 01:46:58 +0100 |
---|---|---|
committer | Bertram <bertram@cegetel.net> | 2010-01-27 01:46:58 +0100 |
commit | 572ed6a1aa6c847e8764bddf2bb0d687ecf1a405 (patch) | |
tree | f0183d944a3a887b359e2dc2895e87a9c2767e66 /src/being.h | |
parent | 692aac3122843c59610684802e25b92cc9f0a33c (diff) | |
download | mana-572ed6a1aa6c847e8764bddf2bb0d687ecf1a405.tar.gz mana-572ed6a1aa6c847e8764bddf2bb0d687ecf1a405.tar.bz2 mana-572ed6a1aa6c847e8764bddf2bb0d687ecf1a405.tar.xz mana-572ed6a1aa6c847e8764bddf2bb0d687ecf1a405.zip |
Added mutators/accessors to being.h and smal cleanups.
Diffstat (limited to 'src/being.h')
-rw-r--r-- | src/being.h | 132 |
1 files changed, 93 insertions, 39 deletions
diff --git a/src/being.h b/src/being.h index 9f50b2cc..c564482a 100644 --- a/src/being.h +++ b/src/being.h @@ -115,18 +115,6 @@ class Being : public Sprite, public ConfigListener */ enum { DOWN = 1, LEFT = 2, UP = 4, RIGHT = 8 }; - int mFrame; -#ifdef EATHENA_SUPPORT - int mWalkTime; -#endif - int mEmotion; /**< Currently showing emotion */ - int mEmotionTime; /**< Time until emotion disappears */ - int mSpeechTime; - - int mAttackSpeed; /**< Attack speed */ - Action mAction; /**< Action the being is performing */ - Uint16 mJob; /**< Job (player job, npc, monster, creature ) */ - /** * Constructor. * @@ -143,12 +131,42 @@ class Being : public Sprite, public ConfigListener */ void clearPath(); +#ifdef EATHENA_SUPPORT + /** + * Returns the walk time. + * Used to know which frame to display and trigger + * the next Tile step. + */ + int getWalkTime() const { return mWalkTime; } + + /** + * Set the current WalkTime value. + * @see Ea::BeingHandler that set it to tick time. + */ + void setWalkTime(int walkTime) { mWalkTime = walkTime; } + + /** + * Makes this being take the next step (tile) of its path. + */ + virtual void nextStep(); + + /** + * Get the current X pixel offset. + */ + int getXOffset() const + { return getOffset(LEFT, RIGHT); } + + /** + * Get the current Y pixel offset. + */ + int getYOffset() const + { return getOffset(UP, DOWN); } + /** * Sets a new destination for this being to walk to. */ -#ifdef EATHENA_SUPPORT virtual void setDestination(int destX, int destY); -#else +#elif MANASERV_SUPPORT /** * Creates a path for the being from current position to ex and ey */ @@ -234,13 +252,6 @@ class Being : public Sprite, public ConfigListener */ int getNumberOfLayers() const; -#ifdef EATHENA_SUPPORT - /** - * Makes this being take the next step of his path. - */ - virtual void nextStep(); -#endif - /** * Performs being logic. */ @@ -261,6 +272,16 @@ class Being : public Sprite, public ConfigListener */ virtual Type getType() const { return UNKNOWN; } + /** + * Return Being's current Job (player job, npc, monster, creature ) + */ + Uint16 getJob() const { return mJob; } + + /** + * Set Being's current Job (player job, npc, monster, creature ) + */ + void setJob(Uint16 job) { mJob = job; } + /** * Sets the walk speed. * in pixels per second for eAthena, @@ -276,6 +297,18 @@ class Being : public Sprite, public ConfigListener float getWalkSpeed() const { return mWalkSpeed; } /** + * Sets the attack speed. + * @todo In what unit? + */ + void setAttackSpeed(int speed) { mAttackSpeed = speed; } + + /** + * Gets the attack speed. + * @todo In what unit? + */ + int getAttackSpeed() const { return mAttackSpeed; } + + /** * Sets the sprite id. */ void setId(int id) { mId = id; } @@ -293,6 +326,11 @@ class Being : public Sprite, public ConfigListener virtual void setAction(Action action, int attackType = 0); /** + * Get the being's action currently performed. + */ + Action getCurrentAction() const { return mAction; } + + /** * Returns whether this being is still alive. */ bool isAlive() const { return mAction != DEAD; } @@ -307,12 +345,15 @@ class Being : public Sprite, public ConfigListener */ void setDirection(Uint8 direction); -#ifdef EATHENA_SUPPORT /** - * Returns the walk time. + * Returns the being's current sprite frame number. */ - int getWalkTime() const { return mWalkTime; } -#endif + int getCurrentFrame() const { return mFrame; } + + /** + * Set the being's current sprite frame number. + */ + void setFrame(int frame) { mFrame = frame; } /** * Returns the direction the being is facing. @@ -361,20 +402,6 @@ class Being : public Sprite, public ConfigListener int getPixelY() const { return mPos.y; } -#ifdef EATHENA_SUPPORT - /** - * Get the current X pixel offset. - */ - int getXOffset() const - { return getOffset(LEFT, RIGHT); } - - /** - * Get the current Y pixel offset. - */ - int getYOffset() const - { return getOffset(UP, DOWN); } -#endif - /** * Sets the position of this being. */ @@ -438,6 +465,11 @@ class Being : public Sprite, public ConfigListener */ void untarget() { mUsedTargetCursor = NULL; } + + /** + * Set the Emoticon type and time displayed above + * the being. + */ void setEmote(Uint8 emotion, Uint8 emote_time) { mEmotion = emotion; @@ -445,6 +477,12 @@ class Being : public Sprite, public ConfigListener } /** + * Get the current Emoticon type displayed above + * the being. + */ + Uint8 getEmotion() const { return mEmotion; } + + /** * Sets the being's stun mode. If zero, the being is `normal', * otherwise it is `stunned' in some fashion. */ @@ -539,6 +577,22 @@ class Being : public Sprite, public ConfigListener virtual void showName(); + /** The current sprite Frame number to be displayed */ + int mFrame; + +#ifdef EATHENA_SUPPORT + /** Used to trigger the nextStep (walking on next Tile) */ + int mWalkTime; +#endif + int mEmotion; /**< Currently showing emotion */ + int mEmotionTime; /**< Time until emotion disappears */ + /** Time until the last speech sentence disappears */ + int mSpeechTime; + + int mAttackSpeed; /**< Attack speed */ + Action mAction; /**< Action the being is performing */ + Uint16 mJob; /**< Job (player job, npc, monster, creature ) */ + int mId; /**< Unique sprite id */ Uint8 mDirection; /**< Facing direction */ Uint8 mSpriteDirection; /**< Facing direction */ |