aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoryinsimei2017-07-01 22:01:26 +0200
committerEugene Sandulenko2017-07-13 18:27:45 +0200
commit639f20f16834e813a75293e1d60f6953560799f2 (patch)
tree1ea3c71120901df5521a664134a80b7909db66f9 /engines
parente7d1f272dc7b17609c2737b9cd1d1e5b573b1c0b (diff)
downloadscummvm-rg350-639f20f16834e813a75293e1d60f6953560799f2.tar.gz
scummvm-rg350-639f20f16834e813a75293e1d60f6953560799f2.tar.bz2
scummvm-rg350-639f20f16834e813a75293e1d60f6953560799f2.zip
SLUDGE: fix bug of setting zbuffer before backdrop
Diffstat (limited to 'engines')
-rw-r--r--engines/sludge/backdrop.cpp8
-rw-r--r--engines/sludge/zbuffer.cpp8
2 files changed, 15 insertions, 1 deletions
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index 76d831e27a..9bd8cbf3ac 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -58,6 +58,7 @@ GLuint snapshotTextureName = 0;
#endif
bool backdropExists = false;
+extern int zBufferToSet;
Graphics::Surface lightMap;
Graphics::Surface backdropSurface;
@@ -319,6 +320,12 @@ void loadBackDrop(int fileNum, int x, int y) {
finishAccess();
setResourceForFatal(-1);
+
+ // set zBuffer if it's not set
+ if (zBufferToSet >= 0) {
+ setZBuffer(zBufferToSet);
+ zBufferToSet = -1;
+ }
}
void mixBackDrop(int fileNum, int x, int y) {
@@ -876,6 +883,7 @@ bool loadHSI(Common::SeekableReadStream *stream, int x, int y, bool reserve) {
deleteTextures(1, &tmpTex);
#endif
backdropExists = true;
+
return true;
}
diff --git a/engines/sludge/zbuffer.cpp b/engines/sludge/zbuffer.cpp
index 76fa515de2..f2d627ef0d 100644
--- a/engines/sludge/zbuffer.cpp
+++ b/engines/sludge/zbuffer.cpp
@@ -35,6 +35,7 @@
namespace Sludge {
+int zBufferToSet = -1;
zBufferData zBuffer;
extern int sceneWidth, sceneHeight;
extern Graphics::Surface backdropSurface;
@@ -73,7 +74,12 @@ void sortZPal(int *oldpal, int *newpal, int size) {
}
bool setZBuffer(int num) {
- debug("Setting zBuffer");
+ // if the backdrop has not been set yet
+ // set zbuffer later
+ if (!backdropSurface.getPixels()) {
+ zBufferToSet = num;
+ return true;
+ }
uint32 stillToGo = 0;
int yPalette[16], sorted[16], sortback[16];