diff options
| author | Paul Gilbert | 2016-04-13 22:45:32 -0400 | 
|---|---|---|
| committer | Paul Gilbert | 2016-07-10 16:11:02 -0400 | 
| commit | 18a38c84e9ddeeb063621c290b8be6dce72daaf1 (patch) | |
| tree | 22ee09d99c0a3634956a01782daf9a0828514e8c | |
| parent | fdbb1868e4838248cc69302046c04700635beb55 (diff) | |
| download | scummvm-rg350-18a38c84e9ddeeb063621c290b8be6dce72daaf1.tar.gz scummvm-rg350-18a38c84e9ddeeb063621c290b8be6dce72daaf1.tar.bz2 scummvm-rg350-18a38c84e9ddeeb063621c290b8be6dce72daaf1.zip  | |
TITANIC: Implementing CCarry classes msg handlers
| -rw-r--r-- | engines/titanic/carry/chicken.h | 2 | ||||
| -rw-r--r-- | engines/titanic/carry/napkin.cpp | 21 | ||||
| -rw-r--r-- | engines/titanic/carry/napkin.h | 3 | ||||
| -rw-r--r-- | engines/titanic/carry/note.cpp | 8 | ||||
| -rw-r--r-- | engines/titanic/carry/note.h | 3 | ||||
| -rw-r--r-- | engines/titanic/carry/parcel.cpp | 3 | ||||
| -rw-r--r-- | engines/titanic/carry/parcel.h | 1 | ||||
| -rw-r--r-- | engines/titanic/core/game_object.cpp | 6 | ||||
| -rw-r--r-- | engines/titanic/core/game_object.h | 5 | ||||
| -rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 4 | ||||
| -rw-r--r-- | engines/titanic/pet_control/pet_control.h | 5 | ||||
| -rw-r--r-- | engines/titanic/pet_control/pet_section.cpp | 2 | ||||
| -rw-r--r-- | engines/titanic/pet_control/pet_section.h | 5 | 
13 files changed, 65 insertions, 3 deletions
diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h index a81c27c7e1..bbc46f8464 100644 --- a/engines/titanic/carry/chicken.h +++ b/engines/titanic/carry/chicken.h @@ -30,7 +30,7 @@ namespace Titanic {  class CChicken : public CCarry {  private:  	static int _v1; -private: +public:  	int _field12C;  	CString _string6;  	int _field13C; diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp index 48d03819ee..c998c132fc 100644 --- a/engines/titanic/carry/napkin.cpp +++ b/engines/titanic/carry/napkin.cpp @@ -21,9 +21,14 @@   */  #include "titanic/carry/napkin.h" +#include "titanic/carry/chicken.h"  namespace Titanic { +BEGIN_MESSAGE_MAP(CNapkin, CCarry) +	ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() +  CNapkin::CNapkin() : CCarry() {  } @@ -37,4 +42,20 @@ void CNapkin::load(SimpleFile *file) {  	CCarry::load(file);  } +bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) { +	CChicken *chicken = static_cast<CChicken *>(msg->_other); +	if (chicken) { +		if (chicken->_string6 == "None" || chicken->_field12C) { +			CActMsg actMsg("Clean"); +			actMsg.execute("Chicken"); +		} else { +			petDisplayMsg("The Chicken is already quite clean enough, thank you."); +		} +	} + +	dropOnPet(); +	return CCarry::UseWithOtherMsg(msg); +} + +  } // End of namespace Titanic diff --git a/engines/titanic/carry/napkin.h b/engines/titanic/carry/napkin.h index 144189be5c..ac14b70efa 100644 --- a/engines/titanic/carry/napkin.h +++ b/engines/titanic/carry/napkin.h @@ -24,10 +24,13 @@  #define TITANIC_NAPKIN_H  #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h"  namespace Titanic {  class CNapkin : public CCarry { +	DECLARE_MESSAGE_MAP +	bool UseWithOtherMsg(CUseWithOtherMsg *msg);  public:  	CLASSDEF  	CNapkin(); diff --git a/engines/titanic/carry/note.cpp b/engines/titanic/carry/note.cpp index e8400126ac..78286d71bd 100644 --- a/engines/titanic/carry/note.cpp +++ b/engines/titanic/carry/note.cpp @@ -24,6 +24,10 @@  namespace Titanic { +BEGIN_MESSAGE_MAP(CNote, CCarry) +	ON_MESSAGE(MouseDoubleClickMsg) +END_MESSAGE_MAP() +  CNote::CNote() : CCarry(), _field138(1) {  } @@ -43,4 +47,8 @@ void CNote::load(SimpleFile *file) {  	CCarry::load(file);  } +bool CNote::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { +	return true; +} +  } // End of namespace Titanic diff --git a/engines/titanic/carry/note.h b/engines/titanic/carry/note.h index b96e2cf855..22a95b0bd3 100644 --- a/engines/titanic/carry/note.h +++ b/engines/titanic/carry/note.h @@ -24,10 +24,13 @@  #define TITANIC_NOTE_H  #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h"  namespace Titanic {  class CNote : public CCarry { +	DECLARE_MESSAGE_MAP +	bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);  private:  	CString _string6;  	int _field138; diff --git a/engines/titanic/carry/parcel.cpp b/engines/titanic/carry/parcel.cpp index b450d887c5..275c982d63 100644 --- a/engines/titanic/carry/parcel.cpp +++ b/engines/titanic/carry/parcel.cpp @@ -24,6 +24,9 @@  namespace Titanic { +BEGIN_MESSAGE_MAP(CParcel, CCarry) +END_MESSAGE_MAP() +  CParcel::CParcel() : CCarry() {  } diff --git a/engines/titanic/carry/parcel.h b/engines/titanic/carry/parcel.h index 59f3ed9d6c..cb36bed23d 100644 --- a/engines/titanic/carry/parcel.h +++ b/engines/titanic/carry/parcel.h @@ -28,6 +28,7 @@  namespace Titanic {  class CParcel : public CCarry { +	DECLARE_MESSAGE_MAP  public:  	CLASSDEF  	CParcel(); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 4628ccccf2..0a541bfb4d 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -562,4 +562,10 @@ bool CGameObject::compareViewNameTo(const CString &name) const {  	return getViewFullName().compareToIgnoreCase(name);  } +void CGameObject::petDisplayMsg(const CString &msg) const { +	CPetControl *pet = getPetControl(); +	if (pet) +		pet->displayMessage(msg); +} +  } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 658c8449fb..09a00e30bb 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -160,6 +160,11 @@ protected:  	 * string form to the passed string  	 */  	bool compareViewNameTo(const CString &name) const; + +	/** +	* Display a message in the PET +	*/ +	void petDisplayMsg(const CString &msg) const;  public:  	int _field60;  	CursorId _cursorId; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 5bc3edc7a6..a5885502f0 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -350,4 +350,8 @@ void CPetControl::drawIndent(CScreenManager *screenManager, int indent) {  	_frame.drawIndent(screenManager, indent);  } +void CPetControl::displayMessage(const CString &msg) { +	error("TODO: CPetControl::displayMessage"); +} +  } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index f357c29378..401f5de3b9 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -196,6 +196,11 @@ public:  	CGameObject *dragEnd(const Point &pt) const {  		return _currentArea == PET_INVENTORY ? _inventory.dragEnd(pt) : nullptr;  	} + +	/** +	 * Display a message +	 */ +	void displayMessage(const CString &msg);  };  } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index d531b5d0d7..349fa40fcf 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -25,7 +25,7 @@  namespace Titanic { -void CPetSection::proc16() { +void CPetSection::displayMessage(const CString &msg) {  	error("TODO");  } diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 93a9145411..43ae623b37 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -96,7 +96,10 @@ public:  	 */  	virtual CGameObject *dragEnd(const Point &pt) const { return nullptr; } -	virtual void proc16(); +	/** +	 * Display a message +	 */ +	virtual void displayMessage(const CString &msg);  	/**  	 * Returns true if the object is in a valid state  | 
