[Scummvm-cvs-logs] scummvm master -> 99b353b9fef51eccbf88b1bfa8a69381369dfd50

dreammaster dreammaster at scummvm.org
Wed Aug 3 01:27:14 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:
99b353b9fe TITANIC: Added CPETPosition enterViewMsg


Commit: 99b353b9fef51eccbf88b1bfa8a69381369dfd50
    https://github.com/scummvm/scummvm/commit/99b353b9fef51eccbf88b1bfa8a69381369dfd50
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-02T19:27:00-04:00

Commit Message:
TITANIC: Added CPETPosition enterViewMsg

Changed paths:
    engines/titanic/core/game_object.cpp
    engines/titanic/core/game_object.h
    engines/titanic/game/pet/pet_position.cpp
    engines/titanic/pet_control/pet_control.h
    engines/titanic/pet_control/pet_rooms.cpp
    engines/titanic/pet_control/pet_rooms.h



diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 39e4f84..3ee3254 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 69036b1..048c166 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 3573cde..d3d030e 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 ef7e49d..a86d110 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 fcf8238..2415c96 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 ba33560..af1ea2a 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; }
 };
 






More information about the Scummvm-git-logs mailing list