summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-26 21:49:39 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-26 21:49:39 +0300
commite5272cde78d23a297dad05976e8579b3e5759de4 (patch)
tree598c3636e7409b1db5c5e618b1a31397a8bead20 /src/resources/spritedef.cpp
parent7d7a01211828a9484ae5fd617e855e349c32f76e (diff)
downloadManaVerse-e5272cde78d23a297dad05976e8579b3e5759de4.tar.gz
ManaVerse-e5272cde78d23a297dad05976e8579b3e5759de4.tar.bz2
ManaVerse-e5272cde78d23a297dad05976e8579b3e5759de4.tar.xz
ManaVerse-e5272cde78d23a297dad05976e8579b3e5759de4.zip
Fix incorrect last dead frame delay for old servers.
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r--src/resources/spritedef.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 0d9b95f6f..02b46f1cf 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -36,6 +36,7 @@
#include "debug.h"
SpriteReference *SpriteReference::Empty = nullptr;
+extern int serverVersion;
Action *SpriteDef::getAction(std::string action, unsigned num) const
{
@@ -99,13 +100,30 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, int variant)
def->mProcessedFiles.insert(animationFile);
def->loadSprite(rootNode, variant, palettes);
def->substituteActions();
+ if (serverVersion < 1)
+ def->fixDeadAction();
return def;
}
+void SpriteDef::fixDeadAction()
+{
+ ActionsIter it = mActions.begin();
+ ActionsIter it_end = mActions.end();
+ for (; it != it_end; ++ it)
+ {
+ ActionMap *d = (*it).second;
+ if (!d)
+ continue;
+ ActionMap::iterator i = d->find("dead");
+ if (i != d->end() && i->second)
+ (i->second)->setLastFrameDelay(0);
+ }
+}
+
void SpriteDef::substituteAction(std::string complete, std::string with)
{
- Actions::const_iterator it = mActions.begin();
- Actions::const_iterator it_end = mActions.end();
+ ActionsConstIter it = mActions.begin();
+ ActionsConstIter it_end = mActions.end();
for (; it != it_end; ++ it)
{
ActionMap *d = (*it).second;