Skip to content
Permalink
Browse files

TITANIC: Fix adding centre cards to Titania

  • Loading branch information...
dreammaster committed Feb 20, 2017
1 parent 9ed2977 commit 2963af577505325dc578bad096d64499e0823a34
Showing with 29 additions and 32 deletions.
  1. +17 −20 engines/titanic/carry/brain.cpp
  2. +9 −9 engines/titanic/game/brain_slot.cpp
  3. +3 −3 engines/titanic/game/brain_slot.h
@@ -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) {
@@ -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;
}
@@ -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

0 comments on commit 2963af5

Please sign in to comment.
You can’t perform that action at this time.