diff options
author | Simei Yin | 2017-07-20 01:55:21 +0200 |
---|---|---|
committer | Simei Yin | 2017-07-20 02:00:18 +0200 |
commit | 7e95f7dc635409152a86e2209e308f69a83c1889 (patch) | |
tree | 8d43431f207930a15857214a6eb4cf1031b8a38e | |
parent | aded7ce9e9cdfd8f6c2a24f712d860f3ac712f75 (diff) | |
download | scummvm-rg350-7e95f7dc635409152a86e2209e308f69a83c1889.tar.gz scummvm-rg350-7e95f7dc635409152a86e2209e308f69a83c1889.tar.bz2 scummvm-rg350-7e95f7dc635409152a86e2209e308f69a83c1889.zip |
SLUDGE: Fix backdrop loading for images not of the window size
-rw-r--r-- | engines/sludge/backdrop.cpp | 27 | ||||
-rw-r--r-- | engines/sludge/builtin.cpp | 1 | ||||
-rw-r--r-- | engines/sludge/graphics.cpp | 2 | ||||
-rw-r--r-- | engines/sludge/graphics.h | 3 | ||||
-rw-r--r-- | engines/sludge/people.cpp | 1 | ||||
-rw-r--r-- | engines/sludge/zbuffer.cpp | 4 |
6 files changed, 22 insertions, 16 deletions
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp index 5236ab3142..8ef14b2b09 100644 --- a/engines/sludge/backdrop.cpp +++ b/engines/sludge/backdrop.cpp @@ -236,6 +236,7 @@ void GraphicsManager::killAllBackDrop() { } bool GraphicsManager::resizeBackdrop(int x, int y) { + debug(kSludgeDebugGraphics, "Load HSI"); _sceneWidth = x; _sceneHeight = y; return reserveBackdrop(); @@ -247,7 +248,7 @@ bool GraphicsManager::killResizeBackdrop(int x, int y) { } void GraphicsManager::loadBackDrop(int fileNum, int x, int y) { - debug(kSludgeDebugGraphics, "Load back drop"); + debug(kSludgeDebugGraphics, "Load back drop of num %i at position %i, %i", fileNum, x, y); setResourceForFatal(fileNum); if (!g_sludge->_resMan->openFileFromNum(fileNum)) { fatal("Can't load overlay image"); @@ -262,14 +263,14 @@ void GraphicsManager::loadBackDrop(int fileNum, int x, int y) { g_sludge->_resMan->finishAccess(); setResourceForFatal(-1); - // set zBuffer if it's not set - if (_zBufferToSet >= 0) { - setZBuffer(_zBufferToSet); - _zBufferToSet = -1; + // reset zBuffer + if (_zBuffer->originalNum >= 0) { + setZBuffer(_zBuffer->originalNum); } } void GraphicsManager::mixBackDrop(int fileNum, int x, int y) { + debug(kSludgeDebugGraphics, "Mix back drop of num %i at position %i, %i", fileNum, x, y); setResourceForFatal(fileNum); if (!g_sludge->_resMan->openFileFromNum(fileNum)) { fatal("Can't load overlay image"); @@ -285,9 +286,9 @@ void GraphicsManager::mixBackDrop(int fileNum, int x, int y) { } void GraphicsManager::blankScreen(int x1, int y1, int x2, int y2) { - // in case of no backdrop added at all + // in case of no backdrop added at all, create it if (!_backdropSurface.getPixels()) { - return; + _backdropSurface.create(_winWidth, _winHeight, _renderSurface.format); } if (y1 < 0) @@ -410,11 +411,13 @@ bool GraphicsManager::loadHSI(Common::SeekableReadStream *stream, int x, int y, killAllBackDrop(); // kill all } - if (!ImgLoader::loadImage(stream, &_backdropSurface, (int)reserve)) + Graphics::Surface tmp; + + if (!ImgLoader::loadImage(stream, &tmp, (int)reserve)) return false; - uint realPicWidth = _backdropSurface.w; - uint realPicHeight = _backdropSurface.h; + uint realPicWidth = tmp.w; + uint realPicHeight = tmp.h; // resize backdrop if (reserve) { @@ -431,6 +434,10 @@ bool GraphicsManager::loadHSI(Common::SeekableReadStream *stream, int x, int y, return false; } + // copy surface loaded to backdrop + _backdropSurface.copyRectToSurface(tmp.getPixels(), tmp.pitch, x, y, tmp.w, tmp.h); + tmp.free(); + _origBackdropSurface.copyFrom(_backdropSurface); _backdropExists = true; diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp index 61ee3538e0..63568d046b 100644 --- a/engines/sludge/builtin.cpp +++ b/engines/sludge/builtin.cpp @@ -77,7 +77,6 @@ extern float speechSpeed; extern byte brightnessLevel; extern byte fadeMode; extern uint16 saveEncoding; -extern byte currentBurnR, currentBurnG, currentBurnB; int paramNum[] = { -1, 0, 1, 1, -1, -1, 1, 3, 4, 1, 0, 0, 8, -1, // SAY->MOVEMOUSE -1, 0, 0, -1, -1, 1, 1, 1, 1, 4, 1, 1, 2, 1,// FOCUS->REMOVEREGION diff --git a/engines/sludge/graphics.cpp b/engines/sludge/graphics.cpp index 81e8ed2ed6..e139e52008 100644 --- a/engines/sludge/graphics.cpp +++ b/engines/sludge/graphics.cpp @@ -64,8 +64,8 @@ GraphicsManager::GraphicsManager(SludgeEngine *vm) { _spriteLayers->numLayers = 0; // ZBuffer - _zBufferToSet = -1; _zBuffer = new ZBufferData; + _zBuffer->originalNum = -1; _zBuffer->sprites = nullptr; // Colors diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h index 024c8cacba..df8fa69c25 100644 --- a/engines/sludge/graphics.h +++ b/engines/sludge/graphics.h @@ -110,7 +110,7 @@ public: // Screen int getCenterX(int width) { return (_winWidth - width) >> 1; } - int checkSizeValide(int width, int height) { return ((width >= 0) && (height >= 0) && (width < (int)_winWidth) && (height > (int)_winHeight)); } + int checkSizeValide(int width, int height) { return ((width >= 0) && (height >= 0) && (width < (int)_winWidth) && (height < (int)_winHeight)); } // Freeze bool freeze(); @@ -194,7 +194,6 @@ private: uint32 getDrawColor(onScreenPerson *thisPerson); // ZBuffer - int _zBufferToSet; ZBufferData *_zBuffer; void sortZPal(int *oldpal, int *newpal, int size); diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp index 64696810d8..e0941a0399 100644 --- a/engines/sludge/people.cpp +++ b/engines/sludge/people.cpp @@ -838,6 +838,7 @@ bool addPerson(int x, int y, int objNum, persona *p) { newPerson->colourmix = 0; newPerson->transparency = 0; newPerson->myPersona = p; + newPerson->lastUsedAnim = 0; setFrames(*newPerson, ANI_STAND); diff --git a/engines/sludge/zbuffer.cpp b/engines/sludge/zbuffer.cpp index 5b6235a6fd..a62c5efc81 100644 --- a/engines/sludge/zbuffer.cpp +++ b/engines/sludge/zbuffer.cpp @@ -44,7 +44,7 @@ void GraphicsManager::killZBuffer() { _zBuffer->sprites = nullptr; } _zBuffer->numPanels = 0; - _zBuffer->originalNum = 0; + _zBuffer->originalNum = -1; } void GraphicsManager::sortZPal(int *oldpal, int *newpal, int size) { @@ -71,7 +71,7 @@ bool GraphicsManager::setZBuffer(int num) { // if the backdrop has not been set yet // set zbuffer later if (!_backdropSurface.getPixels()) { - _zBufferToSet = num; + _zBuffer->originalNum = num; return true; } |