diff options
author | Paul Gilbert | 2013-05-10 17:33:03 +1000 |
---|---|---|
committer | Paul Gilbert | 2013-05-10 17:33:03 +1000 |
commit | 369f886477407f3b91aeaf5a0aae4c65c5d45bea (patch) | |
tree | a177d3274bd6c4551d48535a4e57247e9eb7d617 /engines/hopkins/graphics.cpp | |
parent | 4b387fae7abaeb62eba17165d2d5325ca26ff03b (diff) | |
download | scummvm-rg350-369f886477407f3b91aeaf5a0aae4c65c5d45bea.tar.gz scummvm-rg350-369f886477407f3b91aeaf5a0aae4c65c5d45bea.tar.bz2 scummvm-rg350-369f886477407f3b91aeaf5a0aae4c65c5d45bea.zip |
HOPKINS: Added a zones debugger command
Diffstat (limited to 'engines/hopkins/graphics.cpp')
-rw-r--r-- | engines/hopkins/graphics.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index c2c8b426e6..aa71b2c4c0 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -73,6 +73,7 @@ GraphicsManager::GraphicsManager(HopkinsEngine *vm) { _zoomOutFactor = 0; _width = 0; _specialWidth = 0; + _showZones = false; Common::fill(&_paletteBuffer[0], &_paletteBuffer[PALETTE_SIZE * 2], 0); Common::fill(&_colorTable[0], &_colorTable[PALETTE_EXT_BLOCK_SIZE], 0); @@ -663,11 +664,14 @@ uint16 GraphicsManager::mapRGB(byte r, byte g, byte b) { } void GraphicsManager::updateScreen() { - // TODO: Is this okay here? // Display any aras of the screen that need refreshing displayDirtyRects(); displayRefreshRects(); + // Extra checks for debug information + if (_showZones) + displayZones(); + // Update the screen g_system->updateScreen(); } @@ -1140,6 +1144,7 @@ void GraphicsManager::displayRefreshRects() { screenSurface = g_system->lockScreen(); g_system->copyRectToScreen(_screenBuffer, _screenLineSize, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } + // Loop through copying over any specified rects to the screen for (uint idx = 0; idx < _refreshRects.size(); ++idx) { const Common::Rect &r = _refreshRects[idx]; @@ -1157,6 +1162,50 @@ void GraphicsManager::displayRefreshRects() { resetRefreshRects(); } +/** + * Display any zones for the current room + */ +void GraphicsManager::displayZones() { + Graphics::Surface *screenSurface = g_system->lockScreen(); + + for (int bobZoneId = 0; bobZoneId <= 48; bobZoneId++) { + int bobId = _vm->_linesMan->_bobZone[bobZoneId]; + if (bobId) { + // Get the rectangle for the zone + Common::Rect r(_vm->_objectsMan->_bob[bobId]._oldX, _vm->_objectsMan->_bob[bobId]._oldY, + _vm->_objectsMan->_bob[bobId]._oldX + _vm->_objectsMan->_bob[bobId]._oldWidth, + _vm->_objectsMan->_bob[bobId]._oldY + _vm->_objectsMan->_bob[bobId]._oldHeight); + + displayDebugRect(screenSurface, r); + } + } + + for (int squareZoneId = 0; squareZoneId <= 99; squareZoneId++) { + if (_vm->_linesMan->_zone[squareZoneId]._enabledFl && _vm->_linesMan->_squareZone[squareZoneId]._enabledFl) { + Common::Rect r(_vm->_linesMan->_squareZone[squareZoneId]._left, _vm->_linesMan->_squareZone[squareZoneId]._top, + _vm->_linesMan->_squareZone[squareZoneId]._right, _vm->_linesMan->_squareZone[squareZoneId]._bottom); + + displayDebugRect(screenSurface, r); + } + } + + g_system->unlockScreen(); +} + +void GraphicsManager::displayDebugRect(Graphics::Surface *surface, const Common::Rect &srcRect) { + Common::Rect r = srcRect; + + // Move for scrolling offset and adjust to crop on-screen + r.translate(-_scrollPosX, 0); + r.left = MAX(r.left, (int16)0); + r.top = MAX(r.top, (int16)0); + r.right = MIN(r.right, (int16)SCREEN_WIDTH); + r.bottom = MIN(r.bottom, (int16)SCREEN_HEIGHT); + + // If there's an on-screen portion, display it + if (r.isValidRect()) + surface->frameRect(r, 0xffffff); +} /** * Fast Display of either a compressed or vesa sprite |