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; }
129 kHorizontalShadowType,
135 void setCurID(int32
id)
override;
137 int getFontHeight()
const override;
140 const byte *_fontPtr;
146 ShadowType _shadowType;
154 virtual void setShadowMode(ShadowType mode);
155 virtual void drawBits1(
Graphics::Surface &dest,
int x,
int y,
const byte *src,
int drawTop,
int width,
int height);
156 void drawBits1Kor(
Graphics::Surface &dest,
int x1,
int y1,
const byte *src,
int drawTop,
int width,
int height);
161 virtual void drawBitsN(
const Graphics::Surface &s, byte *dst,
const byte *src, byte bpp,
int drawTop,
int width,
int height);
162 void printCharIntern(
bool is2byte,
const byte *charPtr,
int origWidth,
int origHeight,
int width,
int height,
VirtScreen *vs,
bool ignoreCharsetMask);
163 virtual bool prepareDraw(uint16 chr);
165 int _width, _height, _origWidth, _origHeight;
168 const byte *_charPtr;
175 _cjkSpacing(cjkSpacing), _offsX(0), _offsY(0), _charPtr(
nullptr), _drawScreen(kMainVirtScreen) {}
177 (vm->_game.
platform == Common::kPlatformMacintosh || vm->_game.
platform == Common::kPlatformDOS) &&
178 vm->_language == Common::JA_JPN ? -3 : 0) {}
180 void printChar(
int chr,
bool ignoreCharsetMask)
override;
183 int getCharWidth(uint16 chr)
const override;
187 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE 192 int getCharWidth(uint16 chr)
const override;
193 int getFontHeight()
const override;
196 void drawBitsN(
const Graphics::Surface &s, byte *dst,
const byte *src, byte bpp,
int drawTop,
int width,
int height)
override;
197 bool prepareDraw(uint16 chr)
override;
198 void setupShadowMode();
199 bool useFontRomCharacter(uint16 chr)
const;
200 void processCharsetColors();
209 byte *_trTable =
nullptr;
211 void drawBits1(
Graphics::Surface &dest,
int x,
int y,
const byte *src,
int drawTop,
int width,
int height);
216 void setCurID(int32
id)
override {}
217 void printChar(
int chr,
bool ignoreCharsetMask)
override;
220 int getFontHeight()
const override {
return 8; }
221 int getCharWidth(uint16 chr)
const override {
return 8; }
226 virtual int getDrawWidthIntern(uint16 chr);
227 virtual int getDrawHeightIntern(uint16 chr);
228 virtual void setDrawCharIntern(uint16 chr) {}
230 const byte *_widthTable =
nullptr;
235 void printChar(
int chr,
bool ignoreCharsetMask)
override;
237 void setCurID(int32
id)
override;
238 void setColor(byte color,
bool shadowModeSpecialFlag)
override;
239 int getCharWidth(uint16 chr)
const override;
246 int getCharWidth(uint16 chr)
const override;
247 int getFontHeight()
const override;
250 void setShadowMode(ShadowType mode)
override;
251 void drawBits1(
Graphics::Surface &dest,
int x,
int y,
const byte *src,
int drawTop,
int width,
int height)
override;
252 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE 253 int getDrawWidthIntern(uint16 chr)
override;
254 int getDrawHeightIntern(uint16 chr)
override;
255 void setDrawCharIntern(uint16 chr)
override;
263 void drawBits1(
Graphics::Surface &dest,
int x,
int y,
const byte *src,
int drawTop,
int width,
int height)
override;
265 int getDrawWidthIntern(uint16 chr)
override;
266 int getDrawHeightIntern(uint16 chr)
override;
267 void setDrawCharIntern(uint16 chr)
override;
274 void setColor(byte color,
bool)
override;
286 void setCurID(int32
id)
override {}
287 int getCharWidth(uint16 chr)
const override {
return 8; }
297 bool _useCorrectFontSpacing;
301 int getDrawWidthIntern(uint16 chr)
const;
302 void printCharInternal(
int chr,
int color,
bool shadow,
int x,
int y);
305 byte getTextShadowColor();
313 void setCurID(int32
id)
override;
315 int getStringWidth(
int arg,
const byte *text)
override;
316 int getFontHeight()
const override;
317 int getCharWidth(uint16 chr)
const override;
318 void printChar(
int chr,
bool ignoreCharsetMask)
override;
319 void setColor(byte color,
bool)
override;
322 #ifdef ENABLE_SCUMM_7_8 326 ~CharsetRendererV7()
override {};
328 void printChar(
int,
bool)
override {
error(
"CharsetRendererV7::printChar(): Unexpected call to deprecated function"); }
330 int draw2byte(byte *buffer,
Common::Rect &clipRect,
int x,
int y,
int pitch, int16 col, uint16 chr)
override;
331 int drawCharV7(byte *buffer,
Common::Rect &clipRect,
int x,
int y,
int pitch, int16 col, TextStyleFlags flags, byte chr)
override;
332 int getCharWidth(uint16 chr)
const override;
333 int getCharHeight(uint16 chr)
const override {
return ((chr & 0x80) && _vm->_useCJKMode) ? _vm->_2byteHeight : _fontHeight; }
334 int getFontHeight()
const override {
return _fontHeight; }
335 int setFont(
int)
override {
return 0; }
336 bool newStyleWrapping()
const override {
return _newStyle; }
338 const bool _newStyle;
339 const int _direction;
342 class CharsetRendererNut :
public CharsetRenderer,
public GlyphRenderer_v7 {
345 ~CharsetRendererNut()
override;
347 void printChar(
int,
bool)
override {
error(
"CharsetRendererNut::printChar(): Unexpected call to deprecated function"); }
349 void setCurID(int32
id)
override;
350 int setFont(
int id)
override;
351 bool newStyleWrapping()
const override {
return true; }
353 int draw2byte(byte *buffer,
Common::Rect &clipRect,
int x,
int y,
int pitch, int16 col, uint16 chr)
override;
354 int drawCharV7(byte *buffer,
Common::Rect &clipRect,
int x,
int y,
int pitch, int16 col, TextStyleFlags flags, byte chr)
override;
356 int getFontHeight()
const override;
357 int getCharWidth(uint16 chr)
const override;
358 int getCharHeight(uint16 chr)
const override;
362 NutRenderer *_current;
VirtScreenNumber
Definition: gfx.h:161
Definition: charset.h:149
byte id
Definition: detection.h:77
Common::Platform platform
Definition: detection.h:99
Definition: charset.h:294
Definition: serializer.h:79
Definition: charset.h:278
Definition: formatinfo.h:28
Definition: charset.h:124
Definition: charset.h:159
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: charset.h:242
Definition: charset.h:207
Definition: charset.h:224
Language
Definition: language.h:45