22#ifndef KYRA_SCREEN_EOB_H
23#define KYRA_SCREEN_EOB_H
27#include "graphics/big5.h"
29#include "kyra/graphics/screen.h"
36class Screen_EoB :
public Screen {
37friend class SegaRenderer;
46 kSegaInitShapesPage = 7,
48 kDefeatMsgBackupPage = 10,
49 kCheckPwBackupPage = 10,
50 kSpellbookBackupPage = 10,
51 kEoB2ScriptHelperPage = 12,
52 kCampMenuBackupPage = 12
56 Screen_EoB(EoBCoreEngine *vm,
OSystem *system);
57 ~Screen_EoB()
override;
61 void setClearScreenDim(
int dim);
63 void clearCurDimOvl(
int pageNum);
65 void setMouseCursor(
int x,
int y,
const byte *shape)
override;
66 void setMouseCursor(
int x,
int y,
const byte *shape,
const uint8 *ovl);
70 void printShadedText(
const char *
string,
int x,
int y,
int col1,
int col2,
int shadowCol,
int pitch = -1);
74 void loadBitmap(
const char *filename,
int tempPage,
int dstPage,
Palette *pal,
bool skip =
false)
override;
75 void loadEoBBitmap(
const char *file,
const uint8 *cgaMapping,
int tempPage,
int destPage,
int convertToPage);
76 void loadShapeSetBitmap(
const char *file,
int tempPage,
int destPage);
78 void convertPage(
int srcPage,
int dstPage,
const uint8 *cgaMapping);
80 void setScreenPalette(
const Palette &pal)
override;
81 void getRealPalette(
int num, uint8 *dst)
override;
83 uint8 *encodeShape(uint16 x, uint16 y, uint16 w, uint16 h,
bool encode8bit =
false,
const uint8 *cgaMapping = 0);
84 void drawShape(uint8 pageNum,
const uint8 *shapeData,
int x,
int y,
int sd = -1,
int flags = 0, ...)
override;
85 void drawT1Shape(uint8 pageNum,
const byte *t1data,
int x,
int y,
int sd);
86 const uint8 *scaleShape(
const uint8 *shapeData,
int blockDistance);
87 const uint8 *scaleShapeStep(
const uint8 *shp);
88 const uint8 *generateShapeOverlay(
const uint8 *shp,
const uint8 *fadingTable);
90 void setShapeFrame(
int x1,
int y1,
int x2,
int y2);
91 void enableShapeBackgroundFading(
bool enable);
92 void setShapeFadingLevel(
int val);
94 void setGfxParameters(
int x,
int y,
int col);
95 void drawExplosion(
int scale,
int radius,
int numElements,
int stepSize,
int aspectRatio,
const uint8 *colorTable,
int colorTableSize);
96 void drawVortex(
int numElements,
int radius,
int stepSize,
int,
int disorder,
const uint8 *colorTable,
int colorTableSize);
98 void fadeTextColor(
Palette *pal,
int color,
int rate);
99 bool delayedFadePalStep(
Palette *fadePal,
Palette *destPal,
int rate);
101 void setTextColorMap(
const uint8 *cmap)
override {}
102 int getRectSize(
int w,
int h)
override;
104 void setFadeTable(
const uint8 *table);
105 void createColorFadeTable(
const uint8 *palData, uint8 *dst, uint8 rootColor, uint8 weight);
106 void createHiColorFadeTable(
const uint16 *palData,
void *dst, uint8 rootColor, uint8 weight);
108 const uint16 *getCGADitheringTable(
int index)
const;
109 const uint8 *getEGADitheringTable()
const;
110 int bytesPerPixel()
const;
112 bool loadFont(FontId fontId,
const char *filename)
override;
115 void decodeSHP(
const uint8 *data,
int dstPage);
116 void convertToHiColor(
int page);
117 void shadeRect(
int x1,
int y1,
int x2,
int y2,
int shadingLevel);
120 void selectPC98Palette(
int palID,
Palette &dest,
int brightness = 0,
bool set =
false);
121 void decodeBIN(
const uint8 *src, uint8 *dst, uint16 inSize);
122 void decodePC98PlanarBitmap(uint8 *srcDstBuffer, uint8 *tmpBuffer, uint16 size = 64000);
124 struct PalCycleData {
129 void initPC98PaletteCycle(
int palID, PalCycleData *data);
130 void updatePC98PaletteCycle(
int brightness);
132 PalCycleData *_activePalCycle;
133 uint8 *_cyclePalette;
136 void loadSpecialAmigaCPS(
const char *fileName,
int destPage,
bool isGraphics);
143 void sega_initGraphics();
144 void sega_selectPalette(
int srcPalID,
int dstPalID,
bool set =
false);
146 void sega_updatePaletteFaders(
int palID);
147 void sega_fadePalette(
int delay, int16 brEnd,
int dstPalID = -1,
bool waitForCompletion =
true,
bool noUpdate =
false);
148 void sega_fadeToBlack(
int delay) { sega_fadePalette(delay, -7); }
149 void sega_fadeToWhite(
int delay) { sega_fadePalette(delay, 7); }
150 void sega_fadeToNeutral(
int delay) { sega_fadePalette(delay, 0); }
151 void sega_paletteOps(int16 opPal, int16 par1, int16 par2);
152 void sega_setTextBuffer(uint8 *buffer, uint32 bufferSize);
153 void sega_clearTextBuffer(uint8 col);
154 void sega_loadTextBackground(
const uint8 *src, uint16 size);
155 void sega_drawTextBox(
int pW,
int pH,
int x,
int y,
int w,
int h, uint8 color1, uint8 color2);
156 void sega_loadTextBufferToVRAM(uint16 srcOffset, uint16 addr,
int size);
157 void sega_gfxScale(uint8 *out, uint16 w, uint16 h, uint16 pitch,
const uint8 *in,
const uint16 *stampMap,
const uint16 *traceVectors);
158 void sega_drawClippedLine(
int pW,
int pH,
int x,
int y,
int w,
int h, uint8 color);
159 uint8 *sega_convertShape(
const uint8 *src,
int w,
int h,
int pal,
int hOffs = 0);
160 void sega_encodeShapesFromSprites(
const uint8 **dst,
const uint8 *src,
int numShapes,
int w,
int h,
int pal,
bool removeSprites =
true);
162 SegaRenderer *sega_getRenderer()
const {
return _segaRenderer; }
163 SegaAnimator *sega_getAnimator()
const {
return _segaAnimator; }
166 void updateDirtyRects()
override;
167 void ditherRect(
const uint8 *src, uint8 *dst,
int dstPitch,
int srcW,
int srcH,
int colorKey = -1);
169 template<
typename pixelType ,
bool shapeFading>
void drawShapeSetPixel(uint8 *dst, uint8 col);
170 void scaleShapeProcessLine2Bit(uint8 *&shpDst,
const uint8 *&shpSrc, uint32 transOffsetDst, uint32 transOffsetSrc);
171 void scaleShapeProcessLine4Bit(uint8 *&dst,
const uint8 *&src);
172 bool posWithinRect(
int posX,
int posY,
int x1,
int y1,
int x2,
int y2);
174 void setPagePixelHiCol(
int pageNum,
int x,
int y,
int color);
176 void generateEGADitheringTable(
const Palette &pal);
177 void generateCGADitheringTables(
const uint8 *mappingData);
179 typedef void (Screen_EoB::*DrawShapePlotFunc)(uint8*, uint8);
180 DrawShapePlotFunc _drawShapeSetPixel;
182 int _dsDiv, _dsRem, _dsScaleTrans;
183 uint8 *_cgaScaleTable;
186 const uint8 *_gfxMaxY;
188 int16 _dsX1, _dsX2, _dsY1, _dsY2;
190 bool _dsBackgroundFading;
191 int16 _dsBackgroundFadingXOffs;
192 uint8 _shapeOverlay[16];
196 uint8 *_hiColorConvertBuffer;
198 uint16 *_cgaDitheringTables[2];
199 const uint8 *_cgaMappingDefault;
201 uint8 *_egaDitheringTable;
202 uint8 *_egaDitheringTempPage;
206 const uint16 _hiColorCursorColorKey;
208 static const uint8 _egaMatchTable[];
209 static const ScreenDim _screenDimTableIntl[];
210 static const ScreenDim _screenDimTableZH[];
211 static const int _screenDimTableCount;
214 struct PaletteFader {
215 PaletteFader() : _brCur(0), _brDest(0), _fadeIncr(0), _fadeDelay(0), _fadeTimer(0), _needRefresh(false) {}
224 PaletteFader *_palFaders;
225 bool _specialColorReplace;
226 SegaRenderer *_segaRenderer;
227 SegaAnimator *_segaAnimator;
228 uint16 _segaCurPalette[64];
229 uint16 *_segaCustomPalettes;
230 uint8 *_defaultRenderBuffer;
231 int _defaultRenderBufferSize;
236class ChineseTwoByteFontEoB final :
public Font {
240 virtual Type getType()
const override {
return kBIG5; }
243 return _singleByte->load(data);
246 void setStyles(
int styles)
override { _border = (styles & kStyleBorder); _singleByte->setStyles(styles); }
247 int getHeight()
const override {
return MAX(_big5->getFontHeight(), _singleByte->getHeight()); }
248 int getWidth()
const override {
return MAX(_big5->kChineseTraditionalWidth + 2, _singleByte->getWidth()); }
249 void setColorMap(
const uint8 *src)
override { _colorMap = src; _singleByte->setColorMap(src); }
250 int getCharWidth(uint16 c)
const override;
251 int getCharHeight(uint16 c)
const override;
252 void drawChar(uint16 c,
byte *dst,
int pitch,
int bpp)
const override;
255 uint16 translateBig5(uint16 in)
const;
259 const uint8 *_colorMap;
267class OldDOSFont :
public Font {
270 ~OldDOSFont()
override;
273 bool loadPCBIOSTall();
274 Type getType()
const override {
return kASCII; }
275 int getHeight()
const override {
return _height; }
276 int getWidth()
const override {
return _width; }
277 bool usesOverlay()
const override {
return _useOverlay; }
278 int getCharWidth(uint16 c)
const override;
279 void setColorMap(
const uint8 *src)
override;
280 void setHiColorMap(
const uint32 *src)
override { _hiColorMap = src; }
281 void setStyles(
int styles)
override { _style = styles; }
282 void drawChar(uint16 c,
byte *dst,
int pitch,
int bpp)
const override;
288 const uint8 *_colorMap8bit;
290 uint16 *_bitmapOffsets;
295 uint16 _numGlyphsMax;
300 void drawCharIntern(uint16 c,
byte *dst,
int pitch,
int bpp,
int col1,
int col2)
const;
301 virtual uint16 convert(uint16 c)
const;
303 const uint32 *_hiColorMap;
304 bool _remapCharacters;
306 static uint16 *_cgaDitheringTable;
314class AmigaDOSFont :
public Font {
316 AmigaDOSFont(Resource *res,
bool needsLocalizedFont =
false);
317 ~AmigaDOSFont()
override { unload(); }
320 Type getType()
const override {
return kASCII; }
321 int getHeight()
const override {
return _height; }
322 int getWidth()
const override {
return _width; }
323 int getCharWidth(uint16 c)
const override;
324 void setColorMap(
const uint8 *src)
override { _colorMap = src; }
325 void drawChar(uint16 c,
byte *dst,
int pitch,
int)
const override;
327 static void errorDialog(
int index);
333 TextFont() : data(0), bitmap(0), location(0), spacing(0), kerning(0), height(0), width(0), baseLine(0), firstChar(0), lastChar(0), modulo(0) {}
346 const uint16 *location;
347 const int16 *spacing;
348 const int16 *kerning;
351 TextFont *loadContentFile(
const Common::Path &fileName);
352 void selectMode(
int mode);
355 FontContent() : height(0), style(0), flags(0) {}
369 FontContent *_content;
371 uint16 _selectedElement;
373 const uint8 *_colorMap;
374 const uint16 _maxPathLen;
375 const bool _needsLocalizedFont;
377 static uint8 _errorDialogDisplayed;
385class SJISFontEoB1PC98 :
public SJISFont {
388 ~SJISFontEoB1PC98()
override {}
389 int getCharWidth(uint16 c)
const override;
390 void drawChar(uint16 c,
byte *dst,
int pitch,
int)
const override;
393 uint16 convert(uint16 c)
const;
394 const uint16 *_convTable1, *_convTable2;
401class SJISFontEoB2PC98 :
public SJISFont {
404 ~SJISFontEoB2PC98()
override {}
405 int getCharWidth(uint16 c)
const override;
406 void drawChar(uint16 c,
byte *dst,
int pitch,
int)
const override;
409 uint16 convert(uint16 c)
const;
410 const char *_convTable1, *_convTable2;
418class Font12x12PC98 :
public OldDOSFont{
420 Font12x12PC98(uint8 shadowColor,
const uint16 *convTable1,
const uint16 *convTable2,
const uint8 *lookupTable);
421 ~Font12x12PC98()
override;
422 bool usesOverlay()
const override {
return true; }
423 Type getType()
const override {
return kJIS_X0201; }
424 int getHeight()
const override {
return _height >> 1; }
425 int getWidth()
const override {
return _width >> 1; }
426 int getCharWidth(uint16 c)
const override {
return _width >> 1; };
430 uint16 convert(uint16 c)
const override;
431 const uint16 *_convTable1, *_convTable2;
439class PC98Font :
public OldDOSFont {
441 PC98Font(uint8 shadowColor,
bool useOverlay,
int scaleV,
const uint8 *convTable1 = 0,
const char *convTable2 = 0,
const char *convTable3 = 0);
442 ~PC98Font()
override {}
444 int getHeight()
const override {
return _outputHeight; }
445 int getWidth()
const override {
return _outputWidth; }
446 int getCharWidth(uint16 c)
const override {
return _outputWidth; };
447 Type getType()
const override {
return _type; }
450 uint16 convert(uint16 c)
const override;
451 uint16 makeTwoByte(uint16 c)
const;
453 const uint8 *_convTable1;
454 const char *_convTable2, *_convTable3;
464class SJISFontLarge :
public SJISFont {
467 ~SJISFontLarge()
override {}
469 int getHeight()
const override;
470 int getWidth()
const override;
471 int getCharWidth(uint16 c)
const override;
473 bool usesOverlay()
const override {
return false; }
474 void drawChar(uint16 c,
byte *dst,
int pitch,
int)
const override;
480class SJISFont12x12 :
public Font {
482 SJISFont12x12(
const uint16 *searchTable);
483 ~SJISFont12x12()
override { unload(); }
486 Type getType()
const override {
return kSJIS; }
487 bool usesOverlay()
const override {
return true; }
488 int getHeight()
const override {
return _height; }
489 int getWidth()
const override {
return _width; }
490 int getCharWidth(uint16 c)
const override {
return _width; }
491 void setColorMap(
const uint8 *src)
override { _colorMap = src; }
492 void drawChar(uint16 c,
byte *dst,
int pitch,
int)
const override;
500 const uint8 *_colorMap;
501 const int _height, _width;
504class SegaCDFont :
public Font {
506 SegaCDFont(
Common::Language lang,
const uint16 *convTable1,
const uint16 *convTable2,
const uint8 *widthTable1,
const uint8 *widthTable2,
const uint8 *widthTable3);
507 ~SegaCDFont()
override;
510 Type getType()
const override {
return _forceOneByte ? kASCII : kSJIS; }
511 int getHeight()
const override {
return _height; }
512 int getWidth()
const override {
return _width; }
513 int getCharWidth(uint16 c)
const override;
514 int getCharHeight(uint16 c)
const override;
515 void setStyles(
int styles)
override;
516 void setColorMap(
const uint8 *src)
override { _colorMap = src; }
517 void drawChar(uint16 c,
byte *dst,
int pitch,
int bpp)
const override { drawChar(c, dst, pitch, 0, 0); }
518 void drawChar(uint16 c,
byte *dst,
int pitch,
int xOffs,
int yOffs)
const override;
521 const uint8 *getGlyphData(uint16 c, uint8 &charWidth, uint8 &charHeight, uint8 &pitch)
const;
524 const uint8 *_buffer;
530 const uint8 *_colorMap;
531 const int _height, _width;
532 const uint16 *_convTable1, *_convTable2;
533 const uint8 *_widthTable1, *_widthTable2, *_widthTable3;
Definition: atari-screen.h:42
Language
Definition: language.h:45
RenderMode
Definition: rendermode.h:48
T MAX(T a, T b)
Definition: util.h:66
Definition: detection.h:27
Definition: atari-screen.h:58