diff options
author | johndoe123 | 2013-04-17 19:54:39 +0200 |
---|---|---|
committer | johndoe123 | 2013-04-17 19:54:39 +0200 |
commit | e935f85366ba1e83fdd1cea3712959edee1f6270 (patch) | |
tree | cdcf6e1a29593dc7b75401e93a6c90f62f4a52ff /engines/sword25/gfx/renderobject.cpp | |
parent | 0a0b2f397b95e6e219f2ac8c5b79bbe6300ef432 (diff) | |
download | scummvm-rg350-e935f85366ba1e83fdd1cea3712959edee1f6270.tar.gz scummvm-rg350-e935f85366ba1e83fdd1cea3712959edee1f6270.tar.bz2 scummvm-rg350-e935f85366ba1e83fdd1cea3712959edee1f6270.zip |
SWORD25: Change absolute Z calculation to match that of absolute x/y; remove old comment
Diffstat (limited to 'engines/sword25/gfx/renderobject.cpp')
-rw-r--r-- | engines/sword25/gfx/renderobject.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/engines/sword25/gfx/renderobject.cpp b/engines/sword25/gfx/renderobject.cpp index f2d25771a9..d1381513fd 100644 --- a/engines/sword25/gfx/renderobject.cpp +++ b/engines/sword25/gfx/renderobject.cpp @@ -219,9 +219,10 @@ Common::Rect RenderObject::calcBoundingBox() const { return bbox; } -void RenderObject::calcAbsolutePos(int &x, int &y) const { +void RenderObject::calcAbsolutePos(int &x, int &y, int &z) const { x = calcAbsoluteX(); y = calcAbsoluteY(); + z = calcAbsoluteZ(); } int RenderObject::calcAbsoluteX() const { @@ -238,6 +239,13 @@ int RenderObject::calcAbsoluteY() const { return _y; } +int RenderObject::calcAbsoluteZ() const { + if (_parentPtr.isValid()) + return _parentPtr->getAbsoluteZ() + _z; + else + return _z; +} + void RenderObject::deleteAllChildren() { // Es ist nicht notwendig die Liste zu iterieren, da jedes Kind für sich DetatchChildren an diesem Objekt aufruft und sich somit // selber entfernt. Daher muss immer nur ein beliebiges Element (hier das letzte) gelöscht werden, bis die Liste leer ist. @@ -281,7 +289,7 @@ void RenderObject::sortRenderObjects() { } void RenderObject::updateAbsolutePos() { - calcAbsolutePos(_absoluteX, _absoluteY); + calcAbsolutePos(_absoluteX, _absoluteY, _absoluteZ); RENDEROBJECT_ITER it = _children.begin(); for (; it != _children.end(); ++it) @@ -313,15 +321,10 @@ void RenderObject::setY(int y) { void RenderObject::setZ(int z) { if (z < 0) error("Tried to set a negative Z value (%d).", z); - else + else { _z = z; -} - -int RenderObject::getAbsoluteZ() const { - if (_parentPtr.isValid()) - return _parentPtr->getAbsoluteZ() + _z; - else - return _z; + updateAbsolutePos(); + } } void RenderObject::setVisible(bool visible) { |