diff options
author | Paul Gilbert | 2016-08-27 12:10:37 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-27 12:10:37 -0400 |
commit | c1b6fc3824018118618685fcbfcabe413e865531 (patch) | |
tree | 7f8f9e0bd248e7fd6f4fbcbc0e5d2f9c1cb6aa96 | |
parent | 40ec26b3439eb82e5bf8bff82529c16d34a5ed94 (diff) | |
download | scummvm-rg350-c1b6fc3824018118618685fcbfcabe413e865531.tar.gz scummvm-rg350-c1b6fc3824018118618685fcbfcabe413e865531.tar.bz2 scummvm-rg350-c1b6fc3824018118618685fcbfcabe413e865531.zip |
TITANIC: Implemented game pickup classes
-rw-r--r-- | engines/titanic/carry/photograph.cpp | 11 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up.h | 8 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_bar_glass.cpp | 51 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_bar_glass.h | 4 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_hose.cpp | 67 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_hose.h | 9 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_lemon.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_lemon.h | 3 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_speech_centre.cpp | 36 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_speech_centre.h | 4 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_vis_centre.cpp | 23 | ||||
-rw-r--r-- | engines/titanic/game/pickup/pick_up_vis_centre.h | 3 |
13 files changed, 245 insertions, 13 deletions
diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp index 7f32a0623d..039efd0252 100644 --- a/engines/titanic/carry/photograph.cpp +++ b/engines/titanic/carry/photograph.cpp @@ -21,6 +21,7 @@ */ #include "titanic/carry/photograph.h" +#include "titanic/core/dont_save_file_item.h" #include "titanic/core/room_item.h" namespace Titanic { @@ -59,8 +60,12 @@ bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) { _v1 = 0; CGameObject *target = msg->_dropTarget; - if (target && target->getName() != "NavigationComputer") { - warning("TODO: CPhotograph::MouseDragEndMsg"); + if (target && target->isEquals("NavigationComputer")) { + moveUnder(getDontSave()); + makeDirty(); + playSound("a#46.wav"); + starFn1(14); + showMouse(); return true; } else { return CCarry::MouseDragEndMsg(msg); @@ -78,7 +83,7 @@ bool CPhotograph::MouseDragStartMsg(CMouseDragStartMsg *msg) { } bool CPhotograph::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { - if (getRoom()->getName() == "Home") { + if (getRoom()->isEquals("Home")) { CActMsg actMsg("PlayerPutsPhotoInPET"); actMsg.execute("Doorbot"); } diff --git a/engines/titanic/game/pickup/pick_up.cpp b/engines/titanic/game/pickup/pick_up.cpp index c660a36a32..64d2d1d0d2 100644 --- a/engines/titanic/game/pickup/pick_up.cpp +++ b/engines/titanic/game/pickup/pick_up.cpp @@ -24,16 +24,26 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPickUp, CGameObject) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + void CPickUp::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_enabled, indent); CGameObject::save(file, indent); } void CPickUp::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); + _enabled = file->readNumber(); CGameObject::load(file); } +bool CPickUp::StatusChangeMsg(CStatusChangeMsg *msg) { + _enabled = msg->_newStatus == 1; + setVisible(_enabled); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up.h b/engines/titanic/game/pickup/pick_up.h index f0b6794442..f5ee06fd32 100644 --- a/engines/titanic/game/pickup/pick_up.h +++ b/engines/titanic/game/pickup/pick_up.h @@ -28,11 +28,13 @@ namespace Titanic { class CPickUp : public CGameObject { -private: - int _fieldBC; + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); +protected: + bool _enabled; public: CLASSDEF; - CPickUp() : CGameObject(), _fieldBC(0) {} + CPickUp() : CGameObject(), _enabled(false) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.cpp b/engines/titanic/game/pickup/pick_up_bar_glass.cpp index 85b883281e..9da17b139e 100644 --- a/engines/titanic/game/pickup/pick_up_bar_glass.cpp +++ b/engines/titanic/game/pickup/pick_up_bar_glass.cpp @@ -21,9 +21,16 @@ */ #include "titanic/game/pickup/pick_up_bar_glass.h" +#include "titanic/core/project_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPickUpBarGlass, CPickUp) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + void CPickUpBarGlass::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPickUp::save(file, indent); @@ -34,4 +41,48 @@ void CPickUpBarGlass::load(SimpleFile *file) { CPickUp::load(file); } +bool CPickUpBarGlass::StatusChangeMsg(CStatusChangeMsg *msg) { + switch (msg->_newStatus) { + case 0: + setVisible(false); + _enabled = false; + break; + case 1: + setVisible(true); + _enabled = true; + break; + case 2: + setVisible(true); + _enabled = false; + break; + default: + break; + } + + return true; +} + +bool CPickUpBarGlass::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkStartDragging(msg) && _enabled) { + CTurnOn onMsg; + onMsg.execute("BeerGlass"); + CVisibleMsg visibleMsg; + visibleMsg.execute("BeerGlass"); + CPassOnDragStartMsg passMsg(msg->_mousePos, 1, 3); + passMsg.execute("BeerGlass"); + + msg->_dragItem = getRoot()->findByName("BeerGlass"); + + CActMsg actMsg("PlayerTakesGlass"); + actMsg.execute("Barbot"); + return true; + } else { + return false; + } +} + +bool CPickUpBarGlass::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.h b/engines/titanic/game/pickup/pick_up_bar_glass.h index b5ef6f5a47..d273d96170 100644 --- a/engines/titanic/game/pickup/pick_up_bar_glass.h +++ b/engines/titanic/game/pickup/pick_up_bar_glass.h @@ -28,6 +28,10 @@ namespace Titanic { class CPickUpBarGlass : public CPickUp { + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/pickup/pick_up_hose.cpp b/engines/titanic/game/pickup/pick_up_hose.cpp index 7375ddaa63..d07088cefd 100644 --- a/engines/titanic/game/pickup/pick_up_hose.cpp +++ b/engines/titanic/game/pickup/pick_up_hose.cpp @@ -21,14 +21,24 @@ */ #include "titanic/game/pickup/pick_up_hose.h" +#include "titanic/core/project_item.h" +#include "titanic/core/room_item.h" +#include "titanic/core/view_item.h" namespace Titanic { -int CPickUpHose::_v1; +BEGIN_MESSAGE_MAP(CPickUpHose, CPickUp) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +bool CPickUpHose::_v1; void CPickUpHose::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_target, indent); file->writeNumberLine(_v1, indent); CPickUp::save(file, indent); @@ -36,10 +46,61 @@ void CPickUpHose::save(SimpleFile *file, int indent) { void CPickUpHose::load(SimpleFile *file) { file->readNumber(); - _string1 = file->readString(); + _target = file->readString(); _v1 = file->readNumber(); CPickUp::load(file); } +bool CPickUpHose::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) + return true; + if (_v1 || !_enabled) + return false; + + CViewItem *view = getView(); + if (view) { + _v1 = true; + CRoomItem *room = locateRoom("Arboretum"); + CTreeItem *hose = room ? room->findByName("Hose") : nullptr; + + if (!hose) { + room = locateRoom("FrozenArboretum"); + if (room) + hose = room->findByName("Hose"); + } + + if (hose) { + CVisibleMsg visibleMsg; + visibleMsg.execute(this); + moveUnder(view); + + CPassOnDragStartMsg passMsg(msg->_mousePos, 1); + passMsg.execute("Hose"); + + msg->_dragItem = getRoot()->findByName("Hose"); + _cursorId = CURSOR_IGNORE; + + CActMsg actMsg("PlayerGetsHose"); + actMsg.execute(_target); + } + } + + return true; +} + +bool CPickUpHose::StatusChangeMsg(CStatusChangeMsg *msg) { + _cursorId = msg->_newStatus == 1 ? CURSOR_HAND : CURSOR_IGNORE; + return true; +} + +bool CPickUpHose::EnterViewMsg(CEnterViewMsg *msg) { + _cursorId = CURSOR_IGNORE; + return true; +} + +bool CPickUpHose::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return _enabled; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_hose.h b/engines/titanic/game/pickup/pick_up_hose.h index 80ccedc845..2ad7c2a583 100644 --- a/engines/titanic/game/pickup/pick_up_hose.h +++ b/engines/titanic/game/pickup/pick_up_hose.h @@ -28,10 +28,15 @@ namespace Titanic { class CPickUpHose : public CPickUp { + DECLARE_MESSAGE_MAP; + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); private: - static int _v1; + static bool _v1; - CString _string1; + CString _target; public: CLASSDEF; diff --git a/engines/titanic/game/pickup/pick_up_lemon.cpp b/engines/titanic/game/pickup/pick_up_lemon.cpp index 772114f76c..5109c36304 100644 --- a/engines/titanic/game/pickup/pick_up_lemon.cpp +++ b/engines/titanic/game/pickup/pick_up_lemon.cpp @@ -21,9 +21,15 @@ */ #include "titanic/game/pickup/pick_up_lemon.h" +#include "titanic/core/project_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPickUpLemon, CPickUp) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + void CPickUpLemon::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPickUp::save(file, indent); @@ -34,4 +40,23 @@ void CPickUpLemon::load(SimpleFile *file) { CPickUp::load(file); } +bool CPickUpLemon::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CPickUpLemon::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) + return true; + if (!_enabled) + return false; + + CVisibleMsg visibleMsg; + visibleMsg.execute("Lemon"); + CPassOnDragStartMsg passMsg(msg->_mousePos, 1); + passMsg.execute("Lemon"); + + msg->_dragItem = getRoot()->findByName("Lemon"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_lemon.h b/engines/titanic/game/pickup/pick_up_lemon.h index 0312c71012..c196acdeaf 100644 --- a/engines/titanic/game/pickup/pick_up_lemon.h +++ b/engines/titanic/game/pickup/pick_up_lemon.h @@ -28,6 +28,9 @@ namespace Titanic { class CPickUpLemon : public CPickUp { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.cpp b/engines/titanic/game/pickup/pick_up_speech_centre.cpp index 0b9a8d2c48..d3373556a6 100644 --- a/engines/titanic/game/pickup/pick_up_speech_centre.cpp +++ b/engines/titanic/game/pickup/pick_up_speech_centre.cpp @@ -21,9 +21,16 @@ */ #include "titanic/game/pickup/pick_up_speech_centre.h" +#include "titanic/core/project_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPickUpSpeechCentre, CPickUp) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + void CPickUpSpeechCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPickUp::save(file, indent); @@ -34,4 +41,33 @@ void CPickUpSpeechCentre::load(SimpleFile *file) { CPickUp::load(file); } +bool CPickUpSpeechCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CPickUpSpeechCentre::StatusChangeMsg(CStatusChangeMsg *msg) { + _enabled = msg->_newStatus == 1; + return true; +} + +bool CPickUpSpeechCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkStartDragging(msg)) { + if (_enabled) { + CVisibleMsg visibleMsg; + visibleMsg.execute("SpeechCentre"); + CPassOnDragStartMsg passMsg(msg->_mousePos, 1); + passMsg.execute("SpeechCentre"); + + msg->_dragItem = getRoot()->findByName("SpeechCentre"); + + CActMsg actMsg("PlayerGetsSpeechCentre"); + actMsg.execute("SeasonalAdjust"); + } else { + petDisplayMessage("You can',27h,'t pick this up on account of it being stuck to the branch."); + } + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.h b/engines/titanic/game/pickup/pick_up_speech_centre.h index 29dce04fb3..81ee0b5d77 100644 --- a/engines/titanic/game/pickup/pick_up_speech_centre.h +++ b/engines/titanic/game/pickup/pick_up_speech_centre.h @@ -28,6 +28,10 @@ namespace Titanic { class CPickUpSpeechCentre : public CPickUp { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.cpp b/engines/titanic/game/pickup/pick_up_vis_centre.cpp index 796e46778c..baf1763d09 100644 --- a/engines/titanic/game/pickup/pick_up_vis_centre.cpp +++ b/engines/titanic/game/pickup/pick_up_vis_centre.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPickUpVisCentre, CPickUp) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + void CPickUpVisCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPickUp::save(file, indent); @@ -34,4 +39,22 @@ void CPickUpVisCentre::load(SimpleFile *file) { CPickUp::load(file); } + +bool CPickUpVisCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CPickUpVisCentre::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg) || !_enabled) + return false; + + setVisible(false); + CVisibleMsg visibleMsg; + visibleMsg.execute("VisionCentre"); + msg->execute("VisionCentre"); + CActMsg actMsg("PlayerTakesVisCentre"); + actMsg.execute("Barbot"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.h b/engines/titanic/game/pickup/pick_up_vis_centre.h index 4f808f73c5..a5f59211d3 100644 --- a/engines/titanic/game/pickup/pick_up_vis_centre.h +++ b/engines/titanic/game/pickup/pick_up_vis_centre.h @@ -28,6 +28,9 @@ namespace Titanic { class CPickUpVisCentre : public CPickUp { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); public: CLASSDEF; |