[Scummvm-cvs-logs] scummvm master -> 974e7e80a83a0b44108ff9bdcb2863382b79b32e

bluegr bluegr at gmail.com
Tue Jun 11 18:01:04 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:
974e7e80a8 NEVERHOOD: Remove cheat debug code, and introduce a new command, "cheat"


Commit: 974e7e80a83a0b44108ff9bdcb2863382b79b32e
    https://github.com/scummvm/scummvm/commit/974e7e80a83a0b44108ff9bdcb2863382b79b32e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-06-11T08:57:14-07:00

Commit Message:
NEVERHOOD: Remove cheat debug code, and introduce a new command, "cheat"

Changed paths:
    engines/neverhood/console.cpp
    engines/neverhood/console.h
    engines/neverhood/gamemodule.cpp
    engines/neverhood/modules/module1100.cpp
    engines/neverhood/modules/module1600.h
    engines/neverhood/modules/module2800.cpp
    engines/neverhood/modules/module3000.cpp



diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp
index 8789128..917eae5 100644
--- a/engines/neverhood/console.cpp
+++ b/engines/neverhood/console.cpp
@@ -25,12 +25,14 @@
 #include "neverhood/neverhood.h"
 #include "neverhood/gamemodule.h"
 #include "neverhood/scene.h"
+#include "neverhood/modules/module1600.h"
 
 namespace Neverhood {
 
 Console::Console(NeverhoodEngine *vm) : GUI::Debugger(), _vm(vm) {
 	DCmd_Register("room",			WRAP_METHOD(Console, Cmd_Room));
 	DCmd_Register("surfaces",		WRAP_METHOD(Console, Cmd_Surfaces));
+	DCmd_Register("cheat",			WRAP_METHOD(Console, Cmd_Cheat));
 }
 
 Console::~Console() {
@@ -64,4 +66,95 @@ bool Console::Cmd_Surfaces(int argc, const char **argv) {
 	return true;
 }
 
+bool Console::Cmd_Cheat(int argc, const char **argv) {
+	if (argc < 2) {
+		DebugPrintf("Cheats for various puzzles in the game\n");
+		DebugPrintf("Use %s <cheatname> to use a cheat.\n", argv[0]);
+		DebugPrintf("Cheats:\n-------\n");
+		DebugPrintf("  buttons - enables all 3 buttons on the door in the purple building, module 3000, scene 9\n");
+		DebugPrintf("  cannon  - sets the correct cannon combination in module 3000, scene 8\n");
+		DebugPrintf("  dice    - shows the correct dice combination in the teddy bear puzzle, module 1100, scene 6\n");
+		DebugPrintf("  memory  - solves the memory puzzle, module 1400, scene 4\n");
+		DebugPrintf("  radio   - enables the radio, module 3000, scene 9 - same as pulling the rightmost cord in the flytrap room\n");
+		DebugPrintf("  symbols - solves the symbols puzzle, module 1600, scene 8. Only available in that room\n");
+		DebugPrintf("  tubes   - shows the correct test tube combination in module 2800, scenes 7 and 10, can be used anywhere\n");		
+		return true;
+	}
+
+	Common::String cheatName = argv[1];
+	int module = _vm->_gameModule->getCurrentModuleNum();
+	int scene = _vm->gameState().sceneNum;
+
+	if (cheatName == "buttons") {
+		Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject;
+
+		scene->setSubVar(VA_LOCKS_DISABLED, 0x304008D2, 1);	// kScene3010ButtonNameHashes[0]
+		scene->setSubVar(VA_LOCKS_DISABLED, 0x40119852, 1);	// kScene3010ButtonNameHashes[1]
+		scene->setSubVar(VA_LOCKS_DISABLED, 0x01180951, 1);	// kScene3010ButtonNameHashes[2]
+
+		DebugPrintf("All 3 door buttons have been enabled\n");
+	} else if (cheatName == "cannon") {
+		Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject;
+
+		for (int i = 0; i < 3; i++)
+			scene->setSubVar(VA_CURR_CANNON_SYMBOLS, i,	scene->getSubVar(VA_GOOD_CANNON_SYMBOLS_1, i));
+
+		for (int i = 3; i < 6; i++)
+			scene->setSubVar(VA_CURR_CANNON_SYMBOLS, i,	scene->getSubVar(VA_GOOD_CANNON_SYMBOLS_2, i - 3));
+
+		DebugPrintf("Puzzle solved\n");
+	} else if (cheatName == "dice") {
+		Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject;
+		DebugPrintf("Good: (%d %d %d), current: (%d %d %d)\n",
+			scene->getSubVar(VA_GOOD_DICE_NUMBERS, 0), scene->getSubVar(VA_GOOD_DICE_NUMBERS, 1), scene->getSubVar(VA_GOOD_DICE_NUMBERS, 2),
+			scene->getSubVar(VA_CURR_DICE_NUMBERS, 0), scene->getSubVar(VA_CURR_DICE_NUMBERS, 1), scene->getSubVar(VA_CURR_DICE_NUMBERS, 2)
+		);
+	} else if (cheatName == "memory") {
+		Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject;
+
+		// Autosolve all tiles and leave only two matching tiles closed
+		for (int i = 0; i < 48; i++)
+			scene->setSubVar(VA_IS_TILE_MATCH, i, 1);
+
+		// Close the top left tile
+		scene->setSubVar(VA_IS_TILE_MATCH, 0, 0);
+
+		// Find and close the pair of the top left tile
+		for (int i = 0; i < 48; i++) {
+			if (i != 0 && scene->getSubVar(VA_TILE_SYMBOLS, i) == scene->getSubVar(VA_TILE_SYMBOLS, 0)) {
+				scene->setSubVar(VA_IS_TILE_MATCH, i, 0);
+				break;
+			}
+		}
+
+		DebugPrintf("Puzzle solved\n");
+	} else if (cheatName == "radio") {
+		Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject;
+		scene->setGlobalVar(V_RADIO_ENABLED, 1);
+
+		DebugPrintf("The radio has been enabled\n");
+	} else if (cheatName == "symbols") {
+		if (module == 1600 && scene == 8) {
+			Scene1609 *scene = ((Scene1609 *)((Module1600 *)_vm->_gameModule->_childObject)->_childObject);
+
+			for (int index = 0; index < 12; index++) {
+				scene->_asSymbols[index]->change((int)scene->getSubVar(VA_CODE_SYMBOLS, index) + 12, index == (int)scene->getSubVar(VA_CODE_SYMBOLS, scene->_noisySymbolIndex));
+			}
+
+			scene->_changeCurrentSymbol = false;
+			scene->_symbolPosition = 11;
+
+			DebugPrintf("Puzzle solved\n");
+		} else {
+			DebugPrintf("Only available in module 1600, scene 8\n");
+		}
+	} else if (cheatName == "tubes") {
+		Scene *scene = (Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject;
+		DebugPrintf("Tube set 1: %d %d %d\n", scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 0), scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 1), scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 2));
+		DebugPrintf("Tube set 2: %d %d %d\n", scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 0), scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 1), scene->getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 2));
+	}
+
+	return true;
+}
+
 } // End of namespace Neverhood
diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h
index 3ae989b..7349820 100644
--- a/engines/neverhood/console.h
+++ b/engines/neverhood/console.h
@@ -39,6 +39,7 @@ private:
 
 	bool Cmd_Room(int argc, const char **argv);
 	bool Cmd_Surfaces(int argc, const char **argv);
+	bool Cmd_Cheat(int argc, const char **argv);
 };
 
 } // End of namespace Neverhood
diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index 2cb0376..70450e2 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -194,21 +194,6 @@ void GameModule::initMemoryPuzzle() {
 				tileSymbolIndex = 0;
 		}
 		setSubVar(VA_IS_PUZZLE_INIT, 0xC8606803, 1);
-
-		// DEBUG Enable to autosolve all tiles and leave only two matching tiles open
-#if 0		
-		for (int i = 0; i < 48; i++)
-			setSubVar(VA_IS_TILE_MATCH, i, 1);
-		int debugIndex = 0;
-		setSubVar(VA_IS_TILE_MATCH, debugIndex, 0);
-		for (int i = 0; i < 48; i++) {
-			if (i != debugIndex && getSubVar(VA_TILE_SYMBOLS, i) == getSubVar(VA_TILE_SYMBOLS, debugIndex)) {
-				setSubVar(VA_IS_TILE_MATCH, i, 0);
-				break;
-			}
-		}
-#endif		
-
 	}
 }
 
