[Scummvm-cvs-logs] SF.net SVN: scummvm:[48030] scummvm/trunk/engines/m4

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Wed Feb 10 12:11:31 CET 2010


Revision: 48030
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48030&view=rev
Author:   dreammaster
Date:     2010-02-10 11:11:31 +0000 (Wed, 10 Feb 2010)

Log Message:
-----------
Separated scene info console method between M4 and MADS classes, and cleaned up the message method

Modified Paths:
--------------
    scummvm/trunk/engines/m4/console.cpp
    scummvm/trunk/engines/m4/console.h
    scummvm/trunk/engines/m4/events.cpp

Modified: scummvm/trunk/engines/m4/console.cpp
===================================================================
--- scummvm/trunk/engines/m4/console.cpp	2010-02-10 11:03:04 UTC (rev 48029)
+++ scummvm/trunk/engines/m4/console.cpp	2010-02-10 11:11:31 UTC (rev 48030)
@@ -36,7 +36,6 @@
 
 	DCmd_Register("scene",			WRAP_METHOD(Console, cmdLoadScene));
 	DCmd_Register("start",			WRAP_METHOD(Console, cmdStartingScene));
-	DCmd_Register("scene_info",		WRAP_METHOD(Console, cmdSceneInfo));
 	DCmd_Register("show_hotspots",	WRAP_METHOD(Console, cmdShowHotSpots));
 	DCmd_Register("list_hotspots",	WRAP_METHOD(Console, cmdListHotSpots));
 	DCmd_Register("play_sound",		WRAP_METHOD(Console, cmdPlaySound));
@@ -99,28 +98,6 @@
 	return false;
 }
 
