diff options
author | Paul Gilbert | 2016-08-21 11:25:39 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-21 11:25:39 -0400 |
commit | 06008ae5caf0e086b0952c73bd5047e9c78cd921 (patch) | |
tree | eaa1ba835cf4c3dc38dd853600835bbc6e421fbf /engines/titanic/carry | |
parent | c7ac12272a3b448c9d6118753a62426e42d2a62f (diff) | |
download | scummvm-rg350-06008ae5caf0e086b0952c73bd5047e9c78cd921.tar.gz scummvm-rg350-06008ae5caf0e086b0952c73bd5047e9c78cd921.tar.bz2 scummvm-rg350-06008ae5caf0e086b0952c73bd5047e9c78cd921.zip |
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic/carry')
-rw-r--r-- | engines/titanic/carry/eye.cpp | 103 | ||||
-rw-r--r-- | engines/titanic/carry/eye.h | 8 | ||||
-rw-r--r-- | engines/titanic/carry/head_piece.h | 2 |
3 files changed, 108 insertions, 5 deletions
diff --git a/engines/titanic/carry/eye.cpp b/engines/titanic/carry/eye.cpp index 5de1789e54..400df2fdc8 100644 --- a/engines/titanic/carry/eye.cpp +++ b/engines/titanic/carry/eye.cpp @@ -21,22 +21,119 @@ */ #include "titanic/carry/eye.h" +#include "titanic/game/head_slot.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/game/transport/lift.h" +#include "titanic/game/television.h" namespace Titanic { -CEye::CEye() : CHeadPiece(), _eyeNum(0) { +BEGIN_MESSAGE_MAP(CEye, CHeadPiece) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(PassOnDragStartMsg) +END_MESSAGE_MAP() + +CEye::CEye() : CHeadPiece(), _eyeFlag(false) { } void CEye::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_eyeNum, indent); + file->writeNumberLine(_eyeFlag, indent); CHeadPiece::save(file, indent); } void CEye::load(SimpleFile *file) { file->readNumber(); - _eyeNum = file->readNumber(); + _eyeFlag = file->readNumber(); CHeadPiece::load(file); } + +bool CEye::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CHeadSlot *slot = dynamic_cast<CHeadSlot *>(msg->_other); + if (slot) { + petMoveToHiddenRoom(); + _flag = true; + CAddHeadPieceMsg headMsg(getName()); + + if (headMsg._value != "NULL") + headMsg.execute(isEquals("Eye1") ? "Eye1Slot" : "Eye2Slot"); + } else if (msg->_other->isEquals("LiftbotWithoutHead")) { + CPetControl *pet = getPetControl(); + if (!CLift::_v1 && pet->getRoomsElevatorNum() == 4) { + _eyeFlag = true; + setPosition(_origPos); + setVisible(false); + CActMsg actMsg1(getName()); + actMsg1.execute("GetLiftEye"); + + CActMsg actMsg2("AddWrongHead"); + actMsg2.execute("FaultyLiftbot"); + } + } else { + return CCarry::UseWithOtherMsg(msg); + } + + return true; +} + +bool CEye::UseWithCharMsg(CUseWithCharMsg *msg) { + CLift *lift = dynamic_cast<CLift *>(msg->_character); + if (lift && lift->getName() == "Well") { + CPetControl *pet = getPetControl(); + if (!CLift::_v1 && pet->getRoomsElevatorNum() == 4) { + _eyeFlag = true; + setPosition(_origPos); + setVisible(false); + + CActMsg actMsg1(getName()); + actMsg1.execute("GetLiftEye"); + CActMsg actMsg2("AddWrongHead"); + actMsg2.execute(msg->_character); + } + + return true; + } else { + return CHeadPiece::UseWithCharMsg(msg); + } +} + +bool CEye::ActMsg(CActMsg *msg) { + if (msg->_action == "BellbotGetLight") { + setVisible(true); + petAddToInventory(); + playSound("z#47.wav"); + + CActMsg actMsg("Eye Removed"); + actMsg.execute("1stClassState"); + } else { + _eyeFlag = false; + + CActMsg actMsg("LoseHead"); + actMsg.execute("FaultyLiftbot"); + } + + return true; +} + +bool CEye::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (isEquals("Eye1")) + CTelevision::_v5 = 0; + + return CHeadPiece::PETGainedObjectMsg(msg); +} + +bool CEye::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + setVisible(true); + if (_eyeFlag) + CTelevision::_v6 = 0; + else if (isEquals("Eye1")) + CTelevision::_v5 = 0; + + return CHeadPiece::PassOnDragStartMsg(msg); +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/eye.h b/engines/titanic/carry/eye.h index 066a85609b..886bd39b84 100644 --- a/engines/titanic/carry/eye.h +++ b/engines/titanic/carry/eye.h @@ -28,8 +28,14 @@ namespace Titanic { class CEye : public CHeadPiece { + DECLARE_MESSAGE_MAP; + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool ActMsg(CActMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); private: - int _eyeNum; + bool _eyeFlag; public: CLASSDEF; CEye(); diff --git a/engines/titanic/carry/head_piece.h b/engines/titanic/carry/head_piece.h index a76496072b..367f781f0e 100644 --- a/engines/titanic/carry/head_piece.h +++ b/engines/titanic/carry/head_piece.h @@ -33,7 +33,7 @@ class CHeadPiece : public CCarry { bool SenseWorkingMsg(CSenseWorkingMsg *msg); bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); -private: +protected: bool _flag; CString _string6; bool _field13C; |