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

dreammaster dreammaster at scummvm.org
Tue Sep 6 12:56:04 CEST 2011


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

Summary:
edeff6c849 TSAGE: Added extra debugger command for showing available hotspot regions
d43fbc8dfa TSAGE: Fixed problem with NamedHotspot items not getting added to scenes


Commit: edeff6c84931b8f7ec8b1fedfec8aaec3ecc6a3a
    https://github.com/scummvm/scummvm/commit/edeff6c84931b8f7ec8b1fedfec8aaec3ecc6a3a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-09-06T03:50:08-07:00

Commit Message:
TSAGE: Added extra debugger command for showing available hotspot regions

This is different from the hotspots command, since that only shows regions explicitly assigned to a hotspot

Changed paths:
    engines/tsage/debugger.cpp
    engines/tsage/debugger.h



diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp
index e3c4569..2a6b4eb 100644
--- a/engines/tsage/debugger.cpp
+++ b/engines/tsage/debugger.cpp
@@ -32,6 +32,7 @@ Debugger::Debugger() : GUI::Debugger() {
 	DCmd_Register("scene",			WRAP_METHOD(Debugger, Cmd_Scene));
 	DCmd_Register("walk_regions",	WRAP_METHOD(Debugger, Cmd_WalkRegions));
 	DCmd_Register("priority_regions",	WRAP_METHOD(Debugger, Cmd_PriorityRegions));
+	DCmd_Register("scene_regions",	WRAP_METHOD(Debugger, Cmd_SceneRegions));
 	DCmd_Register("setflag",		WRAP_METHOD(Debugger, Cmd_SetFlag));
 	DCmd_Register("getflag",		WRAP_METHOD(Debugger, Cmd_GetFlag));
 	DCmd_Register("clearflag",		WRAP_METHOD(Debugger, Cmd_ClearFlag));
@@ -171,6 +172,59 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
 }
 
 /*
+ * This command draws the scene regions onto the screen. These are the regions
+ * used by hotspots that have non-rectangular areas.
+ */
+bool Debugger::Cmd_SceneRegions(int argc, const char **argv) {
+	int regionNum = 0;
+
+	// Check for an optional specific region to display
+	if (argc == 2)
+		regionNum = strToInt(argv[1]);
+
+	// Color index to use for the first priority region
+	int color = 16;
+	int count = 0;
+
+	// Lock the background surface for access
+	Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
+
+	Common::List<Region>::iterator i = _globals->_sceneRegions.begin();
+	Common::String regionsDesc;
+
+	for (; i != _globals->_sceneRegions.end(); ++i, ++color, ++count) {
+		Region &r = *i;
+
+		if ((regionNum == 0) || (regionNum == (count + 1))) {
+			for (int y = 0; y < destSurface.h; ++y) {
+				byte *destP = (byte *)destSurface.getBasePtr(0, y);
+
+				for (int x = 0; x < destSurface.w; ++x) {
+					if (r.contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x,
+							_globals->_sceneManager._scene->_sceneBounds.top + y)))
+						*destP = color;
+					++destP;
+				}
+			}
+		}
+
+		regionsDesc += Common::String::format("Region id = %d bounds=%d,%d,%d,%d\n",
+			r._regionId, r._bounds.left, r._bounds.top, r._bounds.right, r._bounds.bottom);
+	}
+
+	// Release the surface
+	_globals->_sceneManager._scene->_backSurface.unlockSurface();
+
+	// Mark the scene as requiring a full redraw
+	_globals->_paneRefreshFlag[0] = 2;
+
+	DebugPrintf("Total regions = %d\n", count);
+	DebugPrintf("%s", regionsDesc.c_str());
+
+	return true;
+}
+
+/*
  * This command sets a flag
  */
 bool Debugger::Cmd_SetFlag(int argc, const char **argv) {
@@ -414,7 +468,7 @@ bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
 			if (ri != _globals->_sceneRegions.end()) {
 				// Fill out the areas defined by the region
 				Region &r = *ri;
-
+			
 				for (int y = r._bounds.top; y < r._bounds.bottom; ++y) {
 					LineSliceSet set = r.getLineSlices(y);
 
diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h
index 8bc1b06..fcdbc2d 100644
--- a/engines/tsage/debugger.h
+++ b/engines/tsage/debugger.h
@@ -37,6 +37,7 @@ protected:
 	bool Cmd_Scene(int argc, const char **argv);
 	bool Cmd_WalkRegions(int argc, const char **argv);
 	bool Cmd_PriorityRegions(int argc, const char **argv);
+	bool Cmd_SceneRegions(int argc, const char **argv);
 	bool Cmd_SetFlag(int argc, const char **argv);
 	bool Cmd_GetFlag(int argc, const char **argv);
 	bool Cmd_ClearFlag(int argc, const char **argv);


Commit: d43fbc8dfa0bf416cdba545525e67be9e5e2c46b
    https://github.com/scummvm/scummvm/commit/d43fbc8dfa0bf416cdba545525e67be9e5e2c46b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-09-06T03:50:34-07:00

Commit Message:
TSAGE: Fixed problem with NamedHotspot items not getting added to scenes

Changed paths:
    engines/tsage/core.cpp



diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index ad082d6..21d5390 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -1768,6 +1768,18 @@ void NamedHotspot::setup(int sceneRegionId, int resNum, int lookLineNum, int tal
 	_lookLineNum = lookLineNum;
 	_talkLineNum = talkLineNum;
 	_useLineNum = useLineNum;
+
+	// Handle adding hotspot to scene items list as necessary
+	switch (mode) {
+	case 2:
+		GLOBALS._sceneItems.push_front(this);
+		break;
+	case 3:
+		break;
+	default:
+		GLOBALS._sceneItems.push_back(this);
+		break;
+	}
 }
 
 void NamedHotspot::synchronize(Serializer &s) {






More information about the Scummvm-git-logs mailing list