diff options
author | Paul Gilbert | 2016-08-27 07:50:19 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-27 07:50:19 -0400 |
commit | 795cdb6365bcf01a92950e6fee8632a3a749d165 (patch) | |
tree | f0224d5f26f4f27da0413c04c22ff41e18334c1b /engines/titanic/game/pet/pet_lift.cpp | |
parent | 7acd288e365c352602feff3cd03b610ddbe76603 (diff) | |
download | scummvm-rg350-795cdb6365bcf01a92950e6fee8632a3a749d165.tar.gz scummvm-rg350-795cdb6365bcf01a92950e6fee8632a3a749d165.tar.bz2 scummvm-rg350-795cdb6365bcf01a92950e6fee8632a3a749d165.zip |
TITANIC: Implemented PET game classes
Diffstat (limited to 'engines/titanic/game/pet/pet_lift.cpp')
-rw-r--r-- | engines/titanic/game/pet/pet_lift.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/engines/titanic/game/pet/pet_lift.cpp b/engines/titanic/game/pet/pet_lift.cpp index 39b0d01540..afa9dd04cd 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 |