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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
/* ScummVM - Scumm Interpreter
* Copyright (C) 2002-2006 The ScummVM project
*
* 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$
*
*/
#if !defined(SMUSH_PLAYER_H) && !defined(DISABLE_SCUMM_7_8)
#define SMUSH_PLAYER_H
#include "common/util.h"
#include "scumm/smush/chunk.h"
#include "scumm/smush/codec37.h"
#include "scumm/smush/codec47.h"
#include "scumm/sound.h"
namespace Scumm {
class ScummEngine_v7;
class SmushFont;
class SmushMixer;
class StringResource;
class SmushPlayer {
friend class Insane;
private:
ScummEngine_v7 *_vm;
int _version;
int32 _nbframes;
SmushMixer *_smixer;
int16 _deltaPal[0x300];
byte _pal[0x300];
StringResource *_strings;
Codec37Decoder _codec37;
Codec47Decoder _codec47;
FileChunk *_base;
byte *_frameBuffer;
byte *_specialBuffer;
Common::String _seekFile;
int32 _seekPos;
int32 _seekFrame;
bool _skipNext;
int32 _frame;
Audio::SoundHandle _IACTchannel;
Audio::AppendableAudioStream *_IACTstream;
Audio::SoundHandle _compressedFileSoundHandle;
bool _compressedFileMode;
Common::File _compressedFile;
byte _IACToutput[4096];
int32 _IACTpos;
bool _storeFrame;
bool _alreadyInit;
bool _initDone;
int _speed;
bool _outputSound;
bool _endOfFile;
byte *_dst;
bool _updateNeeded;
bool _warpNeeded;
int _palDirtyMin, _palDirtyMax;
int _warpX, _warpY;
int _warpButtons;
bool _insanity;
bool _middleAudio;
bool _skipPalette;
#ifdef _WIN32_WCE
bool _inTimer;
int16 _inTimerCount;
int16 _inTimerCountRedraw;
#endif
#ifdef __SYMBIAN32__
bool _closeOnTextTick;
#endif
public:
SmushPlayer(ScummEngine_v7 *scumm);
~SmushPlayer();
void pause();
void unpause();
void play(const char *filename, int32 speed, int32 offset = 0, int32 startFrame = 0);
void release();
void warpMouse(int x, int y, int buttons);
protected:
SmushFont *_sf[5];
int _width, _height;
int _origPitch, _origNumStrips;
bool _paused;
uint32 _pauseStartTime;
uint32 _pauseTime;
void insanity(bool);
void setPalette(const byte *palette);
void setPaletteValue(int n, byte r, byte g, byte b);
void setDirtyColors(int min, int max);
void seekSan(const char *file, int32 pos, int32 contFrame);
const char *getString(int id);
private:
void parseNextFrame();
void init(int32 spped);
void setupAnim(const char *file);
void updateScreen();
void tryCmpFile(const char *filename);
bool readString(const char *file);
void checkBlock(const Chunk &, Chunk::type, uint32 = 0);
void handleAnimHeader(Chunk &);
void handleFrame(Chunk &);
void handleNewPalette(Chunk &);
#ifdef USE_ZLIB
void handleZlibFrameObject(Chunk &b);
#endif
void handleFrameObject(Chunk &);
void handleSoundBuffer(int32, int32, int32, int32, int32, int32, Chunk &, int32);
void handleSoundFrame(Chunk &);
void handleStore(Chunk &);
void handleFetch(Chunk &);
void handleIACT(Chunk &);
void handleTextResource(Chunk &);
void handleDeltaPalette(Chunk &);
void readPalette(byte *, Chunk &);
void timerCallback();
};
} // End of namespace Scumm
#endif
|