[Scummvm-git-logs] scummvm master -> 795cdb6365bcf01a92950e6fee8632a3a749d165

dreammaster dreammaster at scummvm.org
Sat Aug 27 13:50:32 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
795cdb6365 TITANIC: Implemented PET game classes


Commit: 795cdb6365bcf01a92950e6fee8632a3a749d165
    https://github.com/scummvm/scummvm/commit/795cdb6365bcf01a92950e6fee8632a3a749d165
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-27T07:50:19-04:00

Commit Message:
TITANIC: Implemented PET game classes

Changed paths:
    engines/titanic/game/pet/pet.cpp
    engines/titanic/game/pet/pet.h
    engines/titanic/game/pet/pet_lift.cpp
    engines/titanic/game/pet/pet_lift.h
    engines/titanic/game/pet/pet_monitor.cpp
    engines/titanic/game/pet/pet_pellerator.cpp
    engines/titanic/game/pet/pet_pellerator.h
    engines/titanic/game/pet/pet_sentinal.cpp
    engines/titanic/game/pet/pet_sentinal.h
    engines/titanic/game/pet/pet_sounds.cpp
    engines/titanic/game/pet/pet_sounds.h
    engines/titanic/game/pet/pet_transition.cpp
    engines/titanic/game/pet/pet_transition.h
    engines/titanic/game/pet/pet_transport.cpp
    engines/titanic/game/pet_disabler.cpp
    engines/titanic/game/pet_disabler.h
    engines/titanic/messages/pet_messages.h



diff --git a/engines/titanic/game/pet/pet.cpp b/engines/titanic/game/pet/pet.cpp
index cd4e16d..99c9e01 100644
--- a/engines/titanic/game/pet/pet.cpp
+++ b/engines/titanic/game/pet/pet.cpp
@@ -21,9 +21,14 @@
  */
 
 #include "titanic/game/pet/pet.h"
+#include "titanic/pet_control/pet_control.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPET, CGameObject)
+	ON_MESSAGE(ShowTextMsg)
+END_MESSAGE_MAP()
+
 CPET::CPET() : CGameObject(), _fieldBC(0), _fieldC0(3),
 	_fieldC4(0), _fieldC8(0), _fieldD8(0), _fieldDC(0) {
 }
@@ -54,4 +59,11 @@ void CPET::load(SimpleFile *file) {
 	CGameObject::load(file);
 }
 
