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.
This commit is contained in:
Joseph-Eugene Winzer
2017-07-17 16:28:06 +02:00
parent ea064e17c1
commit e9d7b7ca0f
3 changed files with 18 additions and 18 deletions
+1
View File
@@ -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();
+15 -16
View File
@@ -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) {
+2 -2
View File
@@ -117,8 +117,8 @@ public:
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);