diff options
Diffstat (limited to 'engines/titanic/game')
-rw-r--r-- | engines/titanic/game/long_stick_dispenser.cpp | 99 | ||||
-rw-r--r-- | engines/titanic/game/long_stick_dispenser.h | 8 | ||||
-rw-r--r-- | engines/titanic/game/maitred/maitred_arm_holder.cpp | 19 | ||||
-rw-r--r-- | engines/titanic/game/maitred/maitred_arm_holder.h | 3 | ||||
-rw-r--r-- | engines/titanic/game/maitred/maitred_body.cpp | 46 | ||||
-rw-r--r-- | engines/titanic/game/maitred/maitred_body.h | 8 | ||||
-rw-r--r-- | engines/titanic/game/maitred/maitred_legs.cpp | 66 | ||||
-rw-r--r-- | engines/titanic/game/maitred/maitred_legs.h | 7 | ||||
-rw-r--r-- | engines/titanic/game/maitred/maitred_prod_receptor.cpp | 81 | ||||
-rw-r--r-- | engines/titanic/game/maitred/maitred_prod_receptor.h | 9 | ||||
-rw-r--r-- | engines/titanic/game/missiveomat.cpp | 37 | ||||
-rw-r--r-- | engines/titanic/game/missiveomat.h | 6 | ||||
-rw-r--r-- | engines/titanic/game/transport/lift_indicator.cpp | 12 |
13 files changed, 377 insertions, 24 deletions
diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index cb562ec3ca..08a29f2e4b 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -21,9 +21,21 @@ */ #include "titanic/game/long_stick_dispenser.h" +#include "titanic/core/project_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CLongStickDispenser, CGameObject) + ON_MESSAGE(PuzzleSolvedMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(EnterRoomMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + void CLongStickDispenser::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); @@ -42,10 +54,97 @@ void CLongStickDispenser::load(SimpleFile *file) { CGameObject::load(file); } +bool CLongStickDispenser::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + if (!_fieldBC && !_fieldC4 && !_fieldC0) { + CStatusChangeMsg statusMsg; + statusMsg.execute("ShatterGlass"); + _fieldC0 = 1; + loadFrame(19); + } else if (_fieldC0) { + playSound("z#63.wav"); + petDisplayMessage(1, "'This glass is totally and utterly unbreakable."); + } + + return true; +} + +bool CLongStickDispenser::MovieEndMsg(CMovieEndMsg *msg) { + CPuzzleSolvedMsg puzzleMsg; + puzzleMsg.execute("LongStick"); + _fieldC0 = 1; + return true; +} + +bool CLongStickDispenser::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + bool CLongStickDispenser::EnterRoomMsg(CEnterRoomMsg *msg) { _fieldC0 = 0; _fieldC4 = 1; return true; } +bool CLongStickDispenser::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_fieldC0) { + playSound("z#62.wav"); + + switch (_fieldBC) { + case 0: + petDisplayMessage(1, "For emergency long stick, smash glass."); + break; + case 1: + petDisplayMessage(1, "This dispenser has suddenly been fitted with unbreakable glass " + "to prevent unseemly hoarding of sticks."); + break; + default: + break; + } + } + + return true; +} + +bool CLongStickDispenser::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_fieldC0 == 1) { + if (_fieldC4) { + playMovie(19, 38, MOVIE_GAMESTATE); + } else { + playMovie(0, 18, MOVIE_GAMESTATE); + _fieldBC = 1; + } + + _fieldC4 = 1; + _fieldC0 = 0; + } + + return true; +} + +bool CLongStickDispenser::EnterViewMsg(CEnterViewMsg *msg) { + setVisible(true); + loadFrame(38); + _cursorId = CURSOR_HAND; + return true; +} + +bool CLongStickDispenser::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) { + return false; + } else if (_fieldC0 == 1 && _fieldC4 == 1) { + CVisibleMsg visibleMsg(true); + visibleMsg.execute("LongStick"); + CPassOnDragStartMsg dragMsg(msg->_mousePos, 1); + dragMsg.execute("LongStick"); + + msg->_dragItem = getRoot()->findByName("LongStick"); + loadFrame(0); + _fieldC4 = 0; + _cursorId = CURSOR_ARROW; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 2a1b86fb84..be05ef9c65 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -29,7 +29,15 @@ namespace Titanic { class CLongStickDispenser : public CGameObject { + DECLARE_MESSAGE_MAP; + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); bool EnterRoomMsg(CEnterRoomMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); private: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/maitred/maitred_arm_holder.cpp b/engines/titanic/game/maitred/maitred_arm_holder.cpp index 4d35277a33..75d95640d2 100644 --- a/engines/titanic/game/maitred/maitred_arm_holder.cpp +++ b/engines/titanic/game/maitred/maitred_arm_holder.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CMaitreDArmHolder, CDropTarget) + ON_MESSAGE(MaitreDArmHolder) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + void CMaitreDArmHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CDropTarget::save(file, indent); @@ -34,4 +39,18 @@ void CMaitreDArmHolder::load(SimpleFile *file) { CDropTarget::load(file); } +bool CMaitreDArmHolder::MaitreDArmHolder(CMaitreDArmHolder *msg) { + _fieldF4 = 0; + return true; +} + +bool CMaitreDArmHolder::ActMsg(CActMsg *msg) { + if (msg->_action == "LoseArm") { + _bounds = Rect(); + setVisible(false); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_arm_holder.h b/engines/titanic/game/maitred/maitred_arm_holder.h index 3392d60e43..22f961f236 100644 --- a/engines/titanic/game/maitred/maitred_arm_holder.h +++ b/engines/titanic/game/maitred/maitred_arm_holder.h @@ -28,6 +28,9 @@ namespace Titanic { class CMaitreDArmHolder : public CDropTarget { + DECLARE_MESSAGE_MAP; + bool MaitreDArmHolder(CMaitreDArmHolder *msg); + bool ActMsg(CActMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/maitred/maitred_body.cpp b/engines/titanic/game/maitred/maitred_body.cpp index 6b495e5a1c..4cb12aac8f 100644 --- a/engines/titanic/game/maitred/maitred_body.cpp +++ b/engines/titanic/game/maitred/maitred_body.cpp @@ -20,20 +20,56 @@ * */ -#include "titanic/game/maitred/maitred_legs.h" +#include "titanic/game/maitred/maitred_body.h" namespace Titanic { -void CMaitreDLegs::save(SimpleFile *file, int indent) { +BEGIN_MESSAGE_MAP(CMaitreDBody, CMaitreDProdReceptor) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(AnimateMaitreDMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + +void CMaitreDBody::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_armed, indent); CMaitreDProdReceptor::save(file, indent); } -void CMaitreDLegs::load(SimpleFile *file) { +void CMaitreDBody::load(SimpleFile *file) { file->readNumber(); - _fieldC8 = file->readNumber(); + _armed = file->readNumber(); CMaitreDProdReceptor::load(file); } +bool CMaitreDBody::EnterViewMsg(CEnterViewMsg *msg) { + return true; +} + +bool CMaitreDBody::AnimateMaitreDMsg(CAnimateMaitreDMsg *msg) { + static const char *const ARMED_CLIPS[5] = { + "Talking 1", "Talking 2", "Talking 3", "Talking 4", nullptr + }; + static const char *const UNARMED_CLIPS[5] = { + "Armless Talking 1", "Armless Talking 2", "Armless Talking 3", + "Armless Talking 4", nullptr + }; + + if (!hasActiveMovie()) { + playRandomClip(_armed ? ARMED_CLIPS : UNARMED_CLIPS); + } + + return true; +} + +bool CMaitreDBody::ActMsg(CActMsg *msg) { + if (msg->_action == "LoseArm") { + _armed = false; + loadFrame(262); + playSound("c#75.wav"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_body.h b/engines/titanic/game/maitred/maitred_body.h index 7016c15c71..1798958e84 100644 --- a/engines/titanic/game/maitred/maitred_body.h +++ b/engines/titanic/game/maitred/maitred_body.h @@ -28,11 +28,15 @@ namespace Titanic { class CMaitreDBody : public CMaitreDProdReceptor { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool AnimateMaitreDMsg(CAnimateMaitreDMsg *msg); + bool ActMsg(CActMsg *msg); private: - int _fieldC8; + bool _armed; public: CLASSDEF; - CMaitreDBody() : CMaitreDProdReceptor(), _fieldC8(1) {} + CMaitreDBody() : CMaitreDProdReceptor(), _armed(true) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/maitred/maitred_legs.cpp b/engines/titanic/game/maitred/maitred_legs.cpp index 5071805101..8c0b0db5ea 100644 --- a/engines/titanic/game/maitred/maitred_legs.cpp +++ b/engines/titanic/game/maitred/maitred_legs.cpp @@ -20,20 +20,76 @@ * */ -#include "titanic/game/maitred/maitred_body.h" +#include "titanic/game/maitred/maitred_legs.h" namespace Titanic { -void CMaitreDBody::save(SimpleFile *file, int indent) { +BEGIN_MESSAGE_MAP(CMaitreDLegs, CMaitreDProdReceptor) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(AnimateMaitreDMsg) +END_MESSAGE_MAP() + +void CMaitreDLegs::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_flag, indent); CMaitreDProdReceptor::save(file, indent); } -void CMaitreDBody::load(SimpleFile *file) { +void CMaitreDLegs::load(SimpleFile *file) { file->readNumber(); - _fieldC8 = file->readNumber(); + _flag = file->readNumber(); CMaitreDProdReceptor::load(file); } +bool CMaitreDLegs::EnterViewMsg(CEnterViewMsg *msg) { + _flag = true; + loadFrame(0); + return true; +} + +bool CMaitreDLegs::AnimateMaitreDMsg(CAnimateMaitreDMsg *msg) { + static const char *const WIGGLE_CLIPS[4] = { + "Hip Wiggle", "Knee Bend", "Wire Wiggle", nullptr + }; + static const char *const FIGHTING_CLIPS[4] = { + "Fighting 1", "Fighting 2", "Leg Fidget", nullptr + }; + static const char *const ARCING_SOUNDS[9] = { + "MaitreD Arcing 1.wav", "MaitreD Arcing 2.wav", + "MaitreD Arcing 3.wav", "MaitreD Arcing 4.wav", + "MaitreD Arcing 5.wav", "MaitreD Arcing 6.wav", + "MaitreD Arcing 7.wav", "MaitreD Arcing 8.wav", + "MaitreD Arcing 9.wav" + }; + + switch (msg->_value) { + case 0: + if (_flag) { + playRandomClip(FIGHTING_CLIPS); + + if (getRandomNumber(2) != 0) + playSound(ARCING_SOUNDS[getRandomNumber(9)], + 40 + getRandomNumber(30)); + } else { + playClip("Walk Right"); + _flag = true; + } + break; + + case 1: + if (_flag) { + playClip("Walk Left"); + _flag = false; + } else { + playRandomClip(WIGGLE_CLIPS); + } + break; + + default: + break; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_legs.h b/engines/titanic/game/maitred/maitred_legs.h index 24ba01e712..b8a32eef4c 100644 --- a/engines/titanic/game/maitred/maitred_legs.h +++ b/engines/titanic/game/maitred/maitred_legs.h @@ -28,11 +28,14 @@ namespace Titanic { class CMaitreDLegs : public CMaitreDProdReceptor { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool AnimateMaitreDMsg(CAnimateMaitreDMsg *msg); private: - int _fieldC8; + bool _flag; public: CLASSDEF; - CMaitreDLegs() : CMaitreDProdReceptor(), _fieldC8(1) {} + CMaitreDLegs() : CMaitreDProdReceptor(), _flag(true) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.cpp b/engines/titanic/game/maitred/maitred_prod_receptor.cpp index 4823f143b0..66533a542f 100644 --- a/engines/titanic/game/maitred/maitred_prod_receptor.cpp +++ b/engines/titanic/game/maitred/maitred_prod_receptor.cpp @@ -21,13 +21,21 @@ */ #include "titanic/game/maitred/maitred_prod_receptor.h" +#include "titanic/npcs/maitre_d.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CMaitreDProdReceptor, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseMoveMsg) + ON_MESSAGE(ProdMaitreDMsg) + ON_MESSAGE(DisableMaitreDProdReceptor) +END_MESSAGE_MAP() + void CMaitreDProdReceptor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_counter, indent); file->writeNumberLine(_fieldC4, indent); CGameObject::save(file, indent); @@ -36,10 +44,79 @@ void CMaitreDProdReceptor::save(SimpleFile *file, int indent) { void CMaitreDProdReceptor::load(SimpleFile *file) { file->readNumber(); _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); + _counter = file->readNumber(); _fieldC4 = file->readNumber(); CGameObject::load(file); } +bool CMaitreDProdReceptor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_fieldBC == 2 && static_cast<CGameObject *>(getParent())->hasActiveMovie()) { + return false; + } else { + CProdMaitreDMsg prodMsg(126); + prodMsg.execute(this); + return true; + } +} + +bool CMaitreDProdReceptor::MouseMoveMsg(CMouseMoveMsg *msg) { + if (_fieldBC == 2 && static_cast<CGameObject *>(getParent())->hasActiveMovie()) + return false; + else if (++_counter < 20) + return true; + + _counter = 0; + CProdMaitreDMsg prodMsg(126); + + if (isEquals("Stick")) + prodMsg._value = 121; + else if (isEquals("Hammer")) + prodMsg._value = 122; + else if (isEquals("Lemon")) + prodMsg._value = 123; + else if (isEquals("Chicken")) + prodMsg._value = 124; + else if (isEquals("Perch")) + prodMsg._value = 125; + + CMaitreD *maitreD = static_cast<CMaitreD *>(findRoomObject("MaitreD")); + if (maitreD->_field100 <= 0) + prodMsg.execute(this); + + return true; +} + +bool CMaitreDProdReceptor::ProdMaitreDMsg(CProdMaitreDMsg *msg) { + if (_fieldC4) { + CMaitreD *maitreD = static_cast<CMaitreD *>(findRoomObject("MaitreD")); + if (maitreD->_field100 <= 0) { + CViewItem *view = findView(); + startTalking(maitreD, msg->_value, view); + + switch (_fieldBC) { + case 1: + startTalking(maitreD, 128, view); + break; + case 2: + startTalking(maitreD, 129, view); + break; + case 3: + startTalking(maitreD, 127, view); + break; + default: + startTalking(maitreD, 130, view); + break; + } + } + } + + return true; +} + +bool CMaitreDProdReceptor::DisableMaitreDProdReceptor(CDisableMaitreDProdReceptor *msg) { + _fieldC4 = 0; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.h b/engines/titanic/game/maitred/maitred_prod_receptor.h index f3a547b8ef..0b00ce0014 100644 --- a/engines/titanic/game/maitred/maitred_prod_receptor.h +++ b/engines/titanic/game/maitred/maitred_prod_receptor.h @@ -28,14 +28,19 @@ namespace Titanic { class CMaitreDProdReceptor : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseMoveMsg(CMouseMoveMsg *msg); + bool ProdMaitreDMsg(CProdMaitreDMsg *msg); + bool DisableMaitreDProdReceptor(CDisableMaitreDProdReceptor *msg); protected: int _fieldBC; - int _fieldC0; + int _counter; int _fieldC4; public: CLASSDEF; CMaitreDProdReceptor() : CGameObject(), - _fieldBC(0), _fieldC0(0), _fieldC4(1) {} + _fieldBC(0), _counter(0), _fieldC4(1) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp index 931b146801..32ae24e319 100644 --- a/engines/titanic/game/missiveomat.cpp +++ b/engines/titanic/game/missiveomat.cpp @@ -24,6 +24,14 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CMissiveOMat, CGameObject) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(KeyCharMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(MissiveOMatActionMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + CMissiveOMat::CMissiveOMat() : CGameObject(), _fieldBC(1), _fieldC0(0), _fieldC4(0), _fieldE0(-1) { } @@ -52,4 +60,33 @@ void CMissiveOMat::load(SimpleFile *file) { CGameObject::load(file); } +bool CMissiveOMat::EnterViewMsg(CEnterViewMsg *msg) { + CMissiveOMatActionMsg actionMsg(9); + actionMsg.execute(this); + return true; +} + +bool CMissiveOMat::KeyCharMsg(CKeyCharMsg *msg) { + // TODO + return true; +} + +bool CMissiveOMat::TimerMsg(CTimerMsg *msg) { + if (_fieldBC == 3) { + // TODO + } + + return true; +} + +bool CMissiveOMat::MissiveOMatActionMsg(CMissiveOMatActionMsg *msg) { + // TODO + return true; +} + +bool CMissiveOMat::LeaveViewMsg(CLeaveViewMsg *msg) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/missiveomat.h b/engines/titanic/game/missiveomat.h index 7fde8cf25d..c4913deaa0 100644 --- a/engines/titanic/game/missiveomat.h +++ b/engines/titanic/game/missiveomat.h @@ -28,6 +28,12 @@ namespace Titanic { class CMissiveOMat : public CGameObject { + DECLARE_MESSAGE_MAP; + bool EnterViewMsg(CEnterViewMsg *msg); + bool KeyCharMsg(CKeyCharMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool MissiveOMatActionMsg(CMissiveOMatActionMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); public: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/transport/lift_indicator.cpp b/engines/titanic/game/transport/lift_indicator.cpp index 1336daf7aa..7471affc36 100644 --- a/engines/titanic/game/transport/lift_indicator.cpp +++ b/engines/titanic/game/transport/lift_indicator.cpp @@ -93,14 +93,14 @@ bool CLiftindicator::EnterViewMsg(CEnterViewMsg *msg) { case 1: case 2: setPosition(Point(_bounds.left, _indicatorPos.y + - multiplier * CLift::_elevator1Floor)); + (int)(multiplier * CLift::_elevator1Floor))); _startFrame = CLift::_elevator1Floor; break; case 3: case 4: setPosition(Point(_bounds.left, _indicatorPos.y + - multiplier * CLift::_elevator3Floor)); + (int)(multiplier * CLift::_elevator3Floor))); _startFrame = CLift::_elevator3Floor; break; @@ -115,14 +115,14 @@ bool CLiftindicator::EnterViewMsg(CEnterViewMsg *msg) { case 1: case 2: setPosition(Point(_bounds.left, _indicatorPos.y + - multiplier * CLift::_elevator2Floor)); + (int)(multiplier * CLift::_elevator2Floor))); _startFrame = CLift::_elevator2Floor; break; case 3: case 4: setPosition(Point(_bounds.left, _indicatorPos.y + - multiplier * CLift::_elevator4Floor)); + (int)(multiplier * CLift::_elevator4Floor))); _startFrame = CLift::_elevator4Floor; break; @@ -158,8 +158,8 @@ bool CLiftindicator::PETActivateMsg(CPETActivateMsg *msg) { && pet->getRoomsFloorNum() != CLift::_elevator4Floor) { petDisplayMessage(1, "This elevator is currently in an advanced state of non-functionality."); } else { - _start = _indicatorPos.y + _startFrame * multiplier; - _end = _indicatorPos.y + _endFrame * multiplier; + _start = _indicatorPos.y + (int)(_startFrame * multiplier); + _end = _indicatorPos.y + (int)(_endFrame * multiplier); lockMouse(); addTimer(100); |