diff options
author | Paul Gilbert | 2015-05-19 09:10:35 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-05-19 09:10:35 -0400 |
commit | 8ae0014bc25e42e519d5a6a31279ee22580aaba9 (patch) | |
tree | f65994d628384e0cec0ead4799e92410658e157f /engines | |
parent | 1c395b4de91f3edb0ad7109da016eb42a32b434b (diff) | |
download | scummvm-rg350-8ae0014bc25e42e519d5a6a31279ee22580aaba9.tar.gz scummvm-rg350-8ae0014bc25e42e519d5a6a31279ee22580aaba9.tar.bz2 scummvm-rg350-8ae0014bc25e42e519d5a6a31279ee22580aaba9.zip |
SHERLOCK: Refactor Surface not to descend directly from Graphics::Surface
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/animation.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/inventory.cpp | 15 | ||||
-rw-r--r-- | engines/sherlock/map.cpp | 10 | ||||
-rw-r--r-- | engines/sherlock/scalpel/darts.cpp | 8 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 10 | ||||
-rw-r--r-- | engines/sherlock/screen.cpp | 16 | ||||
-rw-r--r-- | engines/sherlock/surface.cpp | 63 | ||||
-rw-r--r-- | engines/sherlock/surface.h | 56 | ||||
-rw-r--r-- | engines/sherlock/user_interface.cpp | 39 |
9 files changed, 139 insertions, 80 deletions
diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp index 21d63633d3..7c1f2cd229 100644 --- a/engines/sherlock/animation.cpp +++ b/engines/sherlock/animation.cpp @@ -88,7 +88,7 @@ bool Animation::play(const Common::String &filename, int minDelay, int fade, // Draw the sprite. Note that we explicitly use the raw frame below, rather than the ImageFrame, // since we don't want the offsets in the image file to be used, just the explicit position we specify - screen.transBlitFrom(images[imageFrame]._frame, pt); + screen.transBlitFrom(images[imageFrame], pt); } else { // At this point, either the sprites for the frame has been complete, or there weren't any sprites // at all to draw for the frame diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp index 28065a1b72..63642f4e5a 100644 --- a/engines/sherlock/inventory.cpp +++ b/engines/sherlock/inventory.cpp @@ -155,9 +155,9 @@ void Inventory::putInv(InvSlamMode slamIt) { } // Draw the item image - Graphics::Surface &img = (*_invShapes[itemNum])[0]._frame; - bb.transBlitFrom(img, Common::Point(6 + itemNum * 52 + ((47 - img.w) / 2), - 163 + ((33 - img.h) / 2))); + ImageFrame &frame = (*_invShapes[itemNum])[0]; + bb.transBlitFrom(frame, Common::Point(6 + itemNum * 52 + ((47 - frame._width) / 2), + 163 + ((33 - frame._height) / 2))); } if (slamIt == SLAM_DISPLAY) @@ -307,11 +307,11 @@ void Inventory::highlight(int index, byte color) { Screen &screen = *_vm->_screen; Surface &bb = *screen._backBuffer; int slot = index - _invIndex; - Graphics::Surface &img = (*_invShapes[slot])[0]._frame; + ImageFrame &frame = (*_invShapes[slot])[0]; bb.fillRect(Common::Rect(8 + slot * 52, 165, (slot + 1) * 52, 194), color); - bb.transBlitFrom(img, Common::Point(6 + slot * 52 + ((47 - img.w) / 2), - 163 + ((33 - img.h) / 2))); + bb.transBlitFrom(frame, Common::Point(6 + slot * 52 + ((47 - frame._width) / 2), + 163 + ((33 - frame._height) / 2))); screen.slamArea(8 + slot * 52, 165, 44, 30); } @@ -331,8 +331,7 @@ void Inventory::refreshInv() { ui.examine(); if (!talk._talkToAbort) { - screen._backBuffer2.blitFrom((*ui._controlPanel)[0]._frame, - Common::Point(0, CONTROLS_Y)); + screen._backBuffer2.blitFrom((*ui._controlPanel)[0], Common::Point(0, CONTROLS_Y)); loadInv(); } } diff --git a/engines/sherlock/map.cpp b/engines/sherlock/map.cpp index ae19e65280..ed2912edc9 100644 --- a/engines/sherlock/map.cpp +++ b/engines/sherlock/map.cpp @@ -329,7 +329,7 @@ void Map::saveTopLine() { void Map::eraseTopLine() { Screen &screen = *_vm->_screen; screen._backBuffer1.blitFrom(_topLine, Common::Point(0, 0)); - screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, _topLine.h); + screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, _topLine.h()); } void Map::showPlaceName(int idx, bool highlighted) { @@ -344,7 +344,7 @@ void Map::showPlaceName(int idx, bool highlighted) { bool flipped = people[AL]._sequenceNumber == MAP_DOWNLEFT || people[AL]._sequenceNumber == MAP_LEFT || people[AL]._sequenceNumber == MAP_UPLEFT; - screen._backBuffer1.transBlitFrom(people[AL]._imageFrame->_frame, _lDrawnPos, flipped); + screen._backBuffer1.transBlitFrom(*people[AL]._imageFrame, _lDrawnPos, flipped); } if (highlighted) { @@ -386,9 +386,9 @@ void Map::updateMap(bool flushScreen) { saveIcon(people[AL]._imageFrame, hPos); if (people[AL]._sequenceNumber == MAP_DOWNLEFT || people[AL]._sequenceNumber == MAP_LEFT || people[AL]._sequenceNumber == MAP_UPLEFT) - screen._backBuffer1.transBlitFrom(people[AL]._imageFrame->_frame, hPos, true); + screen._backBuffer1.transBlitFrom(*people[AL]._imageFrame, hPos, true); else - screen._backBuffer1.transBlitFrom(people[AL]._imageFrame->_frame, hPos, false); + screen._backBuffer1.transBlitFrom(*people[AL]._imageFrame, hPos, false); if (flushScreen) { screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); @@ -488,7 +488,7 @@ void Map::saveIcon(ImageFrame *src, const Common::Point &pt) { return; } - assert(size.x <= _iconSave.w && size.y <= _iconSave.h); + assert(size.x <= _iconSave.w() && size.y <= _iconSave.h()); _iconSave.blitFrom(screen._backBuffer1, Common::Point(0, 0), Common::Rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y)); _savedPos = pos; diff --git a/engines/sherlock/scalpel/darts.cpp b/engines/sherlock/scalpel/darts.cpp index e861b9cd62..23ca95454f 100644 --- a/engines/sherlock/scalpel/darts.cpp +++ b/engines/sherlock/scalpel/darts.cpp @@ -332,7 +332,7 @@ void Darts::drawDartThrow(const Common::Point &pt) { int delta = 9; for (int idx = 4; idx < 23; ++idx) { - Graphics::Surface &frame = (*_dartImages)[idx]._frame; + ImageFrame &frame = (*_dartImages)[idx]; // Adjust draw position for animating dart if (idx < 13) @@ -343,15 +343,15 @@ void Darts::drawDartThrow(const Common::Point &pt) { pos.y += delta++; // Draw the dart - Common::Point drawPos(pos.x - frame.w / 2, pos.y - frame.h); + Common::Point drawPos(pos.x - frame._width / 2, pos.y - frame._height); screen._backBuffer1.transBlitFrom(frame, drawPos); - screen.slamArea(drawPos.x, drawPos.y, frame.w, frame.h); + screen.slamArea(drawPos.x, drawPos.y, frame._width, frame._height); // Handle erasing old dart strs if (!oldDrawBounds.isEmpty()) screen.slamRect(oldDrawBounds); - oldDrawBounds = Common::Rect(drawPos.x, drawPos.y, drawPos.x + frame.w, drawPos.y + frame.h); + oldDrawBounds = Common::Rect(drawPos.x, drawPos.y, drawPos.x + frame._width, drawPos.y + frame._height); screen._backBuffer1.blitFrom(screen._backBuffer2, drawPos, oldDrawBounds); events.wait(2); diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 1f83ca4872..56c1e28dbe 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -301,8 +301,8 @@ bool ScalpelEngine::showCityCutscene() { if (finished) { ImageFile titleImages("title2.vgs", true); - _screen->_backBuffer1.copyFrom(*_screen); - _screen->_backBuffer2.copyFrom(*_screen); + _screen->_backBuffer1.blitFrom(*_screen); + _screen->_backBuffer2.blitFrom(*_screen); // London, England _screen->_backBuffer1.transBlitFrom(titleImages[0], Common::Point(10, 11)); @@ -326,8 +326,8 @@ bool ScalpelEngine::showCityCutscene() { if (finished) { ImageFile titleImages("title.vgs", true); - _screen->_backBuffer1.copyFrom(*_screen); - _screen->_backBuffer2.copyFrom(*_screen); + _screen->_backBuffer1.blitFrom(*_screen); + _screen->_backBuffer2.blitFrom(*_screen); // The Lost Files of _screen->_backBuffer1.transBlitFrom(titleImages[0], Common::Point(75, 6)); @@ -519,7 +519,7 @@ void ScalpelEngine::showLBV(const Common::String &filename) { delete stream; _screen->setPalette(images._palette); - _screen->_backBuffer1.blitFrom(images[0]._frame); + _screen->_backBuffer1.blitFrom(images[0]); _screen->verticalTransition(); } diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index 583ac5b485..1d3c0e0dbf 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -39,10 +39,6 @@ Screen::Screen(SherlockEngine *vm) : Surface(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCR Common::fill(&_cMap[0], &_cMap[PALETTE_SIZE], 0); Common::fill(&_sMap[0], &_sMap[PALETTE_SIZE], 0); setFont(1); - - // Set dummy surface used for restricted scene drawing - _sceneSurface.format = Graphics::PixelFormat::createFormatCLUT8(); - _sceneSurface.pitch = SHERLOCK_SCREEN_WIDTH; } Screen::~Screen() { @@ -76,7 +72,7 @@ void Screen::update() { for (i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i) { const Common::Rect &r = *i; const byte *srcP = (const byte *)getBasePtr(r.left, r.top); - g_system->copyRectToScreen(srcP, this->pitch, r.left, r.top, + g_system->copyRectToScreen(srcP, _surface.pitch, r.left, r.top, r.width(), r.height()); } @@ -126,7 +122,7 @@ void Screen::fadeToBlack(int speed) { } setPalette(tempPalette); - fillRect(Common::Rect(0, 0, this->w, this->h), 0); + fillRect(Common::Rect(0, 0, _surface.w, _surface.h), 0); } void Screen::fadeIn(const byte palette[PALETTE_SIZE], int speed) { @@ -189,7 +185,7 @@ void Screen::randomTransition() { if (idx != 0 && (idx % 300) == 0) { // Ensure there's a full screen dirty rect for the next frame update if (_dirtyRects.empty()) - addDirtyRect(Common::Rect(0, 0, this->w, this->h)); + addDirtyRect(Common::Rect(0, 0, _surface.w, _surface.h)); events.pollEvents(); events.delay(1); @@ -409,9 +405,7 @@ void Screen::makeField(const Common::Rect &r) { void Screen::setDisplayBounds(const Common::Rect &r) { assert(r.left == 0 && r.top == 0); - _sceneSurface.setPixels(_backBuffer1.getPixels()); - _sceneSurface.w = r.width(); - _sceneSurface.h = r.height(); + _sceneSurface.setPixels(_backBuffer1.getPixels(), r.width(), r.height()); _backBuffer = &_sceneSurface; } @@ -421,7 +415,7 @@ void Screen::resetDisplayBounds() { } Common::Rect Screen::getDisplayBounds() { - return (_backBuffer == &_sceneSurface) ? Common::Rect(0, 0, _sceneSurface.w, _sceneSurface.h) : + return (_backBuffer == &_sceneSurface) ? Common::Rect(0, 0, _sceneSurface.w(), _sceneSurface.h()) : Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT); } diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp index 83d4b78a0a..9214a75ded 100644 --- a/engines/sherlock/surface.cpp +++ b/engines/sherlock/surface.cpp @@ -37,18 +37,18 @@ Surface::Surface() : _freePixels(false) { Surface::~Surface() { if (_freePixels) - free(); + _surface.free(); } void Surface::create(uint16 width, uint16 height) { if (_freePixels) - free(); + _surface.free(); - Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + _surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); _freePixels = true; } -void Surface::blitFrom(const Graphics::Surface &src) { +void Surface::blitFrom(const Surface &src) { blitFrom(src, Common::Point(0, 0)); } @@ -56,23 +56,30 @@ void Surface::blitFrom(const ImageFrame &src) { blitFrom(src._frame, Common::Point(0, 0)); } -void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt) { - blitFrom(src, pt, Common::Rect(0, 0, src.w, src.h)); +void Surface::blitFrom(const Graphics::Surface &src) { + blitFrom(src, Common::Point(0, 0)); +} + +void Surface::blitFrom(const Surface &src, const Common::Point &pt) { + blitFrom(src, pt, Common::Rect(0, 0, src._surface.w, src._surface.h)); } void Surface::blitFrom(const ImageFrame &src, const Common::Point &pt) { blitFrom(src._frame, pt, Common::Rect(0, 0, src._frame.w, src._frame.h)); } -void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt, - const Common::Rect &srcBounds) { +void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt) { + blitFrom(src, pt, Common::Rect(0, 0, src.w, src.h)); +} + +void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) { Common::Rect srcRect = srcBounds; Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height()); if (srcRect.isValidRect() && clip(srcRect, destRect)) { // Surface is at least partially or completely on-screen addDirtyRect(destRect); - copyRectToSurface(src, destRect.left, destRect.top, srcRect); + _surface.copyRectToSurface(src, destRect.left, destRect.top, srcRect); } } @@ -80,6 +87,10 @@ void Surface::blitFrom(const ImageFrame &src, const Common::Point &pt, const Com blitFrom(src._frame, pt, srcBounds); } +void Surface::blitFrom(const Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) { + blitFrom(src._surface, pt, srcBounds); +} + void Surface::transBlitFrom(const ImageFrame &src, const Common::Point &pt, bool flipped, int overrideColor) { transBlitFrom(src._frame, pt + src._offset, flipped, overrideColor); @@ -124,24 +135,24 @@ void Surface::fillRect(int x1, int y1, int x2, int y2, byte color) { } void Surface::fillRect(const Common::Rect &r, byte color) { - Graphics::Surface::fillRect(r, color); + _surface.fillRect(r, color); addDirtyRect(r); } bool Surface::clip(Common::Rect &srcBounds, Common::Rect &destBounds) { - if (destBounds.left >= this->w || destBounds.top >= this->h || - destBounds.right <= 0 || destBounds.bottom <= 0) + if (destBounds.left >= _surface.w || destBounds.top >= _surface.h || + destBounds.right <= 0 || destBounds.bottom <= 0) return false; // Clip the bounds if necessary to fit on-screen - if (destBounds.right > this->w) { - srcBounds.right -= destBounds.right - this->w; - destBounds.right = this->w; + if (destBounds.right > _surface.w) { + srcBounds.right -= destBounds.right - _surface.w; + destBounds.right = _surface.w; } - if (destBounds.bottom > this->h) { - srcBounds.bottom -= destBounds.bottom - this->h; - destBounds.bottom = this->h; + if (destBounds.bottom > _surface.h) { + srcBounds.bottom -= destBounds.bottom - _surface.h; + destBounds.bottom = _surface.h; } if (destBounds.top < 0) { @@ -158,7 +169,21 @@ bool Surface::clip(Common::Rect &srcBounds, Common::Rect &destBounds) { } void Surface::clear() { - fillRect(Common::Rect(0, 0, this->w, this->h), 0); + fillRect(Common::Rect(0, 0, _surface.w, _surface.h), 0); +} + +void Surface::free() { + if (_freePixels) { + _surface.free(); + _freePixels = false; + } +} + +void Surface::setPixels(byte *pixels, int w, int h) { + _surface.format = Graphics::PixelFormat::createFormatCLUT8(); + _surface.w = _surface.pitch = w; + _surface.h = h; + _surface.setPixels(pixels); } } // End of namespace Sherlock diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h index 4b7166b090..f3b1b393bb 100644 --- a/engines/sherlock/surface.h +++ b/engines/sherlock/surface.h @@ -30,7 +30,7 @@ namespace Sherlock { struct ImageFrame; -class Surface : public Graphics::Surface { +class Surface { private: bool _freePixels; @@ -38,7 +38,30 @@ private: * Clips the given source bounds so the passed destBounds will be entirely on-screen */ bool clip(Common::Rect &srcBounds, Common::Rect &destBounds); + + /** + * Copy a surface into this one + */ + void blitFrom(const Graphics::Surface &src); + + /** + * Draws a surface at a given position within this surface + */ + void blitFrom(const Graphics::Surface &src, const Common::Point &pt); + + /** + * Draws a sub-section of a surface at a given position within this surface + */ + void blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds); + + /** + * Draws a surface at a given position within this surface with transparency + */ + void transBlitFrom(const Graphics::Surface &src, const Common::Point &pt, + bool flipped = false, int overrideColor = 0); protected: + Graphics::Surface _surface; + virtual void addDirtyRect(const Common::Rect &r) {} public: Surface(uint16 width, uint16 height); @@ -54,7 +77,7 @@ public: /** * Copy a surface into this one */ - void blitFrom(const Graphics::Surface &src); + void blitFrom(const Surface &src); /** * Copy an image frame into this surface @@ -64,7 +87,7 @@ public: /** * Draws a surface at a given position within this surface */ - void blitFrom(const Graphics::Surface &src, const Common::Point &pt); + void blitFrom(const Surface &src, const Common::Point &pt); /** * Copy an image frame onto this surface at a given position @@ -74,7 +97,7 @@ public: /** * Draws a sub-section of a surface at a given position within this surface */ - void blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds); + void blitFrom(const Surface &src, const Common::Point &pt, const Common::Rect &srcBounds); /** * Copy a sub-area of a source image frame into this surface at a given position @@ -88,9 +111,9 @@ public: bool flipped = false, int overrideColor = 0); /** - * Draws a surface at a given position within this surface with transparency - */ - void transBlitFrom(const Graphics::Surface &src, const Common::Point &pt, + * Draws a surface at a given position within this surface with transparency + */ + void transBlitFrom(const Surface &src, const Common::Point &pt, bool flipped = false, int overrideColor = 0); /** @@ -107,6 +130,25 @@ public: * Clear the screen */ void clear(); + + /** + * Free the underlying surface + */ + void free(); + + /** + * Set the pixels for the surface to an existing data block + */ + void setPixels(byte *pixels, int w, int h); + + inline uint16 w() const { return _surface.w; } + inline uint16 h() const { return _surface.h; } + inline const byte *getPixels() const { return (const byte *)_surface.getPixels(); } + inline byte *getPixels() { return (byte *)_surface.getPixels(); } + inline byte *getBasePtr(int x, int y) { return (byte *)_surface.getBasePtr(x, y); } + inline const byte *getBasePtr(int x, int y) const { return (const byte *)_surface.getBasePtr(x, y); } + inline void hLine(int x, int y, int x2, uint32 color) { _surface.hLine(x, y, x2, color); } + inline void vLine(int x, int y, int y2, uint32 color) { _surface.vLine(x, y, y2, color); } }; } // End of namespace Sherlock diff --git a/engines/sherlock/user_interface.cpp b/engines/sherlock/user_interface.cpp index 861c1c695d..d36be4ed76 100644 --- a/engines/sherlock/user_interface.cpp +++ b/engines/sherlock/user_interface.cpp @@ -398,9 +398,9 @@ void UserInterface::depressButton(int num) { Screen &screen = *_vm->_screen; Common::Point pt(MENU_POINTS[num][0], MENU_POINTS[num][1]); - Graphics::Surface &s = (*_controls)[num]._frame; - screen._backBuffer1.transBlitFrom(s, pt); - screen.slamArea(pt.x, pt.y, pt.x + s.w, pt.y + s.h); + ImageFrame &frame = (*_controls)[num]; + screen._backBuffer1.transBlitFrom(frame, pt); + screen.slamArea(pt.x, pt.y, pt.x + frame._width, pt.y + frame._height); } void UserInterface::restoreButton(int num) { @@ -451,10 +451,10 @@ void UserInterface::toggleButton(int num) { _keyboardInput = false; - Graphics::Surface &s = (*_controls)[num]._frame; + ImageFrame &frame = (*_controls)[num]; Common::Point pt(MENU_POINTS[num][0], MENU_POINTS[num][1]); - screen._backBuffer1.transBlitFrom(s, pt); - screen.slamArea(pt.x, pt.y, pt.x + s.w, pt.y + s.h); + screen._backBuffer1.transBlitFrom(frame, pt); + screen.slamArea(pt.x, pt.y, pt.x + frame._width, pt.y + frame._height); } } else { _menuMode = STD_MODE; @@ -1220,7 +1220,7 @@ void UserInterface::doLookControl() { } else if (!_lookHelp) { // Need to close the window and depress the Look button Common::Point pt(MENU_POINTS[0][0], MENU_POINTS[0][1]); - screen._backBuffer2.blitFrom((*_controls)[0]._frame, pt); + screen._backBuffer2.blitFrom((*_controls)[0], pt); banishWindow(true); _windowBounds.top = CONTROLS_Y1; @@ -1801,8 +1801,8 @@ void UserInterface::printObjectDesc(const Common::String &str, bool firstTime) { Common::Point pt(MENU_POINTS[0][0], MENU_POINTS[0][1]); tempSurface.blitFrom(screen._backBuffer2, Common::Point(0, 0), - Common::Rect(pt.x, pt.y, pt.x + tempSurface.w, pt.y + tempSurface.h)); - screen._backBuffer2.transBlitFrom((*_controls)[0]._frame, pt); + Common::Rect(pt.x, pt.y, pt.x + tempSurface.w(), pt.y + tempSurface.h())); + screen._backBuffer2.transBlitFrom((*_controls)[0], pt); banishWindow(1); events.setCursor(MAGNIFY); @@ -1954,9 +1954,9 @@ void UserInterface::summonWindow(const Surface &bgSurface, bool slideUp) { if (slideUp) { // Gradually slide up the display of the window - for (int idx = 1; idx <= bgSurface.h; idx += 2) { + for (int idx = 1; idx <= bgSurface.h(); idx += 2) { screen._backBuffer->blitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - idx), - Common::Rect(0, 0, bgSurface.w, idx)); + Common::Rect(0, 0, bgSurface.w(), idx)); screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - idx, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); @@ -1964,22 +1964,21 @@ void UserInterface::summonWindow(const Surface &bgSurface, bool slideUp) { } } else { // Gradually slide down the display of the window - for (int idx = 1; idx <= bgSurface.h; idx += 2) { + for (int idx = 1; idx <= bgSurface.h(); idx += 2) { screen._backBuffer->blitFrom(bgSurface, - Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h), - Common::Rect(0, bgSurface.h - idx, bgSurface.w, bgSurface.h)); - screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h, - SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - bgSurface.h + idx)); + Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h()), + Common::Rect(0, bgSurface.h() - idx, bgSurface.w(), bgSurface.h())); + screen.slamRect(Common::Rect(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h(), + SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT - bgSurface.h() + idx)); events.delay(10); } } // Final display of the entire window - screen._backBuffer->blitFrom(bgSurface, Common::Point(0, - SHERLOCK_SCREEN_HEIGHT - bgSurface.h), - Common::Rect(0, 0, bgSurface.w, bgSurface.h)); - screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h, bgSurface.w, bgSurface.h); + screen._backBuffer->blitFrom(bgSurface, Common::Point(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h()), + Common::Rect(0, 0, bgSurface.w(), bgSurface.h())); + screen.slamArea(0, SHERLOCK_SCREEN_HEIGHT - bgSurface.h(), bgSurface.w(), bgSurface.h()); _windowOpen = true; } |