From ecd1a9f9435c5fc5d502d75dd256394b5f3283f3 Mon Sep 17 00:00:00 2001 From: athrxx Date: Thu, 23 Feb 2012 21:36:14 +0100 Subject: KYRA: (EOB) - cleanup CGA/EGA code a bit --- engines/kyra/screen_eob.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'engines/kyra/screen_eob.cpp') diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp index 38521d757c..dc53e8aca5 100644 --- a/engines/kyra/screen_eob.cpp +++ b/engines/kyra/screen_eob.cpp @@ -55,7 +55,7 @@ Screen_EoB::Screen_EoB(EoBCoreEngine *vm, OSystem *system) : Screen(vm, system, _egaPixelValueTable = 0; _cgaMappingDefault = 0; _cgaDitheringTables[0] = _cgaDitheringTables[1] = 0; - _useHiResEGADithering = false; + _useLoResEGA = _useHiResEGADithering = false; } Screen_EoB::~Screen_EoB() { @@ -69,12 +69,8 @@ Screen_EoB::~Screen_EoB() { } bool Screen_EoB::init() { - return init(false); -} - -bool Screen_EoB::init(bool useHiResEGADithering) { // Define hi-res pages for EGA mode in EOB II - if (useHiResEGADithering) { + if (_vm->gameFlags().useHiRes) { for (int i = 0; i < 8; i++) _pageScaleFactor[i] = 2; } @@ -99,15 +95,16 @@ bool Screen_EoB::init(bool useHiResEGADithering) { _dsTempPage = new uint8[12000]; - if (_renderMode == Common::kRenderEGA) { - _useHiResEGADithering = useHiResEGADithering; + if (_vm->gameFlags().useHiRes && _renderMode == Common::kRenderEGA) { + _useHiResEGADithering = true; _egaDitheringTable = new uint8[256]; _egaPixelValueTable = new uint8[256]; for (int i = 0; i < 256; i++) { _egaDitheringTable[i] = i & 0x0f; _egaPixelValueTable[i] = i & 0x0f; } - + } else if (_renderMode == Common::kRenderEGA) { + _useLoResEGA = true; } else if (_renderMode == Common::kRenderCGA) { _cgaMappingDefault = _vm->staticres()->loadRawData(kEoB1CgaMappingDefault, temp); _cgaDitheringTables[0] = new uint16[256]; @@ -432,7 +429,7 @@ 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) + if (_useLoResEGA) encode8bit = false; if (_renderMode == Common::kRenderCGA) { @@ -556,7 +553,7 @@ uint8 *Screen_EoB::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool enco *dst++ = (w & 0xff); *dst++ = (h & 0xff); - if (_renderMode == Common::kRenderEGA && !_useHiResEGADithering) { + if (_useLoResEGA) { for (int i = 0; i < 16; i++) dst[i] = i; } else { @@ -1538,6 +1535,7 @@ OldDOSFont::OldDOSFont(Common::RenderMode mode, bool useHiResEGADithering) : _re _data = 0; _width = _height = _numGlyphs = 0; _bitmapOffsets = 0; + _useLoResEGA = (_renderMode == Common::kRenderEGA && !_useHiResEGADithering); _numRef++; if (!_cgaDitheringTable && _numRef == 1) { @@ -1664,7 +1662,7 @@ void OldDOSFont::drawChar(uint16 c, byte *dst, int pitch) const { uint16 cgaMask1 = cgaColorMask[color1 & 3]; uint16 cgaMask2 = cgaColorMask[color2 & 3]; - if (_renderMode == Common::kRenderCGA || (_renderMode == Common::kRenderEGA && !_useHiResEGADithering)) { + if (_renderMode == Common::kRenderCGA || _useLoResEGA) { color1 &= 0x0f; color2 &= 0x0f; } -- cgit v1.2.3