ScummVM API documentation
cmpfile.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 * This file is dual-licensed.
22 * In addition to the GPLv3 license mentioned above, this code is also
23 * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24 * full text of the license.
25 *
26 */
27
28#ifndef GOB_CMPFILE_H
29#define GOB_CMPFILE_H
30
31#include "common/system.h"
32#include "common/array.h"
33
34namespace Common {
35 class String;
36 class SeekableReadStream;
37}
38
39namespace Gob {
40
41class GobEngine;
42class Surface;
43class RXYFile;
44
49class CMPFile {
50public:
51 CMPFile(GobEngine *vm, const Common::String &baseName,
52 uint16 width, uint16 height, uint8 bpp = 1);
53 CMPFile(GobEngine *vm, const Common::String &cmpFile, const Common::String &rxyFile,
54 uint16 width, uint16 height, uint8 bpp = 1);
56 uint16 width, uint16 height, uint8 bpp = 1);
58 uint16 width, uint16 height, uint8 bpp = 1);
59 ~CMPFile();
60
61 bool empty() const;
62
63 uint16 getSpriteCount() const;
64
65 bool getCoordinates(uint16 sprite, uint16 &left, uint16 &top, uint16 &right, uint16 &bottom) const;
66
67 uint16 getWidth (uint16 sprite) const;
68 uint16 getHeight(uint16 sprite) const;
69
70 void getMaxSize(uint16 &width, uint16 &height) const;
71
72 void draw(Surface &dest, uint16 sprite, uint16 x, uint16 y, int32 transp = -1) const;
73 void draw(Surface &dest, uint16 left, uint16 top, uint16 right, uint16 bottom,
74 uint16 x, uint16 y, int32 transp = -1) const;
75
76 uint16 addSprite(uint16 left, uint16 top, uint16 right, uint16 bottom);
77
78 void recolor(uint8 from, uint8 to);
79
80private:
81 GobEngine *_vm;
82
83 uint16 _width;
84 uint16 _height;
85 uint16 _bpp;
86
87 uint16 _maxWidth;
88 uint16 _maxHeight;
89
90 Surface *_surface;
91 RXYFile *_coordinates;
92
93 void loadCMP(const Common::String &cmp);
94 void loadRXY(const Common::String &rxy);
95
96 void loadCMP(Common::SeekableReadStream &cmp);
97 void loadRXY(Common::SeekableReadStream &rxy);
98
99 void createRXY();
100 void createSurface();
101};
102
103} // End of namespace Gob
104
105#endif // GOB_CMPFILE_H
Definition: stream.h:745
Definition: str.h:59
Definition: cmpfile.h:49
Definition: gob.h:166
Definition: rxyfile.h:45
Definition: surface.h:106
Definition: algorithm.h:29