aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1
diff options
context:
space:
mode:
authorTorbjörn Andersson2009-07-28 17:19:33 +0000
committerTorbjörn Andersson2009-07-28 17:19:33 +0000
commitf853376379802198b9b02845dce0c46fec2b0af6 (patch)
tree64bbd9f820ec539f6ca4c46944056a6dcf06bde1 /engines/sword1
parent550d9cf39de5fbbd1f4173d5b7bd955c7649995b (diff)
downloadscummvm-rg350-f853376379802198b9b02845dce0c46fec2b0af6.tar.gz
scummvm-rg350-f853376379802198b9b02845dce0c46fec2b0af6.tar.bz2
scummvm-rg350-f853376379802198b9b02845dce0c46fec2b0af6.zip
Fixed drawing subtitles for cutscenes that are narrower than the screen, and
erase the subtitles manually if they are drawn outside the frame. svn-id: r42859
Diffstat (limited to 'engines/sword1')
-rw-r--r--engines/sword1/animation.cpp42
1 files changed, 37 insertions, 5 deletions
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 2d0d081ef6..7ed50461af 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -160,6 +160,9 @@ void MoviePlayer::play(void) {
stopEvent.kbd = Common::KEYCODE_ESCAPE;
stopEvents.push_back(stopEvent);
+ _textX = 0;
+ _textY = 0;
+
terminated = !playVideo(stopEvents);
if (terminated)
@@ -200,12 +203,15 @@ void MoviePlayer::performPostProcessing(byte *screen) {
}
}
+ byte *src, *dst;
+ int x, y;
+
if (_textMan->giveSpriteData(2)) {
- byte *src = (byte *)_textMan->giveSpriteData(2) + sizeof(FrameHeader);
- byte *dst = screen + _textY * _decoder->getWidth() + _textX * 1;
+ src = (byte *)_textMan->giveSpriteData(2) + sizeof(FrameHeader);
+ dst = screen + _textY * SCREEN_WIDTH + _textX * 1;
- for (int y = 0; y < _textHeight; y++) {
- for (int x = 0; x < _textWidth; x++) {
+ for (y = 0; y < _textHeight; y++) {
+ for (x = 0; x < _textWidth; x++) {
switch (src[x]) {
case BORDER_COL:
dst[x] = _decoder->getBlack();
@@ -216,8 +222,34 @@ void MoviePlayer::performPostProcessing(byte *screen) {
}
}
src += _textWidth;
- dst += _decoder->getWidth();
+ dst += SCREEN_WIDTH;
+ }
+ } else if (_textX && _textY) {
+ // If the frame doesn't cover the entire screen, we have to
+ // erase the subtitles manually.
+
+ int frameWidth = _decoder->getWidth();
+ int frameHeight = _decoder->getHeight();
+ int frameX = (_system->getWidth() - frameWidth) / 2;
+ int frameY = (_system->getHeight() - frameHeight) / 2;
+
+ dst = screen + _textY * _system->getWidth();
+
+ for (y = 0; y < _textHeight; y++) {
+ if (_textY + y < frameY || _textY + y >= frameY + frameHeight) {
+ memset(dst + _textX, _decoder->getBlack(), _textWidth);
+ } else {
+ if (frameX > _textX)
+ memset(dst + _textX, _decoder->getBlack(), frameX - _textX);
+ if (frameX + frameWidth < _textX + _textWidth)
+ memset(dst + frameX + frameWidth, _decoder->getBlack(), _textX + _textWidth - (frameX + frameWidth));
+ }
+
+ dst += _system->getWidth();
}
+
+ _textX = 0;
+ _textY = 0;
}
}