summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/layout.cpp2
-rw-r--r--src/resources/imageset.cpp5
-rw-r--r--src/resources/spritedef.cpp8
3 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index ad474cf63..3dc4eb038 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -335,7 +335,7 @@ void LayoutArray::reflow(int nx, int ny, int nw, int nh)
LayoutCell *cell = mCells[gridY][gridX];
if (cell && cell->mType != LayoutCell::NONE)
{
- int dx = x, dy = y, dw, dh;
+ int dx = x, dy = y, dw = 0, dh = 0;
align(dx, dw, 0, *cell, &widths[gridX]);
align(dy, dh, 1, *cell, &heights[gridY]);
cell->reflow(dx, dy, dw, dh);
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index fa0cef349..af180b0eb 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -28,7 +28,10 @@
#include "utils/dtor.h"
-ImageSet::ImageSet(Image *img, int width, int height, int margin, int spacing)
+ImageSet::ImageSet(Image *img, int width, int height,
+ int margin, int spacing) :
+ mOffsetX(0),
+ mOffsetY(0)
{
if (img)
{
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index db1c3d0c3..e6a65926e 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -221,10 +221,10 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode,
for_each_xml_child_node(frameNode, animationNode)
{
const int delay = XML::getProperty(frameNode, "delay", 0);
- int offsetX = XML::getProperty(frameNode, "offsetX",
- imageSet->getOffsetX());
- int offsetY = XML::getProperty(frameNode, "offsetY",
- imageSet->getOffsetY());
+ int offsetX = XML::getProperty(frameNode, "offsetX", 0) +
+ imageSet->getOffsetX();
+ int offsetY = XML::getProperty(frameNode, "offsetY", 0) +
+ imageSet->getOffsetY();
offsetY -= imageSet->getHeight() - 32;
offsetX -= imageSet->getWidth() / 2 - 16;