From 572ed6a1aa6c847e8764bddf2bb0d687ecf1a405 Mon Sep 17 00:00:00 2001 From: Bertram Date: Wed, 27 Jan 2010 01:46:58 +0100 Subject: Added mutators/accessors to being.h and smal cleanups. --- src/being.h | 132 ++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 93 insertions(+), 39 deletions(-) (limited to 'src/being.h') 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, @@ -275,6 +296,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. */ @@ -292,6 +325,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. */ @@ -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,12 +465,23 @@ 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; mEmotionTime = emote_time; } + /** + * 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 */ -- cgit v1.2.3-60-g2f50