diff options
-rw-r--r-- | engines/supernova/graphics.cpp | 10 | ||||
-rw-r--r-- | engines/supernova/graphics.h | 7 | ||||
-rw-r--r-- | engines/supernova/supernova.cpp | 4 |
3 files changed, 10 insertions, 11 deletions
diff --git a/engines/supernova/graphics.cpp b/engines/supernova/graphics.cpp index e2467d1c3c..5913553633 100644 --- a/engines/supernova/graphics.cpp +++ b/engines/supernova/graphics.cpp @@ -11,7 +11,8 @@ namespace Supernova { MSNImageDecoder::MSNImageDecoder() : _surface(NULL) - , _palette(NULL) { + , _palette(NULL) + , _encodedImage(NULL) { } MSNImageDecoder::~MSNImageDecoder() { @@ -72,6 +73,7 @@ bool MSNImageDecoder::loadStream(Common::SeekableReadStream &stream) { } byte zwCodes[256]; + Common::fill(zwCodes, zwCodes + 256, 0); byte numRepeat = stream.readByte(); byte numZw = stream.readByte(); stream.read(zwCodes, numZw); @@ -88,7 +90,7 @@ bool MSNImageDecoder::loadStream(Common::SeekableReadStream &stream) { _encodedImage[i++] = value; } } else if (input < numZw) { - input = zwCodes[input]; + input = zwCodes[input - numRepeat]; --input; _encodedImage[i++] = input; _encodedImage[i++] = input; @@ -157,6 +159,10 @@ void MSNImageDecoder::destroy() { _surface->free(); _surface = NULL; } + if (_encodedImage) { + delete[] _encodedImage; + _encodedImage = NULL; + } } } diff --git a/engines/supernova/graphics.h b/engines/supernova/graphics.h index 94d6b5e936..7cd0e3c66e 100644 --- a/engines/supernova/graphics.h +++ b/engines/supernova/graphics.h @@ -9,7 +9,7 @@ class SeekableReadStream; } namespace Graphics { -class Surface; +struct Surface; } namespace Supernova { @@ -24,11 +24,6 @@ const byte initPalette[48] = { 63, 10, 10 }; -// TODO -const byte defaultVGAPalette[] = { - 0, 0, 0 -}; - class MSNImageDecoder : public Image::ImageDecoder { public: MSNImageDecoder(); diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index 0a1eb459b0..a2302230bd 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -64,8 +64,6 @@ SupernovaEngine::~SupernovaEngine() { } Common::Error SupernovaEngine::run() { -// const Graphics::PixelFormat format(3, 8, 8, 8, 0, 16, 8, 0, 0); -// initGraphics(kScreenWidth, kScreenHeight, &format); initGraphics(kScreenWidth, kScreenHeight); debug(_system->getScreenFormat().toString().c_str()); _console = new Console(this); @@ -172,9 +170,9 @@ void SupernovaEngine::initPalette() { 63, 0, 0, 0, 0,30, 0, 0,45, 40,40,40, 20,50,63, 10,63,10, 60,60, 0, 63,10,10 }; - Common::copy(init_pal, init_pal + sizeof(init_pal), pal); _system->getPaletteManager()->setPalette(pal, 0, 256); + _system->getPaletteManager()->setPalette(init_pal, 0, 16); } void SupernovaEngine::playSound(int filenumber, int offset) { |