ScummVM API documentation
sprites.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 CRYOMNI3D_SPRITES_H
23#define CRYOMNI3D_SPRITES_H
24
25#include "common/array.h"
26#include "common/str.h"
27
28#include "graphics/cursor.h"
29
30namespace Common {
31class ReadStream;
32}
33
34namespace Graphics {
35struct Surface;
36}
37
38namespace CryOmni3D {
39
40class Sprites {
41public:
42 Sprites();
43 virtual ~Sprites();
44
45 void loadSprites(Common::ReadStream &spr_fl);
46 void setupMapTable(const uint *table, uint size);
47
48 void setSpriteHotspot(uint spriteId, uint x, uint y);
49
50 void replaceSprite(uint oldSpriteId, uint newSpriteId);
51
52 uint getSpritesCount() const;
53
54 void replaceSpriteColor(uint spriteId, byte currentColor, byte newColor);
55
56 const Graphics::Surface &getSurface(uint spriteId) const;
57 const Graphics::Cursor &getCursor(uint spriteId) const;
58
59 uint revMapSpriteId(uint id) const;
60 uint calculateSpriteId(uint baseId, uint offset) const;
61
62 byte getKeyColor(uint spriteId) const { return 0; }
63
64private:
65 class CryoCursor : public Graphics::Cursor {
66 public:
67 uint16 getWidth() const override { return _width; }
68 uint16 getHeight() const override { return _height; }
69 uint16 getHotspotX() const override { return _offX; }
70 uint16 getHotspotY() const override { return _offY; }
71 byte getKeyColor() const override { return 0; }
72
73 const byte *getSurface() const override { return _data; }
74
75 const byte *getPalette() const override { return nullptr; }
76 byte getPaletteStartIndex() const override { return 0; }
77 uint16 getPaletteCount() const override { return 0; }
78
79 uint setup(uint16 width, uint16 height);
80
81 uint16 _width;
82 uint16 _height;
83 int16 _offX;
84 int16 _offY;
85 uint _constantId;
86
87 byte *_data;
88
89 uint refCnt;
90
91 CryoCursor();
92 ~CryoCursor() override;
93 };
94
95 // Pointer to avoid to mutate Sprites when asking for a cursor
96 Graphics::Surface *_surface;
99};
100
101} // End of namespace CryOmni3D
102
103#endif
Definition: stream.h:385
Definition: sprites.h:40
Definition: cursor.h:42
Definition: algorithm.h:29
Definition: cryomni3d.h:62
Definition: formatinfo.h:28
Definition: surface.h:67