aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authoruruk2014-05-30 11:14:47 +0200
committeruruk2014-05-30 11:14:47 +0200
commitbb2f8dd68e1d6b2b30b07f60c0cd4e125b47ea4d (patch)
tree9a1e28cfb1eb1a322225c05adc0962a2f96ea521 /engines/mohawk
parent5ad4e157e5398347651a0da0db07f9daf01bf373 (diff)
parent0a46d67baea121bed0511ce45bfdd8438a43d35d (diff)
downloadscummvm-rg350-bb2f8dd68e1d6b2b30b07f60c0cd4e125b47ea4d.tar.gz
scummvm-rg350-bb2f8dd68e1d6b2b30b07f60c0cd4e125b47ea4d.tar.bz2
scummvm-rg350-bb2f8dd68e1d6b2b30b07f60c0cd4e125b47ea4d.zip
Merge branch 'master' of https://github.com/scummvm/scummvm into cge2
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/console.cpp266
-rw-r--r--engines/mohawk/riven.cpp82
-rw-r--r--engines/mohawk/riven.h22
-rw-r--r--engines/mohawk/riven_external.cpp6
-rw-r--r--engines/mohawk/riven_graphics.cpp2
-rw-r--r--engines/mohawk/riven_saveload.cpp79
-rw-r--r--engines/mohawk/riven_scripts.cpp4
-rw-r--r--engines/mohawk/riven_vars.cpp418
8 files changed, 409 insertions, 470 deletions
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index 2e83eb3328..d49f3e8637 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -49,20 +49,20 @@ namespace Mohawk {
#ifdef ENABLE_MYST
MystConsole::MystConsole(MohawkEngine_Myst *vm) : GUI::Debugger(), _vm(vm) {
- DCmd_Register("changeCard", WRAP_METHOD(MystConsole, Cmd_ChangeCard));
- DCmd_Register("curCard", WRAP_METHOD(MystConsole, Cmd_CurCard));
- DCmd_Register("var", WRAP_METHOD(MystConsole, Cmd_Var));
- DCmd_Register("curStack", WRAP_METHOD(MystConsole, Cmd_CurStack));
- DCmd_Register("changeStack", WRAP_METHOD(MystConsole, Cmd_ChangeStack));
- DCmd_Register("drawImage", WRAP_METHOD(MystConsole, Cmd_DrawImage));
- DCmd_Register("drawRect", WRAP_METHOD(MystConsole, Cmd_DrawRect));
- DCmd_Register("setResourceEnable", WRAP_METHOD(MystConsole, Cmd_SetResourceEnable));
- DCmd_Register("playSound", WRAP_METHOD(MystConsole, Cmd_PlaySound));
- DCmd_Register("stopSound", WRAP_METHOD(MystConsole, Cmd_StopSound));
- DCmd_Register("playMovie", WRAP_METHOD(MystConsole, Cmd_PlayMovie));
- DCmd_Register("disableInitOpcodes", WRAP_METHOD(MystConsole, Cmd_DisableInitOpcodes));
- DCmd_Register("cache", WRAP_METHOD(MystConsole, Cmd_Cache));
- DCmd_Register("resources", WRAP_METHOD(MystConsole, Cmd_Resources));
+ registerCmd("changeCard", WRAP_METHOD(MystConsole, Cmd_ChangeCard));
+ registerCmd("curCard", WRAP_METHOD(MystConsole, Cmd_CurCard));
+ registerCmd("var", WRAP_METHOD(MystConsole, Cmd_Var));
+ registerCmd("curStack", WRAP_METHOD(MystConsole, Cmd_CurStack));
+ registerCmd("changeStack", WRAP_METHOD(MystConsole, Cmd_ChangeStack));
+ registerCmd("drawImage", WRAP_METHOD(MystConsole, Cmd_DrawImage));
+ registerCmd("drawRect", WRAP_METHOD(MystConsole, Cmd_DrawRect));
+ registerCmd("setResourceEnable", WRAP_METHOD(MystConsole, Cmd_SetResourceEnable));
+ registerCmd("playSound", WRAP_METHOD(MystConsole, Cmd_PlaySound));
+ registerCmd("stopSound", WRAP_METHOD(MystConsole, Cmd_StopSound));
+ registerCmd("playMovie", WRAP_METHOD(MystConsole, Cmd_PlayMovie));
+ registerCmd("disableInitOpcodes", WRAP_METHOD(MystConsole, Cmd_DisableInitOpcodes));
+ registerCmd("cache", WRAP_METHOD(MystConsole, Cmd_Cache));
+ registerCmd("resources", WRAP_METHOD(MystConsole, Cmd_Resources));
}
MystConsole::~MystConsole() {
@@ -70,7 +70,7 @@ MystConsole::~MystConsole() {
bool MystConsole::Cmd_ChangeCard(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("Usage: changeCard <card>\n");
+ debugPrintf("Usage: changeCard <card>\n");
return true;
}
@@ -81,20 +81,20 @@ bool MystConsole::Cmd_ChangeCard(int argc, const char **argv) {
}
bool MystConsole::Cmd_CurCard(int argc, const char **argv) {
- DebugPrintf("Current Card: %d\n", _vm->getCurCard());
+ debugPrintf("Current Card: %d\n", _vm->getCurCard());
return true;
}
bool MystConsole::Cmd_Var(int argc, const char **argv) {
if (argc == 1) {
- DebugPrintf("Usage: var <var> (<value>)\n");
+ debugPrintf("Usage: var <var> (<value>)\n");
return true;
}
if (argc > 2)
_vm->_scriptParser->setVarValue((uint16)atoi(argv[1]), (uint16)atoi(argv[2]));
- DebugPrintf("%d = %d\n", (uint16)atoi(argv[1]), _vm->_scriptParser->getVar((uint16)atoi(argv[1])));
+ debugPrintf("%d = %d\n", (uint16)atoi(argv[1]), _vm->_scriptParser->getVar((uint16)atoi(argv[1])));
return true;
}
@@ -130,19 +130,19 @@ static const uint16 default_start_card[12] = {
};
bool MystConsole::Cmd_CurStack(int argc, const char **argv) {
- DebugPrintf("Current Stack: %s\n", mystStackNames[_vm->getCurStack()]);
+ debugPrintf("Current Stack: %s\n", mystStackNames[_vm->getCurStack()]);
return true;
}
bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) {
if (argc != 2 && argc != 3) {
- DebugPrintf("Usage: changeStack <stack> [<card>]\n\n");
- DebugPrintf("Stacks:\n=======\n");
+ debugPrintf("Usage: changeStack <stack> [<card>]\n\n");
+ debugPrintf("Stacks:\n=======\n");
for (byte i = 0; i < ARRAYSIZE(mystStackNames); i++)
- DebugPrintf(" %s\n", mystStackNames[i]);
+ debugPrintf(" %s\n", mystStackNames[i]);
- DebugPrintf("\n");
+ debugPrintf("\n");
return true;
}
@@ -156,7 +156,7 @@ bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) {
}
if (!stackNum) {
- DebugPrintf("\'%s\' is not a stack name!\n", argv[1]);
+ debugPrintf("\'%s\' is not a stack name!\n", argv[1]);
return true;
}
@@ -177,7 +177,7 @@ bool MystConsole::Cmd_ChangeStack(int argc, const char **argv) {
bool MystConsole::Cmd_DrawImage(int argc, const char **argv) {
if (argc != 2 && argc != 6) {
- DebugPrintf("Usage: drawImage <image> [<left> <top> <right> <bottom>]\n");
+ debugPrintf("Usage: drawImage <image> [<left> <top> <right> <bottom>]\n");
return true;
}
@@ -195,8 +195,8 @@ bool MystConsole::Cmd_DrawImage(int argc, const char **argv) {
bool MystConsole::Cmd_DrawRect(int argc, const char **argv) {
if (argc != 5 && argc != 2) {
- DebugPrintf("Usage: drawRect <left> <top> <right> <bottom>\n");
- DebugPrintf("Usage: drawRect <resource id>\n");
+ debugPrintf("Usage: drawRect <left> <top> <right> <bottom>\n");
+ debugPrintf("Usage: drawRect <resource id>\n");
return true;
}
@@ -213,7 +213,7 @@ bool MystConsole::Cmd_DrawRect(int argc, const char **argv) {
bool MystConsole::Cmd_SetResourceEnable(int argc, const char **argv) {
if (argc < 3) {
- DebugPrintf("Usage: setResourceEnable <resource id> <bool>\n");
+ debugPrintf("Usage: setResourceEnable <resource id> <bool>\n");
return true;
}
@@ -223,7 +223,7 @@ bool MystConsole::Cmd_SetResourceEnable(int argc, const char **argv) {
bool MystConsole::Cmd_PlaySound(int argc, const char **argv) {
if (argc == 1) {
- DebugPrintf("Usage: playSound <value>\n");
+ debugPrintf("Usage: playSound <value>\n");
return true;
}
@@ -234,7 +234,7 @@ bool MystConsole::Cmd_PlaySound(int argc, const char **argv) {
}
bool MystConsole::Cmd_StopSound(int argc, const char **argv) {
- DebugPrintf("Stopping Sound\n");
+ debugPrintf("Stopping Sound\n");
_vm->_sound->stopSound();
@@ -243,8 +243,8 @@ bool MystConsole::Cmd_StopSound(int argc, const char **argv) {
bool MystConsole::Cmd_PlayMovie(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("Usage: playMovie <name> [<stack>] [<left> <top>]\n");
- DebugPrintf("NOTE: The movie will play *once* in the background.\n");
+ debugPrintf("Usage: playMovie <name> [<stack>] [<left> <top>]\n");
+ debugPrintf("NOTE: The movie will play *once* in the background.\n");
return true;
}
@@ -258,7 +258,7 @@ bool MystConsole::Cmd_PlayMovie(int argc, const char **argv) {
}
if (!stackNum) {
- DebugPrintf("\'%s\' is not a stack name!\n", argv[2]);
+ debugPrintf("\'%s\' is not a stack name!\n", argv[2]);
return true;
}
}
@@ -277,7 +277,7 @@ bool MystConsole::Cmd_PlayMovie(int argc, const char **argv) {
bool MystConsole::Cmd_DisableInitOpcodes(int argc, const char **argv) {
if (argc != 1) {
- DebugPrintf("Usage: disableInitOpcodes\n");
+ debugPrintf("Usage: disableInitOpcodes\n");
return true;
}
@@ -289,7 +289,7 @@ bool MystConsole::Cmd_DisableInitOpcodes(int argc, const char **argv) {
bool MystConsole::Cmd_Cache(int argc, const char **argv) {
if (argc > 2) {
- DebugPrintf("Usage: cache on/off - Omit parameter to get current state\n");
+ debugPrintf("Usage: cache on/off - Omit parameter to get current state\n");
return true;
}
@@ -304,15 +304,15 @@ bool MystConsole::Cmd_Cache(int argc, const char **argv) {
_vm->setCacheState(state);
}
- DebugPrintf("Cache: %s\n", state ? "Enabled" : "Disabled");
+ debugPrintf("Cache: %s\n", state ? "Enabled" : "Disabled");
return true;
}
bool MystConsole::Cmd_Resources(int argc, const char **argv) {
- DebugPrintf("Resources in card %d:\n", _vm->getCurCard());
+ debugPrintf("Resources in card %d:\n", _vm->getCurCard());
for (uint i = 0; i < _vm->_resources.size(); i++) {
- DebugPrintf("#%2d %s\n", i, _vm->_resources[i]->describe().c_str());
+ debugPrintf("#%2d %s\n", i, _vm->_resources[i]->describe().c_str());
}
return true;
@@ -323,21 +323,21 @@ bool MystConsole::Cmd_Resources(int argc, const char **argv) {
#ifdef ENABLE_RIVEN
RivenConsole::RivenConsole(MohawkEngine_Riven *vm) : GUI::Debugger(), _vm(vm) {
- DCmd_Register("changeCard", WRAP_METHOD(RivenConsole, Cmd_ChangeCard));
- DCmd_Register("curCard", WRAP_METHOD(RivenConsole, Cmd_CurCard));
- DCmd_Register("var", WRAP_METHOD(RivenConsole, Cmd_Var));
- DCmd_Register("playSound", WRAP_METHOD(RivenConsole, Cmd_PlaySound));
- DCmd_Register("playSLST", WRAP_METHOD(RivenConsole, Cmd_PlaySLST));
- DCmd_Register("stopSound", WRAP_METHOD(RivenConsole, Cmd_StopSound));
- DCmd_Register("curStack", WRAP_METHOD(RivenConsole, Cmd_CurStack));
- DCmd_Register("changeStack", WRAP_METHOD(RivenConsole, Cmd_ChangeStack));
- DCmd_Register("hotspots", WRAP_METHOD(RivenConsole, Cmd_Hotspots));
- DCmd_Register("zipMode", WRAP_METHOD(RivenConsole, Cmd_ZipMode));
- DCmd_Register("dumpScript", WRAP_METHOD(RivenConsole, Cmd_DumpScript));
- DCmd_Register("listZipCards", WRAP_METHOD(RivenConsole, Cmd_ListZipCards));
- DCmd_Register("getRMAP", WRAP_METHOD(RivenConsole, Cmd_GetRMAP));
- DCmd_Register("combos", WRAP_METHOD(RivenConsole, Cmd_Combos));
- DCmd_Register("sliderState", WRAP_METHOD(RivenConsole, Cmd_SliderState));
+ registerCmd("changeCard", WRAP_METHOD(RivenConsole, Cmd_ChangeCard));
+ registerCmd("curCard", WRAP_METHOD(RivenConsole, Cmd_CurCard));
+ registerCmd("var", WRAP_METHOD(RivenConsole, Cmd_Var));
+ registerCmd("playSound", WRAP_METHOD(RivenConsole, Cmd_PlaySound));
+ registerCmd("playSLST", WRAP_METHOD(RivenConsole, Cmd_PlaySLST));
+ registerCmd("stopSound", WRAP_METHOD(RivenConsole, Cmd_StopSound));
+ registerCmd("curStack", WRAP_METHOD(RivenConsole, Cmd_CurStack));
+ registerCmd("changeStack", WRAP_METHOD(RivenConsole, Cmd_ChangeStack));
+ registerCmd("hotspots", WRAP_METHOD(RivenConsole, Cmd_Hotspots));
+ registerCmd("zipMode", WRAP_METHOD(RivenConsole, Cmd_ZipMode));
+ registerCmd("dumpScript", WRAP_METHOD(RivenConsole, Cmd_DumpScript));
+ registerCmd("listZipCards", WRAP_METHOD(RivenConsole, Cmd_ListZipCards));
+ registerCmd("getRMAP", WRAP_METHOD(RivenConsole, Cmd_GetRMAP));
+ registerCmd("combos", WRAP_METHOD(RivenConsole, Cmd_Combos));
+ registerCmd("sliderState", WRAP_METHOD(RivenConsole, Cmd_SliderState));
}
RivenConsole::~RivenConsole() {
@@ -346,7 +346,7 @@ RivenConsole::~RivenConsole() {
bool RivenConsole::Cmd_ChangeCard(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("Usage: changeCard <card>\n");
+ debugPrintf("Usage: changeCard <card>\n");
return true;
}
@@ -358,19 +358,19 @@ bool RivenConsole::Cmd_ChangeCard(int argc, const char **argv) {
}
bool RivenConsole::Cmd_CurCard(int argc, const char **argv) {
- DebugPrintf("Current Card: %d\n", _vm->getCurCard());
+ debugPrintf("Current Card: %d\n", _vm->getCurCard());
return true;
}
bool RivenConsole::Cmd_Var(int argc, const char **argv) {
if (argc == 1) {
- DebugPrintf("Usage: var <var name> (<value>)\n");
+ debugPrintf("Usage: var <var name> (<value>)\n");
return true;
}
if (!_vm->_vars.contains(argv[1])) {
- DebugPrintf("Unknown variable '%s'\n", argv[1]);
+ debugPrintf("Unknown variable '%s'\n", argv[1]);
return true;
}
@@ -379,13 +379,13 @@ bool RivenConsole::Cmd_Var(int argc, const char **argv) {
if (argc > 2)
var = (uint32)atoi(argv[2]);
- DebugPrintf("%s = %d\n", argv[1], var);
+ debugPrintf("%s = %d\n", argv[1], var);
return true;
}
bool RivenConsole::Cmd_PlaySound(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("Usage: playSound <value>\n");
+ debugPrintf("Usage: playSound <value>\n");
return true;
}
@@ -397,7 +397,7 @@ bool RivenConsole::Cmd_PlaySound(int argc, const char **argv) {
bool RivenConsole::Cmd_PlaySLST(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("Usage: playSLST <slst index> <card, default = current>\n");
+ debugPrintf("Usage: playSLST <slst index> <card, default = current>\n");
return true;
}
@@ -412,7 +412,7 @@ bool RivenConsole::Cmd_PlaySLST(int argc, const char **argv) {
}
bool RivenConsole::Cmd_StopSound(int argc, const char **argv) {
- DebugPrintf("Stopping Sound\n");
+ debugPrintf("Stopping Sound\n");
_vm->_sound->stopSound();
_vm->_sound->stopAllSLST();
@@ -420,58 +420,57 @@ bool RivenConsole::Cmd_StopSound(int argc, const char **argv) {
}
bool RivenConsole::Cmd_CurStack(int argc, const char **argv) {
- DebugPrintf("Current Stack: %s\n", _vm->getStackName(_vm->getCurStack()).c_str());
+ debugPrintf("Current Stack: %s\n", _vm->getStackName(_vm->getCurStack()).c_str());
return true;
}
bool RivenConsole::Cmd_ChangeStack(int argc, const char **argv) {
- byte i;
-
if (argc < 3) {
- DebugPrintf("Usage: changeStack <stack> <card>\n\n");
- DebugPrintf("Stacks:\n=======\n");
+ debugPrintf("Usage: changeStack <stack> <card>\n\n");
+ debugPrintf("Stacks:\n=======\n");
- for (i = 0; i <= tspit; i++)
- DebugPrintf(" %s\n", _vm->getStackName(i).c_str());
+ for (uint i = kStackFirst; i <= kStackLast; i++)
+ debugPrintf(" %s\n", _vm->getStackName(i).c_str());
- DebugPrintf("\n");
+ debugPrintf("\n");
return true;
}
- byte stackNum = 0;
+ uint stack = kStackUnknown;
- for (i = 1; i <= tspit + 1; i++)
- if (!scumm_stricmp(argv[1], _vm->getStackName(i - 1).c_str())) {
- stackNum = i;
+ for (uint i = kStackFirst; i <= kStackLast; i++) {
+ if (!scumm_stricmp(argv[1], _vm->getStackName(i).c_str())) {
+ stack = i;
break;
}
+ }
- if (!stackNum) {
- DebugPrintf("\'%s\' is not a stack name!\n", argv[1]);
+ if (stack == kStackUnknown) {
+ debugPrintf("\'%s\' is not a stack name!\n", argv[1]);
return true;
}
- _vm->changeToStack(stackNum - 1);
+ _vm->changeToStack(stack);
_vm->changeToCard((uint16)atoi(argv[2]));
return false;
}
bool RivenConsole::Cmd_Hotspots(int argc, const char **argv) {
- DebugPrintf("Current card (%d) has %d hotspots:\n", _vm->getCurCard(), _vm->getHotspotCount());
+ debugPrintf("Current card (%d) has %d hotspots:\n", _vm->getCurCard(), _vm->getHotspotCount());
for (uint16 i = 0; i < _vm->getHotspotCount(); i++) {
- DebugPrintf("Hotspot %d, index %d, BLST ID %d (", i, _vm->_hotspots[i].index, _vm->_hotspots[i].blstID);
+ debugPrintf("Hotspot %d, index %d, BLST ID %d (", i, _vm->_hotspots[i].index, _vm->_hotspots[i].blstID);
if (_vm->_hotspots[i].enabled)
- DebugPrintf("enabled");
+ debugPrintf("enabled");
else
- DebugPrintf("disabled");
+ debugPrintf("disabled");
- DebugPrintf(") - (%d, %d, %d, %d)\n", _vm->_hotspots[i].rect.left, _vm->_hotspots[i].rect.top, _vm->_hotspots[i].rect.right, _vm->_hotspots[i].rect.bottom);
- DebugPrintf(" Name = %s\n", _vm->getHotspotName(i).c_str());
+ debugPrintf(") - (%d, %d, %d, %d)\n", _vm->_hotspots[i].rect.left, _vm->_hotspots[i].rect.top, _vm->_hotspots[i].rect.right, _vm->_hotspots[i].rect.bottom);
+ debugPrintf(" Name = %s\n", _vm->getHotspotName(i).c_str());
}
return true;
@@ -481,34 +480,33 @@ bool RivenConsole::Cmd_ZipMode(int argc, const char **argv) {
uint32 &zipModeActive = _vm->_vars["azip"];
zipModeActive = !zipModeActive;
- DebugPrintf("Zip Mode is ");
- DebugPrintf(zipModeActive ? "Enabled" : "Disabled");
- DebugPrintf("\n");
+ debugPrintf("Zip Mode is ");
+ debugPrintf(zipModeActive ? "Enabled" : "Disabled");
+ debugPrintf("\n");
return true;
}
bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) {
if (argc < 4) {
- DebugPrintf("Usage: dumpScript <stack> <CARD or HSPT> <card>\n");
+ debugPrintf("Usage: dumpScript <stack> <CARD or HSPT> <card>\n");
return true;
}
uint16 oldStack = _vm->getCurStack();
+ uint newStack = kStackUnknown;
- byte newStack = 0;
-
- for (byte i = 1; i <= tspit + 1; i++)
- if (!scumm_stricmp(argv[1], _vm->getStackName(i - 1).c_str())) {
+ for (uint i = kStackFirst; i <= kStackLast; i++) {
+ if (!scumm_stricmp(argv[1], _vm->getStackName(i).c_str())) {
newStack = i;
break;
}
+ }
- if (!newStack) {
- DebugPrintf("\'%s\' is not a stack name!\n", argv[1]);
+ if (newStack == kStackUnknown) {
+ debugPrintf("\'%s\' is not a stack name!\n", argv[1]);
return true;
}
- newStack--;
_vm->changeToStack(newStack);
// Load in Variable Names
@@ -594,7 +592,7 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) {
delete hsptStream;
} else {
- DebugPrintf("%s doesn't have any scripts!\n", argv[2]);
+ debugPrintf("%s doesn't have any scripts!\n", argv[2]);
}
// See above for why this is printed via debugN
@@ -602,18 +600,18 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) {
_vm->changeToStack(oldStack);
- DebugPrintf("Script dump complete.\n");
+ debugPrintf("Script dump complete.\n");
return true;
}
bool RivenConsole::Cmd_ListZipCards(int argc, const char **argv) {
if (_vm->_zipModeData.size() == 0) {
- DebugPrintf("No zip card data.\n");
+ debugPrintf("No zip card data.\n");
} else {
- DebugPrintf("Listing zip cards:\n");
+ debugPrintf("Listing zip cards:\n");
for (uint32 i = 0; i < _vm->_zipModeData.size(); i++)
- DebugPrintf("ID = %d, Name = %s\n", _vm->_zipModeData[i].id, _vm->_zipModeData[i].name.c_str());
+ debugPrintf("ID = %d, Name = %s\n", _vm->_zipModeData[i].id, _vm->_zipModeData[i].name.c_str());
}
return true;
@@ -621,7 +619,7 @@ bool RivenConsole::Cmd_ListZipCards(int argc, const char **argv) {
bool RivenConsole::Cmd_GetRMAP(int argc, const char **argv) {
uint32 rmapCode = _vm->getCurCardRMAP();
- DebugPrintf("RMAP for %s %d = %08x\n", _vm->getStackName(_vm->getCurStack()).c_str(), _vm->getCurCard(), rmapCode);
+ debugPrintf("RMAP for %s %d = %08x\n", _vm->getStackName(_vm->getCurStack()).c_str(), _vm->getCurCard(), rmapCode);
return true;
}
@@ -635,20 +633,20 @@ bool RivenConsole::Cmd_Combos(int argc, const char **argv) {
uint32 prisonCombo = _vm->_vars["pcorrectorder"];
uint32 domeCombo = _vm->_vars["adomecombo"];
- DebugPrintf("Telescope Combo:\n ");
+ debugPrintf("Telescope Combo:\n ");
for (int i = 0; i < 5; i++)
- DebugPrintf("%d ", _vm->_externalScriptHandler->getComboDigit(teleCombo, i));
+ debugPrintf("%d ", _vm->_externalScriptHandler->getComboDigit(teleCombo, i));
- DebugPrintf("\nPrison Combo:\n ");
+ debugPrintf("\nPrison Combo:\n ");
for (int i = 0; i < 5; i++)
- DebugPrintf("%d ", _vm->_externalScriptHandler->getComboDigit(prisonCombo, i));
+ debugPrintf("%d ", _vm->_externalScriptHandler->getComboDigit(prisonCombo, i));
- DebugPrintf("\nDome Combo:\n ");
+ debugPrintf("\nDome Combo:\n ");
for (int i = 1; i <= 25; i++)
if (domeCombo & (1 << (25 - i)))
- DebugPrintf("%d ", i);
+ debugPrintf("%d ", i);
- DebugPrintf("\n");
+ debugPrintf("\n");
return true;
}
@@ -656,17 +654,17 @@ bool RivenConsole::Cmd_SliderState(int argc, const char **argv) {
if (argc > 1)
_vm->_externalScriptHandler->setDomeSliderState((uint32)atoi(argv[1]));
- DebugPrintf("Dome Slider State = %08x\n", _vm->_externalScriptHandler->getDomeSliderState());
+ debugPrintf("Dome Slider State = %08x\n", _vm->_externalScriptHandler->getDomeSliderState());
return true;
}
#endif // ENABLE_RIVEN
LivingBooksConsole::LivingBooksConsole(MohawkEngine_LivingBooks *vm) : GUI::Debugger(), _vm(vm) {
- DCmd_Register("playSound", WRAP_METHOD(LivingBooksConsole, Cmd_PlaySound));
- DCmd_Register("stopSound", WRAP_METHOD(LivingBooksConsole, Cmd_StopSound));
- DCmd_Register("drawImage", WRAP_METHOD(LivingBooksConsole, Cmd_DrawImage));
- DCmd_Register("changePage", WRAP_METHOD(LivingBooksConsole, Cmd_ChangePage));
+ registerCmd("playSound", WRAP_METHOD(LivingBooksConsole, Cmd_PlaySound));
+ registerCmd("stopSound", WRAP_METHOD(LivingBooksConsole, Cmd_StopSound));
+ registerCmd("drawImage", WRAP_METHOD(LivingBooksConsole, Cmd_DrawImage));
+ registerCmd("changePage", WRAP_METHOD(LivingBooksConsole, Cmd_ChangePage));
}
LivingBooksConsole::~LivingBooksConsole() {
@@ -674,7 +672,7 @@ LivingBooksConsole::~LivingBooksConsole() {
bool LivingBooksConsole::Cmd_PlaySound(int argc, const char **argv) {
if (argc == 1) {
- DebugPrintf("Usage: playSound <value>\n");
+ debugPrintf("Usage: playSound <value>\n");
return true;
}
@@ -684,7 +682,7 @@ bool LivingBooksConsole::Cmd_PlaySound(int argc, const char **argv) {
}
bool LivingBooksConsole::Cmd_StopSound(int argc, const char **argv) {
- DebugPrintf("Stopping Sound\n");
+ debugPrintf("Stopping Sound\n");
_vm->_sound->stopSound();
return true;
@@ -692,7 +690,7 @@ bool LivingBooksConsole::Cmd_StopSound(int argc, const char **argv) {
bool LivingBooksConsole::Cmd_DrawImage(int argc, const char **argv) {
if (argc == 1) {
- DebugPrintf("Usage: drawImage <value>\n");
+ debugPrintf("Usage: drawImage <value>\n");
return true;
}
@@ -703,13 +701,13 @@ bool LivingBooksConsole::Cmd_DrawImage(int argc, const char **argv) {
bool LivingBooksConsole::Cmd_ChangePage(int argc, const char **argv) {
if (argc < 2 || argc > 3) {
- DebugPrintf("Usage: changePage <page>[.<subpage>] [<mode>]\n");
+ debugPrintf("Usage: changePage <page>[.<subpage>] [<mode>]\n");
return true;
}
int page, subpage = 0;
if (sscanf(argv[1], "%d.%d", &page, &subpage) == 0) {
- DebugPrintf("Usage: changePage <page>[.<subpage>] [<mode>]\n");
+ debugPrintf("Usage: changePage <page>[.<subpage>] [<mode>]\n");
return true;
}
LBMode mode = argc == 2 ? _vm->getCurMode() : (LBMode)atoi(argv[2]);
@@ -720,21 +718,21 @@ bool LivingBooksConsole::Cmd_ChangePage(int argc, const char **argv) {
if (_vm->loadPage(mode, page, subpage))
return false;
}
- DebugPrintf("no such page %d.%d\n", page, subpage);
+ debugPrintf("no such page %d.%d\n", page, subpage);
return true;
}
#ifdef ENABLE_CSTIME
CSTimeConsole::CSTimeConsole(MohawkEngine_CSTime *vm) : GUI::Debugger(), _vm(vm) {
- DCmd_Register("playSound", WRAP_METHOD(CSTimeConsole, Cmd_PlaySound));
- DCmd_Register("stopSound", WRAP_METHOD(CSTimeConsole, Cmd_StopSound));
- DCmd_Register("drawImage", WRAP_METHOD(CSTimeConsole, Cmd_DrawImage));
- DCmd_Register("drawSubimage", WRAP_METHOD(CSTimeConsole, Cmd_DrawSubimage));
- DCmd_Register("changeCase", WRAP_METHOD(CSTimeConsole, Cmd_ChangeCase));
- DCmd_Register("changeScene", WRAP_METHOD(CSTimeConsole, Cmd_ChangeScene));
- DCmd_Register("caseVariable", WRAP_METHOD(CSTimeConsole, Cmd_CaseVariable));
- DCmd_Register("invItem", WRAP_METHOD(CSTimeConsole, Cmd_InvItem));
+ registerCmd("playSound", WRAP_METHOD(CSTimeConsole, Cmd_PlaySound));
+ registerCmd("stopSound", WRAP_METHOD(CSTimeConsole, Cmd_StopSound));
+ registerCmd("drawImage", WRAP_METHOD(CSTimeConsole, Cmd_DrawImage));
+ registerCmd("drawSubimage", WRAP_METHOD(CSTimeConsole, Cmd_DrawSubimage));
+ registerCmd("changeCase", WRAP_METHOD(CSTimeConsole, Cmd_ChangeCase));
+ registerCmd("changeScene", WRAP_METHOD(CSTimeConsole, Cmd_ChangeScene));
+ registerCmd("caseVariable", WRAP_METHOD(CSTimeConsole, Cmd_CaseVariable));
+ registerCmd("invItem", WRAP_METHOD(CSTimeConsole, Cmd_InvItem));
}
CSTimeConsole::~CSTimeConsole() {
@@ -742,7 +740,7 @@ CSTimeConsole::~CSTimeConsole() {
bool CSTimeConsole::Cmd_PlaySound(int argc, const char **argv) {
if (argc == 1) {
- DebugPrintf("Usage: playSound <value>\n");
+ debugPrintf("Usage: playSound <value>\n");
return true;
}
@@ -752,7 +750,7 @@ bool CSTimeConsole::Cmd_PlaySound(int argc, const char **argv) {
}
bool CSTimeConsole::Cmd_StopSound(int argc, const char **argv) {
- DebugPrintf("Stopping Sound\n");
+ debugPrintf("Stopping Sound\n");
_vm->_sound->stopSound();
return true;
@@ -760,7 +758,7 @@ bool CSTimeConsole::Cmd_StopSound(int argc, const char **argv) {
bool CSTimeConsole::Cmd_DrawImage(int argc, const char **argv) {
if (argc == 1) {
- DebugPrintf("Usage: drawImage <value>\n");
+ debugPrintf("Usage: drawImage <value>\n");
return true;
}
@@ -771,7 +769,7 @@ bool CSTimeConsole::Cmd_DrawImage(int argc, const char **argv) {
bool CSTimeConsole::Cmd_DrawSubimage(int argc, const char **argv) {
if (argc < 3) {
- DebugPrintf("Usage: drawSubimage <value> <subimage>\n");
+ debugPrintf("Usage: drawSubimage <value> <subimage>\n");
return true;
}
@@ -782,7 +780,7 @@ bool CSTimeConsole::Cmd_DrawSubimage(int argc, const char **argv) {
bool CSTimeConsole::Cmd_ChangeCase(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("Usage: changeCase <value>\n");
+ debugPrintf("Usage: changeCase <value>\n");
return true;
}
@@ -792,7 +790,7 @@ bool CSTimeConsole::Cmd_ChangeCase(int argc, const char **argv) {
bool CSTimeConsole::Cmd_ChangeScene(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("Usage: changeScene <value>\n");
+ debugPrintf("Usage: changeScene <value>\n");
return true;
}
@@ -802,12 +800,12 @@ bool CSTimeConsole::Cmd_ChangeScene(int argc, const char **argv) {
bool CSTimeConsole::Cmd_CaseVariable(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("Usage: caseVariable <id> [<value>]\n");
+ debugPrintf("Usage: caseVariable <id> [<value>]\n");
return true;
}
if (argc == 2) {
- DebugPrintf("case variable %d has value %d\n", atoi(argv[1]), _vm->_caseVariable[atoi(argv[1])]);
+ debugPrintf("case variable %d has value %d\n", atoi(argv[1]), _vm->_caseVariable[atoi(argv[1])]);
} else {
_vm->_caseVariable[atoi(argv[1])] = atoi(argv[2]);
}
@@ -816,7 +814,7 @@ bool CSTimeConsole::Cmd_CaseVariable(int argc, const char **argv) {
bool CSTimeConsole::Cmd_InvItem(int argc, const char **argv) {
if (argc < 3) {
- DebugPrintf("Usage: invItem <id> <0 or 1>\n");
+ debugPrintf("Usage: invItem <id> <0 or 1>\n");
return true;
}
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index e1059bebaa..a7fe12b9e1 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -55,7 +55,7 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
_activatedSLST = false;
_ignoreNextMouseUp = false;
_extrasFile = 0;
- _curStack = aspit;
+ _curStack = kStackUnknown;
_hotspots = 0;
removeTimer();
@@ -161,7 +161,7 @@ Common::Error MohawkEngine_Riven::run() {
// Let's begin, shall we?
if (getFeatures() & GF_DEMO) {
// Start the demo off with the videos
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(6);
} else if (ConfMan.hasKey("save_slot")) {
// Load game from launcher/command line if requested
@@ -172,12 +172,12 @@ Common::Error MohawkEngine_Riven::run() {
// Attempt to load the game. On failure, just send us to the main menu.
if (_saveLoad->loadGame(savedGamesList[gameToLoad]).getCode() != Common::kNoError) {
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(1);
}
} else {
// Otherwise, start us off at aspit's card 1 (the main menu)
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(1);
}
@@ -255,16 +255,16 @@ void MohawkEngine_Riven::handleEvents() {
case Common::KEYCODE_r:
// Return to the main menu in the demo on ctrl+r
if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) {
- if (_curStack != aspit)
- changeToStack(aspit);
+ if (_curStack != kStackAspit)
+ changeToStack(kStackAspit);
changeToCard(1);
}
break;
case Common::KEYCODE_p:
// Play the intro videos in the demo on ctrl+p
if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) {
- if (_curStack != aspit)
- changeToStack(aspit);
+ if (_curStack != kStackAspit)
+ changeToStack(kStackAspit);
changeToCard(6);
}
break;
@@ -343,20 +343,22 @@ struct RivenSpecialChange {
uint32 startCardRMAP;
byte targetStack;
uint32 targetCardRMAP;
-} rivenSpecialChange[] = {
- { aspit, 0x1f04, ospit, 0x44ad }, // Trap Book
- { bspit, 0x1c0e7, ospit, 0x2e76 }, // Dome Linking Book
- { gspit, 0x111b1, ospit, 0x2e76 }, // Dome Linking Book
- { jspit, 0x28a18, rspit, 0xf94 }, // Tay Linking Book
- { jspit, 0x26228, ospit, 0x2e76 }, // Dome Linking Book
- { ospit, 0x5f0d, pspit, 0x3bf0 }, // Return from 233rd Age
- { ospit, 0x470a, jspit, 0x1508e }, // Return from 233rd Age
- { ospit, 0x5c52, gspit, 0x10bea }, // Return from 233rd Age
- { ospit, 0x5d68, bspit, 0x1adfd }, // Return from 233rd Age
- { ospit, 0x5e49, tspit, 0xe87 }, // Return from 233rd Age
- { pspit, 0x4108, ospit, 0x2e76 }, // Dome Linking Book
- { rspit, 0x32d8, jspit, 0x1c474 }, // Return from Tay
- { tspit, 0x21b69, ospit, 0x2e76 } // Dome Linking Book
+};
+
+static const RivenSpecialChange rivenSpecialChange[] = {
+ { kStackAspit, 0x1f04, kStackOspit, 0x44ad }, // Trap Book
+ { kStackBspit, 0x1c0e7, kStackOspit, 0x2e76 }, // Dome Linking Book
+ { kStackGspit, 0x111b1, kStackOspit, 0x2e76 }, // Dome Linking Book
+ { kStackJspit, 0x28a18, kStackRspit, 0xf94 }, // Tay Linking Book
+ { kStackJspit, 0x26228, kStackOspit, 0x2e76 }, // Dome Linking Book
+ { kStackOspit, 0x5f0d, kStackPspit, 0x3bf0 }, // Return from 233rd Age
+ { kStackOspit, 0x470a, kStackJspit, 0x1508e }, // Return from 233rd Age
+ { kStackOspit, 0x5c52, kStackGspit, 0x10bea }, // Return from 233rd Age
+ { kStackOspit, 0x5d68, kStackBspit, 0x1adfd }, // Return from 233rd Age
+ { kStackOspit, 0x5e49, kStackTspit, 0xe87 }, // Return from 233rd Age
+ { kStackPspit, 0x4108, kStackOspit, 0x2e76 }, // Dome Linking Book
+ { kStackRspit, 0x32d8, kStackJspit, 0x1c474 }, // Return from Tay
+ { kStackTspit, 0x21b69, kStackOspit, 0x2e76 } // Dome Linking Book
};
void MohawkEngine_Riven::changeToCard(uint16 dest) {
@@ -556,16 +558,16 @@ void MohawkEngine_Riven::checkInventoryClick() {
// In the demo, check if we've clicked the exit button
if (getFeatures() & GF_DEMO) {
if (g_demoExitRect->contains(mousePos)) {
- if (_curStack == aspit && _curCard == 1) {
+ if (_curStack == kStackAspit && _curCard == 1) {
// From the main menu, go to the "quit" screen
changeToCard(12);
- } else if (_curStack == aspit && _curCard == 12) {
+ } else if (_curStack == kStackAspit && _curCard == 12) {
// From the "quit" screen, just quit
_gameOver = true;
} else {
// Otherwise, return to the main menu
- if (_curStack != aspit)
- changeToStack(aspit);
+ if (_curStack != kStackAspit)
+ changeToStack(kStackAspit);
changeToCard(1);
}
}
@@ -573,7 +575,7 @@ void MohawkEngine_Riven::checkInventoryClick() {
}
// No inventory shown on aspit
- if (_curStack == aspit)
+ if (_curStack == kStackAspit)
return;
// Set the return stack/card id's.
@@ -589,31 +591,31 @@ void MohawkEngine_Riven::checkInventoryClick() {
if (!hasCathBook) {
if (g_atrusJournalRect1->contains(mousePos)) {
_gfx->hideInventory();
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(5);
}
} else if (!hasTrapBook) {
if (g_atrusJournalRect2->contains(mousePos)) {
_gfx->hideInventory();
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(5);
} else if (g_cathJournalRect2->contains(mousePos)) {
_gfx->hideInventory();
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(6);
}
} else {
if (g_atrusJournalRect3->contains(mousePos)) {
_gfx->hideInventory();
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(5);
} else if (g_cathJournalRect3->contains(mousePos)) {
_gfx->hideInventory();
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(6);
} else if (g_trapBookRect3->contains(mousePos)) {
_gfx->hideInventory();
- changeToStack(aspit);
+ changeToStack(kStackAspit);
changeToCard(7);
}
}
@@ -735,16 +737,20 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &
Common::String MohawkEngine_Riven::getStackName(uint16 stack) const {
static const char *rivenStackNames[] = {
- "aspit",
- "bspit",
- "gspit",
- "jspit",
+ "<unknown>",
"ospit",
"pspit",
"rspit",
- "tspit"
+ "tspit",
+ "bspit",
+ "gspit",
+ "jspit",
+ "aspit"
};
+ // Sanity check.
+ assert(stack < ARRAYSIZE(rivenStackNames));
+
return rivenStackNames[stack];
}
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index c22b9f7f87..9c23d07c52 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -44,18 +44,20 @@ class RivenConsole;
class RivenSaveLoad;
class RivenOptionsDialog;
-#define RIVEN_STACKS 8
-
// Riven Stack Types
enum {
- aspit = 0, // Main Menu, Books, Setup
- bspit = 1, // Book-Making Island
- gspit = 2, // Garden Island
- jspit = 3, // Jungle Island
- ospit = 4, // 233rd Age (Gehn's Office)
- pspit = 5, // Prison Island
- rspit = 6, // Rebel Age (Tay)
- tspit = 7 // Temple Island
+ kStackUnknown = 0, // Default value for ReturnStackID
+ kStackOspit = 1, // 233rd Age (Gehn's Office)
+ kStackPspit = 2, // Prison Island
+ kStackRspit = 3, // Temple Island
+ kStackTspit = 4, // Rebel Age (Tay)
+ kStackBspit = 5, // Book-Making Island
+ kStackGspit = 6, // Garden Island
+ kStackJspit = 7, // Jungle Island
+ kStackAspit = 8, // Main Menu, Books, Setup
+
+ kStackFirst = kStackOspit,
+ kStackLast = kStackAspit
};
// NAME Resource ID's
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index 10dcfd9fa7..3d0bccc47f 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -405,7 +405,7 @@ void RivenExternal::drawDomeSliders(uint16 startHotspot) {
// On pspit, the rect is different by two pixels
// (alternatively, we could just use hotspot 3 here, but only on pspit is there a hotspot for this)
- if (_vm->getCurStack() == pspit)
+ if (_vm->getCurStack() == kStackPspit)
dstAreaRect.translate(-2, 0);
// Find out bitmap id
@@ -2016,8 +2016,8 @@ void RivenExternal::xorollcredittime(uint16 argc, uint16 *argv) {
// WORKAROUND: The special change stuff only handles one destination and it would
// be messy to modify the way that currently works. If we use the trap book on Tay,
// we should be using the Tay end game sequences.
- if (_vm->_vars["returnstackid"] == rspit) {
- _vm->changeToStack(rspit);
+ if (_vm->_vars["returnstackid"] == kStackRspit) {
+ _vm->changeToStack(kStackRspit);
_vm->changeToCard(2);
return;
}
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index 615b2fdadb..b44fbb828e 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -289,7 +289,7 @@ void RivenGraphics::showInventory() {
drawInventoryImage(101, g_demoExitRect);
} else {
// We don't want to show the inventory on setup screens or in other journals.
- if (_vm->getCurStack() == aspit)
+ if (_vm->getCurStack() == kStackAspit)
return;
// There are three books and three vars. We have three different
diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp
index d97d0e174b..6af66f7a2d 100644
--- a/engines/mohawk/riven_saveload.cpp
+++ b/engines/mohawk/riven_saveload.cpp
@@ -38,56 +38,6 @@ Common::StringArray RivenSaveLoad::generateSaveGameList() {
return _saveFileMan->listSavefiles("*.rvn");
}
-// Note: The stack numbers we use do not match up to what the original executable,
-// so, match them ;)
-static uint16 mapOldStackIDToNew(uint16 oldID) {
- switch (oldID) {
- case 1:
- return ospit;
- case 2:
- return pspit;
- case 3:
- return rspit;
- case 4:
- return tspit;
- case 5:
- return bspit;
- case 6:
- return gspit;
- case 7:
- return jspit;
- case 8:
- return aspit;
- }
-
- error("Unknown old stack ID %d", oldID);
- return 0;
-}
-
-static uint16 mapNewStackIDToOld(uint16 newID) {
- switch (newID) {
- case aspit:
- return 8;
- case bspit:
- return 5;
- case gspit:
- return 6;
- case jspit:
- return 7;
- case ospit:
- return 1;
- case pspit:
- return 2;
- case rspit:
- return 3;
- case tspit:
- return 4;
- }
-
- error("Unknown new stack ID %d", newID);
- return 0;
-}
-
Common::Error RivenSaveLoad::loadGame(Common::String filename) {
if (_vm->getFeatures() & GF_DEMO) // Don't load games in the demo
return Common::kNoError;
@@ -141,9 +91,6 @@ Common::Error RivenSaveLoad::loadGame(Common::String filename) {
names->readUint16BE(); // Skip unknown values
uint32 curNamesPos = names->pos();
- uint16 stackID = 0;
- uint16 cardID = 0;
-
for (uint32 i = 0; i < namesCount && !names->eos(); i++) {
names->seek(curNamesPos);
names->seek(stringOffsets[i], SEEK_CUR);
@@ -165,25 +112,18 @@ Common::Error RivenSaveLoad::loadGame(Common::String filename) {
uint32 &var = _vm->_vars[name];
name.toLowercase();
- // Handle any special variables here
// WORKAROUND: time variables are reset here for one main reason:
// The save does not store any start point for the time, so we don't know the real time.
// Because of this, in many cases, the original would just give a 'free' Ytram upon saving
// since the time would be used in a new (improper) time frame.
- if (name.equalsIgnoreCase("CurrentStackID")) // Remap to our definitions, store for later
- stackID = mapOldStackIDToNew(rawVariables[i]);
- else if (name.equalsIgnoreCase("CurrentCardID")) // Store for later
- cardID = rawVariables[i];
- else if (name.equalsIgnoreCase("ReturnStackID") && var != 0) // if 0, the game did not use the variable yet
- var = mapOldStackIDToNew(rawVariables[i]);
- else if (name.contains("time")) // WORKAROUND: See above
+ if (name.contains("time"))
var = 0;
- else // Otherwise, just store it
+ else
var = rawVariables[i];
}
- _vm->changeToStack(stackID);
- _vm->changeToCard(cardID);
+ _vm->changeToStack(_vm->_vars["CurrentStackID"]);
+ _vm->changeToCard(_vm->_vars["CurrentCardID"]);
delete names;
delete[] stringOffsets;
@@ -224,14 +164,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVARSSection() {
for (RivenVariableMap::const_iterator it = _vm->_vars.begin(); it != _vm->_vars.end(); it++) {
stream->writeUint32BE(0); // Unknown
stream->writeUint32BE(0); // Unknown
-
- // Remap returnstackid here because we don't actually want to change
- // our internal returnstackid.
- uint32 variable = it->_value;
- if (it->_key == "returnstackid")
- variable = mapNewStackIDToOld(variable);
-
- stream->writeUint32BE(variable);
+ stream->writeUint32BE(it->_value);
}
return stream;
@@ -290,7 +223,7 @@ Common::Error RivenSaveLoad::saveGame(Common::String filename) {
filename += ".rvn";
// Convert class variables to variable numbers
- _vm->_vars["currentstackid"] = mapNewStackIDToOld(_vm->getCurStack());
+ _vm->_vars["currentstackid"] = _vm->getCurStack();
_vm->_vars["currentcardid"] = _vm->getCurCard();
Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename);
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index 06b6afdf30..29ee5cd50b 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -403,7 +403,7 @@ void RivenScript::stopSound(uint16 op, uint16 argc, uint16 *argv) {
// would cause all ambient sounds not to play. An alternative
// fix would be to stop all scripts on a stack change, but this
// does fine for now.
- if (_vm->getCurStack() == tspit && (_vm->getCurCardRMAP() == 0x6e9a || _vm->getCurCardRMAP() == 0xfeeb))
+ if (_vm->getCurStack() == kStackTspit && (_vm->getCurCardRMAP() == 0x6e9a || _vm->getCurCardRMAP() == 0xfeeb))
return;
// The argument is a bitflag for the setting.
@@ -586,7 +586,7 @@ void RivenScript::activatePLST(uint16 op, uint16 argc, uint16 *argv) {
void RivenScript::activateSLST(uint16 op, uint16 argc, uint16 *argv) {
// WORKAROUND: Disable the SLST that is played during Riven's intro.
// Riven X does this too (spoke this over with Jeff)
- if (_vm->getCurStack() == tspit && _vm->getCurCardRMAP() == 0x6e9a && argv[0] == 2)
+ if (_vm->getCurStack() == kStackTspit && _vm->getCurCardRMAP() == 0x6e9a && argv[0] == 2)
return;
_vm->_sound->playSLST(argv[0], _vm->getCurCard());
diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp
index 1cd748d8d6..f09aba7f90 100644
--- a/engines/mohawk/riven_vars.cpp
+++ b/engines/mohawk/riven_vars.cpp
@@ -31,240 +31,240 @@ namespace Mohawk {
static const char *variableNames[] = {
// aspit
- "aatrusbook",
- "aatruspage",
- "acathbook",
- "acathpage",
- "acathstate",
- "adoit",
- "adomecombo",
- "agehn",
- "ainventory",
- "aova",
- "apower",
- "araw",
- "atemp",
- "atrap",
- "atrapbook",
- "auservolume",
- "azip",
+ "aAtrusBook",
+ "aAtrusPage",
+ "aCathBook",
+ "aCathPage",
+ "aCathState",
+ "aDoIt",
+ "aDomeCombo",
+ "aGehn",
+ "aInventory",
+ "aOva",
+ "aPower",
+ "aRaw",
+ "aTemp",
+ "aTrap",
+ "aTrapBook",
+ "aUserVolume",
+ "aZip",
// bspit
- "bbacklock",
- "bbait",
- "bbigbridge",
- "bbirds",
- "bblrarm",
- "bblrdoor",
- "bblrgrt",
- "bblrsw",
- "bblrvalve",
- "bblrwtr",
- "bbook",
- "bbrlever",
- "bcavedoor",
+ "bBackLock",
+ "bBait",
+ "bBigBridge",
+ "bBirds",
+ "bBlrArm",
+ "bBlrDoor",
+ "bBlrGrt",
+ "bBlrSw",
+ "bBlrValve",
+ "bBlrWtr",
+ "bBook",
+ "bBrLever",
+ "bCaveDoor",
"bcombo",
- "bcpipegr",
- "bcratergg",
- "bdome",
- "bdrwr",
- "bfans",
- "bfmdoor",
- "bidvlv",
- "blab",
- "blabbackdr",
- "blabbook",
- "blabeye",
- "blabfrontdr",
- "blabpage",
- "blever",
- "bfrontlock",
- "bheat",
- "bmagcar",
- "bpipdr",
- "bprs",
- "bstove",
- "btrap",
- "bvalve",
- "bvise",
- "bytram",
- "bytramtime",
- "bytrap",
- "bytrapped",
+ "bCPipeGr",
+ "bCraterGg",
+ "bDome",
+ "bDrwr",
+ "bFans",
+ "bFMDoor",
+ "bIdVlv",
+ "bLab",
+ "bLabBackDr",
+ "bLabBook",
+ "bLabEye",
+ "bLabFrontDr",
+ "bLabPage",
+ "bLever",
+ "bFrontLock",
+ "bHeat",
+ "bMagCar",
+ "bPipDr",
+ "bPrs",
+ "bStove",
+ "bTrap",
+ "bValve",
+ "bVise",
+ "bYtram",
+ "bYtramTime",
+ "bYtrap",
+ "bYtrapped",
// gspit
- "gbook",
- "gcathtime",
- "gcathstate",
- "gcombo",
- "gdome",
- "gemagcar",
- "gimagecurr",
+ "gBook",
+ "gCathTime",
+ "gCathState",
+ "gCombo",
+ "gDome",
+ "gEmagCar",
+ "gImageCurr",
"gimagemax",
- "gimagerot",
- "glkbtns",
- "glkbridge",
- "glkelev",
- "glview",
- "glviewmpos",
- "glviewpos",
- "gnmagrot",
- "gnmagcar",
- "gpinup",
- "gpinpos",
- "gpinsmpos",
- "grview",
- "grviewmpos",
- "grviewpos",
- "gscribe",
- "gscribetime",
- "gsubelev",
- "gsubdr",
- "gupmoov",
- "gwhark",
- "gwharktime",
+ "gImageRot",
+ "gLkBtns",
+ "gLkBridge",
+ "gLkElev",
+ "gLView",
+ "gLViewMPos",
+ "gLViewPos",
+ "gNmagRot",
+ "gNmagCar",
+ "gPinUp",
+ "gPinPos",
+ "gPinsMPos",
+ "gRView",
+ "gRViewMPos",
+ "gRViewPos",
+ "gScribe",
+ "gScribeTime",
+ "gSubElev",
+ "gSubDr",
+ "gUpMoov",
+ "gWhark",
+ "gWharkTime",
// jspit
- "jwmagcar",
- "jbeetle",
- "jbeetlepool",
- "jbook",
- "jbridge1",
- "jbridge2",
- "jbridge3",
- "jbridge4",
- "jbridge5",
- "jccb",
- "jcombo",
- "jcrg",
- "jdome",
- "jdrain",
- "jgallows",
- "jgate",
- "jgirl",
- "jiconcorrectorder",
- "jiconorder",
- "jicons",
- "jladder",
- "jleftpos",
- "jpeek",
- "jplaybeetle",
- "jprebel",
- "jprisondr",
- "jprisonsecdr",
- "jrbook",
- "jrightpos",
- "jsouthpathdr",
- "jschooldr",
- "jsub",
- "jsubdir",
- "jsubhatch",
- "jsubsw",
- "jsunners",
- "jsunnertime",
- "jthronedr",
- "jtunneldr",
- "jtunnellamps",
- "jvillagepeople",
- "jwarning",
- "jwharkpos",
- "jwharkram",
- "jwmouth",
- "jwmagcar",
- "jymagcar",
+ "jWMagCar",
+ "jBeetle",
+ "jBeetlePool",
+ "jBook",
+ "jBridge1",
+ "jBridge2",
+ "jBridge3",
+ "jBridge4",
+ "jBridge5",
+ "jCCB",
+ "jCombo",
+ "jCrg",
+ "jDome",
+ "jDrain",
+ "jGallows",
+ "jGate",
+ "jGirl",
+ "jIconCorrectOrder",
+ "jIconOrder",
+ "jIcons",
+ "jLadder",
+ "jLeftPos",
+ "jPeek",
+ "jPlayBeetle",
+ "jPRebel",
+ "jPrisonDr",
+ "jPrisonSecDr",
+ "jrBook",
+ "jRightPos",
+ "jSouthPathDr",
+ "jSchoolDr",
+ "jSub",
+ "jSubDir",
+ "jSubHatch",
+ "jSubSw",
+ "jSunners",
+ "jSunnerTime",
+ "jThroneDr",
+ "jTunnelDr",
+ "jTunnelLamps",
+ "jVillagePeople",
+ "jWarning",
+ "jWharkPos",
+ "jWharkRam",
+ "jWMouth",
+ "jWMagCar",
+ "jYMagCar",
// ospit
"oambient",
- "obutton",
+ "oButton",
"ocage",
- "odeskbook",
- "ogehnpage",
- "omusicplayer",
- "ostanddrawer",
- "ostove",
+ "oDeskBook",
+ "oGehnPage",
+ "oMusicPlayer",
+ "oStandDrawer",
+ "oStove",
// pspit
- "pbook",
- "pcage",
- "pcathcheck",
- "pcathstate",
- "pcathtime",
- "pcombo",
- "pcorrectorder",
+ "pBook",
+ "pCage",
+ "pCathCheck",
+ "pCathState",
+ "pCathTime",
+ "pCombo",
+ "pCorrectOrder",
"pdome",
- "pelevcombo",
- "pleftpos",
- "prightpos",
- "ptemp",
- "pwharkpos",
+ "pElevCombo",
+ "pLeftPos",
+ "pRightPos",
+ "pTemp",
+ "pWharkPos",
// rspit
- "rrebel",
- "rrebelview",
- "rrichard",
- "rvillagetime",
+ "rRebel",
+ "rRebelView",
+ "rRichard",
+ "rVillageTime",
// tspit
- "tbars",
- "tbeetle",
- "tblue",
- "tbook",
- "tbookvalve",
- "tcage",
- "tcombo",
- "tcorrectorder",
- "tcovercombo",
- "tdl",
- "tdome",
- "tdomeelev",
- "tdomeelevbtn",
- "tgatebrhandle",
- "tgatebridge",
- "tgatestate",
- "tgreen",
- "tgridoor",
- "tgrodoor",
- "tgrmdoor",
- "tguard",
- "timagedoor",
- "tmagcar",
- "torange",
- "tred",
- "tsecdoor",
- "tsubbridge",
- "ttelecover",
- "ttelehandle",
- "ttelepin",
- "ttelescope",
- "ttelevalve",
- "ttemple",
- "ttempledoor",
- "ttunneldoor",
- "tviewer",
- "tviolet",
- "twabrvalve",
- "twaffle",
- "tyellow",
+ "tBars",
+ "tBeetle",
+ "tBlue",
+ "tBook",
+ "tBookValve",
+ "tCage",
+ "tCombo",
+ "tCorrectOrder",
+ "tCoverCombo",
+ "tDL",
+ "tDome",
+ "tDomeElev",
+ "tDomeElevBtn",
+ "tGateBrHandle",
+ "tGateBridge",
+ "tGateState",
+ "tGreen",
+ "tGRIDoor",
+ "tGRODoor",
+ "tGRMDoor",
+ "tGuard",
+ "tImageDoor",
+ "tMagCar",
+ "tOrange",
+ "tRed",
+ "tSecDoor",
+ "tSubBridge",
+ "tTeleCover",
+ "tTeleHandle",
+ "tTelePin",
+ "tTelescope",
+ "tTeleValve",
+ "tTemple",
+ "tTempleDoor",
+ "tTunnelDoor",
+ "tViewer",
+ "tViolet",
+ "tWaBrValve",
+ "tWaffle",
+ "tYellow",
// Miscellaneous
"elevbtn1",
"elevbtn2",
"elevbtn3",
- "domecheck",
- "transitionsenabled",
- "transitionmode",
- "waterenabled",
- "rivenambients",
- "stackvarsinitialized",
- "doingsetupscreens",
+ "domeCheck",
+ "transitionsEnabled",
+ "transitionMode",
+ "waterEnabled",
+ "RivenAmbients",
+ "stackVarsInitialized",
+ "DoingSetupScreens",
"all_book",
- "playerhasbook",
- "returnstackid",
- "returncardid",
- "newpos",
- "themarble",
- "currentstackid",
- "currentcardid"
+ "playerHasBook",
+ "returnStackID",
+ "returnCardID",
+ "NewPos",
+ "theMarble",
+ "CurrentStackID",
+ "CurrentCardID"
};
uint32 &MohawkEngine_Riven::getStackVar(uint32 index) {