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