diff options
author | athrxx | 2015-11-14 19:52:26 +0100 |
---|---|---|
committer | athrxx | 2018-11-14 17:22:20 +0100 |
commit | e4e5e68f0dbec85bb28157e094a95ef33440a2ba (patch) | |
tree | d00173f96124da9712509234984219c2296ba756 /graphics | |
parent | 35126dba8a22aea3b0235ffbe5ae9df2ad248f7b (diff) | |
download | scummvm-rg350-e4e5e68f0dbec85bb28157e094a95ef33440a2ba.tar.gz scummvm-rg350-e4e5e68f0dbec85bb28157e094a95ef33440a2ba.tar.bz2 scummvm-rg350-e4e5e68f0dbec85bb28157e094a95ef33440a2ba.zip |
KYRA: implement SJIS features required for EOB II FM-Towns
- low res font drawing for intro and outro texts
- fat print mode for ingame texts
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/sjis.cpp | 37 | ||||
-rw-r--r-- | graphics/sjis.h | 14 |
2 files changed, 45 insertions, 6 deletions
diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index 877f314c69..0c65492ece 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -71,7 +71,7 @@ void FontSJIS::drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32 } FontSJISBase::FontSJISBase() - : _drawMode(kDefaultMode), _flippedMode(false), _fontWidth(16), _fontHeight(16), _bitPosNewLineMask(0) { +: _drawMode(kDefaultMode), _flippedMode(false), _fatPrint(false), _fontWidth(16), _fontHeight(16), _bitPosNewLineMask(0) { } void FontSJISBase::setDrawingMode(DrawingMode mode) { @@ -88,6 +88,13 @@ void FontSJISBase::toggleFlippedMode(bool enable) { warning("Flipped mode unsupported by this font"); } +void FontSJISBase::toggleFatPrint(bool enable) { + if (hasFeature(kFeatFatPrint)) + _fatPrint = enable; + else + warning("Fat print unsupported by this font"); +} + uint FontSJISBase::getFontHeight() const { switch (_drawMode) { case kOutlineMode: @@ -207,6 +214,25 @@ const uint8 *FontSJISBase::flipCharacter(const uint8 *glyph, const int w) const } #endif +const uint8 *FontSJISBase::makeFatCharacter(const uint8 *glyph, const int w) const { + // This is the EOB II FM-Towns implementation. + // The last bit to the right of each line is cut off so that the fat + // character actually has the same width as it would normally have. + if (w == 8) { + for (int i = 0; i < 16; ++i) { + _tempGlyph2[i] = *glyph | (*glyph >> 1); + glyph++; + } + } else { + for (int i = 0; i < 16; ++i) { + uint16 l = READ_BE_UINT16(glyph); + WRITE_BE_UINT16(&_tempGlyph2[i << 1], l | (l >> 1)); + glyph += 2; + } + } + return _tempGlyph2; +} + void FontSJISBase::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2, int maxW, int maxH) const { const uint8 *glyphSource = 0; int width = 0, height = 0; @@ -243,11 +269,14 @@ void FontSJISBase::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, return; } + if (_fatPrint) + glyphSource = makeFatCharacter(glyphSource, width); + #ifndef DISABLE_FLIPPED_MODE if (_flippedMode) glyphSource = flipCharacter(glyphSource, width); #endif - + uint8 outline[18 * 18]; if (_drawMode == kOutlineMode) { memset(outline, 0, sizeof(outline)); @@ -409,7 +438,7 @@ const uint8 *FontTowns::getCharData(uint16 ch) const { } bool FontTowns::hasFeature(int feat) const { - static const int features = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow | kFeatFlipped; + static const int features = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow | kFeatFlipped | kFeatFatPrint; return (features & feat) ? true : false; } @@ -577,7 +606,7 @@ bool FontSjisSVM::hasFeature(int feat) const { // Flipped mode is not supported since the hard coded table (taken from SCUMM 5 FM-TOWNS) // is set up for font sizes of 8/16. This mode is also not required at the moment, since // there aren't any SCUMM 5 PC-Engine games. - static const int features16 = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow | kFeatFlipped; + static const int features16 = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow | kFeatFlipped | kFeatFatPrint; static const int features12 = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow; return (((_fontWidth == 12) ? features12 : features16) & feat) ? true : false; } diff --git a/graphics/sjis.h b/graphics/sjis.h index 4c5b2797c5..2872471d24 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -91,6 +91,11 @@ public: virtual void setDrawingMode(DrawingMode mode) {} /** + * Enable fat character drawing if supported by the Font (used in EOB II FM-Towns). + */ + virtual void toggleFatPrint(bool enable) {} + + /** * Enable flipped character drawing if supported by the Font (e.g. in the MI1 circus scene after Guybrush gets shot out of the cannon). */ virtual void toggleFlippedMode(bool enable) {} @@ -147,6 +152,8 @@ public: virtual void toggleFlippedMode(bool enable); + virtual void toggleFatPrint(bool enable); + virtual uint getFontHeight() const; virtual uint getMaxFontWidth() const; @@ -165,9 +172,11 @@ private: const uint8 *flipCharacter(const uint8 *glyph, const int w) const; mutable uint8 _tempGlyph[32]; #endif + const uint8 *makeFatCharacter(const uint8 *glyph, const int w) const; + mutable uint8 _tempGlyph2[32]; protected: DrawingMode _drawMode; - bool _flippedMode; + bool _flippedMode, _fatPrint; int _fontWidth, _fontHeight; uint8 _bitPosNewLineMask; @@ -180,7 +189,8 @@ protected: kFeatOutline = 1 << 1, kFeatShadow = 1 << 2, kFeatFMTownsShadow = 1 << 3, - kFeatFlipped = 1 << 4 + kFeatFlipped = 1 << 4, + kFeatFatPrint = 1 << 5 }; virtual bool hasFeature(int feat) const = 0; |