aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/bomb.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2017-02-19 22:57:31 -0500
committerPaul Gilbert2017-02-19 22:57:31 -0500
commit2d80b931b3f004265fd08c3182f94a4c5824e063 (patch)
tree72b13f5ebe790b819820b06ca3b3fc311c4aba2d /engines/titanic/game/bomb.cpp
parentc1bc64d3912f60d6c5812f1f82d196eb78d5b4f2 (diff)
downloadscummvm-rg350-2d80b931b3f004265fd08c3182f94a4c5824e063.tar.gz
scummvm-rg350-2d80b931b3f004265fd08c3182f94a4c5824e063.tar.bz2
scummvm-rg350-2d80b931b3f004265fd08c3182f94a4c5824e063.zip
WORKAROUND: Stop resetting bomb code wheels when loading savegames
The original kept resetting the bomb's code wheels whenever the view was entered, which meant reloading a savegame, you lost any progress you'd made. Presumably this was done as a quick and dirty hack in case anyone was stupid enough to rearm the bomb after fixing it the first time. I've added new code that now only resets the wheels when the bomb is initially armed, and you can now save in the bomb closeup, and it will remember all your selections
Diffstat (limited to 'engines/titanic/game/bomb.cpp')
-rw-r--r--engines/titanic/game/bomb.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp
index 0f4ce92d29..17c10c5082 100644
--- a/engines/titanic/game/bomb.cpp
+++ b/engines/titanic/game/bomb.cpp
@@ -21,6 +21,7 @@
*/
#include "titanic/game/bomb.h"
+#include "titanic/game/code_wheel.h"
namespace Titanic {
@@ -36,6 +37,8 @@ BEGIN_MESSAGE_MAP(CBomb, CBackground)
ON_MESSAGE(SetFrameMsg)
END_MESSAGE_MAP()
+const int CORRECT_WHEELS = 23;
+
static const char *const HUNDREDS_WAVS[] = {
"", "z#353.wav", "z#339.wav", "z#325.wav", "z#311.wav", "z#297.wav",
"z#283.wav", "z#269.wav", "z#255.wav", "z#241.wav"
@@ -115,9 +118,13 @@ void CBomb::load(SimpleFile *file) {
}
bool CBomb::StatusChangeMsg(CStatusChangeMsg *msg) {
- _numCorrectWheels += msg->_newStatus;
+ // Check whether the wheels are corect
+ CCheckCodeWheelsMsg checkMsg;
+ checkMsg.execute(findRoom(), nullptr, MSGFLAG_SCAN);
+
+ _numCorrectWheels = checkMsg._isCorrect ? CORRECT_WHEELS : 0;
- if (_numCorrectWheels == 23) {
+ if (_numCorrectWheels == CORRECT_WHEELS) {
// Nobody likes a smartass
startAnimTimer("Disarmed", 2000);
lockMouse();
@@ -158,7 +165,7 @@ bool CBomb::StatusChangeMsg(CStatusChangeMsg *msg) {
}
bool CBomb::EnterViewMsg(CEnterViewMsg *msg) {
- _numCorrectWheels = 2;
+ // WORKAROUND: Don't keep resetting wheels
return true;
}
@@ -169,7 +176,7 @@ bool CBomb::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
stopSound(_soundHandle);
//stopSound(_unusedHandle);
- if (_numCorrectWheels < 23) {
+ if (_numCorrectWheels < CORRECT_WHEELS) {
_tappedCtr = MIN(_tappedCtr + 1, 23);
CString name;
@@ -263,6 +270,16 @@ bool CBomb::TurnOn(CTurnOn *msg) {
_soundHandle = playSound("z#389.wav", _volume);
_active = true;
+ // WORKAROUND: Only reset the code wheels back to 'O' value
+ // when first arming the bomb, not whenever the bomb view is entered
+ _numCorrectWheels = 2;
+ CRoomItem *room = findRoom();
+ for (CTreeItem *treeItem = room; treeItem; treeItem = treeItem->scan(room)) {
+ CodeWheel *codeWheel = dynamic_cast<CodeWheel *>(treeItem);
+ if (codeWheel)
+ codeWheel->reset();
+ }
+
CActMsg actMsg("Arm Bomb");
actMsg.execute("EndExplodeShip");
addTimer(0);