aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2013-05-10 17:33:03 +1000
committerPaul Gilbert2013-05-10 17:33:03 +1000
commit369f886477407f3b91aeaf5a0aae4c65c5d45bea (patch)
treea177d3274bd6c4551d48535a4e57247e9eb7d617 /engines
parent4b387fae7abaeb62eba17165d2d5325ca26ff03b (diff)
downloadscummvm-rg350-369f886477407f3b91aeaf5a0aae4c65c5d45bea.tar.gz
scummvm-rg350-369f886477407f3b91aeaf5a0aae4c65c5d45bea.tar.bz2
scummvm-rg350-369f886477407f3b91aeaf5a0aae4c65c5d45bea.zip
HOPKINS: Added a zones debugger command
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/debugger.cpp11
-rw-r--r--engines/hopkins/debugger.h1
-rw-r--r--engines/hopkins/graphics.cpp51
-rw-r--r--engines/hopkins/graphics.h3
-rw-r--r--engines/hopkins/lines.h2
5 files changed, 66 insertions, 2 deletions
diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp
index 246270c1c2..762df0adaa 100644
--- a/engines/hopkins/debugger.cpp
+++ b/engines/hopkins/debugger.cpp
@@ -34,6 +34,7 @@ Debugger::Debugger(HopkinsEngine *vm) : GUI::Debugger() {
DCmd_Register("rects", WRAP_METHOD(Debugger, cmd_DirtyRects));
DCmd_Register("teleport", WRAP_METHOD(Debugger, cmd_Teleport));
DCmd_Register("show_room", WRAP_METHOD(Debugger, cmd_ShowCurrentRoom));
+ DCmd_Register("zones", WRAP_METHOD(Debugger, cmd_Zones));
}
// Turns dirty rects on or off
@@ -64,4 +65,14 @@ bool Debugger::cmd_ShowCurrentRoom(int argc, const char **argv) {
return true;
}
+bool Debugger::cmd_Zones(int argc, const char **argv) {
+if (argc != 2) {
+ DebugPrintf("%s: [on | off]\n", argv[0]);
+ return true;
+ } else {
+ _vm->_graphicsMan->_showZones = !strcmp(argv[1], "on");
+ return false;
+ }
+}
+
} // End of namespace Hopkins
diff --git a/engines/hopkins/debugger.h b/engines/hopkins/debugger.h
index 7f7bffd755..16b5f872d6 100644
--- a/engines/hopkins/debugger.h
+++ b/engines/hopkins/debugger.h
@@ -41,6 +41,7 @@ public:
bool cmd_DirtyRects(int argc, const char **argv);
bool cmd_Teleport(int argc, const char **argv);
bool cmd_ShowCurrentRoom(int argc, const char **argv);
+ bool cmd_Zones(int argc, const char **argv);
};
} // End of namespace Hopkins
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
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index b7d7eaa86f..142de129b9 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -118,6 +118,7 @@ public:
Common::Array<Common::Rect> _dirtyRects;
Common::Array<Common::Rect> _refreshRects;
bool _showDirtyRects;
+ bool _showZones;
byte *_palettePixels;
public:
@@ -135,6 +136,8 @@ public:
void addRectToArray(Common::Array<Common::Rect> &rects, const Common::Rect &newRect);
void displayDirtyRects();
void displayRefreshRects();
+ void displayZones();
+ void displayDebugRect(Graphics::Surface *surface, const Common::Rect &srcRect);
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);
diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h
index 2eeafdac09..27229aa105 100644
--- a/engines/hopkins/lines.h
+++ b/engines/hopkins/lines.h
@@ -115,7 +115,6 @@ private:
Directions _smoothMoveDirection;
LigneZoneItem _zoneLine[MAX_LINES+1];
SegmentItem _segment[101];
- SquareZoneItem _squareZone[101];
int _currentSegmentId;
int _maxLineIdx;
int _lastLine;
@@ -168,6 +167,7 @@ public:
int _bobZone[105];
bool _bobZoneFl[105];
ZoneItem _zone[106];
+ SquareZoneItem _squareZone[101];
LinesManager(HopkinsEngine *vm);
~LinesManager();