aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph-Eugene Winzer2017-06-13 20:22:37 +0200
committerThierry Crozat2018-01-22 22:59:48 +0000
commite2122bddf15245e1c8e33e182370a43b91f2a0ad (patch)
tree174ea57d42d387945d00671a1cbaf6cb08790314
parentd55ef4045ef287421af9aafa94fb8196cc7d7189 (diff)
downloadscummvm-rg350-e2122bddf15245e1c8e33e182370a43b91f2a0ad.tar.gz
scummvm-rg350-e2122bddf15245e1c8e33e182370a43b91f2a0ad.tar.bz2
scummvm-rg350-e2122bddf15245e1c8e33e182370a43b91f2a0ad.zip
SUPERNOVA: Updates renderImage() function
renderImage() now considers the size of image sections instead of blitting them on 320x200 by default.
-rw-r--r--engines/supernova/graphics.h1
-rw-r--r--engines/supernova/supernova.cpp26
-rw-r--r--engines/supernova/supernova.h3
3 files changed, 21 insertions, 9 deletions
diff --git a/engines/supernova/graphics.h b/engines/supernova/graphics.h
index 585aabe260..462e9ea36a 100644
--- a/engines/supernova/graphics.h
+++ b/engines/supernova/graphics.h
@@ -26,7 +26,6 @@ public:
bool loadSection(int _section);
-private:
static const int kMaxSections = 50;
static const int kMaxClickFields = 80;
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index 3c57fcdaf5..602f69fc1a 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -49,6 +49,7 @@ SupernovaEngine::SupernovaEngine(OSystem *syst)
, _menuBrightness(255)
, _imageIndex(10)
, _sectionIndex(0)
+ , _delay(33)
{
// const Common::FSNode gameDataDir(ConfMan.get("path"));
// SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
@@ -82,7 +83,7 @@ Common::Error SupernovaEngine::run() {
renderImage(_imageIndex, _sectionIndex);
renderText(Common::String::format("%u | %u", _imageIndex, _sectionIndex).c_str(), 0, 190, 15);
_system->updateScreen();
- _system->delayMillis(10);
+ _system->delayMillis(_delay);
}
//deinit timer/sound/..
@@ -121,7 +122,8 @@ void SupernovaEngine::updateEvents() {
}
}
if (event.kbd.keycode == Common::KEYCODE_e) {
- ++_sectionIndex;
+ renderImage(_imageIndex, 0);
+ renderImage(_imageIndex, ++_sectionIndex);
}
break;
default:
@@ -168,7 +170,7 @@ void playSoundMod(int filenumber)
// play Supernova MOD file
}
-void SupernovaEngine::renderImage(int filenumber, int section) {
+void SupernovaEngine::renderImage(int filenumber, int section, bool fullscreen) {
Common::File file;
if (!file.open(Common::String::format("msn_data.0%2d", filenumber))) {
error("File %s could not be read!", file.getName());
@@ -176,9 +178,19 @@ void SupernovaEngine::renderImage(int filenumber, int section) {
_image.loadStream(file);
_image.loadSection(section);
- _system->getPaletteManager()->setPalette(_image.getPalette(), 16, 240);
+ _system->getPaletteManager()->setPalette(_image.getPalette(), 16, 239);
paletteBrightness();
- _system->copyRectToScreen(_image.getSurface()->getPixels(), 320, 0, 0, 320, 200);
+ if (fullscreen) {
+ _system->copyRectToScreen(_image.getSurface()->getPixels(), 320, 0, 0, 320, 200);
+ } else {
+ size_t offset = _image._section[section].y1 * 320 + _image._section[section].x1;
+ _system->copyRectToScreen(static_cast<const byte *>(_image.getSurface()->getPixels()) + offset,
+ 320,
+ _image._section[section].x1,
+ _image._section[section].y1,
+ _image._section[section].x2 - _image._section[section].x1,
+ _image._section[section].y2 - _image._section[section].y1);
+ }
}
static int characterWidth(const char *text) {
@@ -336,7 +348,7 @@ void SupernovaEngine::paletteFadeOut() {
paletteBrightness();
_brightness -= 20;
_system->updateScreen();
- _system->delayMillis(10);
+ _system->delayMillis(_delay);
}
_menuBrightness = 0;
_brightness = 0;
@@ -353,7 +365,7 @@ void SupernovaEngine::paletteFadeIn() {
paletteBrightness();
_brightness += 20;
_system->updateScreen();
- _system->delayMillis(10);
+ _system->delayMillis(_delay);
}
_menuBrightness = 255;
_brightness = 255;
diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h
index 2e15850b61..017c912f13 100644
--- a/engines/supernova/supernova.h
+++ b/engines/supernova/supernova.h
@@ -54,6 +54,7 @@ private:
byte _sectionIndex;
byte _menuBrightness;
byte _brightness;
+ uint _delay;
void initData();
void initPalette();
@@ -64,7 +65,7 @@ private:
void playSound(int filenumber, int offset = 0);
void playSoundMod(int filenumber);
void stopSound();
- void renderImage(int filenumber, int section);
+ void renderImage(int filenumber, int section, bool fullscreen = false);
void renderMessage(char *text, MessagePosition position);
void renderText(const char *text, int x, int y, byte color);
void renderBox(int x, int y, int width, int height, byte color);