[Scummvm-cvs-logs] scummvm master -> 17762761fe01b467bf2df2e33b3d7293eb40c26c

dreammaster dreammaster at scummvm.org
Wed Aug 3 00:31:51 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:
17762761fe TITANIC: Added CPETPosition leaveViewMsg


Commit: 17762761fe01b467bf2df2e33b3d7293eb40c26c
    https://github.com/scummvm/scummvm/commit/17762761fe01b467bf2df2e33b3d7293eb40c26c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-02T18:31:37-04:00

Commit Message:
TITANIC: Added CPETPosition leaveViewMsg

Changed paths:
    engines/titanic/game/pet/pet_position.cpp
    engines/titanic/game/pet/pet_position.h



diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp
index 9f58093..3573cde 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 d1ac050..0cf835f 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;
 






More information about the Scummvm-git-logs mailing list