ScummVM API documentation
assets.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 MADS_ASSETS_H
23 #define MADS_ASSETS_H
24 
25 #include "common/array.h"
26 #include "common/path.h"
27 #include "mads/palette.h"
28 
29 namespace MADS {
30 
31 enum AssetFlags {
32  ASSET_TRANSLATE = 1, ASSET_HEADER_ONLY = 2, ASSET_CHAR_INFO = 4,
33  ASSET_SPINNING_OBJECT = 8
34 };
35 
36 class MADSEngine;
37 class MSprite;
38 class MSurface;
39 
41  uint32 _stream;
42  Common::Rect _bounds;
43  uint32 _comp;
44  MSprite *_frame;
45 };
46 
48 public:
50 
51  int _totalFrames;
52  int _numEntries;
53  int _startFrames[16];
54  int _stopFrames[16];
55  int _ticksList[16];
56  int _velocity;
57  int _ticksAmount;
58  int _centerOfGravity;
59 };
60 
61 class SpriteAsset {
62 private:
63  MADSEngine *_vm;
64  byte _palette[PALETTE_SIZE];
65  int _colorCount;
66  uint32 _srcSize;
67  int _frameRate, _pixelSpeed;
68  int _maxWidth, _maxHeight;
69  int _frameCount;
70  Common::Array<uint32> _frameOffsets;
72  uint8 _mode;
73  bool _isBackground;
74 
78  void load(Common::SeekableReadStream *stream, int flags);
79 
80 public:
81  SpriteSetCharInfo *_charInfo;
82  int _usageIndex;
83 
87  SpriteAsset(MADSEngine *vm, const Common::Path &resourceName, int flags);
88 
92  SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int flags);
93 
97  ~SpriteAsset();
98 
99  int getCount() { return _frameCount; }
100  int getFrameRate() const { return _frameRate; }
101  int getPixelSpeed() const { return _pixelSpeed; }
102  Common::Point getFramePos(int index) { assert (index < _frameCount); return Common::Point(_frames[index]._bounds.left, _frames[index]._bounds.top); }
103  int getFrameWidth(int index) { assert (index < _frameCount); return _frames[index]._bounds.width(); }
104  int getFrameHeight(int index) { assert (index < _frameCount); return _frames[index]._bounds.height(); }
105  int getMaxFrameWidth() const { return _maxWidth; }
106  int getMaxFrameHeight() const { return _maxHeight; }
107  MSprite *getFrame(int frameIndex);
108  byte *getPalette() { return _palette; }
109  int getColorCount() { return _colorCount; }
110  bool isBackground() const { return _isBackground; }
111 };
112 
113 } // End of namespace MADS
114 
115 #endif /* MADS_ASSETS_H */
Definition: assets.h:47
Definition: rect.h:144
Definition: path.h:52
Definition: stream.h:745
Definition: assets.h:40
Definition: rect.h:45
Definition: mads.h:87
Definition: assets.h:61
Definition: action.h:28
Definition: sprites.h:109