ScummVM API documentation
seqfile.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  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, this code is also
23  * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24  * full text of the license.
25  *
26  */
27 
28 #ifndef GOB_PREGOB_SEQFILE_H
29 #define GOB_PREGOB_SEQFILE_H
30 
31 #include "common/system.h"
32 #include "common/array.h"
33 #include "common/list.h"
34 
35 #include "gob/util.h"
36 
37 namespace Common {
38  class String;
39  class SeekableReadStream;
40 }
41 
42 namespace Gob {
43 
44 class GobEngine;
45 
46 class DECFile;
47 class ANIFile;
48 class ANIObject;
49 
58 class SEQFile {
59 public:
60  SEQFile(GobEngine *vm, const Common::String &fileName);
61  virtual ~SEQFile();
62 
70  void play(bool abortable = true, uint16 endFrame = 0xFFFF, uint16 frameRate = 0);
71 
72 
73 protected:
74  GobEngine *_vm;
75 
76 
78  uint16 getFrame() const;
79 
81  void seekFrame(uint16 frame);
82 
84  uint addLoop(uint16 startFrame, uint16 endFrame, uint16 loopCount);
85 
87  void skipLoop(uint loopID);
88 
90  void delLoop(uint loopID);
91 
93  void abortPlay();
94 
96  virtual void handleFrameEvent();
98  virtual void handleInput(int16 key, int16 mouseX, int16 mouseY, MouseButtons mouseButtons);
99 
100 
101 private:
103  static const uint kObjectCount = 4;
104 
106  struct BackgroundKey {
107  uint16 frame;
108 
109  const DECFile *background;
110  };
111 
113  struct AnimationKey {
114  uint object;
115 
116  uint16 frame;
117 
118  const ANIFile *ani;
119 
120  uint16 animation;
121 
122  int16 x;
123  int16 y;
124 
125  int16 order;
126  };
127 
129  struct Object {
130  ANIObject *object;
131 
132  int16 order;
133  };
134 
136  struct Loop {
137  uint16 startFrame;
138  uint16 endFrame;
139 
140  uint16 loopCount;
141  uint16 currentLoop;
142 
143  bool empty;
144  };
145 
148 
151 
153 
154  typedef Common::Array<Loop> Loops;
155 
156 
157  uint16 _frame;
158  bool _abortPlay;
159 
160  uint16 _frameRate;
161 
162  Backgrounds _backgrounds;
163  Animations _animations;
164 
165  BackgroundKeys _bgKeys;
166  AnimationKeys _animKeys;
167 
168  Object _objects[kObjectCount];
169 
170  Loops _loops;
171 
173  bool _abortable;
174 
175 
176  // -- Loading helpers --
177 
178  void load(Common::SeekableReadStream &seq);
179 
180  const ANIFile *findANI(uint16 index, uint16 &animation);
181 
182  // -- Playback helpers --
183 
184  void playFrame();
185 
187  Objects getOrderedObjects();
188 
189  void clearAnims();
190  void drawAnims();
191 
193  void cleanLoops();
194 };
195 
196 } // End of namespace Gob
197 
198 #endif // GOB_PREGOB_SEQFILE_H
Definition: decfile.h:51
Definition: gob.h:163
Definition: str.h:59
Definition: aniobject.h:42
Definition: seqfile.h:58
Definition: list.h:44
Definition: stream.h:745
Definition: anifile.h:40
Definition: algorithm.h:29
Definition: anifile.h:53