diff options
-rw-r--r-- | engines/supernova/imageid.h | 26 | ||||
-rw-r--r-- | engines/supernova/screen.cpp | 47 | ||||
-rw-r--r-- | engines/supernova/screen.h | 6 |
3 files changed, 48 insertions, 31 deletions
diff --git a/engines/supernova/imageid.h b/engines/supernova/imageid.h index 952f707b6e..7cfa08370e 100644 --- a/engines/supernova/imageid.h +++ b/engines/supernova/imageid.h @@ -176,19 +176,19 @@ enum ImageId { kRocksRockAnimation3, // file 13 kBluePlanetBackground, - kBluePlanetDummy1, - kBluePlanetDummy2, - kBluePlanetDummy3, - kBluePlanetDummy4, - kBluePlanetDummy5, - kBluePlanetDummy6, - kBluePlanetDummy7, - kBluePlanetDummy8, - kBluePlanetDummy9, - kBluePlanetDummy10, - kBluePlanetDummy11, - kBluePlanetDummy12, - kBluePlanetDummy13, + kBluePlanetShipAnimation1, + kBluePlanetShipAnimation2, + kBluePlanetShipAnimation3, + kBluePlanetShipAnimation4, + kBluePlanetShipAnimation5, + kBluePlanetShipAnimation6, + kBluePlanetShipAnimation7, + kBluePlanetShipAnimation8, + kBluePlanetShipAnimation9, + kBluePlanetShipAnimation10, + kBluePlanetShipAnimation11, + kBluePlanetShipAnimation12, + kBluePlanetShipAnimation13, // file 14 kRogerCrashBackground, kRogerCrashAnimation1, diff --git a/engines/supernova/screen.cpp b/engines/supernova/screen.cpp index da940c32e0..5404b13254 100644 --- a/engines/supernova/screen.cpp +++ b/engines/supernova/screen.cpp @@ -327,7 +327,7 @@ void Screen::renderText(StringId stringId, int x, int y, byte color) { renderText(_vm->getGameString(stringId), x, y, color); } -void Screen::renderImageSection(int section) { +void Screen::renderImageSection(const MSNImage *image, int section) { // 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; @@ -335,14 +335,14 @@ void Screen::renderImageSection(int section) { section -= 128; invert = true; } - if (!_currentImage || section > _currentImage->_numSections - 1) + if (section > image->_numSections - 1) return; - Common::Rect sectionRect(_currentImage->_section[section].x1, - _currentImage->_section[section].y1, - _currentImage->_section[section].x2 + 1, - _currentImage->_section[section].y2 + 1) ; - if (_currentImage->_filenumber == 1 || _currentImage->_filenumber == 2) { + Common::Rect sectionRect(image->_section[section].x1, + image->_section[section].y1, + image->_section[section].x2 + 1, + image->_section[section].y2 + 1) ; + if (image->_filenumber == 1 || image->_filenumber == 2) { sectionRect.setWidth(640); sectionRect.setHeight(480); if (_screenWidth != 640) { @@ -361,20 +361,35 @@ void Screen::renderImageSection(int section) { uint offset = 0; int pitch = sectionRect.width(); if (invert) { - pitch = _currentImage->_pitch; - offset = _currentImage->_section[section].y1 * pitch + - _currentImage->_section[section].x1; + pitch = image->_pitch; + offset = image->_section[section].y1 * pitch + + image->_section[section].x1; section = 0; } - void *pixels = _currentImage->_sectionSurfaces[section]->getPixels(); + void *pixels = image->_sectionSurfaces[section]->getPixels(); _vm->_system->copyRectToScreen(static_cast<const byte *>(pixels) + offset, pitch, sectionRect.left, sectionRect.top, sectionRect.width(), sectionRect.height()); } -void Screen::renderImage(ImageId id) { - // TODO: include staticscreen.cpp and render section of filenumber +void Screen::renderImage(ImageId id, bool removeImage) { + ImageInfo info = imageInfo[id]; + const MSNImage *image = _resMan->getImage(info.filenumber); + + if (_currentImage != image) { + _currentImage = image; + _vm->_system->getPaletteManager()->setPalette(image->getPalette(), 16, 239); + } + + do { + if (removeImage) + renderImageSection(image, info.section + 128); + else + renderImageSection(image, info.section); + + info.section = image->_section[info.section].next; + } while (info.section != 0); } void Screen::renderImage(int section) { @@ -392,9 +407,9 @@ void Screen::renderImage(int section) { do { if (sectionVisible) - renderImageSection(section); + renderImageSection(_currentImage, section); else - renderImageSection(section + 128); + renderImageSection(_currentImage, section + 128); section = _currentImage->_section[section].next; } while (section != 0); } @@ -428,7 +443,7 @@ void Screen::renderRoom(Room &room) { int section = i; if (room.isSectionVisible(section)) { do { - renderImageSection(section); + renderImageSection(_currentImage, section); section = _currentImage->_section[section].next; } while (section != 0); } diff --git a/engines/supernova/screen.h b/engines/supernova/screen.h index a3c37f599a..d57fb53ed2 100644 --- a/engines/supernova/screen.h +++ b/engines/supernova/screen.h @@ -143,9 +143,8 @@ public: void paletteFadeIn(); void paletteFadeOut(); void paletteBrightness(); - void renderImage(ImageId id); + void renderImage(ImageId id, bool removeImage = false); void renderImage(int section); - void renderImageSection(int section); bool setCurrentImage(int filenumber); void saveScreen(int x, int y, int width, int height); void saveScreen(const GuiElement &guiElement); @@ -175,6 +174,9 @@ public: void update(); private: + void renderImageSection(const MSNImage *image, int section); + +private: SupernovaEngine *_vm; GameManager *_gm; ResourceManager *_resMan; |