aboutsummaryrefslogtreecommitdiff
path: root/engines/supernova
diff options
context:
space:
mode:
authorJoseph-Eugene Winzer2017-06-24 14:45:23 +0200
committerThierry Crozat2018-01-22 23:42:08 +0000
commit9e21dc42eecf14c69af7c0e39428f24616c8cf23 (patch)
treeea21eb765dced9694d17d29095dd9ac89fe67f58 /engines/supernova
parentcd080b820a5b402c060dd901e8f76bd5e0d3a143 (diff)
downloadscummvm-rg350-9e21dc42eecf14c69af7c0e39428f24616c8cf23.tar.gz
scummvm-rg350-9e21dc42eecf14c69af7c0e39428f24616c8cf23.tar.bz2
scummvm-rg350-9e21dc42eecf14c69af7c0e39428f24616c8cf23.zip
SUPERNOVA: Implements rendering of newspaper articles
The resolution will change dynamically depending what image is about to be rendered. As there are no other GUI elements shown that depend on the screen resolution when the artciles are rendered, there shouldn't be any problems.
Diffstat (limited to 'engines/supernova')
-rw-r--r--engines/supernova/supernova.cpp38
-rw-r--r--engines/supernova/supernova.h2
2 files changed, 32 insertions, 8 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index 99cc867682..297365513c 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -98,6 +98,8 @@ SupernovaEngine::SupernovaEngine(OSystem *syst)
, _sectionIndex(0)
, _delay(33)
, _gameRunning(true)
+ , _screenWidth(320)
+ , _screenHeight(200)
{
// const Common::FSNode gameDataDir(ConfMan.get("path"));
// SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
@@ -119,8 +121,8 @@ SupernovaEngine::~SupernovaEngine() {
}
Common::Error SupernovaEngine::run() {
- initGraphics(kScreenWidth, kScreenHeight);
GameManager gm(this, &_event);
+ initGraphics(_screenWidth, _screenHeight);
_console = new Console(this, &gm);
initData();
@@ -253,17 +255,37 @@ void SupernovaEngine::renderImage(MSNImageDecoder &image, int section, bool full
image.loadSection(section);
_system->getPaletteManager()->setPalette(image.getPalette(), 16, 239);
paletteBrightness();
+
+ Common::Rect sectionRect(image._section[section].x1,
+ image._section[section].y1,
+ image._section[section].x2 - image._section[section].x1,
+ image._section[section].y2 - image._section[section].y1);
+ if (image._filenumber == 1 || image._filenumber == 2) {
+ sectionRect.setWidth(640);
+ sectionRect.setHeight(480);
+
+ if (_screenWidth != 640) {
+ _screenWidth = 640;
+ _screenHeight = 480;
+ initGraphics(_screenWidth, _screenHeight);
+ }
+ } else {
+ if (_screenWidth != 320) {
+ _screenWidth = 320;
+ _screenHeight = 200;
+ initGraphics(_screenWidth, _screenHeight);
+ }
+ }
+
if (fullscreen) {
_system->copyRectToScreen(image.getSurface()->getPixels(),
- image._pitch, 0, 0, kScreenWidth, kScreenHeight);
+ image._pitch, 0, 0, _screenWidth, _screenHeight);
} else {
- uint offset = image._section[section].y1 * 320 + image._section[section].x1;
+ uint offset = image._section[section].y1 * image._pitch + 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);
+ image._pitch,
+ sectionRect.top, sectionRect.left,
+ sectionRect.width(), sectionRect.height());
}
}
diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h
index 16b9b4e130..db9919ecc4 100644
--- a/engines/supernova/supernova.h
+++ b/engines/supernova/supernova.h
@@ -88,6 +88,8 @@ public:
} _soundSamples[kAudioNumSamples];
Common::Event _event;
bool _gameRunning;
+ int _screenWidth;
+ int _screenHeight;
byte _imageIndex;
byte _sectionIndex;