-bool Console::cmdSceneInfo(int argc, const char **argv) {
-	DebugPrintf("Current scene is: %i\n", _vm->_scene->getCurrentScene());
-	if (_vm->isM4()) {
-		DebugPrintf("Scene resources:\n");
-		DebugPrintf("artBase: %s\n", _vm->_scene->getSceneResources().artBase);
-		DebugPrintf("pictureBase: %s\n", _vm->_scene->getSceneResources().pictureBase);
-		DebugPrintf("hotspotCount: %i\n", _vm->_scene->getSceneResources().hotspotCount);
-		DebugPrintf("parallaxCount: %i\n", _vm->_scene->getSceneResources().parallaxCount);
-		DebugPrintf("propsCount: %i\n", _vm->_scene->getSceneResources().propsCount);
-		DebugPrintf("frontY: %i\n", _vm->_scene->getSceneResources().frontY);
-		DebugPrintf("backY: %i\n", _vm->_scene->getSceneResources().backY);
-		DebugPrintf("frontScale: %i\n", _vm->_scene->getSceneResources().frontScale);
-		DebugPrintf("backScale: %i\n", _vm->_scene->getSceneResources().backScale);
-		DebugPrintf("depthTable: ");
-		for (uint i = 0; i < 16; i++)
-			DebugPrintf("%i ", _vm->_scene->getSceneResources().depthTable[i]);
-		DebugPrintf("\n");
-		DebugPrintf("railNodeCount: %i\n", _vm->_scene->getSceneResources().railNodeCount);
-	}
-	return true;
-}
-
 bool Console::cmdListHotSpots(int argc, const char **argv) {
 	DebugPrintf("Scene hotspots\n");
 	_vm->_scene->getSceneResources().hotspots->dump();
@@ -304,6 +281,7 @@
 
 	DCmd_Register("object",			WRAP_METHOD(MadsConsole, cmdObject));
 	DCmd_Register("message",		WRAP_METHOD(MadsConsole, cmdMessage));
+	DCmd_Register("scene_info",		WRAP_METHOD(MadsConsole, cmdSceneInfo));
 }
 
 bool MadsConsole::cmdObject(int argc, const char **argv) {
@@ -370,14 +348,14 @@
 		DebugPrintf("message 'objnum'\n");
 	else {
 		int messageIdx = strToInt(argv[1]);
-		if ((argc == 3) && !strcmp(argv[2], "id"))
+
+		if ((argc != 3) || (strcmp(argv[2], "idx") != NULL))
 			messageIdx = _vm->globals()->messageIndexOf(messageIdx);
 
-		if (messageIdx == -1)
-			DebugPrintf("Unknown message");
-		else
-		{
-			const char *msg = _vm->globals()->loadMessage(messageIdx);
+		const char *msg = _vm->globals()->loadMessage(messageIdx);
+		if (!msg)
+			DebugPrintf("Unknown message\n");
+		else {
 			Dialog *dlg = new Dialog(_vm, msg, "TEST DIALOG");
 
 			_vm->_viewManager->addView(dlg);
@@ -390,4 +368,40 @@
 	return true;
 }
 
+bool MadsConsole::cmdSceneInfo(int argc, const char **argv) {
+	DebugPrintf("Current scene is: %i\n", _vm->_scene->getCurrentScene());
+
+	return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+M4Console::M4Console(M4Engine *vm): Console(vm) {
+	_vm = vm;
+
+	DCmd_Register("scene_info",		WRAP_METHOD(M4Console, cmdSceneInfo));
+}
+
+bool M4Console::cmdSceneInfo(int argc, const char **argv) {
+	DebugPrintf("Current scene is: %i\n", _vm->_scene->getCurrentScene());
+
+	DebugPrintf("Scene resources:\n");
+	DebugPrintf("artBase: %s\n", _vm->_scene->getSceneResources().artBase);
+	DebugPrintf("pictureBase: %s\n", _vm->_scene->getSceneResources().pictureBase);
+	DebugPrintf("hotspotCount: %i\n", _vm->_scene->getSceneResources().hotspotCount);
+	DebugPrintf("parallaxCount: %i\n", _vm->_scene->getSceneResources().parallaxCount);
+	DebugPrintf("propsCount: %i\n", _vm->_scene->getSceneResources().propsCount);
+	DebugPrintf("frontY: %i\n", _vm->_scene->getSceneResources().frontY);
+	DebugPrintf("backY: %i\n", _vm->_scene->getSceneResources().backY);
+	DebugPrintf("frontScale: %i\n", _vm->_scene->getSceneResources().frontScale);
+	DebugPrintf("backScale: %i\n", _vm->_scene->getSceneResources().backScale);
+	DebugPrintf("depthTable: ");
+	for (uint i = 0; i < 16; i++)
+		DebugPrintf("%i ", _vm->_scene->getSceneResources().depthTable[i]);
+	DebugPrintf("\n");
+	DebugPrintf("railNodeCount: %i\n", _vm->_scene->getSceneResources().railNodeCount);
+
+	return true;
+}
+
 } // End of namespace M4

Modified: scummvm/trunk/engines/m4/console.h
===================================================================
--- scummvm/trunk/engines/m4/console.h	2010-02-10 11:03:04 UTC (rev 48029)
+++ scummvm/trunk/engines/m4/console.h	2010-02-10 11:11:31 UTC (rev 48030)
@@ -39,7 +39,6 @@
 
 	bool cmdLoadScene(int argc, const char **argv);
 	bool cmdStartingScene(int argc, const char **argv);
-	bool cmdSceneInfo(int argc, const char **argv);
 	bool cmdShowHotSpots(int argc, const char **argv);
 	bool cmdListHotSpots(int argc, const char **argv);
 	bool cmdPlaySound(int argc, const char **argv);
@@ -64,14 +63,19 @@
 
 	bool cmdObject(int argc, const char **argv);
 	bool cmdMessage(int argc, const char **argv);
+	bool cmdSceneInfo(int argc, const char **argv);
 public:
 	MadsConsole(MadsEngine *vm);
 	virtual ~MadsConsole() {};
 };
 
 class M4Console : public Console {
+private:
+	M4Engine *_vm;
+
+	bool cmdSceneInfo(int argc, const char **argv);
 public:
-	M4Console(MadsM4Engine *vm): Console(vm) {};
+	M4Console(M4Engine *vm);
 	virtual ~M4Console() {};
 };
 

Modified: scummvm/trunk/engines/m4/events.cpp
===================================================================
--- scummvm/trunk/engines/m4/events.cpp	2010-02-10 11:03:04 UTC (rev 48029)
+++ scummvm/trunk/engines/m4/events.cpp	2010-02-10 11:11:31 UTC (rev 48030)
@@ -52,7 +52,7 @@
 	_ctrlFlag = false;
 
 	if (_vm->isM4())
-		_console = new M4Console(_vm);
+		_console = new M4Console(_m4Vm);
 	else
 		_console = new MadsConsole(_madsVm);
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list