mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 23:01:42 +00:00
Allow quitting or returning to the launcher while cutscenes are playing.
svn-id: r34657
This commit is contained in:
parent
7644ff05f9
commit
46a5320f0d
@ -66,8 +66,8 @@ static const char *sequenceList[20] = {
|
||||
// Basic movie player
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MoviePlayer::MoviePlayer(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
|
||||
: _screen(screen), _textMan(textMan), _snd(snd), _system(system) {
|
||||
MoviePlayer::MoviePlayer(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
|
||||
: _vm(vm), _screen(screen), _textMan(textMan), _snd(snd), _system(system) {
|
||||
_bgSoundStream = NULL;
|
||||
_ticks = 0;
|
||||
_textSpriteBuf = NULL;
|
||||
@ -265,7 +265,7 @@ void MoviePlayer::play(void) {
|
||||
_currentFrame = 0;
|
||||
bool terminated = false;
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (!terminated && decodeFrame()) {
|
||||
while (!terminated && decodeFrame() && !_vm->quit()) {
|
||||
if (!_movieTexts.empty()) {
|
||||
if (_currentFrame == _movieTexts[0]->_startFrame) {
|
||||
_textMan->makeTextSprite(2, (uint8 *)_movieTexts[0]->_text, 600, LETTER_COL);
|
||||
@ -306,6 +306,9 @@ void MoviePlayer::play(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (_vm->quit())
|
||||
_snd->stopHandle(_bgSoundHandle);
|
||||
|
||||
while (!_movieTexts.empty()) {
|
||||
delete _movieTexts.remove_at(_movieTexts.size() - 1);
|
||||
}
|
||||
@ -390,8 +393,8 @@ int SplittedAudioStream::readBuffer(int16 *buffer, const int numSamples) {
|
||||
// Movie player for the new DXA movies
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MoviePlayerDXA::MoviePlayerDXA(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
|
||||
: MoviePlayer(screen, textMan, snd, system) {
|
||||
MoviePlayerDXA::MoviePlayerDXA(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
|
||||
: MoviePlayer(vm, screen, textMan, snd, system) {
|
||||
debug(0, "Creating DXA cutscene player");
|
||||
}
|
||||
|
||||
@ -492,8 +495,8 @@ void MoviePlayerDXA::updateScreen(void) {
|
||||
// Movie player for the old MPEG movies
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MoviePlayerMPEG::MoviePlayerMPEG(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
|
||||
: MoviePlayer(screen, textMan, snd, system) {
|
||||
MoviePlayerMPEG::MoviePlayerMPEG(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system)
|
||||
: MoviePlayer(vm, screen, textMan, snd, system) {
|
||||
#ifdef BACKEND_8BIT
|
||||
debug(0, "Creating MPEG cutscene player (8-bit)");
|
||||
#else
|
||||
@ -625,7 +628,7 @@ Audio::AudioStream *AnimationState::createAudioStream(const char *name, void *ar
|
||||
// Factory function for creating the appropriate cutscene player
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MoviePlayer *makeMoviePlayer(uint32 id, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system) {
|
||||
MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system) {
|
||||
#if defined(USE_ZLIB) || defined(USE_MPEG2)
|
||||
char filename[20];
|
||||
#endif
|
||||
@ -634,7 +637,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, Screen *screen, Text *textMan, Audio::Mi
|
||||
snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]);
|
||||
|
||||
if (Common::File::exists(filename)) {
|
||||
return new MoviePlayerDXA(screen, textMan, snd, system);
|
||||
return new MoviePlayerDXA(vm, screen, textMan, snd, system);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -642,7 +645,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, Screen *screen, Text *textMan, Audio::Mi
|
||||
snprintf(filename, sizeof(filename), "%s.mp2", sequenceList[id]);
|
||||
|
||||
if (Common::File::exists(filename)) {
|
||||
return new MoviePlayerMPEG(screen, textMan, snd, system);
|
||||
return new MoviePlayerMPEG(vm, screen, textMan, snd, system);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
|
||||
class MoviePlayer {
|
||||
public:
|
||||
MoviePlayer(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
|
||||
MoviePlayer(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
|
||||
virtual ~MoviePlayer(void);
|
||||
virtual bool load(uint32 id);
|
||||
void play(void);
|
||||
@ -86,6 +86,7 @@ public:
|
||||
private:
|
||||
bool checkSkipFrame(void);
|
||||
protected:
|
||||
SwordEngine *_vm;
|
||||
Screen *_screen;
|
||||
Text *_textMan;
|
||||
Audio::Mixer *_snd;
|
||||
@ -122,7 +123,7 @@ class MoviePlayerDXA : public MoviePlayer, ::Graphics::DXAPlayer {
|
||||
protected:
|
||||
virtual void setPalette(byte *pal);
|
||||
public:
|
||||
MoviePlayerDXA(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
|
||||
MoviePlayerDXA(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
|
||||
virtual ~MoviePlayerDXA(void);
|
||||
bool load(uint32 id);
|
||||
protected:
|
||||
@ -159,7 +160,7 @@ protected:
|
||||
|
||||
class MoviePlayerMPEG : public MoviePlayer {
|
||||
public:
|
||||
MoviePlayerMPEG(Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
|
||||
MoviePlayerMPEG(SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
|
||||
virtual ~MoviePlayerMPEG(void);
|
||||
bool load(uint32 id);
|
||||
protected:
|
||||
@ -195,7 +196,7 @@ private:
|
||||
FileQueue *_queue;
|
||||
};
|
||||
|
||||
MoviePlayer *makeMoviePlayer(uint32 id, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
|
||||
MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Screen *screen, Text *textMan, Audio::Mixer *snd, OSystem *system);
|
||||
|
||||
} // End of namespace Sword1
|
||||
|
||||
|
@ -55,9 +55,10 @@ namespace Sword1 {
|
||||
|
||||
uint32 Logic::_scriptVars[NUM_SCRIPT_VARS];
|
||||
|
||||
Logic::Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer) {
|
||||
Logic::Logic(SwordEngine *vm, ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer) {
|
||||
g_system->getEventManager()->registerRandomSource(_rnd, "sword1");
|
||||
|
||||
_vm = vm;
|
||||
_objMan = pObjMan;
|
||||
_resMan = resMan;
|
||||
_screen = pScreen;
|
||||
@ -963,7 +964,7 @@ int Logic::fnPlaySequence(Object *cpt, int32 id, int32 sequenceId, int32 d, int3
|
||||
CreditsPlayer player(_system, _mixer);
|
||||
player.play();
|
||||
} else {
|
||||
MoviePlayer *player = makeMoviePlayer(sequenceId, _screen, _textMan, _mixer, _system);
|
||||
MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _screen, _textMan, _mixer, _system);
|
||||
if (player) {
|
||||
if (player->load(sequenceId))
|
||||
player->play();
|
||||
|
@ -37,6 +37,7 @@ namespace Sword1 {
|
||||
#define NON_ZERO_SCRIPT_VARS 95
|
||||
#define NUM_SCRIPT_VARS 1179
|
||||
|
||||
class SwordEngine;
|
||||
class Text;
|
||||
class Sound;
|
||||
class EventManager;
|
||||
@ -51,7 +52,7 @@ typedef int (Logic::*BSMcodeTable)(Object *, int32, int32, int32, int32, int32,
|
||||
|
||||
class Logic {
|
||||
public:
|
||||
Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer);
|
||||
Logic(SwordEngine *vm, ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer);
|
||||
~Logic(void);
|
||||
void initialize(void);
|
||||
void newScreen(uint32 screen);
|
||||
@ -64,6 +65,7 @@ public:
|
||||
// public for mouse (menu looking)
|
||||
int cfnPresetScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
|
||||
private:
|
||||
SwordEngine *_vm;
|
||||
ObjectMan *_objMan;
|
||||
OSystem *_system;
|
||||
Audio::Mixer *_mixer;
|
||||
|
@ -303,7 +303,7 @@ int SwordEngine::init() {
|
||||
_music = new Music(_mixer);
|
||||
_sound = new Sound("", _mixer, _resMan);
|
||||
_menu = new Menu(_screen, _mouse);
|
||||
_logic = new Logic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer);
|
||||
_logic = new Logic(this, _objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer);
|
||||
_mouse->useLogicAndMenu(_logic, _menu);
|
||||
|
||||
syncSoundSettings();
|
||||
|
Loading…
x
Reference in New Issue
Block a user