diff options
Diffstat (limited to 'engines/groovie')
-rw-r--r-- | engines/groovie/graphics.cpp | 25 | ||||
-rw-r--r-- | engines/groovie/graphics.h | 2 | ||||
-rw-r--r-- | engines/groovie/roq.cpp | 6 | ||||
-rw-r--r-- | engines/groovie/script.cpp | 20 |
4 files changed, 41 insertions, 12 deletions
diff --git a/engines/groovie/graphics.cpp b/engines/groovie/graphics.cpp index b85277fac7..e0c198f377 100644 --- a/engines/groovie/graphics.cpp +++ b/engines/groovie/graphics.cpp @@ -63,7 +63,7 @@ void GraphicsMan::update() { // Clear the buffer when ending the fade out if (_fading == 2) - _foreground.fillRect(Common::Rect(640, 320), 0); + _foreground.fillRect(Common::Rect(640, _foreground.h), 0); } } @@ -74,6 +74,22 @@ void GraphicsMan::update() { } } +void GraphicsMan::switchToFullScreen(bool fullScreen) { + _foreground.free(); + _background.free(); + + if (fullScreen) { + _foreground.create(640, 480, _vm->_pixelFormat); + _background.create(640, 480, _vm->_pixelFormat); + } else { + _vm->_system->fillScreen(0); + _foreground.create(640, 320, _vm->_pixelFormat); + _background.create(640, 320, _vm->_pixelFormat); + } + + _changed = true; +} + void GraphicsMan::change() { _changed = true; } @@ -84,7 +100,7 @@ void GraphicsMan::mergeFgAndBg() { countf = (byte *)_foreground.getPixels(); countb = (byte *)_background.getPixels(); - for (i = 640 * 320; i; i--) { + for (i = 640 * _foreground.h; i; i--) { if (255 == *(countf)) { *(countf) = *(countb); } @@ -94,7 +110,10 @@ void GraphicsMan::mergeFgAndBg() { } void GraphicsMan::updateScreen(Graphics::Surface *source) { - _vm->_system->copyRectToScreen(source->getPixels(), 640, 0, 80, 640, 320); + if (!isFullScreen()) + _vm->_system->copyRectToScreen(source->getPixels(), source->pitch, 0, 80, 640, 320); + else + _vm->_system->copyRectToScreen(source->getPixels(), source->pitch, 0, 0, 640, 480); change(); } diff --git a/engines/groovie/graphics.h b/engines/groovie/graphics.h index 72ab01deb6..69934f9d68 100644 --- a/engines/groovie/graphics.h +++ b/engines/groovie/graphics.h @@ -38,6 +38,8 @@ public: void update(); void change(); void mergeFgAndBg(); + void switchToFullScreen(bool fullScreen); + bool isFullScreen() { return (_foreground.h == 480); } void updateScreen(Graphics::Surface *source); Graphics::Surface _foreground; // The main surface that most things are drawn to Graphics::Surface _background; // Used occasionally, mostly (only?) in puzzles diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index 379fcabc07..0c735962b6 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -277,6 +277,12 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) { _prevBuf->create(width, height, _vm->_pixelFormat); } + // Switch from/to fullscreen, if needed + if (_bg->h != 480 && height == 480) + _vm->_graphicsMan->switchToFullScreen(true); + else if (_bg->h == 480 && height != 480) + _vm->_graphicsMan->switchToFullScreen(false); + // Clear the buffers with black _currBuf->fillRect(Common::Rect(width, height), _vm->_pixelFormat.RGBToColor(0, 0, 0)); _prevBuf->fillRect(Common::Rect(width, height), _vm->_pixelFormat.RGBToColor(0, 0, 0)); diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 4f4e45ddd2..1d4ad0aec9 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -350,9 +350,10 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) { // Show hotspots when debugging if (DebugMan.isDebugChannelEnabled(kDebugHotspots)) { - rect.translate(0, -80); + if (!_vm->_graphicsMan->isFullScreen()) + rect.translate(0, -80); _vm->_graphicsMan->_foreground.frameRect(rect, 250); - _vm->_system->copyRectToScreen(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320); + _vm->_graphicsMan->updateScreen(&_vm->_graphicsMan->_foreground); _vm->_system->updateScreen(); } @@ -962,7 +963,7 @@ void Script::o_strcmpnejmp_var() { // 0x21 void Script::o_copybgtofg() { // 0x22 debugC(1, kDebugScript, "COPY_BG_TO_FG"); - memcpy(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_background.getPixels(), 640 * 320); + memcpy(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_background.getPixels(), 640 * _vm->_graphicsMan->_foreground.h); } void Script::o_strcmpeqjmp() { // 0x23 @@ -1198,6 +1199,7 @@ void Script::o_copyrecttobg() { // 0x37 uint16 top = readScript16bits(); uint16 right = readScript16bits(); uint16 bottom = readScript16bits(); + uint16 baseTop = (!_vm->_graphicsMan->isFullScreen()) ? 80 : 0; // Sanity checks to prevent bad pointer access crashes if (left > right) { @@ -1216,9 +1218,9 @@ void Script::o_copyrecttobg() { // 0x37 bottom = top; top = j; } - if (top < 80) { - warning("COPYRECT top < 80... clamping"); - top = 80; + if (top < baseTop) { + warning("COPYRECT top < baseTop... clamping"); + top = baseTop; } if (top >= 480) { warning("COPYRECT top >= 480... clamping"); @@ -1243,13 +1245,13 @@ void Script::o_copyrecttobg() { // 0x37 debugC(1, kDebugScript, "COPYRECT((%d,%d)->(%d,%d))", left, top, right, bottom); - fg = (byte *)_vm->_graphicsMan->_foreground.getBasePtr(left, top - 80); - bg = (byte *)_vm->_graphicsMan->_background.getBasePtr(left, top - 80); + fg = (byte *)_vm->_graphicsMan->_foreground.getBasePtr(left, top - baseTop); + bg = (byte *)_vm->_graphicsMan->_background.getBasePtr(left, top - baseTop); for (i = 0; i < height; i++) { memcpy(bg + offset, fg + offset, width); offset += 640; } - _vm->_system->copyRectToScreen(_vm->_graphicsMan->_background.getBasePtr(left, top - 80), 640, left, top, width, height); + _vm->_system->copyRectToScreen(_vm->_graphicsMan->_background.getBasePtr(left, top - baseTop), 640, left, top, width, height); _vm->_graphicsMan->change(); } |