ScummVM API documentation
spriteinfo.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 DIRECTOR_SPRITEINFO_H
23 #define DIRECTOR_SPRITEINFO_H
24 
25 namespace Director {
26 
27 struct TweenInfo {
28  int32 curvature = 0;
29  int32 flags = 0;
30  int32 easeIn = 0;
31  int32 easeOut = 0;
32  int32 padding = 0;
33 
34  void read(Common::ReadStreamEndian &stream) {
35  curvature = (int32)stream.readUint32();
36  flags = (int32)stream.readUint32();
37  easeIn = (int32)stream.readUint32();
38  easeOut = (int32)stream.readUint32();
39  padding = (int32)stream.readUint32();
40  }
41 };
42 
43 struct SpriteInfo {
44  int32 startFrame = -1;
45  int32 endFrame = -1;
46  int32 xtraInfo = 0;
47  int32 flags = 0;
48  int32 channelNum = 0;
49  TweenInfo tweenInfo;
50 
51  Common::Array<int32> keyFrames;
52 
53  Common::String name; // Sits in a separate item
54 
55  void read(Common::ReadStreamEndian &stream) {
56  startFrame = (int32)stream.readUint32();
57  endFrame = (int32)stream.readUint32();
58  xtraInfo = (int32)stream.readUint32();
59  flags = (int32)stream.readUint32();
60  channelNum = (int32)stream.readUint32();
61  tweenInfo.read(stream);
62 
63  keyFrames.clear();
64  while (!stream.eos()) {
65  int32 frame = (int32)stream.readUint32();
66  if (stream.eos())
67  break;
68  keyFrames.push_back(frame);
69  }
70  }
71 
72  Common::String toString() const {
74  s += Common::String::format("startFrame: %d, endFrame: %d, xtraInfo: %d, flags: 0x%x, channelNum: %d\n",
75  startFrame, endFrame, xtraInfo, flags, channelNum);
76  s += Common::String::format(" tweenInfo: curvature: %d, flags: 0x%x, easeIn: %d, easeOut: %d\n",
77  tweenInfo.curvature, tweenInfo.flags, tweenInfo.easeIn, tweenInfo.easeOut);
78  s += Common::String::format(" name: '%s'\n", name.c_str());
79  s += " keyFrames: ";
80  for (size_t i = 0; i < keyFrames.size(); i++) {
81  s += Common::String::format("%d ", keyFrames[i]);
82  }
83  return s;
84  }
85 };
86 
88  CastMemberID memberID;
89  int32 initializerIndex = 0;
90  Common::String initializerParams;
91 
92  void read(Common::ReadStreamEndian &stream) {
93  memberID.castLib = (int16)stream.readUint16();
94  memberID.member = (int16)stream.readUint16();
95  initializerIndex = (int32)stream.readUint32();
96  }
97 
98  Common::String toString() const {
100  s += Common::String::format("memberID: %s, initializerIndex: %d, initializerParams: '%s'",
101  memberID.asString().c_str(), initializerIndex, initializerParams.c_str());
102  return s;
103  }
104 };
105 
106 } // End of namespace Director
107 
108 #endif
Definition: stream.h:854
Definition: str.h:59
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
virtual bool eos() const =0
void clear()
Definition: array.h:323
Definition: spriteinfo.h:87
Definition: archive.h:36
void push_back(const T &element)
Definition: array.h:183
uint32 readUint32()
Definition: stream.h:883
Definition: spriteinfo.h:27
uint16 readUint16()
Definition: stream.h:874
size_type size() const
Definition: array.h:318
Definition: spriteinfo.h:43
Definition: types.h:411