aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoryinsimei2017-07-01 13:42:30 +0200
committerEugene Sandulenko2017-07-13 18:27:45 +0200
commit44d7663a495d74275eceb3c3a5d36cf1ed060d3d (patch)
treea376db0e4cc870b0bf6a8b1e3de6e3ebdc1bcd9b /engines
parent1a27d671233cea7cb5cc25a1ff2a905260116398 (diff)
downloadscummvm-rg350-44d7663a495d74275eceb3c3a5d36cf1ed060d3d.tar.gz
scummvm-rg350-44d7663a495d74275eceb3c3a5d36cf1ed060d3d.tar.bz2
scummvm-rg350-44d7663a495d74275eceb3c3a5d36cf1ed060d3d.zip
SLUDGE: read headless png sprites
Diffstat (limited to 'engines')
-rw-r--r--engines/sludge/imgloader.cpp14
-rw-r--r--engines/sludge/imgloader.h2
-rw-r--r--engines/sludge/sprites.cpp9
3 files changed, 17 insertions, 8 deletions
diff --git a/engines/sludge/imgloader.cpp b/engines/sludge/imgloader.cpp
index bfac7fa5da..002e8501b0 100644
--- a/engines/sludge/imgloader.cpp
+++ b/engines/sludge/imgloader.cpp
@@ -44,10 +44,22 @@ bool ImgLoader::loadImage(Common::SeekableReadStream *stream, Graphics::Surface
return true;
}
-bool ImgLoader::loadPNGImage(Common::SeekableReadStream *stream, Graphics::Surface *dest) {
+bool ImgLoader::loadPNGImage(Common::SeekableReadStream *stream, Graphics::Surface *dest, bool checkSig) {
::Image::PNGDecoder png;
+
+ // set skip signature
+ if (!checkSig) {
+ png.setSkipSignature(true);
+ }
+
if (!png.loadStream(*stream))
return false;
+
+ // set value back
+ if (!checkSig) {
+ png.setSkipSignature(false);
+ }
+
const Graphics::Surface *sourceSurface = png.getSurface();
Graphics::Surface *pngSurface = sourceSurface->convertTo(*g_sludge->getScreenPixelFormat(), png.getPalette());
dest->copyFrom(*pngSurface);
diff --git a/engines/sludge/imgloader.h b/engines/sludge/imgloader.h
index 35529f516c..e4a09e0d36 100644
--- a/engines/sludge/imgloader.h
+++ b/engines/sludge/imgloader.h
@@ -33,7 +33,7 @@ protected:
public:
static bool loadImage(Common::SeekableReadStream *stream, Graphics::Surface *dest, int reserve = -1);
- static bool loadPNGImage(Common::SeekableReadStream *stream, Graphics::Surface *dest);
+ static bool loadPNGImage(Common::SeekableReadStream *stream, Graphics::Surface *dest, bool checkSig = true);
static bool loadHSIImage(Common::SeekableReadStream *stream, Graphics::Surface *dest, int reserve = -1);
};
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index b5a2ef96eb..51f3062a17 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -175,15 +175,12 @@ bool loadSpriteBank(int fileNum, spriteBank &loadhere, bool isFont) {
// version 3, sprite is png
if (spriteBankVersion == 3) {
+ debug("png sprite");
for (int i = 0; i < total; i++) {
- howmany = bigDataFile->readByte();
- startIndex = 1;
-
loadhere.sprites[i].xhot = getSigned(bigDataFile);
loadhere.sprites[i].yhot = getSigned(bigDataFile);
-
- if (!ImgLoader::loadPNGImage(bigDataFile, &loadhere.sprites[i].surface)) {
- return false;
+ if (!ImgLoader::loadPNGImage(bigDataFile, &loadhere.sprites[i].surface, false)) {
+ return fatal("fail to read png sprite");
}
}
finishAccess();