diff options
author | athrxx | 2019-11-26 22:07:32 +0100 |
---|---|---|
committer | athrxx | 2019-12-18 20:50:44 +0100 |
commit | 5a1162e99929d4a4d6351f91b8527fc0f205ad0f (patch) | |
tree | 1c4783b434cf9f4dbd1d26342b9f675ac26ab852 /engines/kyra/graphics/screen_eob.h | |
parent | 1f42999a7cd3b35df4f5611cf27c7d98974e8673 (diff) | |
download | scummvm-rg350-5a1162e99929d4a4d6351f91b8527fc0f205ad0f.tar.gz scummvm-rg350-5a1162e99929d4a4d6351f91b8527fc0f205ad0f.tar.bz2 scummvm-rg350-5a1162e99929d4a4d6351f91b8527fc0f205ad0f.zip |
KYRA: (EOB/PC98) - fix Japanese text display
Diffstat (limited to 'engines/kyra/graphics/screen_eob.h')
-rw-r--r-- | engines/kyra/graphics/screen_eob.h | 150 |
1 files changed, 149 insertions, 1 deletions
diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h index 6d39ffe809..9c6e17caad 100644 --- a/engines/kyra/graphics/screen_eob.h +++ b/engines/kyra/graphics/screen_eob.h @@ -155,7 +155,155 @@ private: }; /** -* SJIS Font variant used in the intro and outro of EOB II FM-Towns. It appears twice as large, since it is not rendered on the hires overlay pages +* Implementation of the Font interface for old DOS fonts used +* in EOB and EOB II. +* +*/ +class OldDOSFont : public Font { +public: + OldDOSFont(Common::RenderMode mode, uint8 shadowColor); + virtual ~OldDOSFont(); + + virtual bool load(Common::SeekableReadStream &file); + int getHeight() const { return _height; } + int getWidth() const { return _width; } + int getCharWidth(uint16 c) const; + void setColorMap(const uint8 *src); + void set16bitColorMap(const uint16 *src) { _colorMap16bit = src; } + virtual void setStyle(FontStyle style) { _style = style; } + void drawChar(uint16 c, byte *dst, int pitch, int bpp) const; + +protected: + void unload(); + + FontStyle _style; + const uint8 *_colorMap8bit; + uint8 *_data; + uint16 *_bitmapOffsets; + int _width, _height; + int _numGlyphs; + uint8 _shadowColor; + +private: + void drawCharIntern(uint16 c, byte *dst, int pitch, int bpp, int col1, int col2) const; + virtual uint16 convert(uint16 c) const; + Common::RenderMode _renderMode; + const uint16 *_colorMap16bit; + + static uint16 *_cgaDitheringTable; + static int _numRef; +}; + +/** + * Implementation of the Font interface for native AmigaDOS system fonts (normally to be loaded via diskfont.library) + */ +class Resource; +class AmigaDOSFont : public Font { +public: + AmigaDOSFont(Resource *res, bool needsLocalizedFont = false); + ~AmigaDOSFont() { unload(); } + + bool load(Common::SeekableReadStream &file); + int getHeight() const { return _height; } + int getWidth() const { return _width; } + int getCharWidth(uint16 c) const; + void setColorMap(const uint8 *src) { _colorMap = src; } + void drawChar(uint16 c, byte *dst, int pitch, int) const; + + static void errorDialog(int index); + +private: + void unload(); + + struct TextFont { + TextFont() : data(0), bitmap(0), location(0), spacing(0), kerning(0), height(0), width(0), baseLine(0), firstChar(0), lastChar(0), modulo(0) {} + ~TextFont() { + delete[] data; + } + + uint16 height; + uint16 width; + uint16 baseLine; + uint8 firstChar; + uint8 lastChar; + uint16 modulo; + const uint8 *data; + const uint8 *bitmap; + const uint16 *location; + const int16 *spacing; + const int16 *kerning; + }; + + TextFont *loadContentFile(const Common::String fileName); + void selectMode(int mode); + + struct FontContent { + FontContent() : height(0), style(0), flags(0) {} + ~FontContent() { + data.reset(); + } + + Common::String contentFile; + Common::SharedPtr<TextFont> data; + uint16 height; + uint8 style; + uint8 flags; + }; + + int _width, _height; + uint8 _first, _last; + FontContent *_content; + uint16 _numElements; + uint16 _selectedElement; + + const uint8 *_colorMap; + const uint16 _maxPathLen; + const bool _needsLocalizedFont; + + static uint8 _errorDialogDisplayed; + + Resource *_res; +}; + +/** +* SJIS Font variant used in EOB I PC-98. It converts 1-byte characters into 2-byte characters and has a specific shadowing to the left. +*/ +class SJISFontEoB1PC98 : public SJISFont { +public: + SJISFontEoB1PC98(Common::SharedPtr<Graphics::FontSJIS> &font, uint8 shadowColor, const uint16 *convTable1, const uint16 *convTable2); + virtual ~SJISFontEoB1PC98() {} + virtual int getCharWidth(uint16 c) const; + virtual void drawChar(uint16 c, byte *dst, int pitch, int) const; + +private: + uint16 convert(uint16 c) const; + const uint16 *_convTable1, *_convTable2; + bool _defaultConv; + uint8 _shadowColor; +}; + +/** +* OldDOSFont variant used in EOB I PC-98. It uses the same drawing routine, but has a different loader. It contains +* ASCII and Katakana characters and requires several conversion tables to display these. It gets drawn on the SJIS overlay. +*/ +class Font12x12PC98 : public OldDOSFont{ +public: + Font12x12PC98(uint8 shadowColor, const uint16 *convTable1, const uint16 *convTable2, const uint8 *lookupTable); + virtual ~Font12x12PC98(); + bool usesOverlay() const { return true; } + int getHeight() const { return _height >> 1; } + int getWidth() const { return _width >> 1; } + int getCharWidth(uint16 c) const { return _width >> 1; }; + virtual bool load(Common::SeekableReadStream &file); + +private: + virtual uint16 convert(uint16 c) const; + const uint16 *_convTable1, *_convTable2; + uint16 *_bmpOffs; +}; + +/** +* SJIS Font variant used in the intro and outro of EOB II FM-Towns. It appears twice as large, since it is not rendered on the hires overlay pages. */ class SJISFontLarge : public SJISFont { public: |