diff options
Diffstat (limited to 'src/being.h')
-rw-r--r-- | src/being.h | 90 |
1 files changed, 76 insertions, 14 deletions
diff --git a/src/being.h b/src/being.h index 7fd0c7ef..ef830e3a 100644 --- a/src/being.h +++ b/src/being.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,9 +26,9 @@ #include <SDL_types.h> +#include <set> #include <string> #include <vector> -#include <bitset> #include "particlecontainer.h" #include "position.h" @@ -55,6 +54,8 @@ class SimpleAnimation; class SpeechBubble; class Text; +class StatusEffect; + typedef std::list<Sprite*> Sprites; typedef Sprites::iterator SpriteIterator; @@ -190,14 +191,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. @@ -341,12 +344,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 @@ -387,9 +392,45 @@ class Being : public Sprite mEmotionTime = emote_time; } - static int getHairColorsNr(void); + /** + * 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; + + static int getHairColorsNr(); - static int getHairStylesNr(void); + static int getHairStylesNr(); static std::string getHairColor(int index); @@ -416,6 +457,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 */ @@ -425,8 +486,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; @@ -439,8 +498,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; @@ -458,6 +517,9 @@ class Being : public Sprite */ int getOffset(char pos, char neg) const; + /** Reset particle status effects on next redraw? */ + bool mMustResetParticles; + // Speech Bubble components SpeechBubble *mSpeechBubble; |