aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-02 19:27:00 -0400
committerPaul Gilbert2016-08-02 19:27:00 -0400
commit99b353b9fef51eccbf88b1bfa8a69381369dfd50 (patch)
treea856aa3f2d725c5ee8caa9f0f9b5d8887843785a
parent17762761fe01b467bf2df2e33b3d7293eb40c26c (diff)
downloadscummvm-rg350-99b353b9fef51eccbf88b1bfa8a69381369dfd50.tar.gz
scummvm-rg350-99b353b9fef51eccbf88b1bfa8a69381369dfd50.tar.bz2
scummvm-rg350-99b353b9fef51eccbf88b1bfa8a69381369dfd50.zip
TITANIC: Added CPETPosition enterViewMsg
-rw-r--r--engines/titanic/core/game_object.cpp14
-rw-r--r--engines/titanic/core/game_object.h11
-rw-r--r--engines/titanic/game/pet/pet_position.cpp114
-rw-r--r--engines/titanic/pet_control/pet_control.h16
-rw-r--r--engines/titanic/pet_control/pet_rooms.cpp6
-rw-r--r--engines/titanic/pet_control/pet_rooms.h15
6 files changed, 156 insertions, 20 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 39e4f8412e..3ee3254f1c 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1371,11 +1371,6 @@ void CGameObject::petDisplayMessage(const CString &msg) {
pet->displayMessage(msg);
}
-int CGameObject::petGetRooms1D0() const {
- CPetControl *petControl = getPetControl();
- return petControl ? petControl->getRooms1D0() : 0;
-}
-
void CGameObject::petInvChange() {
CPetControl *pet = getPetControl();
if (pet)
@@ -1406,10 +1401,15 @@ void CGameObject::petSetArea(PetArea newArea) const {
pet->setArea(newArea);
}
-void CGameObject::petSetRooms1D0(int val) {
+void CGameObject::petSetRoomsWellEntry(int entryNum) {
CPetControl *petControl = getPetControl();
if (petControl)
- petControl->setRooms1D0(val);
+ petControl->setRoomsWellEntry(entryNum);
+}
+
+int CGameObject::petGetRoomsWellEntry() const {
+ CPetControl *petControl = getPetControl();
+ return petControl ? petControl->getRoomsWellEntry() : 0;
}
void CGameObject::petSetRooms1D4(int v) {
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 69036b1690..048c1668d4 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -744,7 +744,10 @@ public:
*/
void petDisplayMessage(const CString &msg);
- int petGetRooms1D0() const;
+ /**
+ * Gets the entry number used when last arriving at the well
+ */
+ int petGetRoomsWellEntry() const;
/**
* Hide the PET
@@ -786,7 +789,11 @@ public:
*/
void petSetRemoteTarget();
- void petSetRooms1D0(int val);
+ /**
+ * Sets the entry number for arriving at the well
+ */
+ void petSetRoomsWellEntry(int entryNum);
+
void petSetRooms1D4(int v);
diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp
index 3573cdeeae..d3d030eb16 100644
--- a/engines/titanic/game/pet/pet_position.cpp
+++ b/engines/titanic/game/pet/pet_position.cpp
@@ -53,7 +53,119 @@ bool CPETPosition::EnterRoomMsg(CEnterRoomMsg *msg) {
}
bool CPETPosition::EnterViewMsg(CEnterViewMsg *msg) {
- // TODO
+ CPetControl *pet = getPetControl();
+ CString viewStr = msg->_newView->getNodeViewName();
+ CString tempStr;
+
+ if (compareRoomNameTo("TopOfWell")) {
+ tempStr = msg->_newView->getNodeViewName();
+ int wellEntry = 0;
+
+ if (tempStr == "Node 25.N")
+ wellEntry = 1;
+ else if (tempStr == "Node 24.SE")
+ wellEntry = 2;
+ else if (tempStr == "Node 26.N")
+ wellEntry = 3;
+ else if (tempStr == "Node 27.N")
+ wellEntry = 4;
+
+ if (wellEntry != 0)
+ petSetRoomsWellEntry(wellEntry);
+ } else if (compareRoomNameTo("1stClassLobby")) {
+ int roomNum = 0;
+
+ if (viewStr == "Node 2.N")
+ roomNum = 1;
+ else if (viewStr == "Node 3.N")
+ roomNum = 2;
+ else if (viewStr == "Node 4.N")
+ roomNum = 3;
+ else if (viewStr == "Node 5.N")
+ roomNum = 1;
+ else if (viewStr == "Node 6.N")
+ roomNum = 2;
+ else if (viewStr == "Node 7.N")
+ roomNum = 3;
+
+ if (pet) {
+ pet->setRoomsRoomNum(roomNum);
+ pet->resetRoomsHighlight();
+
+ int elevatorNum = pet->getRoomsElevatorNum();
+ int wellEntry = 0;
+
+ if (viewStr == "Node 10.S")
+ wellEntry = (elevatorNum == 1 || elevatorNum == 2) ? 1 : 3;
+ else if (viewStr == "Node 9.S")
+ wellEntry = (elevatorNum == 1 || elevatorNum == 2) ? 2 : 4;
+
+ if (wellEntry)
+ petSetRoomsWellEntry(wellEntry);
+ }
+ } else if (compareRoomNameTo("2ndClassLobby")) {
+ int roomNum = 0;
+
+ if (viewStr == "Node 3.N")
+ roomNum = 1;
+ else if (viewStr == "Node 4.N")
+ roomNum = 2;
+ else if (viewStr == "Node 5.N")
+ roomNum = 3;
+ else if (viewStr == "Node 6.N")
+ roomNum = 4;
+
+ if (pet) {
+ pet->setRoomsRoomNum(roomNum);
+ pet->resetRoomsHighlight();
+
+ int elevatorNum = pet->getRoomsElevatorNum();
+ int wellEntry = 0;
+
+ if (viewStr == "Node 8.S")
+ wellEntry = (elevatorNum == 1 || elevatorNum == 2) ? 1 : 3;
+ else if (viewStr == "Node 1.S")
+ wellEntry = (elevatorNum == 1 || elevatorNum == 2) ? 2 : 4;
+
+ if (wellEntry)
+ petSetRoomsWellEntry(wellEntry);
+ }
+ } else if (compareRoomNameTo("SecClassLittleLift")) {
+ if (pet && viewStr == "Node 1.N")
+ pet->resetRoomsHighlight();
+ } else if (compareRoomNameTo("SGTLittleLift")) {
+ if (pet && viewStr == "Node 1.N")
+ pet->resetRoomsHighlight();
+ } else if (compareRoomNameTo("SgtLobby")) {
+ int roomNum = 0;
+
+ if (viewStr == "Node 4.N")
+ roomNum = 1;
+ else if (viewStr == "Node 5.N")
+ roomNum = 2;
+ else if (viewStr == "Node 6.N")
+ roomNum = 3;
+ else if (viewStr == "Node 7.N")
+ roomNum = 4;
+ else if (viewStr == "Node 8.N")
+ roomNum = 5;
+ else if (viewStr == "Node 9.N")
+ roomNum = 6;
+
+ if (pet) {
+ pet->setRooms1CC(1);
+ pet->setRoomsRoomNum(roomNum);
+
+ if (viewStr == "Node 1.S")
+ pet->setRoomsWellEntry(pet->getRoomsElevatorNum());
+ }
+ } else if (compareRoomNameTo("BottomOfWell")) {
+ if (viewStr == "Node 10.E")
+ petSetRoomsWellEntry(3);
+ else if (viewStr == "Node 11.W")
+ petSetRoomsWellEntry(1);
+ }
+
return true;
}
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index ef7e49d4e4..a86d110458 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -470,12 +470,20 @@ public:
return _rooms.getRoomNum();
}
- void setRooms1D0(int v) {
- _rooms.set1D0(v);
+ /**
+ * Sets the entry number for arriving at the well
+ */
+ void setRoomsWellEntry(int entryNum) {
+ _rooms.setWellEntry(entryNum);
}
- int getRooms1D0() const {
- return _rooms.get1D0();
+
+ /**
+ * Gets the entry number used when last arriving at the well
+ */
+ int getRoomsWellEntry() const {
+ return _rooms.getWellEntry();
}
+
void setRooms1CC(int v) {
_rooms.set1CC(v);
}
diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp
index fcf8238eb6..2415c96966 100644
--- a/engines/titanic/pet_control/pet_rooms.cpp
+++ b/engines/titanic/pet_control/pet_rooms.cpp
@@ -31,7 +31,7 @@ CPetRooms::CPetRooms() :
_chevLeftOnLit(nullptr), _chevLeftOffLit(nullptr),
_chevRightOnLit(nullptr), _chevRightOffLit(nullptr),
_floorNum(0), _elevatorNum(0), _roomNum(0), _field1CC(0),
- _field1D0(0), _field1D4(0) {
+ _wellEntry(0), _field1D4(0) {
}
bool CPetRooms::setup(CPetControl *petControl) {
@@ -139,7 +139,7 @@ void CPetRooms::load(SimpleFile *file, int param) {
_elevatorNum = file->readNumber();
_roomNum = file->readNumber();
_field1CC = file->readNumber();
- _field1D0 = file->readNumber();
+ _wellEntry = file->readNumber();
_field1D4 = file->readNumber();
}
}
@@ -155,7 +155,7 @@ void CPetRooms::save(SimpleFile *file, int indent) {
file->writeNumberLine(_elevatorNum, indent);
file->writeNumberLine(_roomNum, indent);
file->writeNumberLine(_field1CC, indent);
- file->writeNumberLine(_field1D0, indent);
+ file->writeNumberLine(_wellEntry, indent);
file->writeNumberLine(_field1D4, indent);
}
diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h
index ba3356091a..af1ea2ae4f 100644
--- a/engines/titanic/pet_control/pet_rooms.h
+++ b/engines/titanic/pet_control/pet_rooms.h
@@ -47,7 +47,7 @@ private:
int _elevatorNum;
int _roomNum;
int _field1CC;
- int _field1D0;
+ int _wellEntry;
int _field1D4;
private:
/**
@@ -200,8 +200,17 @@ public:
int getRoomNum() const { return _roomNum; }
void set1CC(int val) { _field1CC = val; }
int get1CC() const { return _field1CC; }
- void set1D0(int val) { _field1D0 = val; }
- int get1D0() const { return _field1D0; }
+
+ /**
+ * Sets the entry number for arriving at the well
+ */
+ void setWellEntry(int val) { _wellEntry = val; }
+
+ /**
+ * Gets the entry number used when last arriving at the well
+ */
+ int getWellEntry() const { return _wellEntry; }
+
void set1D4(int val) { _field1D4 = val; }
};