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/*
23 * This code is based on the original source code of Lord Avalot d'Argent version 1.3.
24 * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
25 */
26
27#ifndef AVALANCHE_GRAPHICS_H
28#define AVALANCHE_GRAPHICS_H
29
30#include "avalanche/enums.h"
31
32#include "common/file.h"
33#include "common/rect.h"
34#include "graphics/surface.h"
35
36namespace Avalanche {
37class AvalancheEngine;
38class AnimationType;
39struct SpriteType;
40struct ChunkBlock;
41
42typedef byte FontType[256][16];
43typedef byte ManiType[2049];
44typedef byte SilType[51][11]; // 35, 4
45
47 int16 _horizontal, _vertical;
48};
49
51public:
52 static const MouseHotspotType kMouseHotSpots[9];
53 Color _talkBackgroundColor, _talkFontColor;
54
57 void init();
58 void loadDigits();
59 void loadMouse(byte which);
60
61 void drawRectangle(Common::Rect rect, Color color);
62 void drawFilledRectangle(Common::Rect rect, Color color);
63 void blackOutScreen();
64 void drawDot(int x, int y, Color color);
65 void drawLine(int x1, int y1, int x2, int y2, int penX, int penY, Color color);
66 Common::Point drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
67 void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
68 void drawTriangle(Common::Point *p, Color color);
69 void drawNormalText(const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
70 void drawScrollText(const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
71 void drawDigit(int index, int x, int y);
72 void drawDirection(int index, int x, int y);
73 void drawScrollShadow(int16 x1, int16 y1, int16 x2, int16 y2);
74 void drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String text);
75 void drawScroll(int mx, int lx, int my, int ly);
76 void drawMenuBar(Color color);
77 void drawSpeedBar(int speed);
78 void drawBackgroundSprite(int16 x, int16 y, SpriteType &sprite);
79 void drawMenuBlock(int x1, int y1, int x2, int y2, Color color);
80 void drawMenuItem(int x1, int y1, int x2, int y2);
81 void wipeChar(int x, int y, Color color);
82 void drawChar(byte ander, int x, int y, Color color);
83 void drawDebugLines();
84
85 // For the mini-game "Nim".
86 void nimLoad();
87 void nimDrawStone(int x, int y);
88 void nimDrawInitials();
89 void nimDrawLogo();
90 void nimFree();
91
92 // Used in wobble()
93 void shiftScreen();
94
95 // Used in winning()
96 void drawWinningPic();
97
98 /*
99 * Used in quitting(), the parameter is to accept different numbers (representing different scenarios). I put it here to
100 * preserve some of the multi-purpose functionality of the original function.
101 */
102
103 void drawQuittingPic();
104
105 // Ghostroom's functions:
106 void ghostDrawMonster(byte ***picture, uint16 destX, int16 destY, MonsterType type);
107 Graphics::Surface ghostLoadPicture(Common::File &file, Common::Point &coord);
108 void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY);
109 void ghostDrawBackgroundItems(Common::File &file);
110
111 // Help's function:
112 void helpDrawButton(int y, byte which);
113 void helpDrawHighlight(byte which, Color color);
114 void helpDrawBigText(const Common::String &text, int16 x, int16 y, Color color);
115
116 // Shoot em' up's functions:
117 void seuDrawTitle();
118 void seuLoad();
119 void seuFree();
120 void seuDrawPicture(int x, int y, byte which);
121 void seuDrawCameo(int destX, int destY, byte w1, byte w2);
122 uint16 seuGetPicWidth(int which);
123 uint16 seuGetPicHeight(int which);
124
125 // Main Menu's functions:
126 // The main menu uses a different screen height (350) from the game itself (200 * 2)
127 // so it needs it's own graphic functions on that matter.
128 void menuRefreshScreen();
129 void menuInitialize();
130 void menuFree();
131 void menuRestoreScreen();
132 void menuLoadPictures();
133 void menuDrawBigText(FontType font, uint16 x, uint16 y, Common::String text, Color color);
134
135 void clearAlso();
136 void clearTextBar();
137 void setAlsoLine(int x1, int y1, int x2, int y2, Color color);
138 byte getAlsoColor(int x1, int y1, int x2, int y2);
139 byte getScreenColor(Common::Point pos);
140
141 // Further information about this: https://moddingwiki.shikadi.net/wiki/Raw_EGA_data
142 Graphics::Surface loadPictureRaw(Common::File &file, uint16 width, uint16 height);
143
144 void drawSprite(AnimationType *sprite, byte picnum, int16 x, int16 y);
145 void drawThinkPic(const Common::Path &filename, int id);
146 void drawToolbar();
147 void drawCursor(byte pos);
148 void drawReadyLight(Color color);
149 void drawSoundLight(bool state);
150 void drawErrorLight(bool state);
151 void drawSign(Common::String name, int16 xl, int16 yl, int16 y);
152 void drawIcon(int16 x, int16 y, byte which);
153 void drawScreenLine(int16 x, int16 y, int16 x2, int16 y2, Color color);
154 void prepareBubble(int xc, int xw, int my, Common::Point points[3]);
155 void refreshScreen();
156 void loadBackground(Common::File &file);
157 void refreshBackground();
158 void setBackgroundColor(Color newColor);
159 void setDialogColor(Color bg, Color text);
160
161 void zoomOut(int16 x, int16 y);
162 void showScroll();
163 void getNaturalPicture(SpriteType &sprite);
164
165 void saveScreen();
166 void restoreScreen();
167 void removeBackup();
168
169 Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data.
170 void drawPicture(Graphics::Surface &target, const Graphics::Surface &picture, uint16 destX, uint16 destY);
171 // Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc.
172 // Returns the end point of the arc. (Needed in Clock.)
173 Common::Point drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
174 void drawText(Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
175
176 Graphics::Surface &getSurface() { return _surface; }
177 Graphics::Surface &getMenuSurface() { return _menu; }
178
179private:
180 static const int16 kMouseSize = 134;
181 static const uint16 kBackgroundWidth = kScreenWidth;
182 static const byte kEgaPaletteIndex[16];
183 static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151.
184 // The 8 = number of bits in a byte, and 12080 comes from Lucerna::load().
185 static const uint16 kMenuScreenHeight = 350;
186
187 Graphics::Surface _background;
188 Graphics::Surface _backup;
189 Graphics::Surface _digits[10]; // digitsize and rwlitesize are defined in loadDigits() !!!
190 Graphics::Surface _directions[9]; // Maybe it will be needed to move them to the class itself instead.
191 Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/marnanel/avalot/wiki/Also
192 Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.)
193 Graphics::Surface _scrolls;
194 Graphics::Surface _surface;
195 Graphics::Surface _menu;
196
197 // For the mini-game "Nim".
198 Graphics::Surface _nimStone;
199 Graphics::Surface _nimInitials[3];
200 Graphics::Surface _nimLogo;
201
202 // For the mini-game "Shoot em' up".
203 Graphics::Surface _seuPictures[99];
204
205 byte _egaPalette[64][3];
206
207 AvalancheEngine *_vm;
208
209 void skipDifference(int size, const Graphics::Surface &picture, Common::File &file);
210
211 // Further information about these two: https://moddingwiki.shikadi.net/wiki/Raw_EGA_data
212 Graphics::Surface loadPictureSign(Common::File &file, uint16 width, uint16 height); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim.
213
214 void drawBigText(Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
215};
216
217} // End of namespace Avalanche
218
219#endif // AVALANCHE_GRAPHICS_H
Definition: animation.h:42
Definition: avalanche.h:78
Definition: graphics.h:50
Definition: file.h:47
Definition: path.h:52
Definition: str.h:59
Definition: graphics.h:46
Definition: background.h:39
Definition: rect.h:144
Definition: rect.h:536
Definition: surface.h:67