ScummVM API documentation
graphics.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 LASTEXPRESS_GRAPHICS_H
23#define LASTEXPRESS_GRAPHICS_H
24
25#include "lastexpress/lastexpress.h"
26
27#include "graphics/surface.h"
28
29namespace LastExpress {
30
31typedef struct TBM {
32 int32 x;
33 int32 y;
34 int32 width;
35 int32 height;
36
37 TBM() {
38 x = 0;
39 y = 0;
40 width = 0;
41 height = 0;
42 }
43
44 TBM(int32 newX, int32 newY, int32 newWidth, int32 newHeight) {
45 x = newX;
46 y = newY;
47 width = newWidth;
48 height = newHeight;
49 }
50
51} TBM;
52
53#include "common/pack-start.h"
54typedef struct CursorHeader {
55 int16 hotspotX;
56 int16 hotspotY;
58#include "common/pack-end.h"
59
60typedef uint16 PixMap;
61
62struct Sprite;
63
65 friend class CFight;
66 friend class MemoryManager;
67 friend class LastExpressEngine;
68 friend class LogicManager;
69 friend class SubtitleManager;
70 friend class ArchiveManager;
71 friend class GoldArchiveManager;
72 friend class NISManager;
73 friend class Menu;
74 friend class SpriteManager;
75
76public:
79
80 bool acquireSurface();
81 void unlockSurface();
82 void burstAll();
83
84 void stepBG(int sceneIndex);
85 void goStepBG(int sceneIndex);
86 void stepDissolve(TBM *tbm);
87 void clear(Graphics::Surface &surface, int32 x, int32 y, int32 width, int32 height);
88 void clear(PixMap *pixels, int32 x, int32 y, int32 width, int32 height);
89 void copy(PixMap *src, PixMap *dst, int32 x, int32 y, int32 width, int32 height);
90 void goDissolve(int32 location, int32 width, int32 height, PixMap *buffer);
91 void bitBltSprite255(Sprite *sprite, PixMap *pixels);
92 void bitBltSprite128(Sprite *sprite, PixMap *pixels);
93 void bitBltSprite32(Sprite *sprite, PixMap *pixels);
94 void bitBltSprite16(Sprite *sprite, PixMap *pixels);
95 void bitBltSprite8(Sprite *sprite, PixMap *pixels);
96 void bitBltWane128(Sprite *sprite, PixMap *pixels);
97 void bitBltWane32(Sprite *sprite, PixMap *pixels);
98 void bitBltWane16(Sprite *sprite, PixMap *pixels);
99 void bitBltWane8(Sprite *sprite, PixMap *pixels);
100 void bitBltWax128(Sprite *sprite, PixMap *pixels);
101 void bitBltWax32(Sprite *sprite, PixMap *pixels);
102 void bitBltWax16(Sprite *sprite, PixMap *pixels);
103 void bitBltWax8(Sprite *sprite, PixMap *pixels);
104 void eraseSprite(byte *data);
105 void dissolve(int32 location, int32 width, int32 height, PixMap *buf);
106 void doErase(byte *data);
107
108 // PALETTE
109 void modifyPalette(uint16 *data, uint32 size);
110 int getGammaLevel();
111 void setGammaLevel(int level);
112 void initLuminosityValues(int16 rMask, int16 gMask, int16 bMask);
113 void initDecomp(PixMap *data, TBM *tbm);
114 void decompR(byte *data, int32 size);
115 void decompG(byte *data, int32 size);
116 void decompB(byte *data, int32 size);
117 bool decomp16(byte *data, int32 size);
118
119 // CURSOR HANDLING
120 void drawItem(int cursor, int32 x, int32 y);
121 void drawItemDim(int cursor, int32 x, int32 y, int brightness);
122 void drawMouse();
123 void storeMouse();
124 void restoreMouse();
125 void newMouseLoc();
126 void burstMouseArea(bool updateScreen = true);
127 void burstBox(int32 x, int32 y, int32 width, int32 height, bool updateScreen = true);
128 bool canDrawMouse();
129 void setMouseDrawable(bool drawable);
130
131protected:
132 LastExpressEngine *_engine = nullptr;
133 PixMap *_frontBuffer = nullptr;
134 PixMap *_backBuffer = nullptr;
135 PixMap _mouseBackBuffer[32 * 32];
136
137 byte *_backgroundCompBuffer = nullptr;
138 PixMap _subtitlesBackBuffer[36480];
139 Graphics::Surface _screenSurface;
140 bool _mainSurfaceIsInit = false;
141
142 TBM _renderBox1;
143 TBM _renderBox2;
144 int _gammaLevel = 3;
145 int32 _dissolveSteps = 3;
146
147 bool _luminosityIsInit = false;
148
149 uint16 _brightnessData[6] = {
150 0x0000, 0x7BDE, 0x739C,
151 0x6318, 0x4210, 0x0000
152 };
153
154 int16 _brightnessMaskedBits = 0;
155 int16 _brightnessUnmaskedBits = 0;
156
157 TBM *_bgDecompTargetRect = nullptr;
158 byte *_bgDecompOutBuffer = nullptr;
159 byte *_bgDecompOutBufferTemp = nullptr;
160 int32 _bgDecompFlags = 0;
161 byte _bgLastCompItem = 0;
162 int32 _bgOutChannelDataSizes[3] = { 0, 0, 0 };
163
164 // For the Wax&Wane compression
165 PixMap *_frameData = nullptr;
166 PixMap *_decompressedOffset = nullptr;
167 int _numBlanks = 0;
168
169 bool _disableCharacterDrawing = false;
170 bool _stepBGRecursionFlag = false;
171 bool _shouldDrawEggOrHourglass = false;
172
173 int32 _mouseScreenBufStart = 0;
174 TBM _mouseAreaRect = TBM(320, 240, 32, 32);
175 bool _canDrawMouse = false;
176
177 CursorHeader *_cursorsDataHeader = nullptr;
178 PixMap *_iconsBitmapData = nullptr;
179 uint8 _luminosityData[32 * 7] = {
180 0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 27, 28, 31,
181 0, 1, 2, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 29, 31,
182 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 31,
183 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
184 0, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 31,
185 0, 2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 29, 30, 31,
186 0, 3, 4, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 27, 27, 28, 29, 30, 30, 31
187 };
188};
189
190} // End of namespace LastExpress
191
192#endif // LASTEXPRESS_GRAPHICS_H
Definition: archive.h:77
Definition: fight.h:35
Definition: gold_archive.h:37
Definition: graphics.h:64
Definition: lastexpress.h:523
Definition: logic.h:51
Definition: memory.h:63
Definition: menu.h:37
Definition: nis.h:43
Definition: sprites.h:62
Definition: subtitle.h:57
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
Definition: archive.h:29
Definition: surface.h:67
Definition: graphics.h:54
Definition: lastexpress.h:159
Definition: graphics.h:31