summaryrefslogtreecommitdiff
path: root/src/resources/db/horsedb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/db/horsedb.cpp')
-rw-r--r--src/resources/db/horsedb.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp
index a3daf76cc..e01ebe27c 100644
--- a/src/resources/db/horsedb.cpp
+++ b/src/resources/db/horsedb.cpp
@@ -42,10 +42,14 @@ void HorseDB::load()
if (mLoaded)
unload();
- mUnknown.sprite = AnimatedSprite::load(
+ mUnknown.downSprite = AnimatedSprite::load(
paths.getStringValue("spriteErrorFile"));
- mUnknown.offsetX = 0;
- mUnknown.offsetY = 0;
+ mUnknown.upSprite = AnimatedSprite::load(
+ paths.getStringValue("spriteErrorFile"));
+ mUnknown.upOffsetX = 0;
+ mUnknown.upOffsetY = 0;
+ mUnknown.downOffsetX = 0;
+ mUnknown.downOffsetY = 0;
logger->log1("Initializing horse database...");
@@ -99,22 +103,33 @@ void HorseDB::loadXmlFile(const std::string &fileName)
if (!currentInfo)
continue;
- currentInfo->offsetX = XML::getProperty(horseNode, "offsetX", 0);
- currentInfo->offsetY = XML::getProperty(horseNode, "offsetY", 0);
+ const int offsetX = XML::getProperty(horseNode, "offsetX", 0);
+ const int offsetY = XML::getProperty(horseNode, "offsetY", 0);
+ currentInfo->upOffsetX = XML::getProperty(horseNode, "upOffsetX", offsetX);
+ currentInfo->upOffsetY = XML::getProperty(horseNode, "upOffsetY", offsetY);
+ currentInfo->downOffsetX = XML::getProperty(horseNode, "downOffsetX", offsetX);
+ currentInfo->downOffsetY = XML::getProperty(horseNode, "downOffsetY", offsetY);
for_each_xml_child_node(spriteNode, horseNode)
{
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlNameEqual(spriteNode, "sprite"))
+ if (xmlNameEqual(spriteNode, "downSprite"))
+ {
+ currentInfo->downSprite = AnimatedSprite::load(
+ paths.getStringValue("sprites").append(std::string(
+ reinterpret_cast<const char*>(
+ spriteNode->xmlChildrenNode->content))),
+ XML::getProperty(spriteNode, "variant", 0));
+ }
+ else if (xmlNameEqual(spriteNode, "upSprite"))
{
- currentInfo->sprite = AnimatedSprite::load(
+ currentInfo->upSprite = AnimatedSprite::load(
paths.getStringValue("sprites").append(std::string(
reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content))),
XML::getProperty(spriteNode, "variant", 0));
- break;
}
}
mHorseInfos[id] = currentInfo;
@@ -125,12 +140,14 @@ void HorseDB::unload()
{
FOR_EACH (HorseInfos::const_iterator, i, mHorseInfos)
{
- delete i->second->sprite;
+ delete i->second->upSprite;
+ delete i->second->downSprite;
delete i->second;
}
mHorseInfos.clear();
- delete mUnknown.sprite;
+ delete mUnknown.upSprite;
+ delete mUnknown.downSprite;
mLoaded = false;
}