Permalink
Browse files

SUPERNOVA: Enables renderImage() to render inverse sections

Besides the addition of inverse sections, the 'fullscreen' parameter was
removed as it was used only for testing purposes in the beginning.
  • Loading branch information...
Joefish committed Jul 17, 2017
1 parent ea064e1 commit e9d7b7ca0fbcf32f0a9b952595b02d75ad834505
Showing with 18 additions and 18 deletions.
  1. +1 −0 engines/supernova/graphics.cpp
  2. +15 −16 engines/supernova/supernova.cpp
  3. +2 −2 engines/supernova/supernova.h
@@ -85,6 +85,7 @@ bool MSNImageDecoder::loadStream(Common::SeekableReadStream &stream) {
_section[i].addressHigh = 0xff;
_section[i].addressLow = 0xffff;
_section[i].x2 = 0;
_section[i].next = 0;
}
for (int i = 0; i < _numSections; ++i) {
_section[i].x1 = stream.readUint16LE();
@@ -273,14 +273,16 @@ void SupernovaEngine::playSoundMod(int filenumber)
-1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
}
void SupernovaEngine::renderImage(MSNImageDecoder &image, int section, bool fullscreen) {
void SupernovaEngine::renderImage(MSNImageDecoder &image, int section) {
_sectionIndex = section;
if (section > 128)
section -= 128;
if (section > image._numSections - 1)
return;
_currentImage = &image;
_imageIndex = image._filenumber;
_sectionIndex = section;
_system->getPaletteManager()->setPalette(image.getPalette(), 16, 239);
paletteBrightness();
@@ -291,7 +293,6 @@ void SupernovaEngine::renderImage(MSNImageDecoder &image, int section, bool full
if (image._filenumber == 1 || image._filenumber == 2) {
sectionRect.setWidth(640);
sectionRect.setHeight(480);
if (_screenWidth != 640) {
_screenWidth = 640;
_screenHeight = 480;
@@ -305,23 +306,21 @@ void SupernovaEngine::renderImage(MSNImageDecoder &image, int section, bool full
}
}
if (fullscreen) {
_system->copyRectToScreen(image._sectionSurfaces[section]->getPixels(),
image._pitch, 0, 0, _screenWidth, _screenHeight);
} else {
uint offset = image._section[section].y1 * image._pitch + image._section[section].x1;
_system->copyRectToScreen(static_cast<const byte *>(image._sectionSurfaces[section]->getPixels()) + offset,
image._pitch,
sectionRect.left, sectionRect.top,
sectionRect.width(), sectionRect.height());
}
uint offset = image._section[section].y1 * image._pitch + image._section[section].x1;
if (_sectionIndex > 128)
section = 0;
_system->copyRectToScreen(static_cast<const byte *>(image._sectionSurfaces[section]->getPixels()) + offset,
image._pitch,
sectionRect.left, sectionRect.top,
sectionRect.width(), sectionRect.height());
}
void SupernovaEngine::renderImage(int filenumber, int section, bool fullscreen) {
void SupernovaEngine::renderImage(int filenumber, int section) {
if (filenumber > ARRAYSIZE(_images) - 1)
return;
renderImage(_images[filenumber], section, fullscreen);
renderImage(_images[filenumber], section);
}
void SupernovaEngine::saveScreen(int x, int y, int width, int height) {
@@ -117,8 +117,8 @@ class SupernovaEngine : public Engine {
void playSound(AudioIndex sample);
void playSoundMod(int filenumber);
void stopSound();
void renderImage(MSNImageDecoder &image, int section, bool fullscreen = false);
void renderImage(int filenumber, int section, bool fullscreen = false);
void renderImage(MSNImageDecoder &image, int section);
void renderImage(int filenumber, int section);
void saveScreen(int x, int y, int width, int height);
void restoreScreen();
void renderRoom(Room &room);

0 comments on commit e9d7b7c

Please sign in to comment.