ScummVM API documentation
video.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 PELROCK_VIDEO_H
23 #define PELROCK_VIDEO_H
24 
25 namespace Pelrock {
26 
27 struct ChunkHeader {
28  uint32 blockCount; // +0x00: Number of 0x5000-byte blocks
29  uint32 dataOffset; // +0x04: Varies by chunk type
30  byte chunkType; // +0x08: 1=RLE, 2=BlockCopy, 3=End, 4=Palette, 6=Special
31  // +0x0D: Frame data begins
32  byte *data;
33 };
34 
35 struct Effect {
36  uint16 startFrame;
37 };
38 
39 struct AudioEffect : Effect {
40  Common::String filename;
41 };
42 
43 struct Subtitle : Effect {
44  uint16 endFrame;
45  uint16 x;
46  uint16 y;
47  Common::String text;
48 };
49 
50 struct MusicEffect : Effect {
51  uint32 trackNumber;
52 };
53 
54 struct VoiceData {
55  uint32 offset;
56  uint32 length;
57 };
58 
59 static const uint32 chunkSize = 0x5000;
60 
61 static const int video_special_chars[] = {
62  0x83, // inverted ?
63  0x82, // inverted !
64  0xA5, // capital N tilde
65  0x80, // small n tilde
66  0x7F, // small u tilde
67  0x7E, // small o tilde
68  0x7D, // small i tilde
69  0x7C, // small e tilde
70  0x7B, // small a tilde
71 };
72 
73 class VideoManager {
74 public:
76  Graphics::Screen *screen,
77  PelrockEventManager *events,
78  ChronoManager *chrono,
79  LargeFont *largeFont,
80  DialogManager *dialog,
81  SoundManager *sound);
82  ~VideoManager();
83  void playIntro();
84 
85 private:
86  Graphics::Screen *_screen;
87  PelrockEventManager *_events;
88  ChronoManager *_chrono;
89  LargeFont *_largeFont;
90  DialogManager *_dialog;
91  SoundManager *_sound;
92  void loadPalette(ChunkHeader &chunk);
93  byte *decodeCopyBlock(byte *data, uint32 offset);
94  byte *decodeRLE(byte *data, size_t size, uint32 offset);
95  void readChunk(Common::SeekableReadStream &stream, ChunkHeader &chunk);
96  void processFrame(ChunkHeader &chunk, const int frameCount);
97  void presentFrame();
98  void initMetadata();
99  void readSubtitle(Common::File &metadataFile, Pelrock::Subtitle &subtitle);
100  Subtitle readSubtitle(Common::File &metadataFile);
101  MusicEffect readMusicEffect(Common::File &metadataFile);
102  AudioEffect readAudioEffect(Common::File &metadataFile);
103  byte decodeChar(byte c);
104  Subtitle *getSubtitleForFrame(uint16 frameNumber);
105  uint _currentSubtitleIndex = 0;
106  Graphics::Surface _videoSurface = Graphics::Surface();
108  Common::Array<ChunkHeader> _chunkBuffer;
109  Common::Array<Subtitle> _subtitles;
114  Common::File _introSndFile;
115 };
116 
117 } // End of namespace Pelrock
118 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: surface.h:67
Definition: video.h:43
Definition: array.h:52
Definition: events.h:28
Definition: actions.h:26
Definition: stream.h:745
Definition: screen.h:47
Definition: video.h:73
Definition: hashmap.h:85
Definition: file.h:47
Definition: video.h:35
Definition: video.h:50
Definition: video.h:27
Definition: video.h:54
Definition: dialog.h:76
Definition: sound.h:55
Definition: chrono.h:29
Definition: video.h:39
Definition: large_font.h:27