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 BG_GREYSCALE_RANGE_END 229
35 #define BLACK 0
36 
37 class SherlockEngine;
38 
39 class Screen : public BaseSurface {
40 private:
41  uint32 _transitionSeed;
42 
43  // Rose Tattoo fields
44  int _fadeBytesRead, _fadeBytesToRead;
45  int _oldFadePercent;
46 protected:
47  SherlockEngine *_vm;
48  Surface _backBuffer;
49 
50 public:
51  Surface _backBuffer1, _backBuffer2;
52  bool _fadeStyle;
53  byte _cMap[Graphics::PALETTE_SIZE];
54  byte _sMap[Graphics::PALETTE_SIZE];
55  byte _tMap[Graphics::PALETTE_SIZE];
56  bool _flushScreen;
57  Common::Point _currentScroll;
58 public:
59  static Screen *init(SherlockEngine *vm);
61  ~Screen() override;
62 
66  Surface *getBackBuffer() { return &_backBuffer; }
67 
71  void activateBackBuffer1();
72 
76  void activateBackBuffer2();
77 
81  int equalizePalette(const byte palette[Graphics::PALETTE_SIZE]);
82 
86  void fadeToBlack(int speed = 2);
87 
91  void fadeIn(const byte palette[Graphics::PALETTE_SIZE], int speed = 2);
92 
96  void randomTransition();
97 
101  void verticalTransition();
102 
107  void print(const Common::Point &pt, uint color, MSVC_PRINTF const char *formatStr, ...) GCC_PRINTF(4, 5);
108 
112  void gPrint(const Common::Point &pt, uint color, MSVC_PRINTF const char *formatStr, ...) GCC_PRINTF(4, 5);
113 
117  void restoreBackground(const Common::Rect &r);
118 
122  void slamArea(int16 xp, int16 yp, int16 width, int16 height);
123 
127  void slamRect(const Common::Rect &r);
128 
133  void flushImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
134  int16 *width, int16 *height);
135 
140  void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
141  int16 *width, int16 *height, int scaleVal);
142 
146  void flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect &newBounds, int scaleVal);
147 
151  void blockMove(const Common::Rect &r);
152 
156  void blockMove();
157 
161  void vgaBar(const Common::Rect &r, int color);
162 
166  void setDisplayBounds(const Common::Rect &r);
167 
171  void resetDisplayBounds();
172 
177 
181  void synchronize(Serializer &s);
182 
186  void writeString(const Common::String &str, const Common::Point &pt, uint overrideColor);
187 
188 
189  // Rose Tattoo specific methods
190  void initPaletteFade(int bytesToRead);
191 
192  int fadeRead(Common::SeekableReadStream &stream, byte *buf, int totalSize);
193 
198  static void translatePalette(byte palette[Graphics::PALETTE_SIZE]);
199 };
200 
201 } // End of namespace Sherlock
202 
203 #endif
Definition: surface.h:130
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:524
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:112
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:206
void fadeIn(const byte palette[Graphics::PALETTE_SIZE], int speed=2)
Definition: rect.h:144
void vgaBar(const Common::Rect &r, int color)
Definition: screen.h:39
void slamRect(const Common::Rect &r)
int equalizePalette(const byte palette[Graphics::PALETTE_SIZE])
virtual uint16 height() const
Definition: surface.h:117
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:66
void setDisplayBounds(const Common::Rect &r)
static void translatePalette(byte palette[Graphics::PALETTE_SIZE])
void verticalTransition()
void activateBackBuffer2()