[Scummvm-cvs-logs] SF.net SVN: scummvm:[46925] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Jan 3 16:08:26 CET 2010
Revision: 46925
http://scummvm.svn.sourceforge.net/scummvm/?rev=46925&view=rev
Author: thebluegr
Date: 2010-01-03 15:08:26 +0000 (Sun, 03 Jan 2010)
Log Message:
-----------
The "room" command can now set the current room number, too (more straightforward than changing global var 13)
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/engine/state.cpp
scummvm/trunk/engines/sci/engine/state.h
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2010-01-03 14:39:38 UTC (rev 46924)
+++ scummvm/trunk/engines/sci/console.cpp 2010-01-03 15:08:26 UTC (rev 46925)
@@ -327,7 +327,7 @@
DebugPrintf(" list_saves - List all saved games including filenames\n");
DebugPrintf(" restart_game - Restarts the game\n");
DebugPrintf(" version - Shows the resource and interpreter versions\n");
- DebugPrintf(" room - Shows the current room number\n");
+ DebugPrintf(" room - Gets or sets the current room number\n");
DebugPrintf(" exit - Exits the game\n");
DebugPrintf("\n");
DebugPrintf("Screen:\n");
@@ -630,8 +630,19 @@
}
bool Console::cmdRoomNumber(int argc, const char **argv) {
- DebugPrintf("Current room number is %d\n", _vm->_gamestate->currentRoomNumber());
+ // The room number is stored in global var 13
+ // The same functionality is provided by "vmvars g 13" (but this one is more straighforward)
+ if (argc != 2) {
+ DebugPrintf("Current room number is %d\n", _vm->_gamestate->currentRoomNumber());
+ DebugPrintf("Calling this command with the room number (in decimal or hexadecimal) changes the room\n");
+ } else {
+ Common::String roomNumberStr = argv[1];
+ int roomNumber = strtol(roomNumberStr.c_str(), NULL, roomNumberStr.hasSuffix("h") ? 16 : 10);
+ _vm->getEngineState()->setRoomNumber(roomNumber);
+ DebugPrintf("Room number changed to %d (%x in hex)\n", roomNumber, roomNumber);
+ }
+
return true;
}
Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp 2010-01-03 14:39:38 UTC (rev 46924)
+++ scummvm/trunk/engines/sci/engine/state.cpp 2010-01-03 15:08:26 UTC (rev 46925)
@@ -120,6 +120,10 @@
return script_000->_localsBlock->_locals[13].toUint16();
}
+void EngineState::setRoomNumber(uint16 roomNumber) {
+ script_000->_localsBlock->_locals[13] = make_reg(0, roomNumber);
+}
+
kLanguage EngineState::charToLanguage(const char c) const {
switch (c) {
case 'F':
Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h 2010-01-03 14:39:38 UTC (rev 46924)
+++ scummvm/trunk/engines/sci/engine/state.h 2010-01-03 15:08:26 UTC (rev 46925)
@@ -226,6 +226,7 @@
Script *script_000; /**< script 000, e.g. for globals */
uint16 currentRoomNumber() const;
+ void setRoomNumber(uint16 roomNumber);
/**
* Processes a multilanguage string based on the current language settings and
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