diff options
author | Paul Gilbert | 2016-08-24 18:42:32 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-24 18:42:32 -0400 |
commit | e733f8113f69f37b14e8a2447f5e7dce89a1670d (patch) | |
tree | 085e260735f91cedc9a6572baad64e51ec4b6400 /engines/titanic/game/maitred | |
parent | faf52df0653006ad8107e91bb24bc747e4b01e29 (diff) | |
download | scummvm-rg350-e733f8113f69f37b14e8a2447f5e7dce89a1670d.tar.gz scummvm-rg350-e733f8113f69f37b14e8a2447f5e7dce89a1670d.tar.bz2 scummvm-rg350-e733f8113f69f37b14e8a2447f5e7dce89a1670d.zip |
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic/game/maitred')
-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 |
8 files changed, 221 insertions, 18 deletions
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 |