summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.cpp
diff options
context:
space:
mode:
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;