ScummVM API documentation
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 isValidBlockHeaderType(uint16 blockHeaderType);
72  bool processBlock();
73  bool processBlockInfo(ROQBlockHeader &blockHeader);
74  bool processBlockQuadCodebook(ROQBlockHeader &blockHeader);
75  bool processBlockQuadVector(ROQBlockHeader &blockHeader);
76  void processBlockQuadVectorBlock(int baseX, int baseY);
77  void processBlockQuadVectorBlockSub(int baseX, int baseY);
78  bool processBlockStill(ROQBlockHeader &blockHeader);
79  bool processBlockSoundMono(ROQBlockHeader &blockHeader);
80  bool processBlockSoundStereo(ROQBlockHeader &blockHeader);
81  bool processBlockAudioContainer(ROQBlockHeader &blockHeader);
82  bool playFirstFrame() { return _flagNoPlay; }; // _alpha && !_flagOverlay; }
83  void clearOverlay();
84  void dumpAllSurfaces(const Common::String &funcname);
85 
86  void paint2(byte i, int destx, int desty);
87  void paint4(byte i, int destx, int desty);
88  void paint8(byte i, int destx, int desty);
89  void copy(byte size, int destx, int desty, int dx, int dy);
90 
91  // Origin
92  int16 _origX, _origY;
93  //int16 _screenOffset;
94  void calcStartStop(int &start, int &stop, int origin, int length);
95 
96  // Block coding type
97  byte getCodingType();
98  uint16 _codingType;
99  byte _codingTypeCount;
100 
101  // Codebooks
102  uint16 _num2blocks;
103  uint16 _num4blocks;
104  uint32 _codebook2[256 * 4];
105  byte _codebook4[256 * 4];
106 
107  // Flags
108  bool _flagNoPlay;
109  bool _flagOverlay;
110  bool _altMotionDecoder; // Some ROQ vids use a variation on the copy codeblock
111  bool _flagMasked;
112 
113  // Buffers
114  void redrawRestoreArea(int screenOffset, bool force);
115  void buildShowBuf();
116  byte _scaleX, _scaleY;
117  byte _offScale;
118  int8 _motionOffX, _motionOffY;
119  bool _interlacedVideo;
120  bool _dirty;
121  byte _alpha;
122  bool _firstFrame;
123  Common::Rect *_restoreArea; // Area to be repainted by foreground
124 
125  Video::VideoDecoder *_videoDecoder;
126  bool _isFileHandled;
127 };
128 
129 class ROQSoundPlayer : public ROQPlayer {
130 public:
132  ~ROQSoundPlayer();
133  void createAudioStream(bool stereo) override;
134 };
135 
136 } // End of Groovie namespace
137 
138 #endif // GROOVIE_VIDEO_ROQ_H
Definition: str.h:59
Definition: surface.h:67
Definition: groovie.h:116
Definition: rect.h:524
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
Definition: mixer.h:49
Definition: video_decoder.h:53
Definition: roq.h:129
Definition: roq.h:36
Definition: player.h:36
Definition: animation.h:37
Definition: cursor.h:32
Definition: roq.h:42