aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1/animation.cpp
diff options
context:
space:
mode:
authorThierry Crozat2011-10-27 21:49:33 +0100
committerThierry Crozat2011-10-27 21:49:33 +0100
commit6abd63b804de6d4edd503a750cf89e96a9bfebe3 (patch)
tree0f1648a56463609fc3b422074a85906d8ea8c537 /engines/sword1/animation.cpp
parent44e4e16819186d45e3a1adeed311218b92bbf283 (diff)
downloadscummvm-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/animation.cpp')
-rw-r--r--engines/sword1/animation.cpp15
1 files changed, 8 insertions, 7 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();