diff options
author | Fate <fate-tmw@googlemail.com> | 2008-12-07 04:00:55 -0700 |
---|---|---|
committer | Fate <fate-tmw@googlemail.com> | 2008-12-07 04:00:55 -0700 |
commit | 3fcd6a549fc825f4185a6dc248922e02988caed5 (patch) | |
tree | 2def3534088760ec3d06860eb0af936ec1e66b5b /src/being.h | |
parent | 68923d079602d8a8b7f35e1b56032e03e323ea09 (diff) | |
download | mana-3fcd6a549fc825f4185a6dc248922e02988caed5.tar.gz mana-3fcd6a549fc825f4185a6dc248922e02988caed5.tar.bz2 mana-3fcd6a549fc825f4185a6dc248922e02988caed5.tar.xz mana-3fcd6a549fc825f4185a6dc248922e02988caed5.zip |
Added client-side status change handlers (text, icon, particle effect, audio).
Diffstat (limited to 'src/being.h')
-rw-r--r-- | src/being.h | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/src/being.h b/src/being.h index 15e1e6f9..9390dccd 100644 --- a/src/being.h +++ b/src/being.h @@ -26,7 +26,7 @@ #include <memory> #include <string> #include <SDL_types.h> -#include <bitset> +#include <set> #include "sprite.h" #include "map.h" @@ -46,6 +46,9 @@ class ImageSet; class Particle; class Text; + +class StatusEffect; + /** * A position along a being's path. */ @@ -109,7 +112,6 @@ class Being : public Sprite NUM_TC }; - /** * Directions, to be used as bitmask values */ @@ -356,6 +358,27 @@ class Being : public Sprite } /** + * 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 @@ -400,6 +423,29 @@ 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 */ @@ -407,8 +453,6 @@ class Being : public Sprite std::string mName; /**< Name of character */ SpriteIterator mSpriteIterator; - typedef std::bitset<STATUS_EFFECTS> StatusEffects; - /** Engine-related infos about weapon. */ const ItemInfo* mEquippedWeapon; @@ -419,7 +463,7 @@ class Being : public Sprite Uint32 mSpeechTime; Sint32 mPx, mPy; /**< Pixel coordinates */ Uint16 mStunMode; /**< Stun mode; zero if not stunned */ - StatusEffects mStatusEffects; /**< Bitset of active status effects */ + std::set<int> mStatusEffects; /**< set of active status effects */ std::vector<AnimatedSprite*> mSprites; std::vector<int> mSpriteIDs; |