diff options
author | Travis Howell | 2009-07-07 23:24:34 +0000 |
---|---|---|
committer | Travis Howell | 2009-07-07 23:24:34 +0000 |
commit | 3e47aaa151ff751af867c57344b063c30f5f75f3 (patch) | |
tree | 84101b9c9d7eb333063c43a076ae3645a95ab703 /graphics/sjis.h | |
parent | bd87b653aca29c593cadcdedfc2208cec51456aa (diff) | |
parent | a62b26ea8026666fd658337bcc061c1c4e2ab3f9 (diff) | |
download | scummvm-rg350-3e47aaa151ff751af867c57344b063c30f5f75f3.tar.gz scummvm-rg350-3e47aaa151ff751af867c57344b063c30f5f75f3.tar.bz2 scummvm-rg350-3e47aaa151ff751af867c57344b063c30f5f75f3.zip |
Merged revisions 42205-42206,42208-42209,42211-42212,42214-42217,42219,42221-42222,42229-42235,42238-42240 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
........
r42205 | dreammaster | 2009-07-07 17:41:02 +1000 (Tue, 07 Jul 2009) | 1 line
Removed the shooting workaround delay - the overlay number can vary, so it isn't a reliable way of identifying the specific message
........
r42206 | thebluegr | 2009-07-07 17:44:25 +1000 (Tue, 07 Jul 2009) | 4 lines
- Added auto-detection for EGA graphics. As a result of this, GF_SCI1_EGA has been removed and versions SCI_VERSION_01_EGA and SCI_VERSION_01_VGA have been merged into SCI_VERSION_01
- Simplified the checks for EGA and VGA graphics
- Fixed a bug in script_adjust_opcode_formats()
- Simplified the code in GfxResManager::getView() a bit
........
r42208 | strangerke | 2009-07-07 17:51:18 +1000 (Tue, 07 Jul 2009) | 1 line
Add detection of Playtoons 2 En
........
r42209 | thebluegr | 2009-07-07 17:51:26 +1000 (Tue, 07 Jul 2009) | 1 line
Added a SCI1.1 case in the lofss opcode, like in the lofsa opcode (essentially, lofss and lofsa both load an offset, with lofsa loading it in the accumulator and lofss in the stack). lofss is rarely used in SCI1.1 games, which explains why no lofss-related crashes have been observed in SCI1.1
........
r42211 | thebluegr | 2009-07-07 20:28:05 +1000 (Tue, 07 Jul 2009) | 1 line
Added auto-detection for games with older headers for script blocks, and removed game flag GF_SCI0_OLD
........
r42212 | thebluegr | 2009-07-07 21:14:18 +1000 (Tue, 07 Jul 2009) | 1 line
Cleanup: added an enum for the auto-detected features, removed the selectors which are only used for auto-detection from the convenience selector map and placed feature auto-detection in a separate function. Also, now the automatically detected graphics resources are shown in the console.
........
r42214 | strangerke | 2009-07-07 21:58:22 +1000 (Tue, 07 Jul 2009) | 2 lines
- Separate Playtoons gametypes from in GobEngine::initGameParts()
- Add a specific save/load class for Playtoons as some specific files need to be tested
........
r42215 | strangerke | 2009-07-07 22:03:27 +1000 (Tue, 07 Jul 2009) | 3 lines
- Add a new gametype for 'The Land of the Magic Stones'
- Add detection of the french version
- Add a new game feature for 800*600
........
r42216 | thebluegr | 2009-07-07 22:29:55 +1000 (Tue, 07 Jul 2009) | 1 line
Removed the superfluous sci_version_types array (it's essentially the same as the versionNames array)
........
r42217 | strangerke | 2009-07-07 22:51:21 +1000 (Tue, 07 Jul 2009) | 1 line
Change SaveLoad_Playtoons case
........
r42219 | thebluegr | 2009-07-07 23:39:24 +1000 (Tue, 07 Jul 2009) | 1 line
Removed the weird checks for a maximum resource number (the sci_max_resource_nr array), as it doesn't serve any real purpose and leads to strange errors: if a resource is found which is bigger than the maximum number, it will be remapped to an incorrect number from this check. This makes KQ5CD work properly again (resources would be remapped to incorrect resource numbers from this code as a result of not updating this array with the latest SCI version merges).
........
r42221 | lordhoto | 2009-07-08 00:22:23 +1000 (Wed, 08 Jul 2009) | 1 line
Add generic functionallity to draw FM-Towns ROM. (To be used by KYRA and SCI)
........
r42222 | lordhoto | 2009-07-08 00:22:39 +1000 (Wed, 08 Jul 2009) | 1 line
Adapt KYRA to use the new Graphics::FontSJIS code.
........
r42229 | sev | 2009-07-08 03:11:29 +1000 (Wed, 08 Jul 2009) | 2 lines
kFeatures800 -> kFeatures800x600 in order to have more meaningful name
........
r42230 | lordhoto | 2009-07-08 04:10:35 +1000 (Wed, 08 Jul 2009) | 2 lines
- Added support for outlined FM-Towns ROM drawing
- Adapted KYRA to use that
........
r42231 | lordhoto | 2009-07-08 04:17:30 +1000 (Wed, 08 Jul 2009) | 2 lines
- Rename FontSJIS::enableShadow to enableOutline.
- Initialize outline to false by default in FontTowns.
........
r42232 | lordhoto | 2009-07-08 05:00:39 +1000 (Wed, 08 Jul 2009) | 1 line
Change "FM-Towns" to "FM-TOWNS" for consistency.
........
r42233 | lordhoto | 2009-07-08 05:00:51 +1000 (Wed, 08 Jul 2009) | 1 line
Add guards to only include SJIS font code, when KYRA or SCI is enabled.
........
r42234 | lordhoto | 2009-07-08 05:18:32 +1000 (Wed, 08 Jul 2009) | 1 line
Simply compile guard of SJIS code and fix comment.
........
r42235 | lordhoto | 2009-07-08 05:18:53 +1000 (Wed, 08 Jul 2009) | 1 line
Change all uses of FM-Towns/fm-towns to FM-TOWNS.
........
r42238 | thebluegr | 2009-07-08 06:01:15 +1000 (Wed, 08 Jul 2009) | 1 line
Added a workaround for incorrect font references in LSL1VGA (which was the original purpose of the code removed in rev. 42219)
........
r42239 | thebluegr | 2009-07-08 06:17:07 +1000 (Wed, 08 Jul 2009) | 1 line
Improved the LSL1VGA workaround after talking with waltervn
........
r42240 | thebluegr | 2009-07-08 06:43:27 +1000 (Wed, 08 Jul 2009) | 1 line
Silenced the very chatty song iterator console messages by converting them to appropriate debug messages
........
svn-id: r42248
Diffstat (limited to 'graphics/sjis.h')
-rw-r--r-- | graphics/sjis.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/graphics/sjis.h b/graphics/sjis.h new file mode 100644 index 0000000000..f7321742af --- /dev/null +++ b/graphics/sjis.h @@ -0,0 +1,135 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +// The code in this file is currently only used in KYRA and SCI. +// So if neither of those is enabled, we will skip compiling it. +// If you plan to use this code in another engine, you will have +// to add the proper define check here. +// Also please add the define check at the comment after the +// matching #endif further down this file. +#if defined(ENABLE_KYRA) || defined(ENABLE_SCI) + +#ifndef GRAPHICS_SJIS_H +#define GRAPHICS_SJIS_H + +#include "common/scummsys.h" +#include "common/stream.h" + +#include "graphics/surface.h" + +namespace Graphics { + +/** + * A font that is able to draw SJIS encoded characters. + * + * The font is always monospaced. + */ +class FontSJIS { +public: + virtual ~FontSJIS() {} + + /** + * Enable outline drawing. + * + * After changing outline state, getFontHeight and getFontWidth might return + * different values! + */ + virtual void enableOutline(bool enable) {} + + /** + * Returns the height of the font. + */ + virtual uint getFontHeight() const = 0; + + /** + * Returns the width of the font. + */ + virtual uint getFontWidth() const = 0; + + /** + * Draws a SJIS encoded character on the given surface. + */ + void drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32 c1, uint32 c2) const { + drawChar(dst.getBasePtr(x, y), ch, c1, c2, dst.pitch, dst.bytesPerPixel); + } + + /** + * Draws a SJIS char on the given raw buffer. + * + * @param dst pointer to the destination + * @param ch character to draw + * @param pitch pitch of the destination buffer (size in *bytes*) + * @param bpp bytes per pixel of the destination buffer + * @param c1 forground color + * @param c2 outline color + */ + virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const = 0; +}; + +/** + * FM-TOWNS ROM based SJIS compatible font. + * + * This is used in KYRA and SCI. + */ +class FontTowns : public FontSJIS { +public: + FontTowns() : _outlineEnabled(false) {} + + /** + * Loads the ROM data from the given read stream. + */ + bool loadFromStream(Common::ReadStream &stream); + + void enableOutline(bool enable) { _outlineEnabled = enable; } + + uint getFontHeight() const { return _outlineEnabled ? 18 : 16; } + uint getFontWidth() const { return _outlineEnabled ? 18 : 16; } + + void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const; + +private: + template<typename Color> + void drawCharInternOutline(const uint16 *glyph, uint8 *dst, int pitch, Color c1, Color c2) const; + + template<typename Color> + void drawCharIntern(const uint16 *glyph, uint8 *dst, int pitch, Color c1) const; + + enum { + kFontRomSize = 262144 + }; + + bool _outlineEnabled; + uint16 _fontData[kFontRomSize / 2]; + + static uint sjisToChunk(uint8 low, uint8 high); +}; + +// TODO: Consider adding support for PC98 ROM + +} // end of namespace Graphics + +#endif + +#endif // defined(ENABLE_KYRA) || defined(ENABLE_SCI) + |