ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
roq.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 GROOVIE_VIDEO_ROQ_H
23 #define GROOVIE_VIDEO_ROQ_H
24 
25 #include "groovie/video/player.h"
26 #include "audio/mixer.h"
27 
28 namespace Video {
29 class VideoDecoder;
30 }
31 
32 namespace Groovie {
33 
34 class GroovieEngine;
35 
37  uint16 type;
38  uint32 size;
39  uint16 param;
40 };
41 
42 class ROQPlayer : public VideoPlayer {
43 public:
45  ~ROQPlayer();
46  void setOrigin(int16 x, int16 y) override;
47 
48  Audio::SoundHandle getSoundHandle() {
49  return _soundHandle;
50  }
51 
52  void drawString(Graphics::Surface *surface, const Common::String text, int posx, int posy, uint32 color, bool blackBackground) override;
53  void copyfgtobg(uint8 arg) override;
54 
55  bool isFileHandled() override { return _isFileHandled; }
56 
57 protected:
58  void waitFrame() override;
59  uint16 loadInternal() override;
60  bool playFrameInternal() override;
61  void stopAudioStream() override;
62  virtual void createAudioStream(bool stereo);
63 
64  Audio::SoundHandle _soundHandle;
65  Graphics::Surface *_bg, *_screen, *_overBuf;
66  Graphics::Surface *_currBuf, *_prevBuf;
67 
68 private:
69  bool readBlockHeader(ROQBlockHeader &blockHeader);
70 
71  bool processBlock();
72  bool processBlockInfo(ROQBlockHeader &blockHeader);
73  bool processBlockQuadCodebook(ROQBlockHeader &blockHeader);
74  bool processBlockQuadVector(ROQBlockHeader &blockHeader);
75  void processBlockQuadVectorBlock(int baseX, int baseY);
76  void processBlockQuadVectorBlockSub(int baseX, int baseY);
77  bool processBlockStill(ROQBlockHeader &blockHeader);
78  bool processBlockSoundMono(ROQBlockHeader &blockHeader);
79  bool processBlockSoundStereo(ROQBlockHeader &blockHeader);
80  bool processBlockAudioContainer(ROQBlockHeader &blockHeader);
81  bool playFirstFrame() { return _flagNoPlay; }; // _alpha && !_flagOverlay; }
82  void clearOverlay();
83  void dumpAllSurfaces(const Common::String funcname);
84 
85  void paint2(byte i, int destx, int desty);
86  void paint4(byte i, int destx, int desty);
87  void paint8(byte i, int destx, int desty);
88  void copy(byte size, int destx, int desty, int dx, int dy);
89 
90  // Origin
91  int16 _origX, _origY;
92  //int16 _screenOffset;
93  void calcStartStop(int &start, int &stop, int origin, int length);
94 
95  // Block coding type
96  byte getCodingType();
97  uint16 _codingType;
98  byte _codingTypeCount;
99 
100  // Codebooks
101  uint16 _num2blocks;
102  uint16 _num4blocks;
103  uint32 _codebook2[256 * 4];
104  byte _codebook4[256 * 4];
105 
106  // Flags
107  bool _flagNoPlay;
108  bool _flagOverlay;
109  bool _altMotionDecoder; // Some ROQ vids use a variation on the copy codeblock
110  bool _flagMasked;
111 
112  // Buffers
113  void redrawRestoreArea(int screenOffset, bool force);
114  void buildShowBuf();
115  byte _scaleX, _scaleY;
116  byte _offScale;
117  int8 _motionOffX, _motionOffY;
118  bool _interlacedVideo;
119  bool _dirty;
120  byte _alpha;
121  bool _firstFrame;
122  Common::Rect *_restoreArea; // Area to be repainted by foreground
123 
124  Video::VideoDecoder *_videoDecoder;
125  bool _isFileHandled;
126 };
127 
128 class ROQSoundPlayer : public ROQPlayer {
129 public:
131  ~ROQSoundPlayer();
132  void createAudioStream(bool stereo) override;
133 };
134 
135 } // End of Groovie namespace
136 
137 #endif // GROOVIE_VIDEO_ROQ_H
Definition: str.h:59
Definition: surface.h:67
Definition: groovie.h:116
Definition: rect.h:144
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
Definition: mixer.h:49
Definition: video_decoder.h:53
Definition: roq.h:128
Definition: roq.h:36
Definition: player.h:36
Definition: avi_frames.h:36
Definition: cursor.h:32
Definition: roq.h:42