aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-02 18:31:37 -0400
committerPaul Gilbert2016-08-02 18:31:37 -0400
commit17762761fe01b467bf2df2e33b3d7293eb40c26c (patch)
tree8a64cbc9e867bc4c6ea5ceaaca93764e23b9ec07 /engines/titanic/game
parentceb49fc839a28408f24217abaef41d88eace0247 (diff)
downloadscummvm-rg350-17762761fe01b467bf2df2e33b3d7293eb40c26c.tar.gz
scummvm-rg350-17762761fe01b467bf2df2e33b3d7293eb40c26c.tar.bz2
scummvm-rg350-17762761fe01b467bf2df2e33b3d7293eb40c26c.zip
TITANIC: Added CPETPosition leaveViewMsg
Diffstat (limited to 'engines/titanic/game')
-rw-r--r--engines/titanic/game/pet/pet_position.cpp108
-rw-r--r--engines/titanic/game/pet/pet_position.h2
2 files changed, 109 insertions, 1 deletions
diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp
index 9f58093ccc..3573cdeeae 100644
--- a/engines/titanic/game/pet/pet_position.cpp
+++ b/engines/titanic/game/pet/pet_position.cpp
@@ -21,11 +21,15 @@
*/
#include "titanic/game/pet/pet_position.h"
+#include "titanic/core/view_item.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CPETPosition, CGameObject)
ON_MESSAGE(EnterRoomMsg)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(LeaveViewMsg)
END_MESSAGE_MAP()
void CPETPosition::save(SimpleFile *file, int indent) {
@@ -39,8 +43,110 @@ void CPETPosition::load(SimpleFile *file) {
}
bool CPETPosition::EnterRoomMsg(CEnterRoomMsg *msg) {
- warning("CPETPosition::handleEvent");
+ if (msg->_newRoom->getName() == "EmbLobby") {
+ CPetControl *pet = getPetControl();
+ if (pet)
+ pet->setRoomsFloorNum(1);
+ }
+
+ return true;
+}
+
+bool CPETPosition::EnterViewMsg(CEnterViewMsg *msg) {
+ // TODO
+ return true;
+}
+
+bool CPETPosition::LeaveViewMsg(CLeaveViewMsg *msg) {
+ CPetControl *pet = getPetControl();
+ CString oldView = msg->_oldView->getName();
+ CString newView = msg->_newView->getName();
+
+ if (pet && newView == "Lift.Node 1.N") {
+ int elevatorNum = pet->getRoomsElevatorNum();
+
+ if (oldView == "TopOfWell.Node 25.N") {
+ pet->setRoomsFloorNum(1);
+ pet->setRoomsElevatorNum(1);
+ return true;
+ } else if (oldView == "TopOfWell.Node 24.SE") {
+ pet->setRoomsFloorNum(1);
+ pet->setRoomsElevatorNum(2);
+ return true;
+ } else if (oldView == "TopOfWell.Node 26.N") {
+ pet->setRoomsFloorNum(1);
+ pet->setRoomsElevatorNum(3);
+ return true;
+ } else if (oldView == "TopOfWell.Node 27.N") {
+ pet->setRoomsFloorNum(1);
+ pet->setRoomsElevatorNum(4);
+ return true;
+ } else if (oldView == "1stClassLobby.Node 10.S") {
+ switch (elevatorNum) {
+ case 1:
+ pet->setRoomsFloorNum(1);
+ pet->setRoomsElevatorNum(1);
+ break;
+ case 2:
+ pet->setRoomsElevatorNum(1);
+ break;
+ default:
+ pet->setRoomsElevatorNum(3);
+ break;
+ }
+ return true;
+ } else if (oldView == "1stClassLobby.Node 9.S") {
+ switch (elevatorNum) {
+ case 1:
+ case 2:
+ pet->setRoomsElevatorNum(2);
+ break;
+ default:
+ pet->setRoomsElevatorNum(4);
+ break;
+ }
+ return true;
+ } else if (oldView == "2ndClassLobby.Node 8.S") {
+ switch (elevatorNum) {
+ case 1:
+ case 2:
+ pet->setRoomsElevatorNum(1);
+ break;
+ default:
+ pet->setRoomsElevatorNum(3);
+ break;
+ }
+ return true;
+ } else if (oldView == "2ndClassLobby.Node 1.S") {
+ switch (elevatorNum) {
+ case 1:
+ case 2:
+ pet->setRoomsElevatorNum(2);
+ break;
+ default:
+ pet->setRoomsElevatorNum(4);
+ break;
+ }
+ return true;
+ } else if (oldView == "SgtLobby.Node 1.S") {
+ return true;
+ } else if (oldView == "BottomOfWell.Node 10.E" || oldView == "BottomOfWell.Node 11.W") {
+ pet->setRoomsElevatorNum(1);
+ return true;
+ }
+ }
+
+ CRoomItem *newRoom = msg->_newView->findRoom();
+ if (newRoom) {
+ CString roomName = newRoom->getName();
+ if (roomName == "1stClassLobby" || roomName == "2ndClassLobby" || roomName == "SgtLobby") {
+ if (pet)
+ pet->resetRoomsHighlight();
+ }
+ }
+
return true;
}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h
index d1ac0507f4..0cf835f23f 100644
--- a/engines/titanic/game/pet/pet_position.h
+++ b/engines/titanic/game/pet/pet_position.h
@@ -31,6 +31,8 @@ namespace Titanic {
class CPETPosition : public CGameObject {
DECLARE_MESSAGE_MAP;
bool EnterRoomMsg(CEnterRoomMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
public:
CLASSDEF;