diff --git a/engines/neverhood/modules/module1100.cpp b/engines/neverhood/modules/module1100.cpp
index 3149d7f..0c09ed5 100644
--- a/engines/neverhood/modules/module1100.cpp
+++ b/engines/neverhood/modules/module1100.cpp
@@ -625,13 +625,6 @@ void Scene1105::upClosePanel() {
 }
 
 void Scene1105::update() {
-
-	// DEBUG: Show the correct code
-	debug("(%d, %d) (%d, %d) (%d, %d)", 
-		getSubVar(VA_GOOD_DICE_NUMBERS, 0), getSubVar(VA_CURR_DICE_NUMBERS, 0),
-		getSubVar(VA_GOOD_DICE_NUMBERS, 1), getSubVar(VA_CURR_DICE_NUMBERS, 1),
-		getSubVar(VA_GOOD_DICE_NUMBERS, 2), getSubVar(VA_CURR_DICE_NUMBERS, 2));
-
 	Scene::update();
 	if (_countdown != 0 && (--_countdown == 0))
 		createObjects();
diff --git a/engines/neverhood/modules/module1600.h b/engines/neverhood/modules/module1600.h
index 0bf44ff..5f0da52 100644
--- a/engines/neverhood/modules/module1600.h
+++ b/engines/neverhood/modules/module1600.h
@@ -26,6 +26,7 @@
 #include "neverhood/neverhood.h"
 #include "neverhood/module.h"
 #include "neverhood/scene.h"
+#include "neverhood/console.h"
 #include "neverhood/modules/module3000.h"
 
 namespace Neverhood {
@@ -162,6 +163,7 @@ protected:
 };
 
 class Scene1609 : public Scene {
+	friend class Console;
 public:
 	Scene1609(NeverhoodEngine *vm, Module *parentModule);
 protected:
diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp
index ee3f270..f359cc3 100644
--- a/engines/neverhood/modules/module2800.cpp
+++ b/engines/neverhood/modules/module2800.cpp
@@ -2443,18 +2443,6 @@ uint32 Scene2808::handleMessage(int messageNum, const MessageParam &param, Entit
 }
 
 void Scene2808::update() {
-
-	// DEBUG>>> Show correct values
-	#if 1
-	debug("---------------");
-	if (_testTubeSetNum == 0)
-		debug("%03d %03d %03d", getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 0), getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 1), getSubVar(VA_GOOD_TEST_TUBES_LEVEL_1, 2));
-	else
-		debug("%03d %03d %03d", getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 0), getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 1), getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 2));
-	debug("%03d %03d %03d", _asTestTubes[0]->getFillLevel(), _asTestTubes[1]->getFillLevel(), _asTestTubes[2]->getFillLevel());
-	#endif
-	// DEBUG<<<
-	
 	Scene::update();
 	if (_countdown != 0 && (--_countdown) == 0) {
 		leaveScene(_leaveResult);
diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp
index a2c0eb7..373bfb5 100644
--- a/engines/neverhood/modules/module3000.cpp
+++ b/engines/neverhood/modules/module3000.cpp
@@ -807,14 +807,6 @@ Scene3009::Scene3009(NeverhoodEngine *vm, Module *parentModule, int which)
 
 	SetMessageHandler(&Scene3009::handleMessage);
 	SetUpdateHandler(&Scene3009::update);
-
-	// DEBUG Enable to set the correct code
-#if 0	
-	for (int i = 0; i < 6; i++)
-		setSubVar(VA_CURR_CANNON_SYMBOLS, i, _correctSymbols[i]);
-	sendMessage(this, 0x2003, 0);
-#endif   
-
 }
 
 Scene3009::~Scene3009() {
@@ -1227,13 +1219,6 @@ Scene3010::Scene3010(NeverhoodEngine *vm, Module *parentModule, int which)
 	
 	int initCountdown = 0;
 
-	// DEBUG Enable to activate all buttons
-#if 0	
-	setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[0], 1);
-	setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[1], 1);
-	setSubVar(VA_LOCKS_DISABLED, kScene3010ButtonNameHashes[2], 1);
-#endif	
-
 	setBackground(0x80802626);
 	setPalette(0x80802626);
 






More information about the Scummvm-git-logs mailing list