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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * Plays films within a scene, takes into account the actor in each 'column'. 22 */ 23 24 #ifndef TINSEL_BMV_H 25 #define TINSEL_BMV_H 26 27 #include "common/coroutines.h" 28 #include "common/file.h" 29 30 #include "audio/mixer.h" 31 32 #include "tinsel/object.h" 33 #include "tinsel/palette.h" 34 35 namespace Audio { 36 class QueuingAudioStream; 37 } 38 39 namespace Tinsel { 40 41 42 class BMVPlayer { 43 44 bool bOldAudio; 45 46 /// Set when a movie is on 47 bool bMovieOn; 48 49 /// Set to kill one off 50 bool bAbort; 51 52 /// For escaping out of movies 53 int bmvEscape; 54 55 /// Movie file pointer 56 Common::File stream; 57 58 /// Movie file name 59 char szMovieFile[14]; 60 61 /// Pointers to buffers 62 byte *bigBuffer; 63 64 /// Next data to use to extract a frame 65 int nextUseOffset; 66 67 /// Next data to use to extract sound data 68 int nextSoundOffset; 69 70 /// When above offset gets to what this is set at, rewind 71 int wrapUseOffset; 72 73 /// The offset of the most future packet 74 int mostFutureOffset; 75 76 /// The current frame 77 int currentFrame; 78 int currentSoundFrame; 79 80 /// Number of packets currently in RAM 81 int numAdvancePackets; 82 83 /// Next slot that will be read from disc 84 int nextReadSlot; 85 86 /// Set when the whole file has been read 87 bool bFileEnd; 88 89 /// Palette 90 COLORREF moviePal[256]; 91 92 int blobsInBuffer; 93 94 struct { 95 POBJECT pText; 96 int dieFrame; 97 } texts[2]; 98 99 COLORREF talkColor; 100 101 int bigProblemCount; 102 103 bool bIsText; 104 105 int movieTick; 106 int startTick; 107 uint32 nextMovieTime; 108 109 uint16 Au_Prev1; 110 uint16 Au_Prev2; 111 byte *ScreenBeg; 112 byte *screenBuffer; 113 114 bool audioStarted; 115 116 Audio::QueuingAudioStream *_audioStream; 117 Audio::SoundHandle _audioHandle; 118 119 int nextMaintain; 120 public: 121 BMVPlayer(); 122 123 void PlayBMV(CORO_PARAM, SCNHANDLE hFileStem, int myEscape); 124 void FinishBMV(); 125 void CopyMovieToScreen(); 126 void FettleBMV(); 127 128 bool MoviePlaying(); 129 130 int32 MovieAudioLag(); 131 132 uint32 NextMovieTime(); 133 134 void AbortMovie(); 135 136 private: 137 void InitBMV(byte *memoryBuffer); 138 void PrepAudio(const byte *sourceData, int blobCount, byte *destPtr); 139 void MoviePalette(int paletteOffset); 140 void InitializeMovieSound(); 141 void StartMovieSound(); 142 void FinishMovieSound(); 143 void MovieAudio(int audioOffset, int blobs); 144 void FettleMovieText(); 145 void BmvDrawText(bool bDraw); 146 void MovieText(CORO_PARAM, int stringId, int x, int y, int fontId, COLORREF *pTalkColor, int duration); 147 int MovieCommand(char cmd, int commandOffset); 148 int FollowingPacket(int thisPacket, bool bReallyImportant); 149 void LoadSlots(int number); 150 void InitializeBMV(); 151 bool MaintainBuffer(); 152 bool DoBMVFrame(); 153 bool DoSoundFrame(); 154 }; 155 156 157 } // End of namespace Tinsel 158 159 #endif 160