diff options
author | Paul Gilbert | 2016-04-14 18:32:03 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:11:05 -0400 |
commit | a5e90526355a421d23175bd0ac25f7c2bc0d3276 (patch) | |
tree | e44fbd73d3cf0c3f9e1cd2ca896f8863264ff516 /engines | |
parent | a6d03a15c9b305afab75d5b89b9c818249031ec7 (diff) | |
download | scummvm-rg350-a5e90526355a421d23175bd0ac25f7c2bc0d3276.tar.gz scummvm-rg350-a5e90526355a421d23175bd0ac25f7c2bc0d3276.tar.bz2 scummvm-rg350-a5e90526355a421d23175bd0ac25f7c2bc0d3276.zip |
TITANIC: More CArm message handlers
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/carry/arm.cpp | 68 | ||||
-rw-r--r-- | engines/titanic/carry/arm.h | 5 | ||||
-rw-r--r-- | engines/titanic/carry/phonograph_cylinder.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 19 |
4 files changed, 60 insertions, 34 deletions
diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index f2c7d5233f..0098c6f4c6 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -21,6 +21,7 @@ */ #include "titanic/carry/arm.h" +#include "titanic/messages/messages.h" namespace Titanic { @@ -35,19 +36,18 @@ BEGIN_MESSAGE_MAP(CArm, CCarry) END_MESSAGE_MAP() CArm::CArm() : CCarry(), _string6("Key"), - _field138(0), _field13C(0), _field140(0), _field144(0), - _field148(0), _field158(0), _armRect(220, 208, 409, 350), - _field16C(3), _field170(0) { + _field138(0), _field158(0), _field16C(3), _field170(0), + _armRect(220, 208, 409, 350) { } void CArm::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); file->writeNumberLine(_field138, indent); - file->writeNumberLine(_field13C, indent); - file->writeNumberLine(_field140, indent); - file->writeNumberLine(_field144, indent); - file->writeNumberLine(_field148, indent); + file->writeNumberLine(_hookedRect.left, indent); + file->writeNumberLine(_hookedRect.top, indent); + file->writeNumberLine(_hookedRect.right, indent); + file->writeNumberLine(_hookedRect.bottom, indent); file->writeQuotedLine(_string7, indent); file->writeNumberLine(_field158, indent); @@ -65,10 +65,10 @@ void CArm::load(SimpleFile *file) { file->readNumber(); _string6 = file->readString(); _field138 = file->readNumber(); - _field13C = file->readNumber(); - _field140 = file->readNumber(); - _field144 = file->readNumber(); - _field148 = file->readNumber(); + _hookedRect.left = file->readNumber(); + _hookedRect.top = file->readNumber(); + _hookedRect.right = file->readNumber(); + _hookedRect.bottom = file->readNumber(); _string7 = file->readString(); _field158 = file->readNumber(); @@ -107,14 +107,58 @@ bool CArm::TranslateObjectMsg(CTranslateObjectMsg *msg) { } bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (_string6 != "None") { + CShowTextMsg textMsg("The arm is already holding something."); + textMsg.execute("PET"); + return false; + } else if (msg->_other->getName() == "GondolierLeftLever") { + CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); + hookedMsg._rect.translate(_bounds.left, _bounds.top); + hookedMsg.execute("GondolierLeftLever"); + + if (hookedMsg._result) { + _string7 = "GondolierLeftLever"; + } else { + dropOnPet(); + } + } else if (msg->_other->getName() == "GondolierRightLever") { + CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); + hookedMsg._rect.translate(_bounds.left, _bounds.top); + hookedMsg.execute("GondolierRightLever"); + + if (hookedMsg._result) { + _string7 = "GondolierRightLever"; + } else { + dropOnPet(); + } + } + return true; } bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) { - return true; + if (!_fieldE0) { + CShowTextMsg textMsg("You can't get this."); + textMsg.execute("PET"); + } else if (checkStartDragging(msg)) { + _tempPos = msg->_mousePos - _bounds; + setPosition(msg->_mousePos - _tempPos); + + if (!_string7.empty()) { + CActMsg actMsg("Unhook"); + actMsg.execute(_string7); + _string7.clear(); + } + + loadFrame(_visibleFrame); + return true; + } + + return false; } bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { + // TODO return true; } diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h index 60f597e71f..f19943de51 100644 --- a/engines/titanic/carry/arm.h +++ b/engines/titanic/carry/arm.h @@ -42,10 +42,7 @@ class CArm : public CCarry { private: CString _string6; int _field138; - int _field13C; - int _field140; - int _field144; - int _field148; + Rect _hookedRect; CString _string7; int _field158; Rect _armRect; diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp index e2a7a99927..d7b9fe6c96 100644 --- a/engines/titanic/carry/phonograph_cylinder.cpp +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -68,6 +68,7 @@ void CPhonographCylinder::save(SimpleFile *file, int indent) const { file->writeNumberLine(_bassSpeedControl, indent); file->writeNumberLine(_bassPitchControl, indent); file->writeNumberLine(_bassInversionControl, indent); + file->writeNumberLine(_bassDirectionControl, indent); CCarry::save(file, indent); } @@ -94,6 +95,7 @@ void CPhonographCylinder::load(SimpleFile *file) { _bassSpeedControl = file->readNumber(); _bassPitchControl = file->readNumber(); _bassInversionControl = file->readNumber(); + _bassDirectionControl = file->readNumber(); CCarry::load(file); } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 96749b7ab0..4c26ec5b33 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -180,24 +180,6 @@ public: } }; -class CIsHookedOnMsg : public CMessage { -public: - int _field4; - int _field8; - CString _string1; - int _field18; - int _field1C; - int _field20; -public: - CLASSDEF - CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), - _field18(0), _field1C(0), _field20(0) {} - - static bool isSupportedBy(const CTreeItem *item) { - return supports(item, _type); - } -}; - class CTransportMsg : public CMessage { public: CString _string; @@ -281,6 +263,7 @@ MESSAGE1(CGetChevRoomNum, int, value, 0); MESSAGE2(CHoseConnectedMsg, int, value1, 1, int, value2, 0); MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); +MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, result, false, CString, string1, ""); MESSAGE1(CIsParrotPresentMsg, int, value, 0); MESSAGE1(CKeyCharMsg, int, value, 32); MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); |