diff options
author | Paul Gilbert | 2013-03-02 18:56:14 -0500 |
---|---|---|
committer | Paul Gilbert | 2013-03-02 18:56:14 -0500 |
commit | 7c862d586ede81d759eafae831f8fd54684d92bd (patch) | |
tree | 8ec98bc54c9a80e7989932f3ccb9bfa35f094c5c | |
parent | d738802bc1d1441fee8bce3881cd5233044305d6 (diff) | |
download | scummvm-rg350-7c862d586ede81d759eafae831f8fd54684d92bd.tar.gz scummvm-rg350-7c862d586ede81d759eafae831f8fd54684d92bd.tar.bz2 scummvm-rg350-7c862d586ede81d759eafae831f8fd54684d92bd.zip |
HOPKINS: Preparatory work for a refresh rect list
-rw-r--r-- | engines/hopkins/events.cpp | 6 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 42 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 15 |
3 files changed, 53 insertions, 10 deletions
diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 3a6d31accd..519bd64c2a 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -222,7 +222,7 @@ void EventsManager::checkForNextFrameCounter() { if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { ++_gameCounter; _priorFrameTime = milli; - g_system->updateScreen(); + _vm->_graphicsManager.DD_VBL(); // Signal the ScummVM debugger _vm->_debugger.onFrame(); @@ -465,7 +465,9 @@ void EventsManager::VBL() { _vm->_graphicsManager.lockScreen(); _vm->_graphicsManager.m_scroll16(_vm->_graphicsManager._vesaBuffer, _vm->_graphicsManager._scrollPosX, 20, SCREEN_WIDTH, 440, 0, 20); _vm->_graphicsManager.unlockScreen(); - _vm->_graphicsManager.dstrect[0] = Common::Rect(0, 20, SCREEN_WIDTH, 460); + + _vm->_graphicsManager.resetRefreshRects(); + _vm->_graphicsManager.addRefreshRect(Common::Rect(0, 20, SCREEN_WIDTH, 460)); _vm->_graphicsManager.resetVesaSegment(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index c998a3b011..4fe9c4ef39 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -612,7 +612,7 @@ void GraphicsManager::fadeOut(const byte *palette, int step, const byte *surface setPaletteVGA256(palData); m_scroll16(surface, _vm->_eventsManager._startPos.x, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); - return DD_VBL(); + DD_VBL(); } /** @@ -735,7 +735,10 @@ uint16 GraphicsManager::mapRGB(byte r, byte g, byte b) { } void GraphicsManager::DD_VBL() { - // TODO: Is this okay here? + // Display any aras of the screen that need refreshing + displayRefreshRects(); + + // Update the screen g_system->updateScreen(); } @@ -1093,7 +1096,11 @@ void GraphicsManager::resetVesaSegment() { _dirtyRects.clear(); } -// Add VESA Segment +void GraphicsManager::resetRefreshRects() { + _refreshRects.clear(); +} + +// Add a game area dirty rectangle void GraphicsManager::addDirtyRect(int x1, int y1, int x2, int y2) { x1 = CLIP(x1, _minX, _maxX); y1 = CLIP(y1, _minY, _maxY); @@ -1115,7 +1122,19 @@ void GraphicsManager::addDirtyRect(int x1, int y1, int x2, int y2) { _dirtyRects.push_back(newRect); } -// Display VESA Segment +// Add a refresh rect +void GraphicsManager::addRefreshRect(const Common::Rect &r) { + // Ensure that an existing dest rectangle doesn't already contain the new one + for (uint idx = 0; idx < _refreshRects.size(); ++idx) { + if (_refreshRects[idx].contains(r)) + return; + } + + assert(_refreshRects.size() < DIRTY_RECTS_SIZE); + _refreshRects.push_back(r); +} + +// Draw any game dirty rects onto the screen intermediate surface void GraphicsManager::displayVesaSegment() { if (_dirtyRects.size() == 0) return; @@ -1124,7 +1143,7 @@ void GraphicsManager::displayVesaSegment() { for (uint idx = 0; idx < _dirtyRects.size(); ++idx) { Common::Rect &r = _dirtyRects[idx]; - Common::Rect &dstRect = dstrect[idx]; + Common::Rect dstRect; if (_vm->_eventsManager._breakoutFl) { Copy_Vga16(_vesaBuffer, r.left, r.top, r.right - r.left, r.bottom - r.top, r.left, r.top); @@ -1159,6 +1178,19 @@ void GraphicsManager::displayVesaSegment() { resetVesaSegment(); } +void GraphicsManager::displayRefreshRects() { + if (_refreshRects.size() == 0) + return; +/* + for (uint idx = 0; idx < _refreshRects.size(); ++idx) { + const Common::Rect &r = _refreshRects[idx]; + + g_system->copyRectToScreen(_screenBuffer, WinScan,) + } +*/ + resetRefreshRects(); +} + void GraphicsManager::AFFICHE_SPEEDVGA(const byte *objectData, int xp, int yp, int idx, bool addSegment) { int width = _vm->_objectsManager.getWidth(objectData, idx); int height = _vm->_objectsManager.getHeight(objectData, idx); diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 72fd87c7c3..367b0a2755 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -99,12 +99,18 @@ public: int _minX, _minY; int _maxX, _maxY; bool _noFadingFl; - Common::Rect dstrect[50]; int _scrollStatus; bool _skipVideoLockFl; int _fadeDefaultSpeed; + /** + * The _dirtyRects list contains paletted game areas that need to be redrawn. + * The _dstrect array is the list of areas of the screen that ScummVM needs to be redrawn. + * Some areas, such as the animation managers, skip the _dirtyRects and use _dstrec directly. + */ Common::Array<Common::Rect> _dirtyRects; + Common::Array<Common::Rect> _refreshRects; + int WinScan; byte *PAL_PIXELS; bool MANU_SCROLL; @@ -118,7 +124,12 @@ public: void unlockScreen(); void clearPalette(); void clearScreen(); + void resetVesaSegment(); + void resetRefreshRects(); void addDirtyRect(int x1, int y1, int x2, int y2); + void addRefreshRect(const Common::Rect &r); + void displayVesaSegment(); + void displayRefreshRects(); void copySurface(const byte *surface, int x1, int y1, int width, int height, byte *destSurface, int destX, int destY); void loadImage(const Common::String &file); void loadVgaImage(const Common::String &file); @@ -131,8 +142,6 @@ public: void fadeOutLong(); void fadeOutShort(); void fastDisplay(const byte *spriteData, int xp, int yp, int spriteIndex, bool addSegment = true); - void displayVesaSegment(); - void resetVesaSegment(); void copyWinscanVbe3(const byte *srcData, byte *destSurface); void copyWinscanVbe(const byte *srcP, byte *destP); void copyVideoVbe16(const byte *srcData); |