aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-02-20 09:26:09 -0500
committerPaul Gilbert2017-02-20 09:26:09 -0500
commit2963af577505325dc578bad096d64499e0823a34 (patch)
tree876a0adcdf6b4696ea74e92bbc4e709025242bbc /engines
parent9ed2977f1fc6f9bf3aa87dfb8fd0e5869fbdd006 (diff)
downloadscummvm-rg350-2963af577505325dc578bad096d64499e0823a34.tar.gz
scummvm-rg350-2963af577505325dc578bad096d64499e0823a34.tar.bz2
scummvm-rg350-2963af577505325dc578bad096d64499e0823a34.zip
TITANIC: Fix adding centre cards to Titania
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/carry/brain.cpp37
-rw-r--r--engines/titanic/game/brain_slot.cpp18
-rw-r--r--engines/titanic/game/brain_slot.h6
3 files changed, 29 insertions, 32 deletions
diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp
index 7b2e8d0e45..49178d1e10 100644
--- a/engines/titanic/carry/brain.cpp
+++ b/engines/titanic/carry/brain.cpp
@@ -56,28 +56,25 @@ void CBrain::load(SimpleFile *file) {
bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) {
CBrainSlot *slot = dynamic_cast<CBrainSlot *>(msg->_other);
- if (slot) {
- if (slot->getName() == "CentralCore") {
- setVisible(false);
- petMoveToHiddenRoom();
- CAddHeadPieceMsg headpieceMsg(getName());
- headpieceMsg.execute("CentralCoreSlot");
- }
- else if (!slot->_value1 && slot->getName() == "CentralCoreSlot") {
- setVisible(false);
- petMoveToHiddenRoom();
- CAddHeadPieceMsg headpieceMsg(getName());
- headpieceMsg.execute(msg->_other);
- playSound("z#116.wav");
- setPosition(Point(0, 0));
- setVisible(false);
- _field134 = 1;
- }
-
- return true;
- } else {
+ if (!slot) {
return CCarry::UseWithOtherMsg(msg);
+ } else if (isEquals("CentralCore")) {
+ setVisible(false);
+ petMoveToHiddenRoom();
+ CAddHeadPieceMsg headpieceMsg(getName());
+ headpieceMsg.execute("CentralCoreSlot");
+ } else if (!slot->_occupied && slot->getName() != "CentralCoreSlot") {
+ setVisible(false);
+ petMoveToHiddenRoom();
+ CAddHeadPieceMsg headpieceMsg(getName());
+ headpieceMsg.execute(msg->_other);
+ playSound("z#116.wav");
+ setPosition(Point(0, 0));
+ setVisible(false);
+ _field134 = 1;
}
+
+ return true;
}
bool CBrain::VisibleMsg(CVisibleMsg *msg) {
diff --git a/engines/titanic/game/brain_slot.cpp b/engines/titanic/game/brain_slot.cpp
index 1518d9b0b3..585df09591 100644
--- a/engines/titanic/game/brain_slot.cpp
+++ b/engines/titanic/game/brain_slot.cpp
@@ -33,12 +33,12 @@ BEGIN_MESSAGE_MAP(CBrainSlot, CGameObject)
ON_MESSAGE(MouseDragStartMsg)
END_MESSAGE_MAP()
-int CBrainSlot::_added;
+bool CBrainSlot::_added;
bool CBrainSlot::_woken;
void CBrainSlot::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_value1, indent);
+ file->writeNumberLine(_occupied, indent);
file->writeQuotedLine(_target, indent);
file->writeNumberLine(_added, indent);
file->writeNumberLine(_woken, indent);
@@ -48,7 +48,7 @@ void CBrainSlot::save(SimpleFile *file, int indent) {
void CBrainSlot::load(SimpleFile *file) {
file->readNumber();
- _value1 = file->readNumber();
+ _occupied = file->readNumber();
_target = file->readString();
_added = file->readNumber();
_woken = file->readNumber();
@@ -58,12 +58,12 @@ void CBrainSlot::load(SimpleFile *file) {
bool CBrainSlot::SetFrameMsg(CSetFrameMsg *msg) {
loadFrame(msg->_frameNumber);
- _value1 = 1;
+ _occupied = true;
return true;
}
bool CBrainSlot::AddHeadPieceMsg(CAddHeadPieceMsg *msg) {
- _added = 1;
+ _added = true;
_cursorId = CURSOR_HAND;
CAddHeadPieceMsg addMsg("NULL");
@@ -101,7 +101,7 @@ bool CBrainSlot::AddHeadPieceMsg(CAddHeadPieceMsg *msg) {
}
_target = msg->_value;
- _value1 = 1;
+ _occupied = true;
return true;
}
@@ -124,7 +124,7 @@ bool CBrainSlot::ActMsg(CActMsg *msg) {
}
bool CBrainSlot::MouseDragStartMsg(CMouseDragStartMsg *msg) {
- if (!_value1 || _woken || !checkPoint(msg->_mousePos, false, true))
+ if (!_occupied || _woken || !checkPoint(msg->_mousePos, false, true))
return false;
_cursorId = CURSOR_ARROW;
@@ -134,14 +134,14 @@ bool CBrainSlot::MouseDragStartMsg(CMouseDragStartMsg *msg) {
takeMsg.execute("TitaniaControl");
loadFrame(isEquals("CentralCoreSlot") ? 21 : 0);
- _value1 = 0;
+ _occupied = false;
CPassOnDragStartMsg passMsg;
passMsg._mousePos = msg->_mousePos;
passMsg.execute(_target);
msg->_dragItem = getRoot()->findByName(_target);
- _added = 0;
+ _added = false;
return true;
}
diff --git a/engines/titanic/game/brain_slot.h b/engines/titanic/game/brain_slot.h
index 4d500cc59a..a821cfd1cb 100644
--- a/engines/titanic/game/brain_slot.h
+++ b/engines/titanic/game/brain_slot.h
@@ -35,14 +35,14 @@ class CBrainSlot : public CGameObject {
bool ActMsg(CActMsg *msg);
bool MouseDragStartMsg(CMouseDragStartMsg *msg);
public:
- static int _added;
+ static bool _added;
static bool _woken;
public:
- int _value1;
+ bool _occupied;
CString _target;
public:
CLASSDEF;
- CBrainSlot() : CGameObject(), _value1(0) {}
+ CBrainSlot() : CGameObject(), _occupied(false) {}
/**
* Save the data for the class to file