[Scummvm-cvs-logs] scummvm master -> d6d3c6a13c2c830029872040a76783d84166c238

sylvaintv sylvaintv at gmail.com
Mon May 13 00:06:13 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d6d3c6a13c HOPKINS : Added a lines debugger command


Commit: d6d3c6a13c2c830029872040a76783d84166c238
    https://github.com/scummvm/scummvm/commit/d6d3c6a13c2c830029872040a76783d84166c238
Author: sylvaintv (sylvaintv at gmail.com)
Date: 2013-05-12T15:04:55-07:00

Commit Message:
HOPKINS : Added a lines debugger command

Changed paths:
    engines/hopkins/debugger.cpp
    engines/hopkins/debugger.h
    engines/hopkins/graphics.cpp
    engines/hopkins/graphics.h
    engines/hopkins/lines.h



diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp
index 762df0a..f111eb5 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 16b5f87..746c54a 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 636bdb4..ebc5cfa 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 2cdc430..268db7f 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 27229aa..b32dc6e 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();






More information about the Scummvm-git-logs mailing list