From 4b9602615c33c0c67c9a9d414bb9ff2e298602cb Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 18 Jan 2004 21:09:57 +0000 Subject: This should make subtitles work again in "overlay" cutscene mode. svn-id: r12506 --- sword2/driver/animation.cpp | 45 +++++++++++++++++++++++++++++++++++++++++---- sword2/driver/animation.h | 9 +++++++-- 2 files changed, 48 insertions(+), 6 deletions(-) (limited to 'sword2/driver') diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp index c348079ee1..61ce0a90f1 100644 --- a/sword2/driver/animation.cpp +++ b/sword2/driver/animation.cpp @@ -279,7 +279,35 @@ void AnimationState::plotYUV(NewGuiColor *lut, int width, int height, byte *cons linepos += (2 * 640 - width); ypos += width; } +} + +void AnimationState::drawTextObject(SpriteInfo *s, uint8 *src) { + NewGuiColor *dst = overlay + RENDERWIDE * (s->y - 40) + s->x; + + // FIXME: These aren't the "right" colours, but look good to me. + + NewGuiColor pen = _vm->_system->RGBToColor(255, 255, 255); + NewGuiColor border = _vm->_system->RGBToColor(0, 0, 0); + + for (int y = 0; y < s->h; y++) { + for (int x = 0; x < s->w; x++) { + switch (src[x]) { + case 1: + dst[x] = border; + break; + case 255: + dst[x] = pen; + break; + default: + break; + } + } + dst += RENDERWIDE; + src += s->w; + } +} +void AnimationState::updateDisplay(void) { _vm->_system->copy_rect_overlay(overlay, 640, 0, 40, 640, 400); } @@ -380,9 +408,17 @@ void MoviePlayer::closeTextObject(MovieTextObject *obj) { } } -void MoviePlayer::drawTextObject(MovieTextObject *obj) { - if (obj->textSprite && _textSurface) +void MoviePlayer::drawTextObject(AnimationState *anim, MovieTextObject *obj) { + if (obj->textSprite && _textSurface) { +#ifdef BACKEND_8BIT _vm->_graphics->drawSurface(obj->textSprite, _textSurface); +#else + if (anim) + anim->drawTextObject(obj->textSprite, _textSurface); + else + _vm->_graphics->drawSurface(obj->textSprite, _textSurface); +#endif + } } /** @@ -440,7 +476,7 @@ int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], uint8 *mu textVisible = false; } if (textVisible) - drawTextObject(text[textCounter]); + drawTextObject(anim, text[textCounter]); } frameCounter++; @@ -448,6 +484,7 @@ int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], uint8 *mu #ifdef BACKEND_8BIT _vm->_graphics->updateDisplay(true); #else + anim->updateDisplay(); _vm->_graphics->updateDisplay(false); #endif @@ -570,7 +607,7 @@ int32 MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], uint if (frameCounter == text[textCounter]->startFrame) { _vm->_graphics->clearScene(); openTextObject(text[textCounter]); - drawTextObject(text[textCounter]); + drawTextObject(NULL, text[textCounter]); if (text[textCounter]->speech) { _vm->_mixer->playRaw(&handle, text[textCounter]->speech, text[textCounter]->speechBufferSize, 22050, flags); } diff --git a/sword2/driver/animation.h b/sword2/driver/animation.h index a30585b1b8..3d53e7eb25 100644 --- a/sword2/driver/animation.h +++ b/sword2/driver/animation.h @@ -105,7 +105,7 @@ private: } palettes[50]; #else static NewGuiColor lookup2[BITDEPTH * BITDEPTH * 256]; - NewGuiColor * overlay; + NewGuiColor *overlay; static bool lookupInit; #endif @@ -118,6 +118,11 @@ public: bool init(const char *name); bool decodeFrame(); +#ifndef BACKEND_8BIT + void drawTextObject(SpriteInfo *s, uint8 *src); + void updateDisplay(void); +#endif + private: #ifdef BACKEND_8BIT @@ -136,7 +141,7 @@ private: void openTextObject(MovieTextObject *obj); void closeTextObject(MovieTextObject *obj); - void drawTextObject(MovieTextObject *obj); + void drawTextObject(AnimationState *anim, MovieTextObject *obj); int32 playDummy(const char *filename, MovieTextObject *text[], uint8 *musicOut); -- cgit v1.2.3