+bool CPET::ShowTextMsg(CShowTextMsg *msg) {
+	CPetControl *pet = getPetControl();
+	if (pet)
+		pet->petDisplayMessage(1, msg->_value);
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pet/pet.h b/engines/titanic/game/pet/pet.h
index cdad649..de31a42 100644
--- a/engines/titanic/game/pet/pet.h
+++ b/engines/titanic/game/pet/pet.h
@@ -28,6 +28,8 @@
 namespace Titanic {
 
 class CPET : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool ShowTextMsg(CShowTextMsg *msg);
 public:
 	int _fieldBC;
 	int _fieldC0;
diff --git a/engines/titanic/game/pet/pet_lift.cpp b/engines/titanic/game/pet/pet_lift.cpp
index 39b0d01..afa9dd0 100644
--- a/engines/titanic/game/pet/pet_lift.cpp
+++ b/engines/titanic/game/pet/pet_lift.cpp
@@ -21,9 +21,14 @@
  */
 
 #include "titanic/game/pet/pet_lift.h"
+#include "titanic/pet_control/pet_control.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPETLift, CPETTransport)
+	ON_MESSAGE(TransportMsg)
+END_MESSAGE_MAP()
+
 void CPETLift::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CPETTransport::save(file, indent);
@@ -34,4 +39,36 @@ void CPETLift::load(SimpleFile *file) {
 	CPETTransport::load(file);
 }
 
+bool CPETLift::TransportMsg(CTransportMsg *msg) {
+	CPetControl *pet = getPetControl();
+	if (msg->_value1 != 1)
+		return false;
+
+	int floorNum = -1;
+	if (msg->_roomName == "TopOfWell") {
+		floorNum = 1;
+	} else if (msg->_roomName == "BottomOfWell") {
+		floorNum = 39;
+	} else if (msg->_roomName == "PlayersRoom" && pet) {
+		int assignedFloor = pet->getAssignedFloorNum();
+		if (assignedFloor < 1 || assignedFloor > 39) {
+			pet->petDisplayMessage("You have not assigned a room to go to.");
+			floorNum = -1;
+		}
+	}
+
+	if (floorNum != -1) {
+		int elevatorNum = pet ? pet->getRoomsElevatorNum() : 0;
+
+		if ((elevatorNum == 2 || elevatorNum == 4) && floorNum > 27) {
+			petDisplayMessage("Sorry, this elevator does not go below floor 27.");
+		} else {
+			CTrueTalkTriggerActionMsg triggerMsg(2, floorNum, 0);
+			triggerMsg.execute("Liftbot");
+		}
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pet/pet_lift.h b/engines/titanic/game/pet/pet_lift.h
index 88b4e1c..ce3aace 100644
--- a/engines/titanic/game/pet/pet_lift.h
+++ b/engines/titanic/game/pet/pet_lift.h
@@ -28,6 +28,8 @@
 namespace Titanic {
 
 class CPETLift : public CPETTransport {
+	DECLARE_MESSAGE_MAP;
+	bool TransportMsg(CTransportMsg *msg);
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp
index 6a0d207..2716a81 100644
--- a/engines/titanic/game/pet/pet_monitor.cpp
+++ b/engines/titanic/game/pet/pet_monitor.cpp
@@ -21,6 +21,8 @@
  */
 
 #include "titanic/game/pet/pet_monitor.h"
+#include "titanic/core/room_item.h"
+#include "titanic/pet_control/pet_control.h"
 
 namespace Titanic {
 
@@ -39,7 +41,23 @@ void CPETMonitor::load(SimpleFile *file) {
 }
 
 bool CPETMonitor::EnterRoomMsg(CEnterRoomMsg *msg) {
-	warning("CPETMonitor::handleEvent");
+	bool flag = true;
+	if (msg->_newRoom && msg->_oldRoom) {
+		CString oldRoomName = msg->_oldRoom->getName();
+		CString newRoomName = msg->_newRoom->getName();
+
+		if (newRoomName == "SgtLobby" && oldRoomName == "SGTState")
+			flag = false;
+	}
+
+	if (flag) {
+		CPetControl *pet = getPetControl();
+		if (pet) {
+			pet->setRoomsRoomNum(0);
+			pet->resetRoomsHighlight();
+		}
+	}
+
 	return true;
 }
 
diff --git a/engines/titanic/game/pet/pet_pellerator.cpp b/engines/titanic/game/pet/pet_pellerator.cpp
index a29942c..59516eb 100644
--- a/engines/titanic/game/pet/pet_pellerator.cpp
+++ b/engines/titanic/game/pet/pet_pellerator.cpp
@@ -24,6 +24,10 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPETPellerator, CPETTransport)
+	ON_MESSAGE(PETActivateMsg)
+END_MESSAGE_MAP()
+
 void CPETPellerator::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CPETTransport::save(file, indent);
@@ -34,4 +38,24 @@ void CPETPellerator::load(SimpleFile *file) {
 	CPETTransport::load(file);
 }
 
+bool CPETPellerator::PETActivateMsg(CPETActivateMsg *msg) {
+	CStatusChangeMsg statusMsg;
+
+	if (msg->_name == "PromenadeDeck")
+		statusMsg._newStatus = 0;
+	else if (msg->_name == "MusicRoom")
+		statusMsg._newStatus = 1;
+	else if (msg->_name == "Bar")
+		statusMsg._newStatus = 2;
+	else if (msg->_name == "TopOfWell")
+		statusMsg._newStatus = 4;
+	else if (msg->_name == "1stClassRestaurant")
+		statusMsg._newStatus = 5;
+	else if (msg->_name == "Arboretum")
+		statusMsg._newStatus = 6;
+
+	statusMsg.execute("PelleratorObject");
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pet/pet_pellerator.h b/engines/titanic/game/pet/pet_pellerator.h
index 9b90c9a..51af6f1 100644
--- a/engines/titanic/game/pet/pet_pellerator.h
+++ b/engines/titanic/game/pet/pet_pellerator.h
@@ -24,10 +24,13 @@
 #define TITANIC_PET_PELLERATOR_H
 
 #include "titanic/game/pet/pet_transport.h"
+#include "titanic/messages/pet_messages.h"
 
 namespace Titanic {
 
 class CPETPellerator : public CPETTransport {
+	DECLARE_MESSAGE_MAP;
+	bool PETActivateMsg(CPETActivateMsg *msg);
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/game/pet/pet_sentinal.cpp b/engines/titanic/game/pet/pet_sentinal.cpp
index 1b647d7..ac4cbc8 100644
--- a/engines/titanic/game/pet/pet_sentinal.cpp
+++ b/engines/titanic/game/pet/pet_sentinal.cpp
@@ -21,17 +21,46 @@
  */
 
 #include "titanic/game/pet/pet_sentinal.h"
+#include "titanic/pet_control/pet_control.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPETSentinal, CGameObject)
+	ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
+CPETSentinal::CPETSentinal() : CGameObject(), _elevatorNum(0),
+		_wellEntry(0), _resetHighlight(0) {
+}
+
 void CPETSentinal::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
+	file->writeNumberLine(_elevatorNum, indent);
+	file->writeNumberLine(_wellEntry, indent);
+	file->writeNumberLine(_resetHighlight, indent);
 	CGameObject::save(file, indent);
 }
 
 void CPETSentinal::load(SimpleFile *file) {
 	file->readNumber();
+	_elevatorNum = file->readNumber();
+	_wellEntry = file->readNumber();
+	_resetHighlight = file->readNumber();
 	CGameObject::load(file);
 }
 
+bool CPETSentinal::EnterViewMsg(CEnterViewMsg *msg) {
+	CPetControl *pet = getPetControl();
+	if (pet) {
+		if (_elevatorNum != -1)
+			pet->setRoomsElevatorNum(_elevatorNum);
+		if (_wellEntry)
+			pet->setRoomsWellEntry(_wellEntry);
+		if (_resetHighlight)
+			pet->resetRoomsHighlight();
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pet/pet_sentinal.h b/engines/titanic/game/pet/pet_sentinal.h
index f7f9fef..150fe4a 100644
--- a/engines/titanic/game/pet/pet_sentinal.h
+++ b/engines/titanic/game/pet/pet_sentinal.h
@@ -28,8 +28,15 @@
 namespace Titanic {
 
 class CPETSentinal : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool EnterViewMsg(CEnterViewMsg *msg);
+private:
+	int _elevatorNum;
+	int _wellEntry;
+	bool _resetHighlight;
 public:
 	CLASSDEF;
+	CPETSentinal();
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/game/pet/pet_sounds.cpp b/engines/titanic/game/pet/pet_sounds.cpp
index d612c74..c7f3cd3 100644
--- a/engines/titanic/game/pet/pet_sounds.cpp
+++ b/engines/titanic/game/pet/pet_sounds.cpp
@@ -24,16 +24,40 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPETSounds, CGameObject)
+	ON_MESSAGE(PETPlaySoundMsg)
+	ON_MESSAGE(LoadSuccessMsg)
+END_MESSAGE_MAP()
+
 void CPETSounds::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeNumberLine(_value, indent);
+	file->writeNumberLine(_ticks, indent);
 	CGameObject::save(file, indent);
 }
 
 void CPETSounds::load(SimpleFile *file) {
 	file->readNumber();
-	_value = file->readNumber();
+	_ticks = file->readNumber();
 	CGameObject::load(file);
 }
 
+bool CPETSounds::PETPlaySoundMsg(CPETPlaySoundMsg *msg) {
+	if (msg->_soundNum == 1) {
+		playSound("z#65.wav");
+	} else if (msg->_soundNum == 2 && stateGet24()) {
+		uint ticks = getTicksCount();
+		if (!_ticks || ticks > (_ticks + 12000)) {
+			playSound("z#36.wav");
+			_ticks = ticks;
+		}
+	}
+
+	return true;
+}
+
+bool CPETSounds::LoadSuccessMsg(CLoadSuccessMsg *msg) {
+	_ticks = 0;
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pet/pet_sounds.h b/engines/titanic/game/pet/pet_sounds.h
index 1d3acdb..2262fde 100644
--- a/engines/titanic/game/pet/pet_sounds.h
+++ b/engines/titanic/game/pet/pet_sounds.h
@@ -24,15 +24,19 @@
 #define TITANIC_PET_SOUNDS_H
 
 #include "titanic/core/game_object.h"
+#include "titanic/messages/pet_messages.h"
 
 namespace Titanic {
 
 class CPETSounds : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool PETPlaySoundMsg(CPETPlaySoundMsg *msg);
+	bool LoadSuccessMsg(CLoadSuccessMsg *msg);
 public:
-	int _value;
+	uint _ticks;
 public:
 	CLASSDEF;
-	CPETSounds() : CGameObject(), _value(0) {}
+	CPETSounds() : CGameObject(), _ticks(0) {}
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/game/pet/pet_transition.cpp b/engines/titanic/game/pet/pet_transition.cpp
index 33cc36c..ec10569 100644
--- a/engines/titanic/game/pet/pet_transition.cpp
+++ b/engines/titanic/game/pet/pet_transition.cpp
@@ -21,9 +21,15 @@
  */
 
 #include "titanic/game/pet/pet_transition.h"
+#include "titanic/pet_control/pet_control.h"
+#include "titanic/core/view_item.h"
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPETTransition, CGameObject)
+	ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
 void CPETTransition::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	CGameObject::save(file, indent);
@@ -34,4 +40,21 @@ void CPETTransition::load(SimpleFile *file) {
 	CGameObject::load(file);
 }
 
+bool CPETTransition::EnterViewMsg(CEnterViewMsg *msg) {
+	CPetControl *pet = getPetControl();
+
+	if (compareRoomNameTo("1stClassLobby") && pet) {
+		int elevatorNum = pet->getRoomsElevatorNum();
+		CString nodeView = msg->_newView->getNodeViewName();
+
+		if (nodeView == "Node 1.E") {
+			pet->setRoomsElevatorNum((elevatorNum == 1 || elevatorNum == 2) ? 1 : 3);
+		} else if (nodeView == "Node 1.W") {
+			pet->setRoomsElevatorNum((elevatorNum == 1 || elevatorNum == 2) ? 2 : 4);
+		}
+	}
+
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pet/pet_transition.h b/engines/titanic/game/pet/pet_transition.h
index 4abf16d..d0fa20c 100644
--- a/engines/titanic/game/pet/pet_transition.h
+++ b/engines/titanic/game/pet/pet_transition.h
@@ -28,6 +28,8 @@
 namespace Titanic {
 
 class CPETTransition : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool EnterViewMsg(CEnterViewMsg *msg);
 public:
 	CLASSDEF;
 
diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp
index 9661cac..a48e70e 100644
--- a/engines/titanic/game/pet/pet_transport.cpp
+++ b/engines/titanic/game/pet/pet_transport.cpp
@@ -39,7 +39,7 @@ void CPETTransport::load(SimpleFile *file) {
 }
 
 bool CPETTransport::EnterRoomMsg(CEnterRoomMsg *msg) {
-	warning("CPETTransport::handleEvent");
+	petClear();
 	return true;
 }
 
diff --git a/engines/titanic/game/pet_disabler.cpp b/engines/titanic/game/pet_disabler.cpp
index 2275156..c4946fe 100644
--- a/engines/titanic/game/pet_disabler.cpp
+++ b/engines/titanic/game/pet_disabler.cpp
@@ -24,6 +24,11 @@
 
 namespace Titanic {
 
+BEGIN_MESSAGE_MAP(CPetDisabler, CGameObject)
+	ON_MESSAGE(EnterViewMsg)
+	ON_MESSAGE(LeaveViewMsg)
+END_MESSAGE_MAP()
+
 void CPetDisabler::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	file->writeQuotedLine(_value, indent);
@@ -36,4 +41,14 @@ void CPetDisabler::load(SimpleFile *file) {
 	CGameObject::load(file);
 }
 
+bool CPetDisabler::EnterViewMsg(CEnterViewMsg *msg) {
+	petLockInput();
+	return true;
+}
+
+bool CPetDisabler::LeaveViewMsg(CLeaveViewMsg *msg) {
+	petUnlockInput();
+	return true;
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/game/pet_disabler.h b/engines/titanic/game/pet_disabler.h
index 92b4dff..06e99be 100644
--- a/engines/titanic/game/pet_disabler.h
+++ b/engines/titanic/game/pet_disabler.h
@@ -28,6 +28,9 @@
 namespace Titanic {
 
 class CPetDisabler : public CGameObject {
+	DECLARE_MESSAGE_MAP;
+	bool EnterViewMsg(CEnterViewMsg *msg);
+	bool LeaveViewMsg(CLeaveViewMsg *msg);
 public:
 	CString _value;
 public:
diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h
index 48e5bab..6098172 100644
--- a/engines/titanic/messages/pet_messages.h
+++ b/engines/titanic/messages/pet_messages.h
@@ -35,7 +35,7 @@ MESSAGE0(CPETLostObjectMsg);
 MESSAGE0(CPETObjectSelectedMsg);
 MESSAGE1(CPETObjectStateMsg, int, value, 0);
 MESSAGE0(CPETPhotoOnOffMsg);
-MESSAGE1(CPETPlaySoundMsg, int, value, 0);
+MESSAGE1(CPETPlaySoundMsg, int, soundNum, 0);
 MESSAGE0(CPETReceiveMsg);
 MESSAGE0(CPETSetStarDestinationMsg);
 MESSAGE1(CPETStarFieldLockMsg, int, value, 0);





More information about the Scummvm-git-logs mailing list