diff options
author | Eugene Sandulenko | 2006-05-17 23:52:45 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-05-17 23:52:45 +0000 |
commit | 14ec3f45fa08a0c0071693f4094fc088eb0062b5 (patch) | |
tree | 87e2af334bd1503eacc55c71cd5ccb94e5eb5751 /engines/sword2 | |
parent | 65091f7370ee118b8f99c6106d8cad1fd0ee719e (diff) | |
download | scummvm-rg350-14ec3f45fa08a0c0071693f4094fc088eb0062b5.tar.gz scummvm-rg350-14ec3f45fa08a0c0071693f4094fc088eb0062b5.tar.bz2 scummvm-rg350-14ec3f45fa08a0c0071693f4094fc088eb0062b5.zip |
- Heavily modified patch #1214784: "Disable overlay scaling"
- Eriktorbjorn's patch from same tracker item for scaling sword1/2 cutscenes
is applied as is. It lacks resolution switch on-the-fly.
- GUI widgets are repositioned on the fly and use most space, even aspect
ratio corrected screen is used without scaling
- Heavy tesing is required, but works for me in all cases except for bug
#1483272: "GUI: SCUMM pause dialog breaks upon scaler switch" which needs more
work.
- I probavly broke some backend or two
svn-id: r22505
Diffstat (limited to 'engines/sword2')
-rw-r--r-- | engines/sword2/animation.cpp | 56 | ||||
-rw-r--r-- | engines/sword2/animation.h | 3 |
2 files changed, 50 insertions, 9 deletions
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index c40f69acad..e8d17e88b0 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -53,27 +53,47 @@ void AnimationState::setPalette(byte *pal) { #else void AnimationState::drawTextObject(SpriteInfo *s, byte *src) { - OverlayColor *dst = _overlay + RENDERWIDE * s->y + s->x; - - // FIXME: These aren't the "right" colours, but look good to me. + OverlayColor *dst = _overlay + _movieScale * _movieWidth * _movieScale * s->y + _movieScale * s->x; OverlayColor pen = _sys->RGBToColor(255, 255, 255); OverlayColor border = _sys->RGBToColor(0, 0, 0); + // TODO: Use the AdvMame scalers for the text? Pre-scale it? + for (int y = 0; y < s->h; y++) { + OverlayColor *ptr = dst; + for (int x = 0; x < s->w; x++) { switch (src[x]) { case 1: - dst[x] = border; + *ptr++ = border; + if (_movieScale > 1) { + *ptr++ = border; + if (_movieScale > 2) + *ptr++ = border; + } break; case 255: - dst[x] = pen; + *ptr++ = pen; + if (_movieScale > 1) { + *ptr++ = pen; + if (_movieScale > 2) + *ptr++ = pen; + } break; default: + ptr += _movieScale; break; } } - dst += RENDERWIDE; + + if (_movieScale > 1) { + memcpy(dst + _movieScale * _movieWidth, dst, _movieScale * s->w * sizeof(OverlayColor)); + if (_movieScale > 2) + memcpy(dst + 2 * _movieScale * _movieWidth, dst, _movieScale * s->w * sizeof(OverlayColor)); + } + + dst += _movieScale * _movieScale * _movieWidth; src += s->w; } } @@ -81,28 +101,46 @@ 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 OverlayColor black = _sys->RGBToColor(0, 0, 0); - for (int i = 0; i < _movieWidth * _movieHeight; i++) + for (int i = 0; i < _movieScale * _movieWidth * _movieScale * _movieHeight; i++) _overlay[i] = black; #endif } void AnimationState::updateScreen() { + int x, y; + + x = (_movieWidth - _frameWidth) / 2; + y = (_movieHeight - _frameHeight) / 2; + #ifdef BACKEND_8BIT - byte *buf = _vm->_screen->getScreen() + ((480 - _movieHeight) / 2) * RENDERWIDE + (640 - _movieWidth) / 2; + byte *buf = _vm->_screen->getScreen() + y * RENDERWIDE + x; _vm->_system->copyRectToScreen(buf, _movieWidth, (640 - _movieWidth) / 2, (480 - _movieHeight) / 2, _movieWidth, _movieHeight); #else - _sys->copyRectToOverlay(_overlay, _movieWidth, 0, 0, _movieWidth, _movieHeight); + int width = _movieScale * _frameWidth; + int height = _movieScale * _frameHeight; + int pitch = _movieScale * _movieWidth; + + x *= _movieScale; + y *= _movieScale; + + _sys->copyRectToOverlay(_overlay + y * pitch + x, pitch, x, y, width, height); #endif _vm->_system->updateScreen(); } void AnimationState::drawYUV(int width, int height, byte *const *dat) { + _frameWidth = width; + _frameHeight = height; + #ifdef BACKEND_8BIT _vm->_screen->plotYUV(_lut, width, height, dat); #else diff --git a/engines/sword2/animation.h b/engines/sword2/animation.h index ef3ea67d02..960721b8a1 100644 --- a/engines/sword2/animation.h +++ b/engines/sword2/animation.h @@ -45,6 +45,9 @@ class AnimationState : public ::Graphics::BaseAnimationState { private: Sword2Engine *_vm; + int _frameWidth; + int _frameHeight; + public: AnimationState(Sword2Engine *vm); ~AnimationState(); |