2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-05-08 10:21:17 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-05-08 10:21:17 +00:00
|
|
|
|
|
|
|
#include "scumm/he/animation_he.h"
|
|
|
|
#include "scumm/he/intern_he.h"
|
|
|
|
|
2006-11-02 10:01:32 +00:00
|
|
|
#include "sound/audiostream.h"
|
|
|
|
|
2006-05-08 10:21:17 +00:00
|
|
|
namespace Scumm {
|
|
|
|
|
2006-11-02 10:01:32 +00:00
|
|
|
MoviePlayer::MoviePlayer(ScummEngine_v90he *vm, Audio::Mixer *mixer)
|
2008-12-17 14:48:57 +00:00
|
|
|
: SMKPlayer(mixer), _vm(vm), _mixer(mixer) {
|
2006-05-08 10:21:17 +00:00
|
|
|
|
|
|
|
_flags = 0;
|
|
|
|
_wizResNum = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int MoviePlayer::getImageNum() {
|
2008-12-14 23:41:48 +00:00
|
|
|
if (!_fileStream)
|
2006-05-08 10:21:17 +00:00
|
|
|
return 0;
|
|
|
|
return _wizResNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int MoviePlayer::load(const char *filename, int flags, int image) {
|
2008-12-14 23:41:48 +00:00
|
|
|
if (_fileStream) {
|
2006-06-28 14:06:54 +00:00
|
|
|
closeFile();
|
2006-05-08 10:21:17 +00:00
|
|
|
}
|
|
|
|
|
2008-12-14 23:41:48 +00:00
|
|
|
if (!loadFile(filename)) {
|
|
|
|
warning("Failed to load video file %s", filename);
|
2006-05-08 10:21:17 +00:00
|
|
|
return -1;
|
2007-09-19 08:40:12 +00:00
|
|
|
}
|
2008-12-14 23:41:48 +00:00
|
|
|
debug(1, "Playing video %s", filename);
|
2006-05-08 10:21:17 +00:00
|
|
|
|
|
|
|
if (flags & 2) {
|
2008-12-14 23:41:48 +00:00
|
|
|
_vm->_wiz->createWizEmptyImage(image, 0, 0, getWidth(), getHeight());
|
2006-05-08 10:21:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_flags = flags;
|
|
|
|
_wizResNum = image;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MoviePlayer::handleNextFrame() {
|
2008-12-14 23:41:48 +00:00
|
|
|
if (_fileStream == false) {
|
2006-05-08 10:21:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-09-08 11:15:27 +00:00
|
|
|
VirtScreen *pvs = &_vm->_virtscr[kMainVirtScreen];
|
2006-05-08 10:21:17 +00:00
|
|
|
|
2006-06-28 14:06:54 +00:00
|
|
|
decodeNextFrame();
|
2006-05-08 10:21:17 +00:00
|
|
|
|
|
|
|
if (_flags & 2) {
|
|
|
|
uint8 *dstPtr = _vm->getResourceAddress(rtImage, _wizResNum);
|
|
|
|
assert(dstPtr);
|
2006-06-28 14:06:54 +00:00
|
|
|
uint8 *dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
|
2006-05-08 10:21:17 +00:00
|
|
|
assert(dst);
|
2006-06-28 14:06:54 +00:00
|
|
|
copyFrameToBuffer(dst, 0, 0, _vm->_screenWidth);
|
2006-05-08 10:21:17 +00:00
|
|
|
} else if (_flags & 1) {
|
2006-06-28 14:06:54 +00:00
|
|
|
copyFrameToBuffer(pvs->getBackPixels(0, 0), 0, 0, _vm->_screenWidth);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2008-12-14 23:41:48 +00:00
|
|
|
Common::Rect imageRect(getWidth(), getHeight());
|
2006-09-17 23:35:09 +00:00
|
|
|
_vm->restoreBackgroundHE(imageRect);
|
2006-05-08 10:21:17 +00:00
|
|
|
} else {
|
2006-06-28 14:06:54 +00:00
|
|
|
copyFrameToBuffer(pvs->getPixels(0, 0), 0, 0, _vm->_screenWidth);
|
2006-05-08 10:21:17 +00:00
|
|
|
|
2008-12-14 23:41:48 +00:00
|
|
|
_vm->markRectAsDirty(kMainVirtScreen, 0, 0, getWidth(), getHeight());
|
2006-05-08 10:21:17 +00:00
|
|
|
}
|
|
|
|
|
2008-12-16 09:56:21 +00:00
|
|
|
if (getCurFrame() == getFrameCount()) {
|
2006-06-28 14:06:54 +00:00
|
|
|
closeFile();
|
2006-05-08 10:21:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-28 14:06:54 +00:00
|
|
|
void MoviePlayer::setPalette(byte *pal) {
|
|
|
|
_vm->setPaletteFromPtr(pal, 256);
|
2006-05-08 10:21:17 +00:00
|
|
|
}
|
|
|
|
|
2006-11-03 06:16:11 +00:00
|
|
|
} // End of namespace Scumm
|