ScummVM API documentation
bmv.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  * Plays films within a scene, takes into account the actor in each 'column'.
21  */
22 
23 #ifndef TINSEL_BMV_H
24 #define TINSEL_BMV_H
25 
26 #include "common/coroutines.h"
27 #include "common/file.h"
28 
29 #include "audio/mixer.h"
30 
31 #include "tinsel/object.h"
32 #include "tinsel/palette.h"
33 
34 namespace Audio {
35 class QueuingAudioStream;
36 }
37 
38 namespace Tinsel {
39 
40 typedef enum
41 {
42  BMV_OP_DELTA = 0,
43  BMV_OP_RAW = 1,
44  BMV_OP_RUN = 2,
45  BMV_OP_COUNT
46 } BMV_OP;
47 
48 class BMVPlayer {
49 
50  bool bOldAudio;
51 
53  bool bMovieOn;
54 
56  bool bAbort;
57 
59  int bmvEscape;
60 
62  Common::File stream;
63 
65  char szMovieFile[14];
66 
68  byte *bigBuffer;
69 
71  int nextUseOffset;
72 
74  int nextSoundOffset;
75 
77  int wrapUseOffset;
78 
80  int mostFutureOffset;
81 
83  int currentFrame;
84  int currentSoundFrame;
85 
87  int numAdvancePackets;
88 
90  int nextReadSlot;
91 
93  bool bFileEnd;
94 
96  COLORREF moviePal[256 * 8]; // TinselV1 & V2 need 256, TinselVersion == 3 needs 2048
97 
98  int blobsInBuffer;
99 
100  struct {
101  OBJECT *pText;
102  int dieFrame;
103  } texts[2];
104 
105  COLORREF talkColor;
106 
108  int slotSize;
109  int frames;
110  int prefetchSlots;
111  int numSlots;
112  int frameRate;
113  int audioMaxSize;
114  int audioBlobSize;
115  int width;
116  int height;
117 
119  int frameTime;
120  int bpp;
121 
122  int bigProblemCount;
123 
124  bool bIsText;
125 
126  int movieTick;
127  int startTick;
128  uint32 nextMovieTime;
129 
130  uint16 Au_Prev1;
131  uint16 Au_Prev2;
132  byte *ScreenBeg;
133  byte *screenBuffer;
134 
135  bool audioStarted;
136 
137  Audio::QueuingAudioStream *_audioStream;
138  Audio::SoundHandle _audioHandle;
139 
140  int nextMaintain;
141 public:
142  BMVPlayer();
143 
144  void PlayBMV(CORO_PARAM, SCNHANDLE hFileStem, int myEscape);
145  void FinishBMV();
146  void CopyMovieToScreen();
147  void FettleBMV();
148 
149  bool MoviePlaying();
150 
151  int32 MovieAudioLag();
152 
153  uint32 NextMovieTime();
154 
155  void AbortMovie();
156 
157 private:
158  void ReadHeader();
159 
160  void InitBMV(byte *memoryBuffer);
161  void PrepAudio(const byte *sourceData, int blobCount, byte *destPtr);
162  void PrepBMV(const byte *sourceData, int length, short deltaFetchDisp);
163  void t3DoOperation(BMV_OP op, uint32 len, const byte **src, byte **dst, int32 deltaOffset);
164  void t3PrepBMV(const byte *src, uint32 len, int32 deltaOffset);
165  void MoviePalette(int paletteOffset);
166  void InitializeMovieSound();
167  void StartMovieSound();
168  void FinishMovieSound();
169  void MovieAudio(int audioOffset, int blobs);
170  void FettleMovieText();
171  void BmvDrawText(bool bDraw);
172  void MovieText(CORO_PARAM, int stringId, int x, int y, int fontId, COLORREF *pTalkColor, int duration);
173  int MovieCommand(char cmd, int commandOffset);
174  int FollowingPacket(int thisPacket, bool bReallyImportant);
175  void LoadSlots(int number);
176  void InitializeBMV();
177  bool MaintainBuffer();
178  bool DoBMVFrame();
179  bool DoSoundFrame();
180 };
181 
182 
183 } // End of namespace Tinsel
184 
185 #endif
Definition: bmv.h:48
uint32 SCNHANDLE
Definition: dw.h:31
Definition: mixer.h:49
Definition: object.h:73
#define CORO_PARAM
Definition: coroutines.h:107
Definition: file.h:47
Definition: actors.h:36
Definition: audiostream.h:370
Definition: system.h:38