diff options
-rw-r--r-- | engines/sludge/backdrop.cpp | 8 | ||||
-rw-r--r-- | engines/sludge/zbuffer.cpp | 8 |
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]; |