22 #ifndef SCUMM_CHARSET_H 23 #define SCUMM_CHARSET_H 25 #include "common/scummsys.h" 26 #include "common/rect.h" 27 #include "graphics/sjis.h" 28 #include "scumm/charset_v7.h" 29 #include "scumm/scumm.h" 30 #include "scumm/gfx.h" 42 static inline bool checkKSCode(byte hi, byte lo) {
45 if ((0xA1 > lo) || (0xFE < lo)) {
48 if ((hi >= 0xB0) && (hi <= 0xC8)) {
54 static inline bool checkSJISCode(byte c) {
55 if ((c >= 0x80 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfd))
61 if (lang == Common::JA_JPN)
62 return (c >= 0x80 && c <= 0x9F) || (c >= 0xE0 && c <= 0xFD);
63 else if (lang == Common::KO_KOR)
64 return (c >= 0xB0 && c <= 0xD0);
65 else if (lang == Common::ZH_TWN || lang == Common::ZH_CHN)
76 int _left, _startLeft;
100 virtual void printChar(
int chr,
bool ignoreCharsetMask) = 0;
103 virtual int getStringWidth(
int arg,
const byte *text);
104 void addLinebreaks(
int a, byte *str,
int pos,
int maxwidth);
105 void translateColor();
107 virtual void setCurID(int32
id) = 0;
108 int getCurID() {
return _curId; }
110 virtual int getFontHeight()
const = 0;
111 virtual int getCharHeight(uint16 chr)
const {
return getFontHeight(); }
112 virtual int getCharWidth(uint16 chr)
const = 0;
114 virtual void setColor(byte color,
bool shadowModeSpecialFlag =
false) { _color = color; translateColor(); }
115 virtual byte getColor() {
return _color; }
125 kHorizontalShadowType,
131 void setCurID(int32
id)
override;
133 int getFontHeight()
const override;
136 const byte *_fontPtr;
142 ShadowType _shadowType;
150 virtual void setShadowMode(ShadowType mode);
151 virtual void drawBits1(
Graphics::Surface &dest,
int x,
int y,
const byte *src,
int drawTop,
int width,
int height);
152 void drawBits1Kor(
Graphics::Surface &dest,
int x1,
int y1,
const byte *src,
int drawTop,
int width,
int height);
157 virtual void drawBitsN(
const Graphics::Surface &s, byte *dst,
const byte *src, byte bpp,
int drawTop,
int width,
int height);
158 void printCharIntern(
bool is2byte,
const byte *charPtr,
int origWidth,
int origHeight,
int width,
int height,
VirtScreen *vs,
bool ignoreCharsetMask);
159 virtual bool prepareDraw(uint16 chr);
161 int _width, _height, _origWidth, _origHeight;
164 const byte *_charPtr;
171 _cjkSpacing(cjkSpacing), _offsX(0), _offsY(0), _charPtr(
nullptr), _drawScreen(kMainVirtScreen) {}
173 (vm->_game.
platform == Common::kPlatformMacintosh || vm->_game.
platform == Common::kPlatformDOS) &&
174 vm->_language == Common::JA_JPN ? -3 : 0) {}
176 void printChar(
int chr,
bool ignoreCharsetMask)
override;
179 int getCharWidth(uint16 chr)
const override;
183 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE 188 int getCharWidth(uint16 chr)
const override;
189 int getFontHeight()
const override;
192 void drawBitsN(
const Graphics::Surface &s, byte *dst,
const byte *src, byte bpp,
int drawTop,
int width,
int height)
override;
193 bool prepareDraw(uint16 chr)
override;
194 void setupShadowMode();
195 bool useFontRomCharacter(uint16 chr)
const;
196 void processCharsetColors();
207 void drawBits1(
Graphics::Surface &dest,
int x,
int y,
const byte *src,
int drawTop,
int width,
int height);
212 void setCurID(int32
id)
override {}
213 void printChar(
int chr,
bool ignoreCharsetMask)
override;
216 int getFontHeight()
const override {
return 8; }
217 int getCharWidth(uint16 chr)
const override {
return 8; }
222 virtual int getDrawWidthIntern(uint16 chr);
223 virtual int getDrawHeightIntern(uint16 chr);
224 virtual void setDrawCharIntern(uint16 chr) {}
226 const byte *_widthTable;
231 void printChar(
int chr,
bool ignoreCharsetMask)
override;
233 void setCurID(int32
id)
override;
234 void setColor(byte color,
bool shadowModeSpecialFlag)
override;
235 int getCharWidth(uint16 chr)
const override;
242 int getCharWidth(uint16 chr)
const override;
243 int getFontHeight()
const override;
246 void setShadowMode(ShadowType mode)
override;
247 void drawBits1(
Graphics::Surface &dest,
int x,
int y,
const byte *src,
int drawTop,
int width,
int height)
override;
248 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE 249 int getDrawWidthIntern(uint16 chr)
override;
250 int getDrawHeightIntern(uint16 chr)
override;
251 void setDrawCharIntern(uint16 chr)
override;
259 void drawBits1(
Graphics::Surface &dest,
int x,
int y,
const byte *src,
int drawTop,
int width,
int height)
override;
261 int getDrawWidthIntern(uint16 chr)
override;
262 int getDrawHeightIntern(uint16 chr)
override;
263 void setDrawCharIntern(uint16 chr)
override;
270 void setColor(byte color,
bool)
override;
282 void setCurID(int32
id)
override {}
283 int getCharWidth(uint16 chr)
const override {
return 8; }
289 bool _useCorrectFontSpacing;
293 int getDrawWidthIntern(uint16 chr)
const;
294 void printCharInternal(
int chr,
int color,
bool shadow,
int x,
int y);
297 byte getTextShadowColor();
305 void setCurID(int32
id)
override;
307 int getStringWidth(
int arg,
const byte *text)
override;
308 int getFontHeight()
const override;
309 int getCharWidth(uint16 chr)
const override;
310 void printChar(
int chr,
bool ignoreCharsetMask)
override;
311 void setColor(byte color,
bool)
override;
314 #ifdef ENABLE_SCUMM_7_8 318 ~CharsetRendererV7()
override {};
320 void printChar(
int,
bool)
override {
error(
"CharsetRendererV7::printChar(): Unexpected call to deprecated function"); }
322 int draw2byte(byte *buffer,
Common::Rect &clipRect,
int x,
int y,
int pitch, int16 col, uint16 chr)
override;
323 int drawCharV7(byte *buffer,
Common::Rect &clipRect,
int x,
int y,
int pitch, int16 col, TextStyleFlags flags, byte chr)
override;
324 int getCharWidth(uint16 chr)
const override;
325 int getCharHeight(uint16 chr)
const override {
return ((chr & 0x80) && _vm->_useCJKMode) ? _vm->_2byteHeight : _fontHeight; }
326 int getFontHeight()
const override {
return _fontHeight; }
327 int setFont(
int)
override {
return 0; }
328 bool newStyleWrapping()
const override {
return _newStyle; }
330 const bool _newStyle;
331 const int _direction;
334 class CharsetRendererNut :
public CharsetRenderer,
public GlyphRenderer_v7 {
337 ~CharsetRendererNut()
override;
339 void printChar(
int,
bool)
override {
error(
"CharsetRendererNut::printChar(): Unexpected call to deprecated function"); }
341 void setCurID(int32
id)
override;
342 int setFont(
int id)
override;
343 bool newStyleWrapping()
const override {
return true; }
345 int draw2byte(byte *buffer,
Common::Rect &clipRect,
int x,
int y,
int pitch, int16 col, uint16 chr)
override;
346 int drawCharV7(byte *buffer,
Common::Rect &clipRect,
int x,
int y,
int pitch, int16 col, TextStyleFlags flags, byte chr)
override;
348 int getFontHeight()
const override;
349 int getCharWidth(uint16 chr)
const override;
350 int getCharHeight(uint16 chr)
const override;
354 NutRenderer *_current;
VirtScreenNumber
Definition: gfx.h:161
Definition: charset.h:145
byte id
Definition: detection.h:75
Common::Platform platform
Definition: detection.h:97
Definition: charset.h:286
Definition: serializer.h:79
Definition: charset.h:274
Definition: formatinfo.h:28
Definition: charset.h:120
Definition: charset.h:155
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: charset.h:238
Definition: charset.h:203
Definition: charset.h:220
Language
Definition: language.h:45