MPEG player fixes:

* Initialise _frameWidth and _frameHeight to prevent them from being undefined.
* Fix BS2 subtitle positioning. (Fixes bug #1499916)
* In BS2, copy the frame to the backend in 8-bit mode.
* Fix compilation in 8-bit mode.

BS2 subtitles aren't quite right in 8-bit mode, but I expect we want to
re-design things a bit if we ever add DXA cutscenes. We can fix minor details
then.

svn-id: r22859
This commit is contained in:
Torbjörn Andersson 2006-06-03 09:43:10 +00:00
parent 4b706aca43
commit 3114f19d94
2 changed files with 17 additions and 10 deletions

View File

@ -53,7 +53,11 @@ void AnimationState::setPalette(byte *pal) {
#else
void AnimationState::drawTextObject(SpriteInfo *s, byte *src) {
OverlayColor *dst = _overlay + _movieScale * _movieWidth * _movieScale * s->y + _movieScale * s->x;
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);
@ -88,12 +92,12 @@ void AnimationState::drawTextObject(SpriteInfo *s, byte *src) {
}
if (_movieScale > 1) {
memcpy(dst + _movieScale * _movieWidth, dst, _movieScale * s->w * sizeof(OverlayColor));
memcpy(dst + moviePitch, dst, _movieScale * s->w * sizeof(OverlayColor));
if (_movieScale > 2)
memcpy(dst + 2 * _movieScale * _movieWidth, dst, _movieScale * s->w * sizeof(OverlayColor));
memcpy(dst + 2 * moviePitch, dst, _movieScale * s->w * sizeof(OverlayColor));
}
dst += _movieScale * _movieScale * _movieWidth;
dst += _movieScale * moviePitch;
src += s->w;
}
}
@ -101,9 +105,6 @@ void AnimationState::drawTextObject(SpriteInfo *s, byte *src) {
#endif
void AnimationState::clearScreen() {
_frameWidth = _movieWidth;
_frameHeight = _movieHeight;
#ifdef BACKEND_8BIT
memset(_vm->_screen->getScreen(), 0, _movieWidth * _movieHeight);
#else
@ -273,6 +274,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
if (!anim->init(filename)) {
delete anim;
anim = NULL;
// Missing Files? Use the old 'Narration Only' hack
playDummy(filename, text, leadOut, leadOutLen);
return;
@ -318,6 +320,10 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
drawTextObject(anim, text[textCounter]);
}
#ifdef BACKEND_8BIT
_sys->copyRectToScreen(_vm->_screen->getScreen(), 640, 0, 0, 640, 480);
#endif
anim->updateScreen();
frameCounter++;
@ -390,6 +396,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
_vm->_screen->setPalette(0, 256, oldPal, RDPAL_INSTANT);
delete anim;
anim = NULL;
}
/**

View File

@ -32,7 +32,7 @@
namespace Graphics {
BaseAnimationState::BaseAnimationState(Audio::Mixer *snd, OSystem *sys, int width, int height)
: _movieWidth(width), _movieHeight(height), _snd(snd), _sys(sys) {
: _movieWidth(width), _movieHeight(height), _frameWidth(width), _frameHeight(height), _snd(snd), _sys(sys) {
#ifndef BACKEND_8BIT
const int screenW = _sys->getOverlayWidth();
const int screenH = _sys->getOverlayHeight();
@ -661,6 +661,8 @@ void BaseAnimationState::plotYUV3x(int width, int height, byte *const *dat) {
}
}
#endif
void BaseAnimationState::updateScreen() {
#ifndef BACKEND_8BIT
int width = _movieScale * _frameWidth;
@ -678,6 +680,4 @@ void BaseAnimationState::updateScreen() {
_sys->updateScreen();
}
#endif
} // End of namespace Graphics