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