aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hopkins/debugger.cpp12
-rw-r--r--engines/hopkins/debugger.h1
-rw-r--r--engines/hopkins/graphics.cpp29
-rw-r--r--engines/hopkins/graphics.h2
-rw-r--r--engines/hopkins/lines.h4
5 files changed, 46 insertions, 2 deletions
diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp
index 762df0adaa..f111eb50d3 100644
--- a/engines/hopkins/debugger.cpp
+++ b/engines/hopkins/debugger.cpp
@@ -35,6 +35,7 @@ Debugger::Debugger(HopkinsEngine *vm) : GUI::Debugger() {
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));
+ DCmd_Register("lines", WRAP_METHOD(Debugger, cmd_Lines));
}
// Turns dirty rects on or off
@@ -75,4 +76,15 @@ if (argc != 2) {
}
}
+bool Debugger::cmd_Lines(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("%s: [on | off]\n", argv[0]);
+ return true;
+ } else {
+ _vm->_graphicsMan->_showLines = !strcmp(argv[1], "on");
+ return false;
+ }
+}
+
+
} // End of namespace Hopkins
diff --git a/engines/hopkins/debugger.h b/engines/hopkins/debugger.h
index 16b5f872d6..746c54a675 100644
--- a/engines/hopkins/debugger.h
+++ b/engines/hopkins/debugger.h
@@ -42,6 +42,7 @@ public:
bool cmd_Teleport(int argc, const char **argv);
bool cmd_ShowCurrentRoom(int argc, const char **argv);
bool cmd_Zones(int argc, const char **argv);
+ bool cmd_Lines(int argc, const char **argv);
};
} // End of namespace Hopkins
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index 636bdb40ce..ebc5cfa8da 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -74,6 +74,7 @@ GraphicsManager::GraphicsManager(HopkinsEngine *vm) {
_width = 0;
_specialWidth = 0;
_showZones = false;
+ _showLines = false;
Common::fill(&_paletteBuffer[0], &_paletteBuffer[PALETTE_SIZE * 2], 0);
Common::fill(&_colorTable[0], &_colorTable[PALETTE_EXT_BLOCK_SIZE], 0);
@@ -672,6 +673,9 @@ void GraphicsManager::updateScreen() {
if (_showZones)
displayZones();
+ if (_showLines)
+ displayLines();
+
// Update the screen
g_system->updateScreen();
}
@@ -1192,6 +1196,31 @@ void GraphicsManager::displayZones() {
g_system->unlockScreen();
}
+/**
+ * Display any zones for the current room
+ */
+void GraphicsManager::displayLines() {
+ Graphics::Surface *screenSurface = g_system->lockScreen();
+
+ uint16* pixels = (uint16*)screenSurface->pixels;
+
+ for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) {
+ int i = 0;
+ do {
+ int x = _vm->_linesMan->_lineItem[lineIndex]._lineData[i] - _scrollPosX;
+ int y = _vm->_linesMan->_lineItem[lineIndex]._lineData[i+1];
+ if (x >= 0 && x < SCREEN_WIDTH && y >= 0 && y < SCREEN_HEIGHT) {
+ pixels[ y * screenSurface->w + x ] = 0xffff;
+ }
+ i += 2;
+ }
+ while(_vm->_linesMan->_lineItem[lineIndex]._lineData[i] != -1);
+ }
+
+ g_system->unlockScreen();
+}
+
+
void GraphicsManager::displayDebugRect(Graphics::Surface *surface, const Common::Rect &srcRect, uint32 color) {
Common::Rect r = srcRect;
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index 2cdc4302ef..268db7fc2b 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -119,6 +119,7 @@ public:
Common::Array<Common::Rect> _refreshRects;
bool _showDirtyRects;
bool _showZones;
+ bool _showLines;
byte *_palettePixels;
public:
@@ -137,6 +138,7 @@ public:
void displayDirtyRects();
void displayRefreshRects();
void displayZones();
+ void displayLines();
void displayDebugRect(Graphics::Surface *surface, const Common::Rect &srcRect, uint32 color = 0xffffff);
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);
diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h
index 27229aa105..b32dc6e2a5 100644
--- a/engines/hopkins/lines.h
+++ b/engines/hopkins/lines.h
@@ -118,7 +118,6 @@ private:
int _currentSegmentId;
int _maxLineIdx;
int _lastLine;
- int _linesNumb;
int _newLineIdx;
int _newLineDataIdx;
int _newRouteIdx;
@@ -135,7 +134,6 @@ private:
RouteItem *_testRoute0;
RouteItem *_testRoute1;
int16 *_lineBuf;
- LigneItem _lineItem[MAX_LINES];
RouteItem _bestRoute[8001];
int _zoneSkipCount;
int _oldMouseZoneId;
@@ -168,6 +166,8 @@ public:
bool _bobZoneFl[105];
ZoneItem _zone[106];
SquareZoneItem _squareZone[101];
+ LigneItem _lineItem[MAX_LINES];
+ int _linesNumb;
LinesManager(HopkinsEngine *vm);
~LinesManager();