ScummVM API documentation
dispman.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 /*
23  * This code is based on Labyrinth of Time code with assistance of
24  *
25  * Copyright (c) 1993 Terra Nova Development
26  * Copyright (c) 2004 The Wyrmkeep Entertainment Co.
27  *
28  */
29 
30 #ifndef LAB_DISPMAN_H
31 #define LAB_DISPMAN_H
32 
33 namespace Lab {
34 
35 class LabEngine;
36 class Image;
37 
38 struct TextFont {
39  uint32 _dataLength;
40  uint16 _height;
41  byte _widths[256];
42  uint16 _offsets[256];
43  byte *_data;
44 };
45 
46 enum TransitionType {
47  kTransitionNone,
48  kTransitionWipe,
49  kTransitionScrollWipe,
50  kTransitionScrollBlack,
51  kTransitionScrollBounce,
52  kTransitionTransporter,
53  kTransitionReadFirstFrame,
54  kTransitionReadNextFrame
55 };
56 
57 class DisplayMan {
58 private:
59  LabEngine *_vm;
60 
64  uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter);
65  uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter);
66 
70  Common::String getWord(const char *mainBuffer);
71 
72  void createBox(uint16 y2);
73 
77  void createScreen(bool hiRes);
78 
82  void doScrollBlack();
83  void copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startline, byte *mem);
84 
88  void doScrollWipe(const Common::String filename);
89 
93  void doScrollBounce();
94 
98  void doTransWipe(const Common::String filename);
99 
103  void drawHLine(uint16 x, uint16 y1, uint16 y2, byte color);
104 
108  void drawVLine(uint16 x1, uint16 y, uint16 x2, byte color);
109 
113  void drawText(TextFont *tf, uint16 x, uint16 y, uint16 color, const Common::String text);
114 
119  Common::String getLine(TextFont *tf, const char **mainBuffer, uint16 lineWidth);
120 
124  uint16 textLength(TextFont *font, const Common::String text);
125 
126  bool _actionMessageShown;
127  Common::File *_curBitmap;
128  byte _curVgaPal[256 * 3];
129  byte *_currentDisplayBuffer;
130 
131 public:
132  DisplayMan(LabEngine *lab);
133  virtual ~DisplayMan();
134 
135  void loadPict(const Common::String filename);
136  void loadBackPict(const Common::String fileName, uint16 *highPal);
137 
141  void readPict(const Common::String filename, bool playOnce = true, bool onlyDiffData = false, byte *memoryBuffer = nullptr);
142  void freePict();
143 
147  void doTransition(TransitionType transitionType, const Common::String filename);
148 
152  void blackScreen();
153 
157  void whiteScreen();
158 
162  void blackAllScreen();
163 
167  void drawPanel();
168 
172  void setUpScreens();
173 
174  int longDrawMessage(Common::String str, bool isActionMessage);
175 
179  void drawMessage(Common::String str, bool isActionMessage);
180 
181  void setActionMessage(bool val) { _actionMessageShown = val; }
182 
186  void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte color);
187  void rectFill(Common::Rect fillRect, byte color);
188  void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte color);
205  int flowText(TextFont *font, int16 spacing, byte penColor, byte backPen, bool fillBack,
206  bool centerh, bool centerv, bool output, Common::Rect textRect, const char *text, Image *targetImage = nullptr);
207 
208  void screenUpdate();
209 
214  void setAmigaPal(uint16 *pal);
215 
226  void writeColorRegs(byte *buf, uint16 first, uint16 numReg);
227  void setPalette(void *newPal, uint16 numColors);
228 
232  void checkerBoardEffect(uint16 penColor, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
233 
237  byte *getCurrentDrawingBuffer();
238 
244  void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer);
245 
249  void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer);
250  void fade(bool fadein);
251 
255  void freeFont(TextFont **font);
256 
260  uint16 textHeight(TextFont *tf);
261 
262  bool _longWinInFront;
263  bool _lastMessageLong;
264  uint32 _screenBytesPerPage;
265  int _screenWidth;
266  int _screenHeight;
267  byte *_displayBuffer;
268  uint16 *_fadePalette;
269 };
270 
271 } // End of namespace Lab
272 
273 #endif // LAB_DISPMAN_H
Definition: str.h:59
Definition: dispman.h:57
Definition: rect.h:144
Definition: anim.h:33
Definition: file.h:47
Definition: lab.h:119
Definition: dispman.h:38
Definition: movie_decoder.h:32