diff options
author | Paul Gilbert | 2016-08-27 12:45:36 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-27 12:45:36 -0400 |
commit | 5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a (patch) | |
tree | 7f5e6d224f8d14a1ef8f69a83c91b498ec80add3 /engines | |
parent | c1b6fc3824018118618685fcbfcabe413e865531 (diff) | |
download | scummvm-rg350-5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a.tar.gz scummvm-rg350-5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a.tar.bz2 scummvm-rg350-5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a.zip |
TITANIC: Implemented more game classes
Diffstat (limited to 'engines')
21 files changed, 181 insertions, 58 deletions
diff --git a/engines/titanic/carry/plug_in.cpp b/engines/titanic/carry/plug_in.cpp index c82a4cc422..883458c9b1 100644 --- a/engines/titanic/carry/plug_in.cpp +++ b/engines/titanic/carry/plug_in.cpp @@ -47,19 +47,13 @@ bool CPlugIn::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (otherName == "PET") { return CCarry::UseWithOtherMsg(msg); - } else if (otherName == "DatasideTransporter") { - CString name = getName(); - if (name == "DatasideTransporter") { - // TODO - if (name != "SendYourself") { - // TODO - } - } else { - // TODO - } - } else { + } else if (isEquals("DatasideTransporter")) { CShowTextMsg textMsg("This item is incorrectly calibrated."); textMsg.execute("PET"); + } else if (isEquals("DatasideTransporter")) { + error("TODO: Set msg->_other->fieldC4 = 2"); + } else if (isEquals("SendYourself")) { + error("TODO: Set msg->_other->fieldC8 = 1"); } return true; diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 6abf9c407a..eee71cfc43 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -252,7 +252,7 @@ #include "titanic/game/pickup/pick_up_vis_centre.h" #include "titanic/game/placeholder/bar_shelf_vis_centre.h" #include "titanic/game/placeholder/lemon_on_bar.h" -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" #include "titanic/game/placeholder/tv_on_bar.h" #include "titanic/game/sgt/armchair.h" #include "titanic/game/sgt/basin.h" @@ -669,7 +669,7 @@ DEFFN(CPickUpSpeechCentre); DEFFN(CPickUpVisCentre); DEFFN(CBarShelfVisCentre); DEFFN(CLemonOnBar); -DEFFN(CPlaceHolderItem); +DEFFN(CPlaceHolder); DEFFN(CTVOnBar); DEFFN(CArmchair); DEFFN(CBasin); @@ -1251,10 +1251,10 @@ void CSaveableObject::initClassList() { ADDFN(CPickUpLemon, CPickUp); ADDFN(CPickUpSpeechCentre, CPickUp); ADDFN(CPickUpVisCentre, CPickUp); - ADDFN(CBarShelfVisCentre, CPlaceHolderItem); - ADDFN(CLemonOnBar, CPlaceHolderItem); - ADDFN(CPlaceHolderItem, CGameObject); - ADDFN(CTVOnBar, CPlaceHolderItem); + ADDFN(CBarShelfVisCentre, CPlaceHolder); + ADDFN(CLemonOnBar, CPlaceHolder); + ADDFN(CPlaceHolder, CGameObject); + ADDFN(CTVOnBar, CPlaceHolder); ADDFN(CArmchair, CSGTStateRoom); ADDFN(CBasin, CSGTStateRoom); ADDFN(CBedfoot, CSGTStateRoom); diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 870ee38016..86c34cab8b 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -34,7 +34,7 @@ #include "titanic/core/room_item.h" #include "titanic/pet_control/pet_control.h" #include "titanic/game_manager.h" -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { @@ -96,7 +96,7 @@ bool CTreeItem::isLinkItem() const { } bool CTreeItem::isPlaceHolderItem() const { - return isInstanceOf(CPlaceHolderItem::_type); + return isInstanceOf(CPlaceHolder::_type); } bool CTreeItem::isNamedItem() const { diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp index 6db9345bc0..cdb14516bf 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.cpp +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPlayerMeetsParrot, CGameObject) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + void CPlayerMeetsParrot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -35,7 +39,7 @@ void CPlayerMeetsParrot::load(SimpleFile *file) { } bool CPlayerMeetsParrot::EnterRoomMsg(CEnterRoomMsg *msg) { - warning("CPlayerMeetsParrot::handleEvent"); + stateSet24(); return true; } diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 9cee9ee322..edae18801f 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -29,6 +29,7 @@ namespace Titanic { class CPlayerMeetsParrot : public CGameObject { + DECLARE_MESSAGE_MAP; protected: bool EnterRoomMsg(CEnterRoomMsg *msg); public: diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.cpp b/engines/titanic/game/pickup/pick_up_speech_centre.cpp index d3373556a6..5e99c0a3b7 100644 --- a/engines/titanic/game/pickup/pick_up_speech_centre.cpp +++ b/engines/titanic/game/pickup/pick_up_speech_centre.cpp @@ -63,7 +63,7 @@ bool CPickUpSpeechCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) { CActMsg actMsg("PlayerGetsSpeechCentre"); actMsg.execute("SeasonalAdjust"); } else { - petDisplayMessage("You can',27h,'t pick this up on account of it being stuck to the branch."); + petDisplayMessage("You can't pick this up on account of it being stuck to the branch."); } } diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp index fc5d680f0c..6e5037f237 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp @@ -24,7 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CBarShelfVisCentre, CPlaceHolderItem) +BEGIN_MESSAGE_MAP(CBarShelfVisCentre, CPlaceHolder) ON_MESSAGE(MouseButtonDownMsg) ON_MESSAGE(TimerMsg) ON_MESSAGE(EnterViewMsg) @@ -33,13 +33,13 @@ END_MESSAGE_MAP() void CBarShelfVisCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_flag, indent); - CPlaceHolderItem::save(file, indent); + CPlaceHolder::save(file, indent); } void CBarShelfVisCentre::load(SimpleFile *file) { file->readNumber(); _flag = file->readNumber(); - CPlaceHolderItem::load(file); + CPlaceHolder::load(file); } bool CBarShelfVisCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h index 672655d368..8ad3dcb8d1 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h @@ -23,11 +23,11 @@ #ifndef TITANIC_BAR_SHELF_VIS_CENTRE_H #define TITANIC_BAR_SHELF_VIS_CENTRE_H -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { -class CBarShelfVisCentre : public CPlaceHolderItem { +class CBarShelfVisCentre : public CPlaceHolder { DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool TimerMsg(CTimerMsg *msg); @@ -36,7 +36,7 @@ private: bool _flag; public: CLASSDEF; - CBarShelfVisCentre() : CPlaceHolderItem(), _flag(false) {} + CBarShelfVisCentre() : CPlaceHolder(), _flag(false) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/lemon_on_bar.cpp b/engines/titanic/game/placeholder/lemon_on_bar.cpp index 917c751e67..e9cf6a309a 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.cpp +++ b/engines/titanic/game/placeholder/lemon_on_bar.cpp @@ -24,20 +24,20 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CLemonOnBar, CPlaceHolderItem) +BEGIN_MESSAGE_MAP(CLemonOnBar, CPlaceHolder) ON_MESSAGE(VisibleMsg) END_MESSAGE_MAP() void CLemonOnBar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_lemonPos, indent); - CPlaceHolderItem::save(file, indent); + CPlaceHolder::save(file, indent); } void CLemonOnBar::load(SimpleFile *file) { file->readNumber(); _lemonPos = file->readPoint(); - CPlaceHolderItem::load(file); + CPlaceHolder::load(file); } bool CLemonOnBar::VisibleMsg(CVisibleMsg *msg) { diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h index af5d5e67c8..c6512ced67 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.h +++ b/engines/titanic/game/placeholder/lemon_on_bar.h @@ -23,11 +23,11 @@ #ifndef TITANIC_LEMON_ON_BAR_H #define TITANIC_LEMON_ON_BAR_H -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { -class CLemonOnBar : public CPlaceHolderItem { +class CLemonOnBar : public CPlaceHolder { DECLARE_MESSAGE_MAP; bool VisibleMsg(CVisibleMsg *msg); private: diff --git a/engines/titanic/game/placeholder/place_holder_item.cpp b/engines/titanic/game/placeholder/place_holder.cpp index 365e8cbe50..ae42cabc29 100644 --- a/engines/titanic/game/placeholder/place_holder_item.cpp +++ b/engines/titanic/game/placeholder/place_holder.cpp @@ -20,18 +20,27 @@ * */ -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { -void CPlaceHolderItem::save(SimpleFile *file, int indent) { +BEGIN_MESSAGE_MAP(CPlaceHolder, CGameObject) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + +void CPlaceHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } -void CPlaceHolderItem::load(SimpleFile *file) { +void CPlaceHolder::load(SimpleFile *file) { file->readNumber(); CGameObject::load(file); } +bool CPlaceHolder::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/place_holder_item.h b/engines/titanic/game/placeholder/place_holder.h index de04a64bf7..b1aa041710 100644 --- a/engines/titanic/game/placeholder/place_holder_item.h +++ b/engines/titanic/game/placeholder/place_holder.h @@ -27,7 +27,9 @@ namespace Titanic { -class CPlaceHolderItem : public CGameObject { +class CPlaceHolder : public CGameObject { + DECLARE_MESSAGE_MAP; + bool VisibleMsg(CVisibleMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/placeholder/tv_on_bar.cpp b/engines/titanic/game/placeholder/tv_on_bar.cpp index efbbe50461..e17fb7833d 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.cpp +++ b/engines/titanic/game/placeholder/tv_on_bar.cpp @@ -27,13 +27,13 @@ namespace Titanic { void CTVOnBar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); - CPlaceHolderItem::save(file, indent); + CPlaceHolder::save(file, indent); } void CTVOnBar::load(SimpleFile *file) { file->readNumber(); _pos1 = file->readPoint(); - CPlaceHolderItem::load(file); + CPlaceHolder::load(file); } } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h index d41d972e73..bb5381fb5d 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.h +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -23,11 +23,11 @@ #ifndef TITANIC_TV_ON_BAR_H #define TITANIC_TV_ON_BAR_H -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { -class CTVOnBar : public CPlaceHolderItem { +class CTVOnBar : public CPlaceHolder { private: Point _pos1; public: diff --git a/engines/titanic/game/play_music_button.cpp b/engines/titanic/game/play_music_button.cpp index 8066739f10..93416911b8 100644 --- a/engines/titanic/game/play_music_button.cpp +++ b/engines/titanic/game/play_music_button.cpp @@ -21,23 +21,58 @@ */ #include "titanic/game/play_music_button.h" +#include "titanic/sound/music_room.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPlayMusicButton, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(FrameMsg) +END_MESSAGE_MAP() + void CPlayMusicButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldE0, indent); - file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_flag, indent); + file->writeNumberLine(_ticks, indent); CBackground::save(file, indent); } void CPlayMusicButton::load(SimpleFile *file) { file->readNumber(); - _fieldE0 = file->readNumber(); - _fieldE4 = file->readNumber(); + _flag = file->readNumber(); + _ticks = file->readNumber(); CBackground::load(file); } +bool CPlayMusicButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CMusicRoom *musicRoom = getMusicRoom(); + if (_flag) { + musicRoom->stopMusic(); + stopMovie(); + loadFrame(0); + _flag = false; + } else { + musicRoom->startMusic(100); + playMovie(MOVIE_REPEAT); + _ticks = getTicksCount(); + _flag = true; + } + + return true; +} + +bool CPlayMusicButton::FrameMsg(CFrameMsg *msg) { + if (_flag && !CMusicRoom::_musicHandler->isBusy()) { + CMusicRoom *musicRoom = getMusicRoom(); + musicRoom->stopMusic(); + stopMovie(); + loadFrame(0); + _flag = false; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/play_music_button.h b/engines/titanic/game/play_music_button.h index 4e3474181c..824b372bf9 100644 --- a/engines/titanic/game/play_music_button.h +++ b/engines/titanic/game/play_music_button.h @@ -28,12 +28,15 @@ namespace Titanic { class CPlayMusicButton : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool FrameMsg(CFrameMsg *msg); public: - int _fieldE0; - int _fieldE4; + bool _flag; + uint _ticks; public: CLASSDEF; - CPlayMusicButton() : CBackground(), _fieldE0(0), _fieldE4(0) {} + CPlayMusicButton() : CBackground(), _flag(false), _ticks(0) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/play_on_act.cpp b/engines/titanic/game/play_on_act.cpp index e1ef1201c6..9c368c335d 100644 --- a/engines/titanic/game/play_on_act.cpp +++ b/engines/titanic/game/play_on_act.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPlayOnAct, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + void CPlayOnAct::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); @@ -34,4 +39,20 @@ void CPlayOnAct::load(SimpleFile *file) { CBackground::load(file); } +bool CPlayOnAct::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayMovie") { + setVisible(true); + playMovie(0); + } else if (msg->_action == "PlayToEnd") { + setVisible(true); + playMovie(MOVIE_GAMESTATE); + } + + return true; +} + +bool CPlayOnAct::LeaveViewMsg(CLeaveViewMsg *msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/play_on_act.h b/engines/titanic/game/play_on_act.h index 197e647943..72615f2fc4 100644 --- a/engines/titanic/game/play_on_act.h +++ b/engines/titanic/game/play_on_act.h @@ -28,6 +28,9 @@ namespace Titanic { class CPlayOnAct : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/port_hole.cpp b/engines/titanic/game/port_hole.cpp index f3c447f443..25807b1b1d 100644 --- a/engines/titanic/game/port_hole.cpp +++ b/engines/titanic/game/port_hole.cpp @@ -24,26 +24,72 @@ namespace Titanic { -CPortHole::CPortHole() : CGameObject(), _fieldBC(0), - _string1("b#47.wav"), _string2("b#46.wav") { +BEGIN_MESSAGE_MAP(CPortHole, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CPortHole::CPortHole() : CGameObject(), _open(false), + _closeSoundName("b#47.wav"), _openSoundName("b#46.wav") { } void CPortHole::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_open, indent); + file->writeQuotedLine(_closeSoundName, indent); + file->writeQuotedLine(_openSoundName, indent); CGameObject::save(file, indent); } void CPortHole::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); + _open = file->readNumber(); + _closeSoundName = file->readString(); + _openSoundName = file->readString(); CGameObject::load(file); } +bool CPortHole::ActMsg(CActMsg *msg) { + if (msg->_action == "TogglePortHole") { + if (_open) { + playMovie(14, 26, MOVIE_NOTIFY_OBJECT); + playSound(_closeSoundName); + _open = false; + } else { + setVisible(true); + playMovie(1, 13, 0); + playSound(_openSoundName); + _open = true; + } + } + + return true; +} + +bool CPortHole::MovieEndMsg(CMovieEndMsg *msg) { + _open = false; + setVisible(false); + return true; +} + +bool CPortHole::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_open) { + playSound(_closeSoundName); + playMovie(14, 26, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + _open = false; + } + + return true; +} + +bool CPortHole::EnterViewMsg(CEnterViewMsg *msg) { + setVisible(false); + _open = false; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/port_hole.h b/engines/titanic/game/port_hole.h index 7bba18d12a..9f1997a517 100644 --- a/engines/titanic/game/port_hole.h +++ b/engines/titanic/game/port_hole.h @@ -28,9 +28,14 @@ namespace Titanic { class CPortHole : public CGameObject { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); private: - int _fieldBC; - CString _string1, _string2; + bool _open; + CString _closeSoundName, _openSoundName; public: CLASSDEF; CPortHole(); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 2182f58ac3..90d010b57b 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -242,7 +242,7 @@ MODULE_OBJS := \ game/pickup/pick_up_speech_centre.o \ game/pickup/pick_up_vis_centre.o \ game/placeholder/bar_shelf_vis_centre.o \ - game/placeholder/place_holder_item.o \ + game/placeholder/place_holder.o \ game/placeholder/lemon_on_bar.o \ game/placeholder/tv_on_bar.o \ game/transport/gondolier.o \ |