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