1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*
*/
#ifndef LASTEXPRESS_ANIMATION_H
#define LASTEXPRESS_ANIMATION_H
/*
Animation format (.NIS)
uint32 {4} - Number of chunks
// for each chunk
uint16 {2} - Type
uint16 {2} - Tag
uint32 {4} - Size of chunk
byte {x} - Data (for "data" chunks: backgrounds, overlay & audio data)
*/
#include "lastexpress/drawable.h"
#include "common/array.h"
namespace Common {
class SeekableReadStream;
}
namespace LastExpress {
class AnimFrame;
class AppendableSound;
class Animation : public Drawable {
public:
enum FlagType {
kFlagDefault = 16384,
kFlagProcess = 49152
};
Animation();
~Animation();
bool load(Common::SeekableReadStream *stream, int flag = kFlagDefault);
bool process();
bool hasEnded();
Common::Rect draw(Graphics::Surface *surface);
void play();
private:
static const uint32 _soundBlockSize = 739;
// despite their size field, info chunks don't have a payload
enum ChunkType {
kChunkTypeNone = 0,
kChunkTypeUnknown1 = 1,
kChunkTypeUnknown2 = 2,
kChunkTypeAudioInfo = 3,
kChunkTypeUnknown4 = 4,
kChunkTypeUnknown5 = 5,
kChunkTypeBackground1 = 10,
kChunkTypeSelectBackground1 = 11,
kChunkTypeBackground2 = 12,
kChunkTypeSelectBackground2 = 13,
kChunkTypeOverlay = 20,
kChunkTypeUpdate = 21,
kChunkTypeUpdateTransition = 22,
kChunkTypeSound1 = 30,
kChunkTypeSound2 = 31,
kChunkTypeAudioData = 32,
kChunkTypeAudioEnd = 99
};
struct Chunk {
ChunkType type;
uint16 frame;
uint32 size;
Chunk() {
type = kChunkTypeNone;
frame = 0;
size = 0;
}
};
void reset();
AnimFrame *processChunkFrame(Common::SeekableReadStream *in, const Chunk &c) const;
void processChunkAudio(Common::SeekableReadStream *in, const Chunk &c);
Common::SeekableReadStream *_stream;
Common::Array<Chunk> _chunks;
Common::Array<Chunk>::iterator _currentChunk;
AnimFrame *_overlay, *_background1, *_background2;
byte _backgroundCurrent;
AppendableSound *_audio;
uint32 _startTime;
bool _changed;
int _flag;
};
} // End of namespace LastExpress
#endif // LASTEXPRESS_ANIMATION_H
|