aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2010-02-17 04:20:19 +0000
committerMatthew Hoops2010-02-17 04:20:19 +0000
commit2d03db8a203a8628a2e55c25ad8c1ab0cb47d503 (patch)
tree83e1d824d0e48f4469c16be058f9c22da9c8139f
parent85bce4611c94c0bad9fcb06e868fe3441a54e636 (diff)
downloadscummvm-rg350-2d03db8a203a8628a2e55c25ad8c1ab0cb47d503.tar.gz
scummvm-rg350-2d03db8a203a8628a2e55c25ad8c1ab0cb47d503.tar.bz2
scummvm-rg350-2d03db8a203a8628a2e55c25ad8c1ab0cb47d503.zip
Cleanup handling of the telescope cover combination; matches the original algorithm much better.
svn-id: r48075
-rw-r--r--engines/mohawk/riven_external.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index ba9e802e49..6e056e5079 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -1251,7 +1251,7 @@ void RivenExternal::xpisland990_elevcombo(uint16 argc, uint16 *argv) {
// pelevcombo keeps count of how many buttons we have pressed in the correct order.
// When pelevcombo is 5, clicking the handle will show the video freeing Catherine.
- if (argv[0] == getComboDigit(*_vm->matchVarToString("pcorrectorder"), *correctDigits))
+ if (*correctDigits < 5 && argv[0] == getComboDigit(*_vm->matchVarToString("pcorrectorder"), *correctDigits))
*correctDigits += 1;
else
*correctDigits = 0;
@@ -1397,23 +1397,20 @@ void RivenExternal::xtexterior300_telescopeup(uint16 argc, uint16 *argv) {
}
void RivenExternal::xtisland390_covercombo(uint16 argc, uint16 *argv) {
- // Called when clicking the telescope cover buttons. button is the button number (1...5).
- uint32 *pressedButtons = _vm->matchVarToString("tcovercombo");
+ // Called when clicking the telescope cover buttons. argv[0] is the button number (1...5).
+ uint32 *correctDigits = _vm->matchVarToString("tcovercombo");
- // We pressed a button! Yay! Add it to the queue.
- *pressedButtons *= 10;
- *pressedButtons += argv[0];
+ if (*correctDigits < 5 && argv[0] == getComboDigit(*_vm->matchVarToString("tcorrectorder"), *correctDigits))
+ *correctDigits += 1;
+ else
+ *correctDigits = 0;
- if (*pressedButtons == *_vm->matchVarToString("tcorrectorder")) {
+ // If we have hit the correct 5 buttons in a row, activate the hotspot to open up the
+ // telescope cover.
+ if (*correctDigits == 5)
_vm->_hotspots[9].enabled = true;
- } else {
+ else
_vm->_hotspots[9].enabled = false;
-
- // Set the buttons to the last one pressed if we've
- // pressed more than 5 buttons.
- if (*pressedButtons > 55555)
- *pressedButtons = argv[0];
- }
}
// Atrus' Journal and Trap Book are added to inventory