2005-01-17 10:57:15 +00:00
|
|
|
/* Copyright (C) 1994-1998 Revolution Software Ltd.
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2003-2006 The ScummVM project
|
2004-01-13 01:26:18 +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.
|
2006-02-09 15:12:44 +00:00
|
|
|
*
|
2004-01-13 01:26:18 +00:00
|
|
|
* 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.
|
2006-02-09 15:12:44 +00:00
|
|
|
*
|
2004-01-13 01:26:18 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-01-13 01:26:18 +00:00
|
|
|
*
|
2006-02-09 15:12:44 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2004-01-13 01:26:18 +00:00
|
|
|
*/
|
|
|
|
|
2004-01-12 11:11:19 +00:00
|
|
|
#include "common/stdafx.h"
|
2004-12-21 02:12:58 +00:00
|
|
|
#include "common/config-manager.h"
|
2006-07-08 11:42:07 +00:00
|
|
|
#include "common/file.h"
|
2005-01-10 22:06:49 +00:00
|
|
|
#include "common/system.h"
|
2006-07-08 11:42:07 +00:00
|
|
|
|
2004-02-21 20:00:51 +00:00
|
|
|
#include "sound/vorbis.h"
|
|
|
|
#include "sound/mp3.h"
|
|
|
|
|
2004-01-12 11:11:19 +00:00
|
|
|
#include "sword2/sword2.h"
|
2005-02-27 16:11:19 +00:00
|
|
|
#include "sword2/defs.h"
|
2006-02-17 15:07:36 +00:00
|
|
|
#include "sword2/header.h"
|
2004-02-05 14:19:07 +00:00
|
|
|
#include "sword2/maketext.h"
|
2006-07-08 11:42:07 +00:00
|
|
|
#include "sword2/mouse.h"
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
#include "sword2/resman.h"
|
2006-02-17 15:07:36 +00:00
|
|
|
#include "sword2/screen.h"
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
#include "sword2/sound.h"
|
2006-02-09 15:41:23 +00:00
|
|
|
#include "sword2/animation.h"
|
2004-01-12 11:11:19 +00:00
|
|
|
|
|
|
|
namespace Sword2 {
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
// TODO: The interaction between the basic cutscene player class and the
|
|
|
|
// specific plyers is sometimes a bit awkward, since our classes for
|
|
|
|
// DXA and MPEG decoding are so fundamentally different. The DXA decoder
|
|
|
|
// is just a decoder, while the MPEG decoder has delusions of being a
|
|
|
|
// player. This could probably be simplified quite a bit.
|
2006-05-17 23:52:45 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Basic movie player
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2004-01-13 14:16:40 +00:00
|
|
|
|
2006-07-15 22:04:42 +00:00
|
|
|
const MovieInfo MoviePlayer::_movies[19] = {
|
|
|
|
{ "carib", 222, false },
|
|
|
|
{ "escape", 187, false },
|
|
|
|
{ "eye", 248, false },
|
|
|
|
{ "finale", 1485, false },
|
|
|
|
{ "guard", 75, false },
|
|
|
|
{ "intro", 1800, false },
|
|
|
|
{ "jungle", 186, false },
|
|
|
|
{ "museum", 167, false },
|
|
|
|
{ "pablo", 75, false },
|
|
|
|
{ "pyramid", 60, false },
|
|
|
|
{ "quaram", 184, false },
|
|
|
|
{ "river", 656, false },
|
|
|
|
{ "sailing", 138, false },
|
|
|
|
{ "shaman", 788, true },
|
|
|
|
{ "stone1", 34, true },
|
|
|
|
{ "stone2", 282, false },
|
|
|
|
{ "stone3", 65, true },
|
|
|
|
{ "demo", 60, false },
|
|
|
|
{ "enddemo", 110, false }
|
2004-02-15 14:22:54 +00:00
|
|
|
};
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
MoviePlayer::MoviePlayer(Sword2Engine *vm) {
|
|
|
|
_vm = vm;
|
|
|
|
_mixer = _vm->_mixer;
|
|
|
|
_system = _vm->_system;
|
|
|
|
_textSurface = NULL;
|
|
|
|
_bgSoundStream = NULL;
|
|
|
|
_ticks = 0;
|
|
|
|
_currentFrame = 0;
|
|
|
|
_frameBuffer = NULL;
|
|
|
|
_frameWidth = 0;
|
|
|
|
_frameHeight = 0;
|
|
|
|
_frameX = 0;
|
|
|
|
_frameY = 0;
|
|
|
|
_black = 1;
|
|
|
|
_white = 255;
|
|
|
|
_numFrames = 0;
|
|
|
|
_leadOutFrame = (uint)-1;
|
|
|
|
_seamless = false;
|
|
|
|
_framesSkipped = 0;
|
|
|
|
_forceFrame = false;
|
|
|
|
_textList = NULL;
|
|
|
|
_currentText = 0;
|
2004-03-21 18:49:04 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
MoviePlayer::~MoviePlayer() {
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::updatePalette(byte *pal, bool packed) {
|
|
|
|
byte palette[4 * 256];
|
|
|
|
byte *p = palette;
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
uint32 maxWeight = 0;
|
|
|
|
uint32 minWeight = 0xFFFFFFFF;
|
|
|
|
|
|
|
|
for (int i = 0; i < 256; i++) {
|
|
|
|
int r = *pal++;
|
|
|
|
int g = *pal++;
|
|
|
|
int b = *pal++;
|
|
|
|
|
|
|
|
if (!packed)
|
|
|
|
pal++;
|
|
|
|
|
|
|
|
uint32 weight = 3 * r * r + 6 * g * g + 2 * b * b;
|
|
|
|
|
|
|
|
if (weight >= maxWeight) {
|
2006-07-15 22:22:39 +00:00
|
|
|
_white = i;
|
2006-07-08 11:42:07 +00:00
|
|
|
maxWeight = weight;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (weight <= minWeight) {
|
2006-07-15 22:22:39 +00:00
|
|
|
_black = i;
|
2006-07-08 11:42:07 +00:00
|
|
|
minWeight = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p++ = r;
|
|
|
|
*p++ = g;
|
|
|
|
*p++ = b;
|
|
|
|
*p++ = 0;
|
2004-01-18 21:09:57 +00:00
|
|
|
}
|
2006-07-08 11:42:07 +00:00
|
|
|
|
|
|
|
_vm->_screen->setPalette(0, 256, palette, RDPAL_INSTANT);
|
|
|
|
_forceFrame = true;
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::savePalette() {
|
|
|
|
memcpy(_originalPalette, _vm->_screen->getPalette(), sizeof(_originalPalette));
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::restorePalette() {
|
|
|
|
_vm->_screen->setPalette(0, 256, _originalPalette, RDPAL_INSTANT);
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::clearScreen() {
|
|
|
|
_vm->_screen->clearScene();
|
|
|
|
_system->copyRectToScreen(_vm->_screen->getScreen(), _vm->_screen->getScreenWide(), 0, 0, _vm->_screen->getScreenWide(), _vm->_screen->getScreenDeep());
|
|
|
|
}
|
2004-03-24 07:29:59 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::updateScreen() {
|
|
|
|
_system->updateScreen();
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
bool MoviePlayer::checkSkipFrame() {
|
|
|
|
if (_forceFrame) {
|
|
|
|
_forceFrame = false;
|
|
|
|
return false;
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (_framesSkipped > 10) {
|
|
|
|
warning("Forced frame %d to be displayed", _currentFrame);
|
|
|
|
_framesSkipped = 0;
|
|
|
|
return false;
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (_bgSoundStream) {
|
|
|
|
if ((_mixer->getSoundElapsedTime(_bgSoundHandle) * 12) / 1000 < _currentFrame + 1)
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
if (_system->getMillis() <= _ticks)
|
|
|
|
return false;
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
_framesSkipped++;
|
|
|
|
return true;
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::waitForFrame() {
|
|
|
|
if (_bgSoundStream) {
|
|
|
|
while (_mixer->isSoundHandleActive(_bgSoundHandle) && (_mixer->getSoundElapsedTime(_bgSoundHandle) * 12) / 1000 < _currentFrame) {
|
|
|
|
_system->delayMillis(10);
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
// In case the background sound ends prematurely, update _ticks
|
|
|
|
// so that we can still fall back on the no-sound sync case for
|
|
|
|
// the subsequent frames.
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
_ticks = _system->getMillis();
|
|
|
|
} else {
|
|
|
|
while (_system->getMillis() < _ticks) {
|
|
|
|
_system->delayMillis(10);
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
2006-07-08 11:42:07 +00:00
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::drawFrame() {
|
|
|
|
_ticks += 83;
|
2005-04-25 05:23:21 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (checkSkipFrame()) {
|
|
|
|
warning("Skipped frame %d", _currentFrame);
|
|
|
|
return;
|
2005-04-25 05:23:21 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
waitForFrame();
|
2005-04-25 05:23:21 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
int screenWidth = _vm->_screen->getScreenWide();
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
_system->copyRectToScreen(_frameBuffer + _frameY * screenWidth + _frameX, screenWidth, _frameX, _frameY, _frameWidth, _frameHeight);
|
|
|
|
_vm->_screen->setNeedFullRedraw();
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::openTextObject(MovieTextObject *t) {
|
|
|
|
if (t->textSprite) {
|
|
|
|
_vm->_screen->createSurface(t->textSprite, &_textSurface);
|
|
|
|
}
|
|
|
|
}
|
2005-04-24 15:38:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::closeTextObject(MovieTextObject *t) {
|
|
|
|
if (_textSurface) {
|
|
|
|
_vm->_screen->deleteSurface(_textSurface);
|
|
|
|
_textSurface = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MoviePlayer::drawTextObject(MovieTextObject *t) {
|
|
|
|
if (t->textSprite && _textSurface) {
|
|
|
|
int screenWidth = _vm->_screen->getScreenWide();
|
|
|
|
byte *src = t->textSprite->data;
|
|
|
|
byte *dst = _frameBuffer + (_frameY + _frameHeight - t->textSprite->h - 20) * screenWidth + _frameX + (_frameWidth - t->textSprite->w) / 2;
|
|
|
|
|
|
|
|
for (int y = 0; y < t->textSprite->h; y++) {
|
|
|
|
for (int x = 0; x < t->textSprite->w; x++) {
|
|
|
|
if (src[x] == 1)
|
|
|
|
dst[x] = _black;
|
2006-07-15 22:22:39 +00:00
|
|
|
else if (src[x] == 255)
|
|
|
|
dst[x] = _white;
|
2006-07-08 11:42:07 +00:00
|
|
|
}
|
|
|
|
src += t->textSprite->w;
|
|
|
|
dst += screenWidth;
|
2005-04-24 15:38:53 +00:00
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
2006-07-08 11:42:07 +00:00
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::undrawTextObject(MovieTextObject *t) {
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
bool MoviePlayer::load(const char *name, MovieTextObject *text[]) {
|
|
|
|
_bgSoundStream = NULL;
|
|
|
|
_textList = text;
|
|
|
|
_currentText = 0;
|
|
|
|
_currentFrame = 0;
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
for (int i = 0; i < ARRAYSIZE(_movies); i++) {
|
|
|
|
if (scumm_stricmp(name, _movies[i].name) == 0) {
|
|
|
|
_seamless = _movies[i].seamless;
|
|
|
|
_numFrames = _movies[i].frames;
|
|
|
|
if (_numFrames > 60)
|
|
|
|
_leadOutFrame = _numFrames - 60;
|
2006-07-10 18:57:40 +00:00
|
|
|
|
|
|
|
// Not all cutscenes cover the entire screen, so clear
|
|
|
|
// it. We will always clear the game screen, no matter
|
|
|
|
// how the cutscene is to be displayed. (We have to do
|
|
|
|
// this before showing the overlay.)
|
|
|
|
|
|
|
|
_vm->_mouse->closeMenuImmediately();
|
|
|
|
|
|
|
|
if (!_seamless) {
|
|
|
|
_vm->_screen->clearScene();
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_screen->updateDisplay();
|
2006-07-08 11:42:07 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayer::play(int32 leadIn, int32 leadOut) {
|
|
|
|
bool terminate = false;
|
|
|
|
bool textVisible = false;
|
2004-01-18 19:50:59 +00:00
|
|
|
bool startNextText = false;
|
2006-07-08 11:42:07 +00:00
|
|
|
byte *data;
|
|
|
|
uint32 len;
|
|
|
|
Audio::SoundHandle leadInHandle, leadOutHandle;
|
|
|
|
uint32 flags = Audio::Mixer::FLAG_16BITS;
|
|
|
|
|
|
|
|
// This happens if the user quits during the "eye" cutscene.
|
|
|
|
if (_vm->_quit)
|
|
|
|
return;
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (leadIn) {
|
|
|
|
data = _vm->_resman->openResource(leadIn);
|
|
|
|
len = _vm->_resman->fetchLen(leadIn) - ResHeader::size();
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
assert(_vm->_resman->fetchType(data) == WAV_FILE);
|
2004-02-15 14:22:54 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
data += ResHeader::size();
|
|
|
|
|
|
|
|
_vm->_sound->playFx(&leadInHandle, data, len, Audio::Mixer::kMaxChannelVolume, 0, false, Audio::Mixer::kMusicSoundType);
|
|
|
|
}
|
|
|
|
|
|
|
|
savePalette();
|
|
|
|
|
2004-01-13 10:09:53 +00:00
|
|
|
#ifndef SCUMM_BIG_ENDIAN
|
2005-05-10 23:48:48 +00:00
|
|
|
flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
2004-01-13 10:09:53 +00:00
|
|
|
#endif
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
_framesSkipped = 0;
|
|
|
|
|
|
|
|
_ticks = _system->getMillis();
|
|
|
|
|
|
|
|
if (_bgSoundStream) {
|
|
|
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSoundHandle, _bgSoundStream);
|
|
|
|
}
|
2004-03-24 07:29:59 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
while (!terminate && _currentFrame < _numFrames && decodeFrame()) {
|
|
|
|
_currentFrame++;
|
|
|
|
|
|
|
|
// The frame has been decoded. Now draw the subtitles, if any,
|
|
|
|
// before drawing it to the screen.
|
|
|
|
|
|
|
|
if (_textList && _textList[_currentText]) {
|
|
|
|
MovieTextObject *t = _textList[_currentText];
|
|
|
|
|
|
|
|
if (_currentFrame == t->startFrame) {
|
|
|
|
openTextObject(t);
|
2004-01-13 10:09:53 +00:00
|
|
|
textVisible = true;
|
2004-01-18 12:07:21 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (t->speech) {
|
2004-01-18 19:50:59 +00:00
|
|
|
startNextText = true;
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
2004-01-18 19:50:59 +00:00
|
|
|
}
|
2004-01-18 12:07:21 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (startNextText && !_mixer->isSoundHandleActive(_speechHandle)) {
|
|
|
|
_mixer->playRaw(&_speechHandle, t->speech, t->speechBufferSize, 22050, flags);
|
2004-01-18 19:50:59 +00:00
|
|
|
startNextText = false;
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (_currentFrame == t->endFrame) {
|
|
|
|
undrawTextObject(t);
|
|
|
|
closeTextObject(t);
|
|
|
|
_currentText++;
|
2004-01-13 10:09:53 +00:00
|
|
|
textVisible = false;
|
|
|
|
}
|
2004-03-24 07:29:59 +00:00
|
|
|
|
2004-01-13 10:09:53 +00:00
|
|
|
if (textVisible)
|
2006-07-08 11:42:07 +00:00
|
|
|
drawTextObject(t);
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (leadOut && _currentFrame == _leadOutFrame) {
|
|
|
|
data = _vm->_resman->openResource(leadOut);
|
|
|
|
len = _vm->_resman->fetchLen(leadOut) - ResHeader::size();
|
2006-06-03 09:43:10 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
assert(_vm->_resman->fetchType(data) == WAV_FILE);
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
data += ResHeader::size();
|
|
|
|
|
|
|
|
_vm->_sound->playFx(&leadOutHandle, data, len, Audio::Mixer::kMaxChannelVolume, 0, false, Audio::Mixer::kMusicSoundType);
|
|
|
|
}
|
|
|
|
|
|
|
|
drawFrame();
|
|
|
|
updateScreen();
|
2004-02-15 14:22:54 +00:00
|
|
|
|
2004-03-24 07:29:59 +00:00
|
|
|
OSystem::Event event;
|
2006-07-08 11:42:07 +00:00
|
|
|
|
|
|
|
while (_system->pollEvent(event)) {
|
2004-12-05 17:42:20 +00:00
|
|
|
switch (event.type) {
|
2004-03-24 07:29:59 +00:00
|
|
|
case OSystem::EVENT_SCREEN_CHANGED:
|
2006-07-08 11:42:07 +00:00
|
|
|
handleScreenChanged();
|
2004-03-24 07:29:59 +00:00
|
|
|
break;
|
|
|
|
case OSystem::EVENT_QUIT:
|
|
|
|
_vm->closeGame();
|
2006-07-08 11:42:07 +00:00
|
|
|
terminate = true;
|
|
|
|
break;
|
|
|
|
case OSystem::EVENT_KEYDOWN:
|
|
|
|
if (event.kbd.keycode == 27)
|
|
|
|
terminate = true;
|
2004-03-24 07:29:59 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-25 05:23:21 +00:00
|
|
|
if (!_seamless) {
|
2006-07-08 11:42:07 +00:00
|
|
|
// Most cutscenes fade to black on their own, but not all of
|
|
|
|
// them. I think it looks better if they do.
|
2004-02-15 14:22:54 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
clearScreen();
|
2004-02-15 14:22:54 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
// If the sound is still playing, draw the subtitles one final
|
|
|
|
// time. This happens in the "carib" cutscene.
|
2004-02-15 14:22:54 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (textVisible && _mixer->isSoundHandleActive(_speechHandle)) {
|
|
|
|
drawTextObject(_textList[_currentText]);
|
|
|
|
}
|
2004-02-15 14:22:54 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
updateScreen();
|
|
|
|
}
|
2004-02-15 14:22:54 +00:00
|
|
|
|
2006-07-15 22:42:28 +00:00
|
|
|
// The current text object may still be open
|
2006-07-15 23:18:11 +00:00
|
|
|
if (_textList && _textList[_currentText]) {
|
|
|
|
closeTextObject(_textList[_currentText]);
|
|
|
|
}
|
2006-07-15 22:42:28 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (!terminate) {
|
|
|
|
// Wait for the voice to stop playing. This is to make sure
|
|
|
|
// that we don't cut off the speech in mid-sentence, and - even
|
|
|
|
// more importantly - that we don't free the sound buffer while
|
|
|
|
// it's still in use.
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
while (_mixer->isSoundHandleActive(_speechHandle)) {
|
|
|
|
_system->delayMillis(100);
|
|
|
|
}
|
2004-03-24 07:29:59 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
while (_mixer->isSoundHandleActive(_bgSoundHandle)) {
|
|
|
|
_system->delayMillis(100);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_mixer->stopHandle(_speechHandle);
|
|
|
|
_mixer->stopHandle(_bgSoundHandle);
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
|
|
|
|
2005-04-25 05:23:21 +00:00
|
|
|
if (!_seamless) {
|
2006-07-08 11:42:07 +00:00
|
|
|
clearScreen();
|
|
|
|
updateScreen();
|
2005-04-25 05:23:21 +00:00
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
// Setting the palette implies a full redraw.
|
|
|
|
restorePalette();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef USE_ZLIB
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Movie player for the new DXA movies
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
MoviePlayerDXA::MoviePlayerDXA(Sword2Engine *vm) : MoviePlayer(vm) {
|
|
|
|
debug(0, "Creating DXA cutscene player");
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
MoviePlayerDXA::~MoviePlayerDXA() {
|
|
|
|
closeFile();
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayerDXA::setPalette(byte *pal) {
|
|
|
|
updatePalette(pal);
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
bool MoviePlayerDXA::decodeFrame() {
|
|
|
|
decodeNextFrame();
|
|
|
|
copyFrameToBuffer(_frameBuffer, _frameX, _frameY, _vm->_screen->getScreenWide());
|
|
|
|
return true;
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
bool MoviePlayerDXA::load(const char *name, MovieTextObject *text[]) {
|
|
|
|
if (!MoviePlayer::load(name, text))
|
|
|
|
return false;
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
char filename[20];
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
snprintf(filename, sizeof(filename), "%s.dxa", name);
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (loadFile(filename)) {
|
|
|
|
// The Broken Sword games always use external audio tracks.
|
|
|
|
if (_fd.readUint32BE() != MKID_BE('NULL'))
|
|
|
|
return false;
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
_frameBuffer = _vm->_screen->getScreen();
|
2004-12-21 02:12:58 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
_frameWidth = getWidth();
|
|
|
|
_frameHeight = getHeight();
|
|
|
|
|
|
|
|
_frameX = (_vm->_screen->getScreenWide() - _frameWidth) / 2;
|
|
|
|
_frameY = (_vm->_screen->getScreenDeep() - _frameHeight) / 2;
|
|
|
|
|
|
|
|
_bgSoundStream = Audio::AudioStream::openStreamFile(name);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2006-07-10 09:29:12 +00:00
|
|
|
#ifdef USE_MPEG2
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Movie player for the old MPEG movies
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
MoviePlayerMPEG::MoviePlayerMPEG(Sword2Engine *vm) : MoviePlayer(vm) {
|
|
|
|
#ifdef BACKEND_8BIT
|
|
|
|
debug(0, "Creating MPEG cutscene player (8-bit)");
|
2005-01-04 15:31:30 +00:00
|
|
|
#else
|
2006-07-08 11:42:07 +00:00
|
|
|
debug(0, "Creating MPEG cutscene player (16-bit)");
|
2005-01-04 15:31:30 +00:00
|
|
|
#endif
|
2006-07-08 11:42:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MoviePlayerMPEG::~MoviePlayerMPEG() {
|
|
|
|
delete _anim;
|
|
|
|
_anim = NULL;
|
|
|
|
}
|
2004-12-21 02:12:58 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
bool MoviePlayerMPEG::load(const char *name, MovieTextObject *text[]) {
|
|
|
|
if (!MoviePlayer::load(name, text))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
_anim = new AnimationState(_vm, this);
|
|
|
|
|
|
|
|
if (!_anim->init(name)) {
|
|
|
|
delete _anim;
|
|
|
|
_anim = NULL;
|
|
|
|
return false;
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
#ifdef BACKEND_8BIT
|
|
|
|
_frameBuffer = _vm->_screen->getScreen();
|
|
|
|
#endif
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
return true;
|
|
|
|
}
|
Applied my own patch #1341495, in an attempt to fix alignment issues
reported by Crilith.
To elaborate a bit, the engine no longer accesses resource data through
packed structs. Instead it uses memory streams and the READ/WRITE
functions.
If data is mainly read, not written, I have replaced the old struct with a
new one with a read() function to read the whole thing from memory into the
struct's variables, and a write() function to dump the struct's variables
to memory. In fact, most of these write() functions remain unused.
If data is both read and written, I have replaced the struct with a class
with individual get/set functions to replace the old variables. This
manipulates memory directly.
Since I'm fairly sure that these structs are frequently stored as local
variables for a script, all script variables (both local and global) are
stored as little-endian and accessed through the READ/WRITE functions,
rather than being treated as arrays of 32-bit integers.
On a positive note, the functions for doing endian conversion of resources
and save games have been removed, and some general cleanups have been made
to assist in the rewrite.
Initial reports indicate that this patch indeed fixes alignment issues, and
that I have not - surprisingly - broken the game on big-endian platforms.
At least not in any immediately obvious way. And there's still plenty of
time to fix regressions before 0.9.0, too.
svn-id: r19366
2005-10-29 21:24:54 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
bool MoviePlayerMPEG::checkSkipFrame() {
|
|
|
|
return false;
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayerMPEG::waitForFrame() {
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
bool MoviePlayerMPEG::decodeFrame() {
|
|
|
|
bool result = _anim->decodeFrame();
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
#ifdef BACKEND_8BIT
|
|
|
|
_frameWidth = _anim->getFrameWidth();
|
|
|
|
_frameHeight = _anim->getFrameHeight();
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
_frameX = (_vm->_screen->getScreenWide() - _frameWidth) / 2;
|
|
|
|
_frameY = (_vm->_screen->getScreenDeep() - _frameHeight) / 2;
|
|
|
|
#endif
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
return result;
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-10 09:29:12 +00:00
|
|
|
AnimationState::AnimationState(Sword2Engine *vm, MoviePlayer *player)
|
|
|
|
: BaseAnimationState(vm->_mixer, vm->_system, 640, 480) {
|
|
|
|
_vm = vm;
|
|
|
|
_player = player;
|
|
|
|
}
|
|
|
|
|
|
|
|
AnimationState::~AnimationState() {
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef BACKEND_8BIT
|
|
|
|
|
|
|
|
void AnimationState::setPalette(byte *pal) {
|
|
|
|
_player->updatePalette(pal, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayerMPEG::handleScreenChanged() {
|
|
|
|
_anim->handleScreenChanged();
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayerMPEG::clearScreen() {
|
|
|
|
_anim->clearScreen();
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayerMPEG::drawFrame() {
|
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayerMPEG::updateScreen() {
|
|
|
|
_anim->updateScreen();
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayerMPEG::drawTextObject(MovieTextObject *t) {
|
|
|
|
if (t->textSprite && _textSurface) {
|
|
|
|
_anim->drawTextObject(t->textSprite, _textSurface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimationState::drawTextObject(SpriteInfo *s, byte *src) {
|
|
|
|
int moviePitch = _movieScale * _movieWidth;
|
|
|
|
int textX = _movieScale * s->x;
|
|
|
|
int textY = _movieScale * (_frameHeight - s->h - 12);
|
|
|
|
|
|
|
|
OverlayColor *dst = _overlay + textY * moviePitch + textX;
|
|
|
|
|
|
|
|
OverlayColor pen = _sys->RGBToColor(255, 255, 255);
|
|
|
|
OverlayColor border = _sys->RGBToColor(0, 0, 0);
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
// TODO: Use the AdvMame scalers for the text? Pre-scale it?
|
|
|
|
|
|
|
|
for (int y = 0; y < s->h; y++) {
|
|
|
|
OverlayColor *ptr = dst;
|
|
|
|
|
|
|
|
for (int x = 0; x < s->w; x++) {
|
|
|
|
switch (src[x]) {
|
|
|
|
case 1:
|
|
|
|
*ptr++ = border;
|
|
|
|
if (_movieScale > 1) {
|
|
|
|
*ptr++ = border;
|
|
|
|
if (_movieScale > 2)
|
|
|
|
*ptr++ = border;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 255:
|
|
|
|
*ptr++ = pen;
|
|
|
|
if (_movieScale > 1) {
|
|
|
|
*ptr++ = pen;
|
|
|
|
if (_movieScale > 2)
|
|
|
|
*ptr++ = pen;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ptr += _movieScale;
|
|
|
|
break;
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (_movieScale > 1) {
|
|
|
|
memcpy(dst + moviePitch, dst, _movieScale * s->w * sizeof(OverlayColor));
|
|
|
|
if (_movieScale > 2)
|
|
|
|
memcpy(dst + 2 * moviePitch, dst, _movieScale * s->w * sizeof(OverlayColor));
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
dst += _movieScale * moviePitch;
|
|
|
|
src += s->w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void AnimationState::clearScreen() {
|
|
|
|
#ifdef BACKEND_8BIT
|
|
|
|
memset(_vm->_screen->getScreen(), 0, _movieWidth * _movieHeight);
|
|
|
|
#else
|
|
|
|
OverlayColor black = _sys->RGBToColor(0, 0, 0);
|
|
|
|
|
|
|
|
for (int i = 0; i < _movieScale * _movieWidth * _movieScale * _movieHeight; i++)
|
|
|
|
_overlay[i] = black;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimationState::drawYUV(int width, int height, byte *const *dat) {
|
|
|
|
_frameWidth = width;
|
|
|
|
_frameHeight = height;
|
|
|
|
|
|
|
|
#ifdef BACKEND_8BIT
|
|
|
|
byte *buf = _vm->_screen->getScreen() + ((480 - height) / 2) * RENDERWIDE + (640 - width) / 2;
|
|
|
|
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
int ypos = 0;
|
|
|
|
int cpos = 0;
|
|
|
|
int linepos = 0;
|
|
|
|
|
|
|
|
for (y = 0; y < height; y += 2) {
|
|
|
|
for (x = 0; x < width; x += 2) {
|
|
|
|
int i = ((((dat[2][cpos] + ROUNDADD) >> SHIFT) * (BITDEPTH + 1)) + ((dat[1][cpos] + ROUNDADD) >> SHIFT)) * (BITDEPTH + 1);
|
|
|
|
cpos++;
|
|
|
|
|
|
|
|
buf[linepos ] = _lut[i + ((dat[0][ ypos ] + ROUNDADD) >> SHIFT)];
|
|
|
|
buf[RENDERWIDE + linepos++] = _lut[i + ((dat[0][width + ypos++] + ROUNDADD) >> SHIFT)];
|
|
|
|
buf[linepos ] = _lut[i + ((dat[0][ ypos ] + ROUNDADD) >> SHIFT)];
|
|
|
|
buf[RENDERWIDE + linepos++] = _lut[i + ((dat[0][width + ypos++] + ROUNDADD) >> SHIFT)];
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
2006-07-08 11:42:07 +00:00
|
|
|
linepos += (2 * RENDERWIDE - width);
|
|
|
|
ypos += width;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
plotYUV(width, height, dat);
|
|
|
|
#endif
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-10 09:29:12 +00:00
|
|
|
#endif
|
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Dummy player for subtitled speech only
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
MoviePlayerDummy::MoviePlayerDummy(Sword2Engine *vm) : MoviePlayer(vm) {
|
|
|
|
debug(0, "Creating Dummy cutscene player");
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
MoviePlayerDummy::~MoviePlayerDummy() {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MoviePlayerDummy::load(const char *name, MovieTextObject *text[]) {
|
|
|
|
if (!MoviePlayer::load(name, text))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
_frameBuffer = _vm->_screen->getScreen();
|
|
|
|
|
|
|
|
_frameWidth = 640;
|
|
|
|
_frameHeight = 400;
|
|
|
|
_frameX = 0;
|
|
|
|
_frameY = 40;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MoviePlayerDummy::decodeFrame() {
|
|
|
|
if (_currentFrame == 0 && _textList) {
|
|
|
|
byte dummyPalette[] = {
|
|
|
|
0, 0, 0, 0,
|
|
|
|
255, 255, 255, 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
// 0 is always black
|
|
|
|
// 1 is the border colour - black
|
|
|
|
// 255 is the pen colour - white
|
|
|
|
|
|
|
|
_system->setPalette(dummyPalette, 0, 1);
|
|
|
|
_system->setPalette(dummyPalette, 1, 1);
|
|
|
|
_system->setPalette(dummyPalette + 4, 255, 1);
|
|
|
|
|
|
|
|
byte msgNoCutscenesRU[] = "Po\344uk - to\344\345ko pev\345: hagmute k\344abuwy Ucke\343n, u\344u nocetute ca\343t npoekta u ckava\343te budeo po\344uku";
|
|
|
|
|
|
|
|
#if defined(USE_MPEG2) || defined(USE_ZLIB)
|
|
|
|
byte msgNoCutscenes[] = "Cutscene - Narration Only: Press ESC to exit, or visit www.scummvm.org to download cutscene videos";
|
|
|
|
#else
|
|
|
|
byte msgNoCutscenes[] = "Cutscene - Narration Only: Press ESC to exit, or recompile ScummVM with MPEG2 or ZLib support");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
byte *msg;
|
|
|
|
|
|
|
|
// Russian version substituted latin characters with Cyrillic.
|
|
|
|
if (Common::parseLanguage(ConfMan.get("language")) == Common::RU_RUS) {
|
|
|
|
msg = msgNoCutscenesRU;
|
|
|
|
} else {
|
|
|
|
msg = msgNoCutscenes;
|
|
|
|
}
|
|
|
|
|
|
|
|
byte *data = _vm->_fontRenderer->makeTextSprite(msg, RENDERWIDE, 255, _vm->_speechFontId);
|
|
|
|
|
|
|
|
FrameHeader frame_head;
|
|
|
|
SpriteInfo msgSprite;
|
|
|
|
byte *msgSurface;
|
|
|
|
|
|
|
|
frame_head.read(data);
|
|
|
|
|
|
|
|
msgSprite.x = _vm->_screen->getScreenWide() / 2 - frame_head.width / 2;
|
|
|
|
msgSprite.y = (480 - frame_head.height) / 2;
|
|
|
|
msgSprite.w = frame_head.width;
|
|
|
|
msgSprite.h = frame_head.height;
|
|
|
|
msgSprite.type = RDSPR_NOCOMPRESSION;
|
|
|
|
msgSprite.data = data + FrameHeader::size();
|
|
|
|
|
|
|
|
_vm->_screen->createSurface(&msgSprite, &msgSurface);
|
|
|
|
_vm->_screen->drawSurface(&msgSprite, msgSurface);
|
|
|
|
_vm->_screen->deleteSurface(msgSurface);
|
|
|
|
|
|
|
|
free(data);
|
|
|
|
updateScreen();
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
// If we have played the final voice-over, skip ahead to the lead out
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
if (_textList && !_textList[_currentText] && !_mixer->isSoundHandleActive(_speechHandle) && _leadOutFrame != (uint)-1 && _currentFrame < _leadOutFrame) {
|
|
|
|
_currentFrame = _leadOutFrame - 1;
|
Began what I hope is the final major restructuring of the BS2 engine.
In this first step, I have moved all opcode functions into functions.cpp,
instead of having them scattered all over the place.
To get things to compile again, I had to rewrite the overly complicated
sound effects handling. It's much simpler now.
The next step will be to move any non-trivial code out of the opcode
functions and into the appropriate object. This, I hope, will make it
easier to create well-separated objects, instead of the current mess.
I also want to tear down the artificial boundary between the main directory
and the "driver" directory. We already have a cross-platform layer; there's
no need to have yet another one. (Actually, the rewriting of the sound
effects code took one first step in this direction.)
At the final stage, I'd like to get rid of the "drivers" directory
completely, but I'll probably need some help with that if I want to
preserve the CVS history of the code.
Things will probably be a bit bumpy along the way, but I seem to have
reached a point of relative stability again, which is why I'm commiting
this now.
svn-id: r16668
2005-01-28 16:33:14 +00:00
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
return true;
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
bool MoviePlayerDummy::checkSkipFrame() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MoviePlayerDummy::waitForFrame() {
|
|
|
|
if (!_textList || _currentFrame < _textList[0]->startFrame) {
|
|
|
|
_ticks = _system->getMillis();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
MoviePlayer::waitForFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MoviePlayerDummy::drawFrame() {
|
|
|
|
_ticks += 83;
|
|
|
|
waitForFrame();
|
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
void MoviePlayerDummy::drawTextObject(MovieTextObject *t) {
|
2006-07-15 22:42:28 +00:00
|
|
|
if (t->textSprite && _textSurface) {
|
|
|
|
_vm->_screen->drawSurface(t->textSprite, _textSurface);
|
|
|
|
}
|
2006-07-08 11:42:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MoviePlayerDummy::undrawTextObject(MovieTextObject *t) {
|
2006-07-15 22:42:28 +00:00
|
|
|
if (t->textSprite && _textSurface) {
|
|
|
|
memset(_textSurface, 1, t->textSprite->w * t->textSprite->h);
|
|
|
|
drawTextObject(t);
|
|
|
|
}
|
2006-07-08 11:42:07 +00:00
|
|
|
}
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Factory function for creating the appropriate cutscene player
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
MoviePlayer *makeMoviePlayer(Sword2Engine *vm, const char *name) {
|
|
|
|
char filename[20];
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
#ifdef USE_ZLIB
|
|
|
|
snprintf(filename, sizeof(filename), "%s.dxa", name);
|
|
|
|
|
|
|
|
if (Common::File::exists(filename)) {
|
|
|
|
return new MoviePlayerDXA(vm);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_MPEG2
|
|
|
|
snprintf(filename, sizeof(filename), "%s.mp2", name);
|
|
|
|
|
|
|
|
if (Common::File::exists(filename)) {
|
|
|
|
return new MoviePlayerMPEG(vm);
|
|
|
|
}
|
|
|
|
#endif
|
2004-01-13 10:09:53 +00:00
|
|
|
|
2006-07-08 11:42:07 +00:00
|
|
|
return new MoviePlayerDummy(vm);
|
2004-01-13 10:09:53 +00:00
|
|
|
}
|
|
|
|
|
2004-01-12 11:11:19 +00:00
|
|
|
} // End of namespace Sword2
|