diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-09-28 22:50:00 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-09-30 13:40:45 +0200 |
commit | f7bccd4c7abe33c0f435a4c584d196d611f89674 (patch) | |
tree | 1d8646c213922eb0be09f3de48b10d19b5591cd0 /src/being.h | |
parent | 61f21c0131bbb6631a16205ce5447e8eea2a2db2 (diff) | |
download | mana-f7bccd4c7abe33c0f435a4c584d196d611f89674.tar.gz mana-f7bccd4c7abe33c0f435a4c584d196d611f89674.tar.bz2 mana-f7bccd4c7abe33c0f435a4c584d196d611f89674.tar.xz mana-f7bccd4c7abe33c0f435a4c584d196d611f89674.zip |
Added support for particle effects on equipment
The effect is also there when the equipment is dropped, because it uses
the same field as the floor item.
Removed unused ItemInfo::particle.
Based roughly on M+ commit 44e5d8bcb7fea443ca9ed3844454b11ac6e4dbed.
Closes #85
Diffstat (limited to 'src/being.h')
-rw-r--r-- | src/being.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/being.h b/src/being.h index 0c1d54d6..3bd66b06 100644 --- a/src/being.h +++ b/src/being.h @@ -259,13 +259,13 @@ class Being : public ActorSprite, public EventListener /** * Sets visible equipments for this being. */ - void setSprite(unsigned int slot, int id, + void setSprite(unsigned slot, int id, const std::string &color = std::string(), bool isWeapon = false); - void setSpriteID(unsigned int slot, int id); + void setSpriteID(unsigned slot, int id); - void setSpriteColor(unsigned int slot, + void setSpriteColor(unsigned slot, const std::string &color = std::string()); /** @@ -452,6 +452,12 @@ class Being : public ActorSprite, public EventListener { lookAt(Vector(destPos.x, destPos.y)); } protected: + struct SpriteState { + int id = 0; + std::string color; + std::vector<Particle*> particles; + }; + /** * Sets the new path for this being. */ @@ -464,6 +470,11 @@ class Being : public ActorSprite, public EventListener void showName(); + void addSpriteParticles(SpriteState &spriteState, const SpriteDisplay &display); + void removeSpriteParticles(SpriteState &spriteState); + void removeAllSpriteParticles(); + void restoreAllSpriteParticles(); + void updateColors(); /** @@ -505,8 +516,9 @@ class Being : public ActorSprite, public EventListener Vector mDest; /**< destination coordinates. */ - std::vector<int> mSpriteIDs; - std::vector<std::string> mSpriteColors; + std::vector<SpriteState> mSpriteStates; + bool mRestoreSpriteParticlesOnLogic = false; + Gender mGender = Gender::UNSPECIFIED; // Character guild information |