summaryrefslogtreecommitdiff
path: root/src/resources/db/horsedb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-18 15:37:01 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-18 15:37:01 +0300
commitae7d05fce2107e762e84a287f33f2dbad60abd7d (patch)
treea9d8ce99e98eda697c2b4e8e19d8473b8fedc14a /src/resources/db/horsedb.cpp
parent3e1eec6460461242ff6548f8c542e0c020d18c4a (diff)
downloadplus-ae7d05fce2107e762e84a287f33f2dbad60abd7d.tar.gz
plus-ae7d05fce2107e762e84a287f33f2dbad60abd7d.tar.bz2
plus-ae7d05fce2107e762e84a287f33f2dbad60abd7d.tar.xz
plus-ae7d05fce2107e762e84a287f33f2dbad60abd7d.zip
Split horse into two sprites before player and after player.
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;
}