aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimei Yin2017-08-12 07:25:08 +0200
committerSimei Yin2017-08-12 07:25:29 +0200
commitc84720885a5c48ee9c6a2c7b276c51feac5f1392 (patch)
tree6865938354785351c5718748d1b35b83246b2853
parenta31fcfff2e09f9f751c684ccbe1c0c01edba4108 (diff)
downloadscummvm-rg350-c84720885a5c48ee9c6a2c7b276c51feac5f1392.tar.gz
scummvm-rg350-c84720885a5c48ee9c6a2c7b276c51feac5f1392.tar.bz2
scummvm-rg350-c84720885a5c48ee9c6a2c7b276c51feac5f1392.zip
SLUDGE: Fix sprite depth error
-rw-r--r--engines/sludge/sprites.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index e51a204636..644d87d1a8 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -333,6 +333,7 @@ bool GraphicsManager::scaleSprite(Sprite &single, const SpritePalette &fontPal,
float y = thisPerson->y;
float scale = thisPerson->scale;
+ bool useZB = !(thisPerson->extra & EXTRA_NOZB);
bool light = !(thisPerson->extra & EXTRA_NOLITE);
if (scale <= 0.05)
@@ -365,7 +366,7 @@ bool GraphicsManager::scaleSprite(Sprite &single, const SpritePalette &fontPal,
y2 = y1 + diffY;
}
- Graphics::Surface *ptr = nullptr;;
+ Graphics::Surface *ptr = nullptr;
Graphics::Surface *blitted = &single.surface;
// set light map color
@@ -409,7 +410,7 @@ bool GraphicsManager::scaleSprite(Sprite &single, const SpritePalette &fontPal,
ptr = nullptr;
}
} else {
- int d = ((!(thisPerson->extra & EXTRA_NOZB)) && _zBuffer->numPanels) ? y + _cameraY : 0;
+ int d = useZB ? y + _cameraY : (y + _cameraY > _sceneHeight * 0.6 ? _sceneHeight + 1 : 0);
addSpriteDepth(blitted, d, x1, y1, (mirror ? Graphics::FLIP_H : Graphics::FLIP_NONE), diffX, diffY, spriteColor, ptr);
}
@@ -505,7 +506,7 @@ void GraphicsManager::fixScaleSprite(int x, int y, Sprite &single, const SpriteP
x1 = x - (int)((mirror ? (float)(single.surface.w - (single.xhot + 1)) : (float)single.xhot) * scale);
int y1 = y - (int)((single.yhot - thisPerson->floaty) * scale);
- Graphics::Surface *ptr = nullptr;;
+ Graphics::Surface *ptr = nullptr;
Graphics::Surface *blitted = &single.surface;
// set light map color
@@ -557,7 +558,7 @@ void GraphicsManager::fixScaleSprite(int x, int y, Sprite &single, const SpriteP
ptr = nullptr;
}
} else {
- int d = useZB ? y + _cameraY : _sceneHeight + 1;
+ int d = useZB ? y + _cameraY : (y + _cameraY > _sceneHeight * 0.6 ? _sceneHeight + 1 : 0);
addSpriteDepth(&single.surface, d, x1, y1, (mirror ? Graphics::FLIP_H : Graphics::FLIP_NONE), diffX, diffY, spriteColor, ptr);
}