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