ScummVM API documentation
screen.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SHERLOCK_SCREEN_H
23 #define SHERLOCK_SCREEN_H
24 
25 #include "common/list.h"
26 #include "common/rect.h"
27 #include "sherlock/image_file.h"
28 #include "sherlock/surface.h"
29 #include "sherlock/resources.h"
30 #include "sherlock/saveload.h"
31 
32 namespace Sherlock {
33 
34 #define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
35 #define BG_GREYSCALE_RANGE_END 229
36 #define BLACK 0
37 
38 class SherlockEngine;
39 
40 class Screen : public BaseSurface {
41 private:
42  uint32 _transitionSeed;
43 
44  // Rose Tattoo fields
45  int _fadeBytesRead, _fadeBytesToRead;
46  int _oldFadePercent;
47 protected:
48  SherlockEngine *_vm;
49  Surface _backBuffer;
50 
51 public:
52  Surface _backBuffer1, _backBuffer2;
53  bool _fadeStyle;
54  byte _cMap[PALETTE_SIZE];
55  byte _sMap[PALETTE_SIZE];
56  byte _tMap[PALETTE_SIZE];
57  bool _flushScreen;
58  Common::Point _currentScroll;
59 public:
60  static Screen *init(SherlockEngine *vm);
62  ~Screen() override;
63 
67  Surface *getBackBuffer() { return &_backBuffer; }
68 
72  void activateBackBuffer1();
73 
77  void activateBackBuffer2();
78 
82  int equalizePalette(const byte palette[PALETTE_SIZE]);
83 
87  void fadeToBlack(int speed = 2);
88 
92  void fadeIn(const byte palette[PALETTE_SIZE], int speed = 2);
93 
97  void randomTransition();
98 
102  void verticalTransition();
103 
108  void print(const Common::Point &pt, uint color, MSVC_PRINTF const char *formatStr, ...) GCC_PRINTF(4, 5);
109 
113  void gPrint(const Common::Point &pt, uint color, MSVC_PRINTF const char *formatStr, ...) GCC_PRINTF(4, 5);
114 
118  void restoreBackground(const Common::Rect &r);
119 
123  void slamArea(int16 xp, int16 yp, int16 width, int16 height);
124 
128  void slamRect(const Common::Rect &r);
129 
134  void flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
135  int16 *width, int16 *height);
136 
141  void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
142  int16 *width, int16 *height, int scaleVal);
143 
147  void flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect &newBounds, int scaleVal);
148 
152  void blockMove(const Common::Rect &r);
153 
157  void blockMove();
158 
162  void vgaBar(const Common::Rect &r, int color);
163 
167  void setDisplayBounds(const Common::Rect &r);
168 
172  void resetDisplayBounds();
173 
178 
182  void synchronize(Serializer &s);
183 
187  void writeString(const Common::String &str, const Common::Point &pt, uint overrideColor);
188 
189 
190  // Rose Tattoo specific methods
191  void initPaletteFade(int bytesToRead);
192 
193  int fadeRead(Common::SeekableReadStream &stream, byte *buf, int totalSize);
194 
199  static void translatePalette(byte palette[PALETTE_SIZE]);
200 };
201 
202 } // End of namespace Sherlock
203 
204 #endif
Definition: surface.h:118
Definition: str.h:59
Common::Rect getDisplayBounds()
void void void restoreBackground(const Common::Rect &r)
void synchronize(Serializer &s)
Definition: animation.h:29
void print(const Common::Point &pt, uint color, MSVC_PRINTF const char *formatStr,...) GCC_PRINTF(4
void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp, int16 *width, int16 *height, int scaleVal)
Definition: rect.h:144
void activateBackBuffer1()
Definition: surface.h:41
Definition: stream.h:745
Definition: serializer.h:79
Definition: image_file.h:36
void fadeToBlack(int speed=2)
int FORCEINLINE GCC_PRINTF(2, 0) int vsprintf_s(T(&dst)[N]
void flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp, int16 *width, int16 *height)
virtual uint16 width() const
Definition: surface.h:100
void slamArea(int16 xp, int16 yp, int16 width, int16 height)
void writeString(const Common::String &str, const Common::Point &pt, uint overrideColor)
Definition: sherlock.h:76
Definition: rect.h:45
void vgaBar(const Common::Rect &r, int color)
static void translatePalette(byte palette[PALETTE_SIZE])
Definition: screen.h:40
void slamRect(const Common::Rect &r)
int equalizePalette(const byte palette[PALETTE_SIZE])
virtual uint16 height() const
Definition: surface.h:105
void randomTransition()
void resetDisplayBounds()
void void gPrint(const Common::Point &pt, uint color, MSVC_PRINTF const char *formatStr,...) GCC_PRINTF(4
Surface * getBackBuffer()
Definition: screen.h:67
void setDisplayBounds(const Common::Rect &r)
void fadeIn(const byte palette[PALETTE_SIZE], int speed=2)
void verticalTransition()
void activateBackBuffer2()