From e5272cde78d23a297dad05976e8579b3e5759de4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 26 Feb 2012 21:49:39 +0300 Subject: Fix incorrect last dead frame delay for old servers. --- src/resources/spritedef.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/resources/spritedef.cpp') 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; -- cgit v1.2.3-70-g09d2