diff options
author | Paul Gilbert | 2013-06-16 09:03:03 -0400 |
---|---|---|
committer | Paul Gilbert | 2013-06-16 09:03:03 -0400 |
commit | 76ba4bcafba4f8c70c318094650bfa45fd674308 (patch) | |
tree | eb1e17ce4f53328957cf1561f5d80bde70c1094e /engines/voyeur | |
parent | 0a0db2bf73fc417d1094ae744e0d350dd4462d38 (diff) | |
download | scummvm-rg350-76ba4bcafba4f8c70c318094650bfa45fd674308.tar.gz scummvm-rg350-76ba4bcafba4f8c70c318094650bfa45fd674308.tar.bz2 scummvm-rg350-76ba4bcafba4f8c70c318094650bfa45fd674308.zip |
VOYEUR: Font rendering fixes
Diffstat (limited to 'engines/voyeur')
-rw-r--r-- | engines/voyeur/files.cpp | 24 | ||||
-rw-r--r-- | engines/voyeur/files.h | 2 | ||||
-rw-r--r-- | engines/voyeur/graphics.cpp | 114 |
3 files changed, 100 insertions, 40 deletions
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp index 94a770ae0e..69cfcc2786 100644 --- a/engines/voyeur/files.cpp +++ b/engines/voyeur/files.cpp @@ -670,6 +670,20 @@ PictureResource::PictureResource() { _imgData = NULL; } +PictureResource::PictureResource(int flags, int select, int pick, int onOff, + int depth, const Common::Rect &bounds, int maskData, byte *imgData, + int planeSize) { + _flags = flags; + _select = select; + _pick = pick; + _onOff = onOff; + _depth = depth; + _bounds = bounds; + _maskData = maskData; + _imgData = imgData; + _planeSize = planeSize; +} + PictureResource::~PictureResource() { delete _imgData; } @@ -677,7 +691,7 @@ PictureResource::~PictureResource() { /*------------------------------------------------------------------------*/ ViewPortResource::ViewPortResource(BoltFilesState &state, const byte *src): - _state(state) { + _fontChar(0, 0xff, 0xff, 0, 0, Common::Rect(), 0, NULL, 0), _state(state) { _flags = READ_LE_UINT16(src); _next = state._curLibPtr->getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource; _pageCount = READ_LE_UINT16(src + 6); @@ -919,12 +933,12 @@ int ViewPortResource::drawText(const Common::String &msg) { gfxManager._saveBack = false; int count = 0; - if (!(fontInfo._fontFlags & 4)) + if (fontInfo._fontFlags & 4) count = 1; else if (fontInfo._fontFlags & 8) count = 8; - for (int i = 0; i < count; ++i) { + for (int i = count; i >= 0; --i) { xp = pos.x; yp = pos.y; @@ -950,7 +964,7 @@ int ViewPortResource::drawText(const Common::String &msg) { break; } - if (i == 0) { + if (i != 0) { _fontChar._pick = 0; _fontChar._onOff = fontInfo._shadowColor; } else if (fontData.field2 == 1 || (fontInfo._fontFlags & 0x10)) { @@ -969,7 +983,7 @@ int ViewPortResource::drawText(const Common::String &msg) { while ((ch = *msgP++) != '\0') { int charValue = (int)ch - minChar; - if (charValue >= totalChars || fontData._charWidth[charValue] == 0) + if (charValue < 0 || charValue >= totalChars || fontData._charWidth[charValue] == 0) charValue = fontData._maxChar - minChar; int charWidth = fontData._charWidth[charValue]; diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index f612904b6d..659f29baaf 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -219,6 +219,8 @@ public: byte *_imgData; public: PictureResource(BoltFilesState &state, const byte *src); + PictureResource(int flags, int select, int pick, int onOff, int depth, + const Common::Rect &bounds, int maskData, byte *imgData, int planeSize); PictureResource(); virtual ~PictureResource(); }; diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index 7a6c72c027..99abc11f52 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -93,19 +93,9 @@ void GraphicsManager::addRectOptSaveRect(ViewPortResource *viewPort, int idx, co if (viewPort->_rectListCount[idx] == -1) return; + // TODO: Lots of code in original, which I suspect may be overlapping rect merging viewPort->_rectListPtr[idx]->push_back(bounds); - count1 = count2 = viewPort->_rectListCount[idx]; - varE = var24 = 0; - - if (count1 > 0) { - for (idx1 = 0; idx1 < count1; ++idx1) { - // TODO: In progress - - Common::Array<Common::Rect> &rectList = *viewPort->_rectListPtr[idx]; - } - - viewPort->_rectListCount[idx] = idx1; - } + ++viewPort->_rectListCount[idx]; } void GraphicsManager::restoreMCGASaveRect(ViewPortResource *viewPort) { @@ -148,9 +138,11 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des bool isClipped = false; int var52; int var20, var22; - int var26; + int var26, var2C; + byte *srcImgData, *destImgData; byte *srcP, *destP; + byte byteVal, byteVal2; // Get the picture parameters, or deference viewport pointers to get their pictures PictureResource *srcPic = (PictureResource *)srcDisplay; @@ -292,6 +284,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des if (srcFlags & 8) { error("TODO: sDrawPic"); } else { + // loc_258B8 srcP = srcImgData + srcOffset; if (destFlags & 8) { @@ -316,43 +309,94 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des } } } else { + // loc_2615E destP = destImgData + screenOffset; - // loc_2615E if (srcFlags & 2) { - srcP = srcImgData + srcOffset; - - if (destFlags & 8) { - error("TODO: sDrawPic"); - } else { - // loc_25773 - destP = destImgData + screenOffset; - srcP = (byte *)_screenSurface.pixels + srcOffset; + // loc_2617e + if (srcFlags & 0x100) { + // loc_26188 + srcP = srcImgData; + if (isClipped) { + // loc_26199 +error("TODO: var22/var24/var2C not initialised before use?"); + if (var22 < 0) { + var22 = -var22; + } else { + var22 = 0; + } + var26 = var22 + width2; + if (var24 < 0) { + var24 = -var24; + } else { + var24 = 0; + } - if (srcFlags & 2) { - // Copy from screen to surface with transparency + width2 = srcPic->_bounds.width(); + height1 = var24 + height1; + byteVal = 0; + for (int yp = 0; yp < height1; ++yp) { - for (int xp = 0; xp < width2; ++xp, ++destP) { - byte srcPixel = *srcP++; - if (srcPixel) - *destP = srcPixel; + for (int xp = 0; xp < width2; ++xp) { + if (byteVal2 <= 0) { + byteVal = *srcP++; + if (byteVal & 0x80) { + byteVal &= 0x7f; + byteVal2 = *srcP++; + if (!byteVal2) + byteVal2 = width2; + } + } + + if (yp >= var24 && xp >= var22 && xp < var26) { + if (byteVal > 0) + *destP = byteVal; + ++destP; + } } - destP += widthDiff2; - srcP += widthDiff; + if (yp >= var24) + destP += widthDiff2; } } else { - // Copy from screen surface without transparency + // loc_262BE + byteVal = 0; for (int yp = 0; yp < height1; ++yp) { - for (int xp = 0; xp < width2; ++xp, ++destP) { - byte srcPixel = *srcP++; - *destP = srcPixel; + for (int xp = 0; xp < width2; ++xp) { + byteVal2 = 0; + if (!byteVal2) { + byteVal = *++srcP; + if (byteVal & 0x80) { + byteVal &= 0x7f; + byteVal2 = *srcP++; + + if (!byteVal2) + byteVal2 = width2; + } + } + + if (byteVal > 0) + *destP = byteVal; + + ++destP; + --byteVal2; } destP += widthDiff2; - srcP += widthDiff; } } + } else { + // loc_2637F + // Copy with transparency + for (int yp = 0; yp < height1; ++yp) { + for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) { + if (*srcP != 0) + *destP = *srcP; + } + + destP += widthDiff2; + srcP += widthDiff; + } } } else { if (srcFlags & 0x100) { |