diff options
Diffstat (limited to 'src/being.h')
-rw-r--r-- | src/being.h | 103 |
1 files changed, 94 insertions, 9 deletions
diff --git a/src/being.h b/src/being.h index 689eda02..715a7192 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; @@ -198,14 +199,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. @@ -347,12 +350,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 @@ -391,6 +396,48 @@ 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; + + static int getHairColorCount(); + + static int getHairStyleCount(); + + static std::string getHairColor(int index); + virtual AnimatedSprite* getSprite(int index) const { return mSprites[index]; } @@ -407,6 +454,35 @@ class Being : public Sprite */ virtual void updateCoords() {} + /** + * Trigger visual effect, with components + * + * \param effectId ID of the effect to trigger + * \param sfx Whether to trigger sound effects + * \param gfx Whether to trigger graphical effects + */ + 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); + int mId; /**< Unique sprite id */ Uint16 mWalkSpeed; /**< Walking speed */ Uint8 mDirection; /**< Facing direction */ @@ -419,7 +495,9 @@ class Being : public Sprite /** Engine-related infos about weapon. */ const ItemInfo* mEquippedWeapon; - static int mNumberOfHairstyles; /** Number of hair styles in use */ + static std::vector<std::string> hairColors; + static int mNumberOfHairColors; /** Number of hair colors in use */ + static int mNumberOfHairstyles; /** Number of hair styles in use */ Path mPath; std::string mSpeech; @@ -427,12 +505,16 @@ class Being : public Sprite Uint16 mHairStyle, mHairColor; Gender mGender; int mPx, mPy; /**< Pixel coordinates */ + Uint16 mStunMode; /**< Stun mode; zero if not stunned */ + std::set<int> mStatusEffects; /**< set of active status effects */ const gcn::Color* mNameColor; std::vector<AnimatedSprite*> mSprites; std::vector<int> mSpriteIDs; std::vector<std::string> mSpriteColors; + ParticleList mStunParticleEffects; + ParticleVector mStatusParticleEffects; ParticleList mChildParticleEffects; private: @@ -442,6 +524,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; |