ScummVM API documentation
cup_player_he.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
23#if !defined(SCUMM_HE_CUP_PLAYER_HE_H) && defined(ENABLE_HE)
24#define SCUMM_HE_CUP_PLAYER_HE_H
25
26#include "common/stream.h"
27
28namespace Scumm {
29
30struct CUP_Sfx {
31 int16 num;
32 uint32 flags;
33};
34
35struct CUP_SfxChannel {
36 Audio::SoundHandle handle;
37 int16 sfxNum;
38 uint32 flags;
39};
40
41class CUP_Player {
42public:
43
44 enum {
45 kSfxFlagLoop = 1 << 0,
46 kSfxFlagRestart = 1 << 1
47 };
48
49 enum {
50 kSfxChannels = 8,
51 kSfxQueueSize = 16,
52 kDefaultPlaybackRate = 66,
53 kDefaultVideoWidth = 640,
54 kDefaultVideoHeight = 480
55 };
56
57 CUP_Player(OSystem *sys, ScummEngine_vCUPhe *vm, Audio::Mixer *mixer);
58
59 bool open(const char *filename);
60 void close();
61 void play();
62 void copyRectToScreen(const Common::Rect &r);
63 void updateScreen();
64 void updateSfx();
65 void waitForSfxChannel(int channel);
66 bool parseNextHeaderTag(Common::SeekableReadStream &dataStream);
67 bool parseNextBlockTag(Common::SeekableReadStream &dataStream);
68 void handleHEAD(Common::SeekableReadStream &dataStream, uint32 dataSize);
69 void handleSFXB(Common::SeekableReadStream &dataStream, uint32 dataSize);
70 void handleRGBS(Common::SeekableReadStream &dataStream, uint32 dataSize);
71 void handleFRAM(Common::SeekableReadStream &dataStream, uint32 dataSize);
72 void handleSRLE(Common::SeekableReadStream &dataStream, uint32 dataSize);
73 bool handleLZSS(Common::SeekableReadStream &dataStream, uint32 dataSize);
74 void handleRATE(Common::SeekableReadStream &dataStream, uint32 dataSize);
75 void handleSNDE(Common::SeekableReadStream &dataStream, uint32 dataSize);
76 void handleTOIL(Common::SeekableReadStream &dataStream, uint32 dataSize);
77
78protected:
79
80 ScummEngine_vCUPhe *_vm;
81 Audio::Mixer *_mixer;
82 OSystem *_system;
83
84 Common::File _fileStream;
85
86 int _playbackRate = 0;
87 int _width = 0, _height = 0;
88
89 uint8 _paletteData[256 * 3] = {};
90 bool _paletteChanged = false;
91 uint8 *_offscreenBuffer = nullptr;
92
93 uint8 *_inLzssBufData = nullptr;
94 uint32 _inLzssBufSize = 0;
95 uint8 *_outLzssBufData = nullptr;
96 uint32 _outLzssBufSize = 0;
97
98 uint32 _dataSize = 0;
99
100 int _sfxCount = 0;
101 uint8 *_sfxBuffer = nullptr;
102 CUP_SfxChannel _sfxChannels[kSfxChannels] = {};
103 CUP_Sfx _sfxQueue[kSfxQueueSize] = {};
104 int _sfxQueuePos = 0;
105 int _lastSfxChannel = 0;
106};
107
108} // End of namespace Scumm
109
110#endif
Definition: mixer.h:70
Definition: mixer.h:49
Definition: file.h:47
Definition: stream.h:745
Definition: system.h:166
Definition: actor.h:30
Definition: rect.h:536