ScummVM API documentation
dungeon_pictures.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 ULTIMA2_GFX_DUNGEON_PICTURES_H
23#define ULTIMA2_GFX_DUNGEON_PICTURES_H
24
25#include "graphics/palette.h"
26#include "graphics/views/gfx_surface.h"
27#include "ultima/ultima2/data/data.h"
28
29namespace Ultima {
30namespace Ultima2 {
31namespace Gfx {
32
40public:
41 enum Kind {
42 FRONT, LEFT, RIGHT, LEFT_OPEN, RIGHT_OPEN, FRONT_DOOR, LEFT_DOOR, RIGHT_DOOR,
43 LADDER_UP, LADDER_DOWN, CHEST, KIND_COUNT
44 };
45
46 static constexpr int DEPTHS = 8;
47 static constexpr int MONSTER_TYPES = 8;
48
52 static constexpr int PALETTE_BASE = 48;
53
54private:
55 // Plain data, so that the static pictures need no constructors
56 struct Picture {
57 int16 _left, _top, _width, _height;
58 byte *_pixels;
59
60 bool isPresent() const {
61 return _pixels != nullptr;
62 }
63 };
64
65 static Picture _pictures[KIND_COUNT][DEPTHS];
66 static Picture _doorway;
67 static Picture _monsters[MONSTER_TYPES][DEPTHS];
68 static bool _enabled;
69 static bool _loaded;
70 static bool _paletteLoaded;
71 static byte _inverse[256];
72
73 static void freePictures();
74 static bool loadPicture(Picture &picture, const Common::String &name);
75 static void draw(Graphics::Views::GfxSurface &s, const Picture &picture, int offset);
76
77public:
81 static void setEnabled(bool enabled) {
82 _enabled = enabled;
83 }
84
88 static bool isActive();
89
93 static void load();
94
98 static void unload();
99
104 static void loadPalette(Graphics::Palette &palette);
105
110 static bool draw(Graphics::Views::GfxSurface &s, Kind kind, int depth, int offset);
111
115 static bool drawDoorway(Graphics::Views::GfxSurface &s, int offset);
116
121 static bool drawMonster(Graphics::Views::GfxSurface &s, int type, int depth, int offset);
122
126 static byte invert(byte color);
127};
128
129} // namespace Gfx
130} // namespace Ultima2
131} // namespace Ultima
132
133#endif
Definition: str.h:59
Simple class for handling a palette data.
Definition: palette.h:61
Definition: gfx_surface.h:34
Definition: dungeon_pictures.h:39
static constexpr int PALETTE_BASE
Definition: dungeon_pictures.h:52
static bool draw(Graphics::Views::GfxSurface &s, Kind kind, int depth, int offset)
static void setEnabled(bool enabled)
Definition: dungeon_pictures.h:81
static void loadPalette(Graphics::Palette &palette)
static bool drawDoorway(Graphics::Views::GfxSurface &s, int offset)
static byte invert(byte color)
static bool drawMonster(Graphics::Views::GfxSurface &s, int type, int depth, int offset)