diff options
author | Jaromir Wysoglad | 2019-06-18 10:31:49 +0200 |
---|---|---|
committer | Thierry Crozat | 2019-07-28 15:09:14 +0100 |
commit | 83e05ea13f61fdd5d582115c8c2bbd246f70983c (patch) | |
tree | a18687fa0a205254a8d231b24d0d63ca9af2dcd9 /engines/supernova2/graphics.cpp | |
parent | 76142e2e7dddcc41906bdddc1138d452b15de3bc (diff) | |
download | scummvm-rg350-83e05ea13f61fdd5d582115c8c2bbd246f70983c.tar.gz scummvm-rg350-83e05ea13f61fdd5d582115c8c2bbd246f70983c.tar.bz2 scummvm-rg350-83e05ea13f61fdd5d582115c8c2bbd246f70983c.zip |
SUPERNOVA2: Add english translated image
This adds translated image of cyphered text inside Cabin room
I don't think I can get any closer to the original looks with
.pbm format.
Diffstat (limited to 'engines/supernova2/graphics.cpp')
-rw-r--r-- | engines/supernova2/graphics.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/engines/supernova2/graphics.cpp b/engines/supernova2/graphics.cpp index 592a8e9081..b629041cc9 100644 --- a/engines/supernova2/graphics.cpp +++ b/engines/supernova2/graphics.cpp @@ -81,12 +81,9 @@ bool MS2Image::init(int filenumber) { } bool MS2Image::loadFromEngineDataFile() { - //TODO - /*Common::String name; - if (_filenumber == 1) + Common::String name; + if (_filenumber == 28) name = "IMG1"; - else if (_filenumber == 2) - name = "IMG2"; else return false; @@ -96,16 +93,16 @@ bool MS2Image::loadFromEngineDataFile() { // or the format is not as expected. We will get those warning when reading the // strings anyway (actually the engine will even refuse to start). Common::File f; - if (!f.open(SUPERNOVA_DAT)) + if (!f.open(SUPERNOVA2_DAT)) return false; char id[5], lang[5]; id[4] = lang[4] = '\0'; f.read(id, 3); - if (strncmp(id, "MSN", 3) != 0) + if (strncmp(id, "MS2", 3) != 0) return false; int version = f.readByte(); - if (version != SUPERNOVA_DAT_VERSION) + if (version != SUPERNOVA2_DAT_VERSION) return false; while (!f.eos()) { @@ -118,7 +115,7 @@ bool MS2Image::loadFromEngineDataFile() { return f.read(_encodedImage, size) == size; } else f.skip(size); - }*/ + } return false; } @@ -222,8 +219,9 @@ bool MS2Image::loadStream(Common::SeekableReadStream &stream) { bool MS2Image::loadSections() { bool isPoster = _filenumber == 38; - int imageWidth = isPoster ? 640 : 320; - int imageHeight = isPoster ? 480 : 200; + bool isCypheredText = _filenumber == 28 && ConfMan.get("language") == "en"; + int imageWidth = isPoster || isCypheredText ? 640 : 320; + int imageHeight = isPoster || isCypheredText ? 480 : 200; _pitch = imageWidth; for (int section = 0; section < _numSections; ++section) { @@ -242,6 +240,19 @@ bool MS2Image::loadSections() { *surfacePixels++ = (_encodedImage[i] & 0x02) ? kColorWhite63 : kColorBlack; *surfacePixels++ = (_encodedImage[i] & 0x01) ? kColorWhite63 : kColorBlack; } + } else if (isCypheredText) { + surface->create(imageWidth, imageHeight, g_system->getScreenFormat()); + byte *surfacePixels = static_cast<byte *>(surface->getPixels()); + for (int i = 0; i < imageWidth * imageHeight / 8; ++i) { + *surfacePixels++ = (_encodedImage[i] & 0x80) ? kColorWhite44 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x40) ? kColorWhite44 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x20) ? kColorWhite44 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x10) ? kColorWhite44 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x08) ? kColorWhite44 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x04) ? kColorWhite44 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x02) ? kColorWhite44 : kColorBlack; + *surfacePixels++ = (_encodedImage[i] & 0x01) ? kColorWhite44 : kColorBlack; + } } else { uint32 offset = (_section[section].addressHigh << 16) + _section[section].addressLow; |