22 #ifndef KYRA_SCREEN_EOB_H 23 #define KYRA_SCREEN_EOB_H 27 #include "graphics/big5.h" 29 #include "kyra/graphics/screen.h" 36 class Screen_EoB :
public Screen {
37 friend 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 createFadeTable(
const uint8 *palData, uint8 *dst, uint8 rootColor, uint8 weight);
106 void createFadeTable16bit(
const uint16 *palData, uint16 *dst, uint16 rootColor, uint8 weight);
108 const uint16 *getCGADitheringTable(
int index);
109 const uint8 *getEGADitheringTable();
111 bool loadFont(FontId fontId,
const char *filename)
override;
114 void decodeSHP(
const uint8 *data,
int dstPage);
115 void convertToHiColor(
int page);
116 void shadeRect(
int x1,
int y1,
int x2,
int y2,
int shadingLevel);
119 void selectPC98Palette(
int palID,
Palette &dest,
int brightness = 0,
bool set =
false);
120 void decodeBIN(
const uint8 *src, uint8 *dst, uint16 inSize);
121 void decodePC98PlanarBitmap(uint8 *srcDstBuffer, uint8 *tmpBuffer, uint16 size = 64000);
123 struct PalCycleData {
128 void initPC98PaletteCycle(
int palID, PalCycleData *data);
129 void updatePC98PaletteCycle(
int brightness);
131 PalCycleData *_activePalCycle;
132 uint8 *_cyclePalette;
135 void loadSpecialAmigaCPS(
const char *fileName,
int destPage,
bool isGraphics);
142 void sega_initGraphics();
143 void sega_selectPalette(
int srcPalID,
int dstPalID,
bool set =
false);
145 void sega_updatePaletteFaders(
int palID);
146 void sega_fadePalette(
int delay, int16 brEnd,
int dstPalID = -1,
bool waitForCompletion =
true,
bool noUpdate =
false);
147 void sega_fadeToBlack(
int delay) { sega_fadePalette(delay, -7); }
148 void sega_fadeToWhite(
int delay) { sega_fadePalette(delay, 7); }
149 void sega_fadeToNeutral(
int delay) { sega_fadePalette(delay, 0); }
150 void sega_paletteOps(int16 opPal, int16 par1, int16 par2);
151 void sega_setTextBuffer(uint8 *buffer, uint32 bufferSize);
152 void sega_clearTextBuffer(uint8 col);
153 void sega_loadTextBackground(
const uint8 *src, uint16 size);
154 void sega_drawTextBox(
int pW,
int pH,
int x,
int y,
int w,
int h, uint8 color1, uint8 color2);
155 void sega_loadTextBufferToVRAM(uint16 srcOffset, uint16 addr,
int size);
156 void sega_gfxScale(uint8 *out, uint16 w, uint16 h, uint16 pitch,
const uint8 *in,
const uint16 *stampMap,
const uint16 *traceVectors);
157 void sega_drawClippedLine(
int pW,
int pH,
int x,
int y,
int w,
int h, uint8 color);
158 uint8 *sega_convertShape(
const uint8 *src,
int w,
int h,
int pal,
int hOffs = 0);
159 void sega_encodeShapesFromSprites(
const uint8 **dst,
const uint8 *src,
int numShapes,
int w,
int h,
int pal,
bool removeSprites =
true);
161 SegaRenderer *sega_getRenderer()
const {
return _segaRenderer; }
162 SegaAnimator *sega_getAnimator()
const {
return _segaAnimator; }
165 void updateDirtyRects()
override;
166 void ditherRect(
const uint8 *src, uint8 *dst,
int dstPitch,
int srcW,
int srcH,
int colorKey = -1);
168 void drawShapeSetPixel(uint8 *dst, uint8 col);
169 void scaleShapeProcessLine2Bit(uint8 *&shpDst,
const uint8 *&shpSrc, uint32 transOffsetDst, uint32 transOffsetSrc);
170 void scaleShapeProcessLine4Bit(uint8 *&dst,
const uint8 *&src);
171 bool posWithinRect(
int posX,
int posY,
int x1,
int y1,
int x2,
int y2);
173 void setPagePixel16bit(
int pageNum,
int x,
int y, uint16 color);
175 void generateEGADitheringTable(
const Palette &pal);
176 void generateCGADitheringTables(
const uint8 *mappingData);
178 int _dsDiv, _dsRem, _dsScaleTrans;
179 uint8 *_cgaScaleTable;
182 const uint8 *_gfxMaxY;
184 int16 _dsX1, _dsX2, _dsY1, _dsY2;
186 bool _dsBackgroundFading;
187 int16 _dsBackgroundFadingXOffs;
188 uint8 _shapeOverlay[16];
192 uint8 *_convertHiColorBuffer;
194 uint16 *_cgaDitheringTables[2];
195 const uint8 *_cgaMappingDefault;
197 uint8 *_egaDitheringTable;
198 uint8 *_egaDitheringTempPage;
202 const uint16 _cursorColorKey16Bit;
204 static const uint8 _egaMatchTable[];
205 static const ScreenDim _screenDimTableIntl[];
206 static const ScreenDim _screenDimTableZH[];
207 static const int _screenDimTableCount;
210 struct PaletteFader {
211 PaletteFader() : _brCur(0), _brDest(0), _fadeIncr(0), _fadeDelay(0), _fadeTimer(0), _needRefresh(false) {}
220 PaletteFader *_palFaders;
221 bool _specialColorReplace;
222 SegaRenderer *_segaRenderer;
223 SegaAnimator *_segaAnimator;
224 uint16 _segaCurPalette[64];
225 uint16 *_segaCustomPalettes;
226 uint8 *_defaultRenderBuffer;
227 int _defaultRenderBufferSize;
232 class ChineseTwoByteFontEoB final :
public Font {
236 virtual Type getType()
const override {
return kBIG5; }
239 return _singleByte->load(data);
242 void setStyles(
int styles)
override { _border = (styles & kStyleBorder); _singleByte->setStyles(styles); }
243 int getHeight()
const override {
return MAX(_big5->getFontHeight(), _singleByte->getHeight()); }
244 int getWidth()
const override {
return MAX(_big5->kChineseTraditionalWidth + 2, _singleByte->getWidth()); }
245 void setColorMap(
const uint8 *src)
override { _colorMap = src; _singleByte->setColorMap(src); }
246 int getCharWidth(uint16 c)
const override;
247 int getCharHeight(uint16 c)
const override;
248 void drawChar(uint16 c, byte *dst,
int pitch,
int bpp)
const override;
251 uint16 translateBig5(uint16 in)
const;
255 const uint8 *_colorMap;
263 class OldDOSFont :
public Font {
266 ~OldDOSFont()
override;
269 bool loadPCBIOSTall();
270 Type getType()
const override {
return kASCII; }
271 int getHeight()
const override {
return _height; }
272 int getWidth()
const override {
return _width; }
273 bool usesOverlay()
const override {
return _useOverlay; }
274 int getCharWidth(uint16 c)
const override;
275 void setColorMap(
const uint8 *src)
override;
276 void set16bitColorMap(
const uint16 *src)
override { _colorMap16bit = src; }
277 void setStyles(
int styles)
override { _style = styles; }
278 void drawChar(uint16 c, byte *dst,
int pitch,
int bpp)
const override;
284 const uint8 *_colorMap8bit;
286 uint16 *_bitmapOffsets;
291 uint16 _numGlyphsMax;
296 void drawCharIntern(uint16 c, byte *dst,
int pitch,
int bpp,
int col1,
int col2)
const;
297 virtual uint16 convert(uint16 c)
const;
299 const uint16 *_colorMap16bit;
300 bool _remapCharacters;
302 static uint16 *_cgaDitheringTable;
310 class AmigaDOSFont :
public Font {
312 AmigaDOSFont(Resource *res,
bool needsLocalizedFont =
false);
313 ~AmigaDOSFont()
override { unload(); }
316 Type getType()
const override {
return kASCII; }
317 int getHeight()
const override {
return _height; }
318 int getWidth()
const override {
return _width; }
319 int getCharWidth(uint16 c)
const override;
320 void setColorMap(
const uint8 *src)
override { _colorMap = src; }
321 void drawChar(uint16 c, byte *dst,
int pitch,
int)
const override;
323 static void errorDialog(
int index);
329 TextFont() : data(0), bitmap(0), location(0), spacing(0), kerning(0), height(0), width(0), baseLine(0), firstChar(0), lastChar(0), modulo(0) {}
342 const uint16 *location;
343 const int16 *spacing;
344 const int16 *kerning;
347 TextFont *loadContentFile(
const Common::Path &fileName);
348 void selectMode(
int mode);
351 FontContent() : height(0), style(0), flags(0) {}
365 FontContent *_content;
367 uint16 _selectedElement;
369 const uint8 *_colorMap;
370 const uint16 _maxPathLen;
371 const bool _needsLocalizedFont;
373 static uint8 _errorDialogDisplayed;
381 class SJISFontEoB1PC98 :
public SJISFont {
384 ~SJISFontEoB1PC98()
override {}
385 int getCharWidth(uint16 c)
const override;
386 void drawChar(uint16 c, byte *dst,
int pitch,
int)
const override;
389 uint16 convert(uint16 c)
const;
390 const uint16 *_convTable1, *_convTable2;
397 class SJISFontEoB2PC98 :
public SJISFont {
400 ~SJISFontEoB2PC98()
override {}
401 int getCharWidth(uint16 c)
const override;
402 void drawChar(uint16 c, byte *dst,
int pitch,
int)
const override;
405 uint16 convert(uint16 c)
const;
406 const char *_convTable1, *_convTable2;
414 class Font12x12PC98 :
public OldDOSFont{
416 Font12x12PC98(uint8 shadowColor,
const uint16 *convTable1,
const uint16 *convTable2,
const uint8 *lookupTable);
417 ~Font12x12PC98()
override;
418 bool usesOverlay()
const override {
return true; }
419 Type getType()
const override {
return kJIS_X0201; }
420 int getHeight()
const override {
return _height >> 1; }
421 int getWidth()
const override {
return _width >> 1; }
422 int getCharWidth(uint16 c)
const override {
return _width >> 1; };
426 uint16 convert(uint16 c)
const override;
427 const uint16 *_convTable1, *_convTable2;
435 class PC98Font :
public OldDOSFont {
437 PC98Font(uint8 shadowColor,
bool useOverlay,
int scaleV,
const uint8 *convTable1 = 0,
const char *convTable2 = 0,
const char *convTable3 = 0);
438 ~PC98Font()
override {}
440 int getHeight()
const override {
return _outputHeight; }
441 int getWidth()
const override {
return _outputWidth; }
442 int getCharWidth(uint16 c)
const override {
return _outputWidth; };
443 Type getType()
const override {
return _type; }
446 uint16 convert(uint16 c)
const override;
447 uint16 makeTwoByte(uint16 c)
const;
449 const uint8 *_convTable1;
450 const char *_convTable2, *_convTable3;
460 class SJISFontLarge :
public SJISFont {
463 ~SJISFontLarge()
override {}
465 int getHeight()
const override;
466 int getWidth()
const override;
467 int getCharWidth(uint16 c)
const override;
469 bool usesOverlay()
const override {
return false; }
470 void drawChar(uint16 c, byte *dst,
int pitch,
int)
const override;
476 class SJISFont12x12 :
public Font {
478 SJISFont12x12(
const uint16 *searchTable);
479 ~SJISFont12x12()
override { unload(); }
482 Type getType()
const override {
return kSJIS; }
483 bool usesOverlay()
const override {
return true; }
484 int getHeight()
const override {
return _height; }
485 int getWidth()
const override {
return _width; }
486 int getCharWidth(uint16 c)
const override {
return _width; }
487 void setColorMap(
const uint8 *src)
override { _colorMap = src; }
488 void drawChar(uint16 c, byte *dst,
int pitch,
int)
const override;
496 const uint8 *_colorMap;
497 const int _height, _width;
500 class SegaCDFont :
public Font {
502 SegaCDFont(
Common::Language lang,
const uint16 *convTable1,
const uint16 *convTable2,
const uint8 *widthTable1,
const uint8 *widthTable2,
const uint8 *widthTable3);
503 ~SegaCDFont()
override;
506 Type getType()
const override {
return _forceOneByte ? kASCII : kSJIS; }
507 int getHeight()
const override {
return _height; }
508 int getWidth()
const override {
return _width; }
509 int getCharWidth(uint16 c)
const override;
510 int getCharHeight(uint16 c)
const override;
511 void setStyles(
int styles)
override;
512 void setColorMap(
const uint8 *src)
override { _colorMap = src; }
513 void drawChar(uint16 c, byte *dst,
int pitch,
int bpp)
const override { drawChar(c, dst, pitch, 0, 0); }
514 void drawChar(uint16 c, byte *dst,
int pitch,
int xOffs,
int yOffs)
const override;
517 const uint8 *getGlyphData(uint16 c, uint8 &charWidth, uint8 &charHeight, uint8 &pitch)
const;
520 const uint8 *_buffer;
526 const uint8 *_colorMap;
527 const int _height, _width;
528 const uint16 *_convTable1, *_convTable2;
529 const uint8 *_widthTable1, *_widthTable2, *_widthTable3;
RenderMode
Definition: rendermode.h:48
Definition: atari-screen.h:60
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: detection.h:27
T MAX(T a, T b)
Definition: util.h:64
Language
Definition: language.h:45
Definition: atari-screen.h:44