summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/horsedb.cpp37
-rw-r--r--src/resources/horseinfo.h18
2 files changed, 39 insertions, 16 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;
}
diff --git a/src/resources/horseinfo.h b/src/resources/horseinfo.h
index 262ecb7e7..860700124 100644
--- a/src/resources/horseinfo.h
+++ b/src/resources/horseinfo.h
@@ -29,16 +29,22 @@ class AnimatedSprite;
struct HorseInfo final
{
HorseInfo() :
- sprite(nullptr),
- offsetX(0),
- offsetY(0)
+ downSprite(nullptr),
+ upSprite(nullptr),
+ downOffsetX(0),
+ downOffsetY(0),
+ upOffsetX(0),
+ upOffsetY(0)
{ }
A_DELETE_COPY(HorseInfo)
- AnimatedSprite *sprite;
- int offsetX;
- int offsetY;
+ AnimatedSprite *downSprite;
+ AnimatedSprite *upSprite;
+ int downOffsetX;
+ int downOffsetY;
+ int upOffsetX;
+ int upOffsetY;
};
#endif // RESOURCES_HORSEINFO_H