diff options
Diffstat (limited to 'src/being.h')
-rw-r--r-- | src/being.h | 81 |
1 files changed, 70 insertions, 11 deletions
diff --git a/src/being.h b/src/being.h index b4508661..9e207448 100644 --- a/src/being.h +++ b/src/being.h @@ -25,6 +25,7 @@ #include <list> #include <memory> #include <SDL_types.h> +#include <set> #include <string> #include <vector> #include <bitset> @@ -53,6 +54,8 @@ class Particle; class SpeechBubble; class Text; +class StatusEffect; + enum Gender { GENDER_MALE = 0, GENDER_FEMALE = 1, @@ -104,7 +107,6 @@ class Being : public Sprite NUM_TC }; - /** * Directions, to be used as bitmask values */ @@ -172,14 +174,16 @@ class Being : public Sprite /** * Returns the name of the being. */ - const std::string& getName() const { return mName; } + const std::string &getName() const + { return mName; } /** * Sets the name for the being. * * @param name The name that should appear. */ - virtual void setName(const std::string &name) { mName = name; } + virtual void setName(const std::string &name) + { mName = name; } /** * Gets the hair color for this being. @@ -323,12 +327,14 @@ class Being : public Sprite /** * Get the current X pixel offset. */ - int getXOffset() const { return getOffset(LEFT, RIGHT); } + int getXOffset() const + { return getOffset(LEFT, RIGHT); } /** * Get the current Y pixel offset. */ - int getYOffset() const { return getOffset(UP, DOWN); } + int getYOffset() const + { return getOffset(UP, DOWN); } /** * Returns the horizontal size of the current base sprite of the being @@ -359,14 +365,47 @@ class Being : public Sprite mEmotionTime = emote_time; } + /** + * Sets the being's stun mode. If zero, the being is `normal', + * otherwise it is `stunned' in some fashion. + */ + void setStunMode(int stunMode) + { + if (mStunMode != stunMode) + updateStunMode(mStunMode, stunMode); + mStunMode = stunMode; + }; + + void setStatusEffect(int index, bool active); + + /** + * A status effect block is a 16 bit mask of status effects. + * We assign each such flag a block ID of offset + bitnr. + * + * These are NOT the same as the status effect indices. + */ + void setStatusEffectBlock(int offset, Uint16 flags); + + /** + * Triggers a visual effect, such as `level up' + * + * Only draws the visual effect, does not play sound effects + * + * \param effectId ID of the effect to trigger + */ + virtual void triggerEffect(int effectId) + { + internalTriggerEffect(effectId, false, true); + } + // Target cursor being used by the being Image *mTargetCursor; const std::auto_ptr<Equipment> mEquipment; - static int getHairColorsNr(void); + static int getHairColorsNr(); - static int getHairStylesNr(void); + static int getHairStylesNr(); static std::string getHairColor(int index); @@ -393,6 +432,26 @@ class Being : public Sprite */ void internalTriggerEffect(int effectId, bool sfx, bool gfx); + /** + * Notify self that the stun mode has been updated. Invoked by + * setStunMode if something changed. + */ + virtual void updateStunMode(int oldMode, int newMode); + + /** + * Notify self that a status effect has flipped. + * The new flag is passed. + */ + virtual void updateStatusEffect(int index, bool newStatus); + + /** + * Handle an update to a status or stun effect + * + * \param The StatusEffect to effect + * \param effectId -1 for stun, otherwise the effect index + */ + virtual void handleStatusEffect(StatusEffect *effect, int effectId); + Uint32 mId; /**< Unique sprite id */ Uint16 mWalkSpeed; /**< Walking speed */ Uint8 mDirection; /**< Facing direction */ @@ -402,8 +461,6 @@ class Being : public Sprite bool mIsGM; bool mParticleEffects; /**< Whether to display particles or not */ - typedef std::bitset<STATUS_EFFECTS> StatusEffects; - /** Engine-related infos about weapon. */ const ItemInfo* mEquippedWeapon; @@ -416,8 +473,8 @@ class Being : public Sprite Gender mGender; Uint32 mSpeechTime; Sint32 mPx, mPy; /**< Pixel coordinates */ - Uint16 mStunMode; /**< Stun mode; zero if not stunned */ - StatusEffects mStatusEffects; /**< Bitset of active status effects */ + Uint16 mStunMode; /**< Stun mode; zero if not stunned */ + std::set<int> mStatusEffects; /**< set of active status effects */ gcn::Color mNameColor; @@ -435,6 +492,8 @@ class Being : public Sprite */ int getOffset(char pos, char neg) const; + bool mMustResetParticles; /**< Reset particle status effects on next redraw? */ + // Speech Bubble components SpeechBubble *mSpeechBubble; |