From 73278c3f9f0157e1adf19134eceeb65eec3e37eb Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Sun, 5 Nov 2017 02:36:45 +0000 Subject: SUPERNOVA: Replace a class variable used in a single function by a local variable --- engines/supernova/supernova.cpp | 12 +++++++----- engines/supernova/supernova.h | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index c693f9e34b..6dda5657ff 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -104,7 +104,6 @@ SupernovaEngine::SupernovaEngine(OSystem *syst) , _brightness(255) , _menuBrightness(255) , _imageIndex(0) - , _sectionIndex(0) , _delay(33) , _textSpeed(kTextSpeed[2]) , _screenWidth(320) @@ -391,10 +390,13 @@ void SupernovaEngine::playSoundMod(int filenumber) } void SupernovaEngine::renderImage(MSNImageDecoder &image, int section) { - _sectionIndex = section; - - if (section > 128) + // Note: inverting means we are removing the section. So we should get the rect for that + // section but draw the background (section 0) instead. + bool invert = false; + if (section > 128) { section -= 128; + invert = true; + } if (section > image._numSections - 1) return; @@ -424,7 +426,7 @@ void SupernovaEngine::renderImage(MSNImageDecoder &image, int section) { } uint offset = image._section[section].y1 * image._pitch + image._section[section].x1; - if (_sectionIndex > 128) + if (invert) section = 0; _system->copyRectToScreen(static_cast(image._sectionSurfaces[section]->getPixels()) + offset, diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h index 8ba298c751..16c98887b0 100644 --- a/engines/supernova/supernova.h +++ b/engines/supernova/supernova.h @@ -108,7 +108,6 @@ public: Common::String _nullString; byte _imageIndex; - byte _sectionIndex; byte _menuBrightness; byte _brightness; uint _timePaused; -- cgit v1.2.3