ScummVM API documentation
tileanim.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 ULTIMA4_MAP_TILEANIM_H
23#define ULTIMA4_MAP_TILEANIM_H
24
25#include "ultima/ultima4/map/direction.h"
26
27namespace Ultima {
28namespace Ultima4 {
29
30class ConfigElement;
31class Image;
32class Tile;
33struct RGBA;
34
39public:
40 static TileAnimTransform *create(const ConfigElement &config);
41
45 static RGBA *loadColorFromConf(const ConfigElement &conf);
46
47 virtual void draw(Image *dest, Tile *tile, MapTile &mapTile) = 0;
48 virtual ~TileAnimTransform() {}
49 virtual bool drawsTile() const = 0;
50
51 // Properties
52 int _random;
53};
54
60public:
61 TileAnimInvertTransform(int xp, int yp, int width, int height);
62 void draw(Image *dest, Tile *tile, MapTile &mapTile) override;
63 bool drawsTile() const override;
64
65private:
66 int x, y, w, h;
67};
68
75public:
76 TileAnimPixelTransform(int xp, int yp);
77 void draw(Image *dest, Tile *tile, MapTile &mapTile) override;
78 bool drawsTile() const override;
79
80 int x, y;
82};
83
89public:
90 TileAnimScrollTransform(int increment);
91 void draw(Image *dest, Tile *tile, MapTile &mapTile) override;
92 bool drawsTile() const override;
93private:
94 int _increment, _current, _lastOffset;
95};
96
102public:
103 TileAnimFrameTransform() : _currentFrame(0) {
104 }
105 void draw(Image *dest, Tile *tile, MapTile &mapTile) override;
106
110 bool drawsTile() const override;
111protected:
112 int _currentFrame;
113};
114
121public:
122 TileAnimPixelColorTransform(int xp, int yp, int width, int height);
124
125 void draw(Image *dest, Tile *tile, MapTile &mapTile) override;
126 bool drawsTile() const override;
127
128 int x, y, w, h;
129 RGBA *_start, *_end;
130};
131
136public:
138 typedef enum {
139 FRAME,
140 DIR
141 } Type;
142
146 static TileAnimContext *create(const ConfigElement &config);
147
152 virtual bool isInContext(Tile *t, MapTile &mapTile, Direction d) = 0;
154 return _animTransforms;
155 }
156 virtual ~TileAnimContext() {}
157private:
158
159 TileAnimTransformList _animTransforms;
160};
161
166public:
171 bool isInContext(Tile *t, MapTile &mapTile, Direction d) override;
172
173private:
174 int _frame;
175};
176
181public:
186 bool isInContext(Tile *t, MapTile &mapTile, Direction d) override;
187
188private:
189 Direction _dir;
190};
191
197class TileAnim {
198public:
199 TileAnim(const ConfigElement &conf);
200 ~TileAnim();
201
202 Common::String _name;
205
206 /* returns the frame to set the mapTile to (only relevant if persistent) */
207 void draw(Image *dest, Tile *tile, MapTile &mapTile, Direction dir);
208
209 int _random; /* true if the tile animation occurs randomely */
210};
211
218
219public:
220 TileAnimSet(const ConfigElement &conf);
221 ~TileAnimSet();
222
227
228 Common::String _name;
229 TileAnimMap _tileAnims;
230};
231
232} // End of namespace Ultima4
233} // End of namespace Ultima
234
235#endif
Definition: array.h:52
Definition: str.h:59
Definition: config.h:126
Definition: image.h:65
Definition: map_tile.h:34
Definition: tileanim.h:135
static TileAnimContext * create(const ConfigElement &config)
TileAnimTransformList & getTransforms()
Definition: tileanim.h:153
void add(TileAnimTransform *)
Definition: tileanim.h:165
Definition: tileanim.h:101
Definition: tileanim.h:197
Definition: tileanim.h:216
TileAnim * getByName(const Common::String &name)
Definition: tileanim.h:38
static RGBA * loadColorFromConf(const ConfigElement &conf)
Definition: tile.h:64
Definition: image.h:36