diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/eobcommon.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/items_eob.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/scene_rpg.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 11 | ||||
-rw-r--r-- | engines/kyra/screen_eob.cpp | 110 | ||||
-rw-r--r-- | engines/kyra/screen_eob.h | 1 | ||||
-rw-r--r-- | engines/kyra/sequences_eob.cpp | 4 |
7 files changed, 76 insertions, 56 deletions
diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index ecac20a7f8..9bec256ec7 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -390,7 +390,7 @@ Common::Error EoBCoreEngine::init() { if (!_staticres->init()) error("_staticres->init() failed"); - if (!screen()->init()) + if (!_screen->init(_flags.gameID == GI_EOB2 && _configRenderMode == Common::kRenderEGA)) error("screen()->init() failed"); if (ConfMan.hasKey("save_slot")) { diff --git a/engines/kyra/items_eob.cpp b/engines/kyra/items_eob.cpp index 5b65887d4b..0994e12e4f 100644 --- a/engines/kyra/items_eob.cpp +++ b/engines/kyra/items_eob.cpp @@ -465,7 +465,7 @@ void EoBCoreEngine::drawItemIconShape(int pageNum, Item itemId, int x, int y) { const uint8 *ovl = 0; if (applyBluePal) { - if (_flags.gameID == GI_EOB1) { + if (_flags.gameID == GI_EOB1) { ovl = (_configRenderMode == Common::kRenderCGA) ? _itemsOverlayCGA : &_itemsOverlay[icn << 4]; } else { _screen->setFadeTableIndex(3); diff --git a/engines/kyra/scene_rpg.cpp b/engines/kyra/scene_rpg.cpp index 7f6b16bfc6..da7c9fdb90 100644 --- a/engines/kyra/scene_rpg.cpp +++ b/engines/kyra/scene_rpg.cpp @@ -111,7 +111,7 @@ void KyraRpgEngine::setDoorShapeDim(int index, int16 &y1, int16 &y2, int dim) { a += _dscDoorFrameIndex1[_currentLevel - 1]; b += _dscDoorFrameIndex2[_currentLevel - 1]; } - + y1 = _dscDoorFrameY1[a]; y2 = _dscDoorFrameY2[b]; diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index d394a86f6f..3087a8a027 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -648,6 +648,9 @@ void Screen::fadeFromBlack(int delay, const UpdateFunctor *upFunc) { } void Screen::fadeToBlack(int delay, const UpdateFunctor *upFunc) { + if (_renderMode == Common::kRenderEGA) + return; + Palette pal(getPalette(0).getNumColors()); fadePalette(pal, delay, upFunc); } @@ -1038,7 +1041,9 @@ void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum, color &= 0x0F; color |= (color << 4); } else if (_renderMode == Common::kRenderCGA) { - color &= 3; + color &= 0x03; + } else if (_renderMode == Common::kRenderEGA) { + color &= 0x0F; } if (xored) { @@ -1117,7 +1122,9 @@ void Screen::drawLine(bool vertical, int x, int y, int length, int color) { color &= 0x0F; color |= (color << 4); } else if (_renderMode == Common::kRenderCGA) { - color &= 3; + color &= 0x03; + } else if (_renderMode == Common::kRenderEGA) { + color &= 0x0F; } if (vertical) { diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp index 8721c2cc02..51665a00b1 100644 --- a/engines/kyra/screen_eob.cpp +++ b/engines/kyra/screen_eob.cpp @@ -70,6 +70,10 @@ Screen_EoB::~Screen_EoB() { } bool Screen_EoB::init() { + return init(false); +} + +bool Screen_EoB::init(bool useHiResEGADithering) { if (Screen::init()) { int temp; _gfxMaxY = _vm->staticres()->loadRawData(kEoBBaseExpObjectY, temp); @@ -91,6 +95,7 @@ bool Screen_EoB::init() { _dsTempPage = new uint8[12000]; if (_renderMode == Common::kRenderEGA) { + _useHiResEGADithering = useHiResEGADithering; _egaColorMap = new uint8[256]; _egaPixelValueTable = new uint8[256]; for (int i = 0; i < 256; i++) { @@ -98,9 +103,6 @@ bool Screen_EoB::init() { _egaPixelValueTable[i] = i & 0x0f; } - if (_vm->game() == GI_EOB2) - _useHiResEGADithering = true; - } else if (_renderMode == Common::kRenderCGA) { _cgaMappingDefault = _vm->staticres()->loadRawData(kEoB1CgaMappingDefault, temp); _cgaDitheringTables[0] = new uint16[256]; @@ -346,6 +348,9 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco uint8 *srcLineStart = getPagePtr(_curPage | 1) + y * 320 + (x << 3); uint8 *src = srcLineStart; + if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) + encode8bit = false; + if (_renderMode == Common::kRenderCGA) { if (cgaMapping) generateCGADitheringTables(cgaMapping); @@ -450,8 +455,12 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco } else { uint8 nib = 0, col = 0; - uint8 *colorMap = new uint8[0x100]; - memset(colorMap, 0xff, 0x100); + uint8 *colorMap = 0; + + if (_renderMode != Common::kRenderEGA) { + colorMap = new uint8[0x100]; + memset(colorMap, 0xff, 0x100); + } shapesize = h * (w << 2) + 20; shp = new uint8[shapesize]; @@ -462,7 +471,13 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco *dst++ = (h & 0xff); *dst++ = (w & 0xff); *dst++ = (h & 0xff); - memset(dst, 0xff, 0x10); + + if (_renderMode == Common::kRenderEGA) { + for (int i = 0; i < 16; i++) + dst[i] = i; + } else { + memset(dst, 0xff, 0x10); + } uint8 *pal = dst; dst += 16; @@ -473,15 +488,18 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco uint16 w1 = w << 3; while (w1--) { uint8 s = *src++; - uint8 c = colorMap[s]; - if (c == 0xff) { - if (col < 0x10) { - *pal++ = s; - c = colorMap[s] = col++; - if (!col) + uint8 c = s & 0x0f; + if (colorMap) { + c = colorMap[s]; + if (c == 0xff) { + if (col < 0x10) { + *pal++ = s; + c = colorMap[s] = col++; + if (!col) + c = 0; + } else { c = 0; - } else { - c = 0; + } } } @@ -782,12 +800,9 @@ void Screen_EoB::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, src += pixelStep; shSwtch = bitShDef; } - if (pixelsPerByte == 2) { - if (pal[(in >> shift) & pixelPackingMask]) - drawShapeSetPixel(dst, pal[(in >> shift) & pixelPackingMask]); - } else { - *dst = (*dst & ((trans >> shift) & (pixelPackingMask))) | pal[(in >> shift) & pixelPackingMask]; - } + uint8 col = (pixelsPerByte == 2) ? pal[(in >> shift) & pixelPackingMask] : (*dst & ((trans >> shift) & (pixelPackingMask))) | pal[(in >> shift) & pixelPackingMask]; + if (col || pixelsPerByte == 4) + drawShapeSetPixel(dst, col); dst++; shift = (shift - (pixelStep * pixelPacking) & 7); } @@ -819,11 +834,11 @@ const uint8 *Screen_EoB::scaleShapeStep(const uint8 *shp) { uint16 w2 = (w << 3) / pixelsPerByte; uint16 t = ((w << 1) % 3) ? 1 : 0; d[1] = ((w << 1) / 3) + t; - + uint32 transOffsetSrc = (pixelsPerByte == 4) ? (shp[0] * shp[1]) << 1 : 0; uint32 transOffsetDst = (pixelsPerByte == 4) ? (d[0] * d[1]) << 1 : 0; shp += 3; - d += 3; + d += 3; if (pixelsPerByte == 2) { int i = 0; @@ -1252,19 +1267,21 @@ const uint16 *Screen_EoB::getCGADitheringTable(int index) { } void Screen_EoB::drawShapeSetPixel(uint8 *dst, uint8 c) { - if (_shapeFadeMode[0]) { - if (_shapeFadeMode[1]) { - c = *dst; - } else { - _shapeFadeInternal &= 7; - c = *(dst + _shapeFadeInternal++); + if ((_renderMode != Common::kRenderCGA && _renderMode != Common::kRenderEGA) || _useHiResEGADithering) { + if (_shapeFadeMode[0]) { + if (_shapeFadeMode[1]) { + c = *dst; + } else { + _shapeFadeInternal &= 7; + c = *(dst + _shapeFadeInternal++); + } } - } - if (_shapeFadeMode[1]) { - uint8 cnt = _shapeFadeMode[1]; - while (cnt--) - c = _fadeData[_fadeDataIndex + c]; + if (_shapeFadeMode[1]) { + uint8 cnt = _shapeFadeMode[1]; + while (cnt--) + c = _fadeData[_fadeDataIndex + c]; + } } *dst = c; @@ -1485,6 +1502,11 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch) const { uint16 cgaMask1 = cgaColorMask[color1 & 3]; uint16 cgaMask2 = cgaColorMask[color2 & 3]; + if (_renderMode == Common::kRenderCGA) { + color1 &= 0x0f; + color2 &= 0x0f; + } + int cH = _height; while (cH--) { int cW = w; @@ -1525,6 +1547,7 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch) const { } last = s; + } else { for (bool runWidthLoop = true; runWidthLoop;) { uint8 s = *src++; @@ -1536,22 +1559,11 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch) const { break; } - if (_renderMode == Common::kRenderCGA) { - uint8 in = s | last; - if (s & i) { - if (color1) - *dst = color1; - } else if (color2) { - *dst = color2; - } - last = s; - } else { - if (s & i) { - if (color1) - *dst = color1; - } else if (color2) { - *dst = color2; - } + if (s & i) { + if (color1) + *dst = color1; + } else if (color2) { + *dst = color2; } dst++; } diff --git a/engines/kyra/screen_eob.h b/engines/kyra/screen_eob.h index dc6c4b200f..cf8f86953d 100644 --- a/engines/kyra/screen_eob.h +++ b/engines/kyra/screen_eob.h @@ -36,6 +36,7 @@ public: virtual ~Screen_EoB(); bool init(); + bool init(bool useHiResEGADithering); void setClearScreenDim(int dim); void clearCurDim(); diff --git a/engines/kyra/sequences_eob.cpp b/engines/kyra/sequences_eob.cpp index aa8d18fe77..4a9f7d8a65 100644 --- a/engines/kyra/sequences_eob.cpp +++ b/engines/kyra/sequences_eob.cpp @@ -119,12 +119,12 @@ void EoBIntroPlayer::start() { Common::SeekableReadStream *s = _vm->resource()->createReadStream("TEXT.RAW"); if (s) { s->seek(768); - _screen->loadFileDataToPage(s, 6, s->size() - 768); + _screen->loadFileDataToPage(s, 5, s->size() - 768); delete s; } else { _screen->loadBitmap("TEXT.CMP", 3, 5, 0); - _screen->convertPage(5, 6, _vm->_cgaMappingAlt); } + _screen->convertPage(5, 6, _vm->_cgaMappingAlt); tower(); orb(); |