diff options
-rw-r--r-- | engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_screen.cpp | 32 | ||||
-rw-r--r-- | engines/sherlock/screen.cpp | 37 | ||||
-rw-r--r-- | engines/sherlock/screen.h | 9 |
4 files changed, 44 insertions, 38 deletions
diff --git a/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp b/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp index f848394864..f8112d8add 100644 --- a/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp +++ b/engines/sherlock/scalpel/3do/scalpel_3do_screen.cpp @@ -117,7 +117,7 @@ void Scalpel3DOScreen::fillRect(const Common::Rect &r, uint color) { void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) { Events &events = *_vm->_events; uint16 *currentScreenBasePtr = (uint16 *)getPixels(); - uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels(); + uint16 *targetScreenBasePtr = (uint16 *)_backBuffer.getPixels(); uint16 currentScreenPixel = 0; uint16 targetScreenPixel = 0; @@ -211,7 +211,7 @@ void Scalpel3DOScreen::fadeIntoScreen3DO(int speed) { void Scalpel3DOScreen::blitFrom3DOcolorLimit(uint16 limitColor) { uint16 *currentScreenPtr = (uint16 *)getPixels(); - uint16 *targetScreenPtr = (uint16 *)_backBuffer->getPixels(); + uint16 *targetScreenPtr = (uint16 *)_backBuffer.getPixels(); uint16 currentScreenPixel = 0; uint16 screenWidth = SHERLOCK_SCREEN_WIDTH; diff --git a/engines/sherlock/scalpel/scalpel_screen.cpp b/engines/sherlock/scalpel/scalpel_screen.cpp index 37e5294c02..ba78f487b6 100644 --- a/engines/sherlock/scalpel/scalpel_screen.cpp +++ b/engines/sherlock/scalpel/scalpel_screen.cpp @@ -35,7 +35,7 @@ ScalpelScreen::ScalpelScreen(SherlockEngine *vm) : Screen(vm) { void ScalpelScreen::makeButton(const Common::Rect &bounds, int textX, const Common::String &buttonText, bool textContainsHotkey) { - Surface &bb = *_backBuffer; + Surface &bb = _backBuffer; bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.right, bounds.top + 1), BUTTON_TOP); bb.fillRect(Common::Rect(bounds.left, bounds.top, bounds.left + 1, bounds.bottom), BUTTON_TOP); bb.fillRect(Common::Rect(bounds.right - 1, bounds.top, bounds.right, bounds.bottom), BUTTON_BOTTOM); @@ -105,24 +105,24 @@ void ScalpelScreen::buttonPrint(const Common::Point &pt, uint color, bool slamIt } void ScalpelScreen::makePanel(const Common::Rect &r) { - _backBuffer->fillRect(r, BUTTON_MIDDLE); - _backBuffer->hLine(r.left, r.top, r.right - 2, BUTTON_TOP); - _backBuffer->hLine(r.left + 1, r.top + 1, r.right - 3, BUTTON_TOP); - _backBuffer->vLine(r.left, r.top, r.bottom - 1, BUTTON_TOP); - _backBuffer->vLine(r.left + 1, r.top + 1, r.bottom - 2, BUTTON_TOP); - - _backBuffer->vLine(r.right - 1, r.top, r.bottom - 1, BUTTON_BOTTOM); - _backBuffer->vLine(r.right - 2, r.top + 1, r.bottom - 2, BUTTON_BOTTOM); - _backBuffer->hLine(r.left, r.bottom - 1, r.right - 1, BUTTON_BOTTOM); - _backBuffer->hLine(r.left + 1, r.bottom - 2, r.right - 1, BUTTON_BOTTOM); + _backBuffer.fillRect(r, BUTTON_MIDDLE); + _backBuffer.hLine(r.left, r.top, r.right - 2, BUTTON_TOP); + _backBuffer.hLine(r.left + 1, r.top + 1, r.right - 3, BUTTON_TOP); + _backBuffer.vLine(r.left, r.top, r.bottom - 1, BUTTON_TOP); + _backBuffer.vLine(r.left + 1, r.top + 1, r.bottom - 2, BUTTON_TOP); + + _backBuffer.vLine(r.right - 1, r.top, r.bottom - 1, BUTTON_BOTTOM); + _backBuffer.vLine(r.right - 2, r.top + 1, r.bottom - 2, BUTTON_BOTTOM); + _backBuffer.hLine(r.left, r.bottom - 1, r.right - 1, BUTTON_BOTTOM); + _backBuffer.hLine(r.left + 1, r.bottom - 2, r.right - 1, BUTTON_BOTTOM); } void ScalpelScreen::makeField(const Common::Rect &r) { - _backBuffer->fillRect(r, BUTTON_MIDDLE); - _backBuffer->hLine(r.left, r.top, r.right - 1, BUTTON_BOTTOM); - _backBuffer->hLine(r.left + 1, r.bottom - 1, r.right - 1, BUTTON_TOP); - _backBuffer->vLine(r.left, r.top + 1, r.bottom - 1, BUTTON_BOTTOM); - _backBuffer->vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP); + _backBuffer.fillRect(r, BUTTON_MIDDLE); + _backBuffer.hLine(r.left, r.top, r.right - 1, BUTTON_BOTTOM); + _backBuffer.hLine(r.left + 1, r.bottom - 1, r.right - 1, BUTTON_TOP); + _backBuffer.vLine(r.left, r.top + 1, r.bottom - 1, BUTTON_BOTTOM); + _backBuffer.vLine(r.right - 1, r.top + 1, r.bottom - 2, BUTTON_TOP); } } // End of namespace Scalpel diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index b60a931e4f..d96310abb3 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -40,7 +40,7 @@ Screen *Screen::init(SherlockEngine *vm) { return new Scalpel::ScalpelScreen(vm); } -Screen::Screen(SherlockEngine *vm) : Graphics::Screen(), _vm(vm), _backBuffer(&_backBuffer1) { +Screen::Screen(SherlockEngine *vm) : Graphics::Screen(), _vm(vm) { _transitionSeed = 1; _fadeStyle = false; Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0); @@ -54,12 +54,22 @@ Screen::Screen(SherlockEngine *vm) : Graphics::Screen(), _vm(vm), _backBuffer(&_ _fadeBytesRead = _fadeBytesToRead = 0; _oldFadePercent = 0; _flushScreen = false; + + _backBuffer.create(_backBuffer1, _backBuffer1.getBounds()); } Screen::~Screen() { Fonts::freeFont(); } +void Screen::activateBackBuffer1() { + _backBuffer.create(_backBuffer1, _backBuffer1.getBounds()); +} + +void Screen::activateBackBuffer2() { + _backBuffer.create(_backBuffer2, _backBuffer2.getBounds()); +} + int Screen::equalizePalette(const byte palette[PALETTE_SIZE]) { int total = 0; byte tempPalette[PALETTE_SIZE]; @@ -116,7 +126,7 @@ void Screen::randomTransition() { int offset = _transitionSeed & 0xFFFF; if (offset < (this->width() * this->height())) - *((byte *)getPixels() + offset) = *((const byte *)_backBuffer->getPixels() + offset); + *((byte *)getPixels() + offset) = *((const byte *)_backBuffer.getPixels() + offset); if (idx != 0 && (idx % 300) == 0) { // Ensure there's a full screen dirty rect for the next frame update @@ -129,7 +139,7 @@ void Screen::randomTransition() { } // Make sure everything has been transferred - SHblitFrom(*_backBuffer); + SHblitFrom(_backBuffer); } void Screen::verticalTransition() { @@ -156,7 +166,7 @@ void Screen::verticalTransition() { void Screen::restoreBackground(const Common::Rect &r) { if (r.width() > 0 && r.height() > 0) - _backBuffer->SHblitFrom(_backBuffer2, Common::Point(r.left, r.top), r); + _backBuffer.SHblitFrom(_backBuffer2, Common::Point(r.left, r.top), r); } void Screen::slamArea(int16 xp, int16 yp, int16 width, int16 height) { @@ -187,7 +197,7 @@ void Screen::slamRect(const Common::Rect &r) { } if (srcRect.isValidRect()) - SHblitFrom(*_backBuffer, Common::Point(destRect.left, destRect.top), srcRect); + SHblitFrom(_backBuffer, Common::Point(destRect.left, destRect.top), srcRect); } } @@ -310,29 +320,26 @@ void Screen::gPrint(const Common::Point &pt, uint color, const char *formatStr, } void Screen::writeString(const Common::String &str, const Common::Point &pt, uint overrideColor) { - Fonts::writeString(_backBuffer, str, pt, overrideColor); + Fonts::writeString(&_backBuffer, str, pt, overrideColor); } void Screen::vgaBar(const Common::Rect &r, int color) { - _backBuffer->fillRect(r, color); + _backBuffer.fillRect(r, color); slamRect(r); } void Screen::setDisplayBounds(const Common::Rect &r) { - _sceneSurface.create(_backBuffer1, r); - assert(_sceneSurface.width() == r.width()); - assert(_sceneSurface.height() == r.height()); - - _backBuffer = &_sceneSurface; + _backBuffer.create(_backBuffer1, r); + assert(_backBuffer.width() == r.width()); + assert(_backBuffer.height() == r.height()); } void Screen::resetDisplayBounds() { - _backBuffer = &_backBuffer1; + _backBuffer.create(_backBuffer1, _backBuffer1.getBounds()); } Common::Rect Screen::getDisplayBounds() { - return (_backBuffer == &_sceneSurface) ? Common::Rect(0, 0, _sceneSurface.width(), _sceneSurface.height()) : - Common::Rect(0, 0, this->width(), this->height()); + return _backBuffer.getBounds(); } void Screen::synchronize(Serializer &s) { diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h index 50aec0a5e1..f05a4f0a90 100644 --- a/engines/sherlock/screen.h +++ b/engines/sherlock/screen.h @@ -42,14 +42,13 @@ class SherlockEngine; class Screen : virtual public Graphics::Screen, virtual public Surface { private: uint32 _transitionSeed; - Surface _sceneSurface; // Rose Tattoo fields int _fadeBytesRead, _fadeBytesToRead; int _oldFadePercent; protected: SherlockEngine *_vm; - Surface *_backBuffer; + Surface _backBuffer; public: Surface _backBuffer1, _backBuffer2; @@ -67,17 +66,17 @@ public: /** * Obtain the currently active back buffer. */ - Surface *getBackBuffer() const { return _backBuffer; } + Surface *getBackBuffer() { return &_backBuffer; } /** * Makes first back buffer active. */ - void activateBackBuffer1() { _backBuffer = &_backBuffer1; } + void activateBackBuffer1(); /** * Makes second back buffer active. */ - void activateBackBuffer2() { _backBuffer = &_backBuffer2; } + void activateBackBuffer2(); /** * Fades from the currently active palette to the passed palette |