diff options
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r-- | src/resources/spritedef.cpp | 73 |
1 files changed, 52 insertions, 21 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index d6cc8960..30d8e778 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,20 +19,22 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <set> +#include "resources/spritedef.h" + +#include "resources/action.h" +#include "resources/animation.h" +#include "resources/dye.h" +#include "resources/image.h" +#include "resources/imageset.h" +#include "resources/resourcemanager.h" -#include "action.h" -#include "animation.h" -#include "dye.h" -#include "image.h" -#include "imageset.h" -#include "resourcemanager.h" -#include "spritedef.h" +#include "log.h" -#include "../log.h" -#include "../utils/xml.h" +#include "utils/xml.h" + +#include <set> -Action* SpriteDef::getAction(SpriteAction action) const +Action *SpriteDef::getAction(SpriteAction action) const { Actions::const_iterator i = mActions.find(action); @@ -46,7 +47,7 @@ Action* SpriteDef::getAction(SpriteAction action) const return i->second; } -SpriteDef *SpriteDef::load(std::string const &animationFile, int variant) +SpriteDef *SpriteDef::load(const std::string &animationFile, int variant) { std::string::size_type pos = animationFile.find('|'); std::string palettes; @@ -121,7 +122,7 @@ void SpriteDef::loadSprite(xmlNodePtr spriteNode, int variant, } } -void SpriteDef::loadImageSet(xmlNodePtr node, std::string const &palettes) +void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes) { const std::string name = XML::getProperty(node, "name", ""); @@ -167,7 +168,7 @@ void SpriteDef::loadAction(xmlNodePtr node, int variant_offset) actionName.c_str(), getIdPath().c_str()); return; } - Action *action = new Action(); + Action *action = new Action; mActions[actionType] = action; // When first action set it as default direction @@ -201,7 +202,7 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode, return; } - Animation *animation = new Animation(); + Animation *animation = new Animation; action->setAnimation(directionType, animation); // Get animation frames @@ -320,7 +321,7 @@ SpriteDef::~SpriteDef() } } -SpriteAction SpriteDef::makeSpriteAction(const std::string& action) +SpriteAction SpriteDef::makeSpriteAction(const std::string &action) { if (action.empty() || action == "default") { return ACTION_DEFAULT; @@ -349,6 +350,36 @@ SpriteAction SpriteDef::makeSpriteAction(const std::string& action) else if (action == "attack_throw") { return ACTION_ATTACK_THROW; } + else if (action == "special0") { + return ACTION_SPECIAL_0; + } + else if (action == "special1") { + return ACTION_SPECIAL_1; + } + else if (action == "special2") { + return ACTION_SPECIAL_2; + } + else if (action == "special3") { + return ACTION_SPECIAL_3; + } + else if (action == "special4") { + return ACTION_SPECIAL_4; + } + else if (action == "special5") { + return ACTION_SPECIAL_5; + } + else if (action == "special6") { + return ACTION_SPECIAL_6; + } + else if (action == "special7") { + return ACTION_SPECIAL_7; + } + else if (action == "special8") { + return ACTION_SPECIAL_8; + } + else if (action == "special9") { + return ACTION_SPECIAL_9; + } else if (action == "cast_magic") { return ACTION_CAST_MAGIC; } @@ -372,7 +403,7 @@ SpriteAction SpriteDef::makeSpriteAction(const std::string& action) } } -SpriteDirection SpriteDef::makeSpriteDirection(const std::string& direction) +SpriteDirection SpriteDef::makeSpriteDirection(const std::string &direction) { if (direction.empty() || direction == "default") { return DIRECTION_DEFAULT; @@ -391,5 +422,5 @@ SpriteDirection SpriteDef::makeSpriteDirection(const std::string& direction) } else { return DIRECTION_INVALID; - }; + } } |