From 8e5861c3cfd41574351547a1a518efcf9007666a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 23 Nov 2011 04:40:34 +0300 Subject: Add ability to play different animation depend on monster hp. Disabled for legacy servers because monster hp unknown and compilated hp can be wrong (version <= 0). For usage need add to action tag attribute hp="xx" Example: ... Here 50 mean 50% of health or less. Default action tag mean hp=100 --- src/resources/spritedef.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/resources/spritedef.h') diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index b2939fca1..642962c0b 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -117,7 +117,9 @@ class SpriteDef : public Resource /** * Returns the specified action. */ - Action *getAction(std::string action) const; + Action *getAction(std::string action, unsigned num) const; + + unsigned findNumber(unsigned num) const; /** * Converts a string into a SpriteDirection enum. @@ -125,11 +127,14 @@ class SpriteDef : public Resource static SpriteDirection makeSpriteDirection(const std::string &direction); + void addAction(unsigned hp, std::string name, Action *action); + private: /** * Constructor. */ - SpriteDef() {} + SpriteDef() + { } /** * Destructor. @@ -178,7 +183,8 @@ class SpriteDef : public Resource typedef std::map ImageSets; typedef ImageSets::iterator ImageSetIterator; - typedef std::map Actions; +// typedef std::map*> Actions; + typedef std::map*> Actions; ImageSets mImageSets; Actions mActions; -- cgit v1.2.3-60-g2f50