diff options
author | Thierry Crozat | 2011-10-27 21:49:33 +0100 |
---|---|---|
committer | Thierry Crozat | 2011-10-27 21:49:33 +0100 |
commit | 6abd63b804de6d4edd503a750cf89e96a9bfebe3 (patch) | |
tree | 0f1648a56463609fc3b422074a85906d8ea8c537 /engines/sword1 | |
parent | 44e4e16819186d45e3a1adeed311218b92bbf283 (diff) | |
download | scummvm-rg350-6abd63b804de6d4edd503a750cf89e96a9bfebe3.tar.gz scummvm-rg350-6abd63b804de6d4edd503a750cf89e96a9bfebe3.tar.bz2 scummvm-rg350-6abd63b804de6d4edd503a750cf89e96a9bfebe3.zip |
SWORD1: Fix crash when using cutscene subtitles with mac version
It might have been simpler to add a bool to Text::makeTextSprite() to
tell it to not byteswap the frame size when called from the movie
player but I was not sure it was a good idea to have frames with
different endianness stored in Text depending where they came from.
Diffstat (limited to 'engines/sword1')
-rw-r--r-- | engines/sword1/animation.cpp | 15 | ||||
-rw-r--r-- | engines/sword1/animation.h | 5 | ||||
-rw-r--r-- | engines/sword1/logic.cpp | 2 |
3 files changed, 12 insertions, 10 deletions
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index 324154f709..d55a08293e 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -28,6 +28,7 @@ #include "sword1/sword1.h" #include "sword1/animation.h" #include "sword1/text.h" +#include "sword1/resman.h" #include "common/str.h" #include "common/system.h" @@ -65,8 +66,8 @@ static const char *const sequenceList[20] = { // Basic movie player /////////////////////////////////////////////////////////////////////////////// -MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType) - : _vm(vm), _textMan(textMan), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) { +MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType) + : _vm(vm), _textMan(textMan), _resMan(resMan), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) { _bgSoundStream = NULL; _decoderType = decoderType; _decoder = decoder; @@ -183,8 +184,8 @@ void MoviePlayer::performPostProcessing(byte *screen) { _textMan->makeTextSprite(2, (const uint8 *)_movieTexts.front()._text.c_str(), 600, LETTER_COL); FrameHeader *frame = _textMan->giveSpriteData(2); - _textWidth = frame->width; - _textHeight = frame->height; + _textWidth = _resMan->toUint16(frame->width); + _textHeight = _resMan->toUint16(frame->height); _textX = 320 - _textWidth / 2; _textY = 420 - _textHeight; } @@ -323,7 +324,7 @@ uint32 DXADecoderWithSound::getElapsedTime() const { // Factory function for creating the appropriate cutscene player /////////////////////////////////////////////////////////////////////////////// -MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system) { +MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system) { Common::String filename; Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle; @@ -331,7 +332,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::M if (Common::File::exists(filename)) { Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(snd); - return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK); + return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK); } filename = Common::String::format("%s.dxa", sequenceList[id]); @@ -339,7 +340,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::M if (Common::File::exists(filename)) { #ifdef USE_ZLIB DXADecoderWithSound *dxaDecoder = new DXADecoderWithSound(snd, bgSoundHandle); - return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA); + return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA); #else GUI::MessageDialog dialog(_("DXA cutscenes found but ScummVM has been built without zlib support"), _("OK")); dialog.runModal(); diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h index fc3061bbf9..1c03c66342 100644 --- a/engines/sword1/animation.h +++ b/engines/sword1/animation.h @@ -67,7 +67,7 @@ private: class MoviePlayer { public: - MoviePlayer(SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType); + MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType); virtual ~MoviePlayer(); bool load(uint32 id); void play(); @@ -75,6 +75,7 @@ public: protected: SwordEngine *_vm; Text *_textMan; + ResMan *_resMan; Audio::Mixer *_snd; OSystem *_system; Common::List<MovieText> _movieTexts; @@ -93,7 +94,7 @@ protected: byte findWhitePalIndex(); }; -MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system); +MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system); } // End of namespace Sword1 diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp index d1c69c80ff..9d92a29a63 100644 --- a/engines/sword1/logic.cpp +++ b/engines/sword1/logic.cpp @@ -959,7 +959,7 @@ int Logic::fnPlaySequence(Object *cpt, int32 id, int32 sequenceId, int32 d, int3 // meantime, we don't want any looping sound effects still playing. _sound->quitScreen(); - MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _textMan, _mixer, _system); + MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _textMan, _resMan, _mixer, _system); if (player) { _screen->clearScreen(); if (player->load(sequenceId)) |