25#include "common/noncopyable.h"
26#include "common/rect.h"
27#include "common/stack.h"
28#include "cine/object.h"
29#include "cine/bg_list.h"
33extern byte *collisionPage;
34static const int kCollisionPageBgIdxAlias = 8;
36enum BackBufferSource {
37 BEFORE_OPENING_MENU = 0,
38 BEFORE_TAKING_THUMBNAIL,
39 MAX_BACK_BUFFER_SOURCES
53 memset(this->name, 0,
sizeof(this->name));
61 if (this->bg != collisionPage) {
66 memset(this->name, 0,
sizeof(this->name));
79 Menu(Type t) : _type(t) {}
82 Type getType()
const {
return _type; }
84 virtual void drawMenu(
FWRenderer &r,
bool top) = 0;
93 int getElementCount()
const {
return _elements.
size(); }
95 void setSelection(
int selection);
97 void drawMenu(
FWRenderer &r,
bool top)
override;
110 void setInput(
const char *input,
int cursor);
112 void drawMenu(
FWRenderer &r,
bool top)
override;
132 byte * _savedBackBuffers[MAX_BACK_BUFFER_SOURCES];
149 uint32 _fadeToBlackLastCalledMs;
152 void fillSprite(
const ObjectStruct &obj, uint8 color = 0);
153 void drawMaskedSprite(
const ObjectStruct &obj,
const byte *mask);
156 int drawMessage(
const char *str,
int x,
int y,
int width,
int color,
bool draw =
true);
157 void drawPlainBox(
int x,
int y,
int width,
int height,
byte color);
158 byte transparentDialogBoxStartColor();
159 void drawTransparentBox(
int x,
int y,
int width,
int height);
160 void drawBorder(
int x,
int y,
int width,
int height,
byte color);
161 void drawDoubleBorder(
int x,
int y,
int width,
int height,
byte color);
162 virtual int drawChar(
char character,
int x,
int y,
bool draw =
true);
163 virtual int undrawChar(
char character,
int x,
int y);
164 void drawLine(
int x,
int y,
int width,
int height,
byte color);
166 virtual void drawBackground();
167 virtual void clearBackBuffer();
168 virtual void removeSavedBackBuffers();
172 virtual void blit(
bool useCollisionPage);
181 virtual bool initialize();
184 virtual bool ready() {
return _background != NULL; }
185 virtual unsigned int currentBg() {
return 0; };
186 virtual unsigned int scrollBg() {
return 0; }
187 virtual bool useTransparentDialogBoxes();
189 virtual void clear();
191 void drawFrame(
bool wait =
false);
196 virtual void blitBackBuffer();
198 virtual void incrustMask(
const BGIncrust &incrust, uint8 color = 0);
199 virtual void incrustSprite(
const BGIncrust &incrust);
201 virtual bool hasSavedBackBuffer(BackBufferSource source);
206 virtual void popSavedBackBuffer(BackBufferSource source);
211 virtual void removeSavedBackBuffer(BackBufferSource source);
213 virtual int16 addBackground(
const char *bgName, uint16 bgIdx);
214 virtual void loadBg16(
const byte *bg,
const char *name,
unsigned int idx = 0);
215 virtual void loadCt16(
const byte *ct,
const char *name);
216 virtual void loadBg256(
const byte *bg,
const char *name,
unsigned int idx = 0);
217 virtual void loadCt256(
const byte *ct,
const char *name);
218 virtual void selectBg(
unsigned int idx);
219 virtual void selectScrollBg(
unsigned int idx);
220 virtual void setScroll(
unsigned int shift);
221 virtual uint getScroll()
const;
222 virtual void removeBg(
unsigned int idx);
224 virtual const char *getBgName(uint idx = 0)
const;
226 virtual void setBlackPalette(
bool updateChangePal);
227 virtual void setPalette();
230 virtual void rotatePalette(
int firstIndex,
int lastIndex,
int mode);
231 virtual void transformPalette(
int first,
int last,
int r,
int g,
int b);
233 void pushMenu(
Menu *menu);
235 void clearMenuStack();
237 virtual uint fadeDelayMs();
238 virtual uint fadeToBlackMinMs();
239 virtual void fadeToBlack();
240 virtual void fadeFromBlack();
241 void showCollisionPage(
bool state);
243 void drawString(
const char *
string,
byte param);
244 int getStringWidth(
const char *str);
253 unsigned int _currentBg;
254 unsigned int _scrollBg;
255 unsigned int _bgShift;
258 void setBackground8ToCollisionPage();
261 void drawSprite(
overlay *overlayPtr,
const byte *spritePtr, int16 width, int16 height,
byte *page, int16 x, int16 y,
byte transparentColor,
byte bpp);
262 int drawChar(
char character,
int x,
int y,
bool draw =
true)
override;
263 void drawBackground()
override;
270 bool initialize()
override;
273 bool ready()
override {
return _bgTable[_currentBg].bg != NULL; }
274 unsigned int currentBg()
override {
return _currentBg; };
275 unsigned int scrollBg()
override {
return _scrollBg; }
277 void clear()
override;
279 void incrustMask(
const BGIncrust &incrust, uint8 color = 0)
override;
280 void incrustSprite(
const BGIncrust &incrust)
override;
282 int16 addBackground(
const char *bgName, uint16 bgIdx)
override;
283 void loadBg16(
const byte *bg,
const char *name,
unsigned int idx = 0)
override;
284 void loadCt16(
const byte *ct,
const char *name)
override;
285 void loadBg256(
const byte *bg,
const char *name,
unsigned int idx = 0)
override;
286 void loadCt256(
const byte *ct,
const char *name)
override;
287 void selectBg(
unsigned int idx)
override;
288 void selectScrollBg(
unsigned int idx)
override;
289 void setScroll(
unsigned int shift)
override;
290 uint getScroll()
const override;
291 void removeBg(
unsigned int idx)
override;
293 const char *getBgName(uint idx = 0)
const override;
297 void rotatePalette(
int firstIndex,
int lastIndex,
int mode)
override;
298 void transformPalette(
int first,
int last,
int r,
int g,
int b)
override;
301void gfxDrawSprite(
byte *src4, uint16 sw, uint16 sh,
byte *dst4, int16 sx, int16 sy);
303extern FWRenderer *renderer;
305void setMouseCursor(
int cursor);
306void gfxCopyPage(
byte *source,
byte *dest);
308void transformPaletteRange(
byte startColor,
byte numColor, int8 r, int8 g, int8 b);
311void gfxDrawMaskedSprite(
const byte *ptr,
const byte *msk, uint16 width, uint16 height,
byte *page, int16 x, int16 y);
312void gfxFillSprite(
const byte *src4, uint16 sw, uint16 sh,
byte *dst4, int16 sx, int16 sy, uint8 fillColor = 0);
314void gfxUpdateSpriteMask(
byte *destMask, int16 x, int16 y, int16 width, int16 height,
const byte *maskPtr, int16 xm, int16 ym, int16 maskWidth, int16 maskHeight);
316void gfxDrawLine(int16 x1, int16 y1, int16 x2, int16 y2,
byte color,
byte *page);
317void gfxDrawPlainBox(int16 x1, int16 y1, int16 x2, int16 y2,
byte color);
319void gfxResetPage(
byte *pagePtr);
321int16 gfxGetBit(int16 x, int16 y,
const byte *ptr, int16 width);
322byte gfxGetColor(int16 x, int16 y,
const byte *ptr, int16 width);
324void gfxResetRawPage(
byte *pageRaw);
325void gfxConvertSpriteToRaw(
byte *dst,
const byte *src, uint16 w, uint16 h);
326void gfxCopyRawPage(
byte *source,
byte *dest);
327void gfxFlipRawPage(
byte *frontBuffer);
328void drawSpriteRaw(
const byte *spritePtr,
const byte *maskPtr, int16 width, int16 height,
byte *page, int16 x, int16 y);
329void gfxDrawPlainBoxRaw(int16 x1, int16 y1, int16 x2, int16 y2,
byte color,
byte *page);
330void drawSpriteRaw2(
const byte *spritePtr,
byte transColor, int16 width, int16 height,
byte *page, int16 x, int16 y);
331void maskBgOverlay(
int targetBgIdx,
const byte *spritePtr,
const byte *maskPtr, int16 width, int16 height,
byte *page, int16 x, int16 y);
338void gfxRedrawMouseCursor();
340void blitScreen(
byte *frontBuffer,
byte *backbuffer);
341void blitRawScreen(
byte *frontBuffer);
virtual void restoreSavedBackBuffer(BackBufferSource source)
Cine::Palette _activePal
The active color palette.
Definition: gfx.h:145
Common::Stack< Menu * > _menuStack
All displayed menus.
Definition: gfx.h:146
virtual bool ready()
Definition: gfx.h:184
int _changePal
Load active palette to video backend on next frame.
Definition: gfx.h:147
static const int _screenHeight
Screen height.
Definition: gfx.h:141
uint16 _cmdY
Player command string position on screen.
Definition: gfx.h:176
static const int _screenSize
Screen size.
Definition: gfx.h:139
Cine::Palette _backupPal
The backup color palette.
Definition: gfx.h:144
bool _showCollisionPage
Should we show the collision page instead of the back buffer? Used for debugging.
Definition: gfx.h:148
virtual void saveBackBuffer(BackBufferSource source)
static const int _screenWidth
Screen width.
Definition: gfx.h:140
uint16 _messageBg
Message box background color.
Definition: gfx.h:175
byte * _backBuffer
Screen backbuffer.
Definition: gfx.h:143
bool ready() override
Definition: gfx.h:273
size_type size() const
Definition: array.h:316
Definition: noncopyable.h:39
Definition: savefile.h:54
Cine::Palette pal
Background color palette.
Definition: gfx.h:47
byte * bg
Background data.
Definition: gfx.h:46
char name[15]
Background filename.
Definition: gfx.h:48
void clear()
Clears the struct (Releases allocated memory etc).
Definition: gfx.h:57
palBg()
Default constructor.
Definition: gfx.h:51
Definition: list_intern.h:54