summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-23 04:40:34 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-24 03:32:57 +0300
commit8e5861c3cfd41574351547a1a518efcf9007666a (patch)
tree8d941791c1bbd296b7125475fa0abb9581df632f /src/resources/spritedef.h
parent004aa3358c6efeb469045785baa891a449dde5a4 (diff)
downloadmanaverse-8e5861c3cfd41574351547a1a518efcf9007666a.tar.gz
manaverse-8e5861c3cfd41574351547a1a518efcf9007666a.tar.bz2
manaverse-8e5861c3cfd41574351547a1a518efcf9007666a.tar.xz
manaverse-8e5861c3cfd41574351547a1a518efcf9007666a.zip
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: <action name="stand" hp="50" imageset="base"> ... </action> Here 50 mean 50% of health or less. Default action tag mean hp=100
Diffstat (limited to 'src/resources/spritedef.h')
-rw-r--r--src/resources/spritedef.h12
1 files changed, 9 insertions, 3 deletions
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<std::string, ImageSet*> ImageSets;
typedef ImageSets::iterator ImageSetIterator;
- typedef std::map<std::string, Action*> Actions;
+// typedef std::map<std::string, std::map<unsigned, Action*>*> Actions;
+ typedef std::map<unsigned, std::map<std::string, Action*>*> Actions;
ImageSets mImageSets;
Actions mActions;