ScummVM API documentation
nsp.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 DARKSEED_NSP_H
23#define DARKSEED_NSP_H
24
25#include "common/array.h"
26#include "common/path.h"
27#include "common/stream.h"
28#include "common/scummsys.h"
29#include "graphics/surface.h"
30
31namespace Darkseed {
32
33class Sprite {
34public:
35 uint16 _width;
36 uint16 _height;
37 uint16 _pitch;
39
40 Sprite(uint16 width, uint16 height, uint16 pitch);
41 bool loadData(Common::SeekableReadStream &readStream);
42 void draw(int x, int y, uint16 frameBottom = 0) const;
43 void draw(Graphics::Surface *dst, int x, int y, uint16 frameBottom = 0) const;
44 void drawScaled(int x, int y, int destWidth, int destHeight, bool flipX) const;
45
46private:
47 void clipToScreen(int x, int y, uint16 frameBottom, uint16 *clippedWidth, uint16 *clippedHeight) const;
48};
49
50class Obt {
51public:
52 uint8 _numFrames;
55 Common::Array<uint8> _frameNo;
56 Common::Array<uint8> _frameDuration;
57 Obt();
58 virtual ~Obt();
59};
60
61class Nsp {
63 Common::Array<Obt> _animations;
64
65public:
66 bool load(const Common::Path &filename);
67 bool containsSpriteAt(int index) const {
68 return (int)_frames.size() > index;
69 }
70 const Sprite &getSpriteAt(int index) const;
71 const Obt &getAnimAt(int index);
72 int16 getTotalAnim() const {
73 return (int16)_animations.size();
74 }
75 int16 getMaxSpriteWidth();
76
77private:
78 bool load(Common::SeekableReadStream &readStream);
79 bool loadObt(const Common::Path &filename);
80};
81
82} // namespace Darkseed
83
84#endif // DARKSEED_NSP_H
size_type size() const
Definition: array.h:316
Definition: path.h:52
Definition: stream.h:745
Definition: nsp.h:61
Definition: nsp.h:50
Definition: nsp.h:33
Definition: surface.h:67