ScummVM API documentation
display.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 QUEEN_DISPLAY_H
23#define QUEEN_DISPLAY_H
24
25#include "common/str.h"
26#include "common/util.h"
27#include "common/random.h"
28#include "queen/defs.h"
29
30class OSystem;
31
32namespace Common {
33struct Rect;
34}
35
36namespace Queen {
37
38class QueenEngine;
39
40class Display {
41public:
42
43 Display(QueenEngine *vm, OSystem *system);
44 ~Display();
45
47 void dynalumInit(const char *roomName, uint16 roomNum);
48
50 void dynalumUpdate(int16 x, int16 y);
51
53 void palSet(const uint8 *pal, int start, int end, bool updateScreen = false);
54
57
60
63
65 void palFadeIn(uint16 roomNum, bool dynalum = false, int16 dynaX = 0, int16 dynaY = 0);
66
68 void palFadeOut(uint16 roomNum);
69
72
74 void palScroll(int start, int end);
75
76 void palSetAmigaColor(uint8 color, uint16 rgb);
77
79 void palCustomColors(uint16 roomNum);
80
82 void palCustomScroll(uint16 roomNum);
83
86
87 void palCustomLightsOff(uint16 roomNum);
88 void palCustomLightsOn(uint16 roomNum);
89
91 void palSetAllDirty() { _pal.dirtyMin = 0; _pal.dirtyMax = 255; }
92
94 int getNumColorsForRoom(uint16 room) const;
95
97 bool isPalFadingDisabled(uint16 room) const;
98
100 void screenMode(int comPanel, bool inCutaway);
101
102 void prepareUpdate();
103 void update(bool dynalum = false, int16 dynaX = 0, int16 dynaY = 0);
104
105 void setupPanel();
106 void setupNewRoom(const char *name, uint16 room);
107
108 void drawBobSprite(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h, uint16 pitch, bool xflip);
109 void drawBobPasteDown(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h);
110 void drawInventoryItem(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h);
111
112 void blit(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, const uint8 *srcBuf, uint16 srcPitch, uint16 w, uint16 h, bool xflip, bool masked);
113 void fill(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, uint16 w, uint16 h, uint8 color);
114
116 void decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd);
117
119 void decodeIFF(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase = 0);
120
121 void horizontalScrollUpdate(int16 xCamera);
122 void horizontalScroll(int16 scroll);
123 int16 horizontalScroll() const { return _horizontalScroll; }
124
125 void fullscreen(bool fs) { _fullRefresh = 2; _fullscreen = fs; }
126 bool fullscreen() const { return _fullscreen; }
127
129 void setDirtyBlock(uint16 x, uint16 y, uint16 w, uint16 h);
130
132 void forceFullRefresh() { _fullRefresh = 2; }
133
135 void setMouseCursor(uint8 *buf, uint16 w, uint16 h);
136
138 void showMouseCursor(bool show);
139
141 void initFont();
142
144 void setText(uint16 x, uint16 y, const char *text, bool outlined = true);
145
147 void setTextCentered(uint16 y, const char *text, bool outlined = true);
148
150 void drawTexts();
151
153 void clearTexts(uint16 y1, uint16 y2);
154
155 void setupInkColors();
156
157 uint8 getInkColor(InkColor color) const { return _inkColors[color]; }
158
160 void textCurrentColor(uint8 color) { _curTextColor = color; }
161
163 void textColor(uint16 y, uint8 color) { _texts[y].color = color; }
164
166 void setFocusRect(const Common::Rect& rect);
167
168 int textCenterX(const char *text) const;
169 uint16 textWidth(const char *text) const;
170 uint16 textWidth(const char *text, uint16 len) const;
171 void drawChar(uint16 x, uint16 y, uint8 color, const uint8 *chr);
172 void drawText(uint16 x, uint16 y, uint8 color, const char *text, bool outlined = true);
173 void drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col);
174
175 void shake(bool reset);
176
177 void blankScreen();
178 void blankScreenEffect1();
179 void blankScreenEffect2();
180 void blankScreenEffect3();
181
182private:
183
184 enum {
185 FADE_SPEED = 16,
186 D_BLOCK_W = 8,
187 D_BLOCK_H = 8
188 };
189
190 enum BufferDimension {
191 BACKDROP_W = 640,
192 BACKDROP_H = 200,
193 SCREEN_W = 320,
194 SCREEN_H = 200,
195 PANEL_W = 320,
196 PANEL_H = 50
197 };
198
199 struct {
200 uint8 *room;
201 uint8 *screen;
202 uint8 *panel;
203 int dirtyMin, dirtyMax;
204 bool scrollable;
205 } _pal;
206
207 struct Dynalum {
208 bool valid;
209 uint8 *mskBuf;
210 uint32 mskSize;
211 int8 *lumBuf;
212 uint32 lumSize;
213 uint8 prevColMask;
214
215 void clear() {
216 valid = false;
217 mskBuf = nullptr;
218 mskSize = 0;
219 lumBuf = nullptr;
220 lumSize = 0;
221 prevColMask = 0;
222 }
223 };
224
225 struct TextSlot {
226 uint16 x;
227 uint8 color;
228 Common::String text;
229 bool outlined;
230
231 void clear() {
232 x = 0;
233 color = 0;
234 text = "";
235 outlined = false;
236 }
237 };
238
239 uint8 *_screenBuf;
240 uint8 *_panelBuf;
241 uint8 *_backdropBuf;
242
243 uint8 _fullRefresh;
244 uint8 *_dirtyBlocks;
245 uint16 _dirtyBlocksWidth, _dirtyBlocksHeight;
246
247 bool _fullscreen;
248
249 uint16 _horizontalScroll;
250 uint16 _bdWidth, _bdHeight;
251
252 const char *_imageExt;
253
255 TextSlot _texts[GAME_SCREEN_HEIGHT];
256
258 uint8 _curTextColor;
259
261 uint8 _charWidth[256];
262
263 uint8 _inkColors[INK_COUNT];
264
266 Dynalum _dynalum;
267 OSystem *_system;
268 QueenEngine *_vm;
269
270 const uint8 *_font;
271
272 static const uint8 _fontRegular[];
273 static const uint8 _fontHebrew[];
274 static const uint8 _fontHebrewAdvBrew[];
275 static const uint8 _fontRussian[];
276 static const uint8 _fontGreek[];
277 static const uint8 _palJoeClothes[];
278 static const uint8 _palJoeDress[];
279};
280
281
282} // End of namespace Queen
283
284#endif
Definition: random.h:44
Definition: str.h:59
Definition: system.h:166
Definition: display.h:40
void forceFullRefresh()
force a full refresh (bypassing the dirtyblocks rendering), on next screen update
Definition: display.h:132
void textCurrentColor(uint8 color)
change the current text color
Definition: display.h:160
int getNumColorsForRoom(uint16 room) const
returns the number of colors used by the room
void screenMode(int comPanel, bool inCutaway)
change fullscreen/panel mode
bool isPalFadingDisabled(uint16 room) const
returns true if we shouldn't fade the palette in the specified room
void palSetJoeNormal()
setup palette for Joe's normal clothes
void decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd)
decode PCX picture data
void palSetJoeDress()
setup palette for Joe's dress
void palGreyPanel()
grey the panel area (used when panel is disabled)
void setFocusRect(const Common::Rect &rect)
Set the focus rectangle to the speaking character.
void palSetAllDirty()
mark all palette entries as dirty
Definition: display.h:91
void palScroll(int start, int end)
scroll some palette colors
void initFont()
initialize font, compute justification sizes
void palFadeOut(uint16 roomNum)
fade the current palette out
void palCustomColors(uint16 roomNum)
custom palette effect for the specified room
void textColor(uint16 y, uint8 color)
change the text color for the specified texts list entry
Definition: display.h:163
void palFadeIn(uint16 roomNum, bool dynalum=false, int16 dynaX=0, int16 dynaY=0)
fade the current palette in
void showMouseCursor(bool show)
show/hide mouse cursor
void drawTexts()
draw the text lists
void setText(uint16 x, uint16 y, const char *text, bool outlined=true)
add the specified text to the texts list
void dynalumUpdate(int16 x, int16 y)
update dynalum for the current room
void palSetPanel()
setup palette for panel and inventory objects
void palCustomFlash()
process a 'palette flash' effect
void palCustomScroll(uint16 roomNum)
custom palette scroll for the specified room
void setDirtyBlock(uint16 x, uint16 y, uint16 w, uint16 h)
mark the specified block as dirty
void palSet(const uint8 *pal, int start, int end, bool updateScreen=false)
update the palette
void setMouseCursor(uint8 *buf, uint16 w, uint16 h)
change mouse cursor bitmap
void decodeIFF(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase=0)
decode IFF picture data
void dynalumInit(const char *roomName, uint16 roomNum)
initialize dynalum for the specified room
void setTextCentered(uint16 y, const char *text, bool outlined=true)
add the specified text to the texts list
void clearTexts(uint16 y1, uint16 y2)
remove entries from the texts list
Definition: queen.h:87
Definition: algorithm.h:29
Definition: bankman.h:28
Definition: rect.h:536