ScummVM API documentation
anim.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 CINE_ANIM_H
23 #define CINE_ANIM_H
24 
25 #include "common/endian.h"
26 
27 #include "cine/saveload.h"
28 
29 namespace Cine {
30 
31 // Size of AnimHeaderStruct payload in bytes
32 #define ANIM_HEADER_SIZE 0x16
33 
35  char idString[4];
36  int16 frameWidth;
37  int16 frameHeight;
38  byte field_8;
39  byte field_9;
40  byte field_A;
41  byte field_B;
42  byte field_C;
43  byte field_D;
44  int16 numFrames;
45  byte field_10;
46  byte field_11;
47  byte field_12;
48  byte field_13;
49  uint16 field_14;
50 };
51 
52 struct AnimDataEntry {
53  char name[9];
54  byte color;
55 };
56 
58  char from[9];
59  char to[9];
60 };
61 
62 #define ANIM_RAW 0 // memcpy
63 #define ANIM_MASK 1 // convertMask
64 #define ANIM_SPRITE 2 // gfxConvertSpriteToRaw
65 #define ANIM_MASKSPRITE 3 // gfxConvertSpriteToRaw + generateMask
66 #define ANIM_PALSPRITE 5 // convert8BBP
67 #define ANIM_FULLSPRITE 8 // convert8BBP2
68 
69 class AnimData {
70 private:
71  byte *_data;
72  byte *_mask;
73  int16 _fileIdx;
74  int16 _frameIdx;
75  char _name[10];
76  int _size;
77 
78 public:
79  uint16 _width;
80  uint16 _height;
81  uint16 _bpp;
82  uint16 _var1;
83  int _realWidth;
84 
85  AnimData();
86  AnimData(const AnimData &src);
87  ~AnimData();
88 
89  AnimData &operator=(const AnimData &src);
90 
91  int size() { return _size; }
92  int16 frameIndex() { return _frameIdx; }
93  const byte *data() const { return _data; }
94  const byte *mask() const { return _mask; }
95  byte getColor(int x, int y);
96 
97  void load(byte *d, int type, uint16 w, uint16 h, int16 file, int16 frame, const char *n, byte transparent = 0);
98  void clear();
99 
100  void save(Common::OutSaveFile &fHandle) const;
101 };
102 
103 #define NUM_MAX_ANIMDATA 255
104 
105 void freeAnimDataTable();
106 void freeAnimDataRange(byte startIdx, byte numIdx);
107 int loadResource(const char *resourceName, int16 idx = -1, int16 frameIndex = -1);
108 void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGameFormat saveGameFormat);
109 void generateMask(const byte *sprite, byte *mask, uint16 size, byte transparency);
110 
111 } // End of namespace Cine
112 
113 #endif
uint16 _width
Image width (usually twice the real size)
Definition: anim.h:79
const byte * data() const
Image data.
Definition: anim.h:93
Definition: anim.h:57
Definition: savefile.h:54
Definition: anim.h:29
Definition: stream.h:745
int _realWidth
Real image width in bytes.
Definition: anim.h:83
const byte * mask() const
Image mask (may be NULL)
Definition: anim.h:94
Definition: anim.h:34
uint16 _var1
Something related to width.
Definition: anim.h:82
uint16 _height
Image height.
Definition: anim.h:80
Definition: anim.h:52
uint16 _bpp
Bit depth/type information.
Definition: anim.h:81
CineSaveGameFormat
Definition: saveload.h:63
Definition: anim.h:69