aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/transport
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-27 22:51:33 -0400
committerPaul Gilbert2016-08-27 22:51:33 -0400
commit8f29f067a41548da7625ebfec43e7ca8f22dfe4a (patch)
tree3cfb83b0285a59738c27a0167ab32abe704efc59 /engines/titanic/game/transport
parent67be58f56204d6662a56f902b0a0f017c176b643 (diff)
downloadscummvm-rg350-8f29f067a41548da7625ebfec43e7ca8f22dfe4a.tar.gz
scummvm-rg350-8f29f067a41548da7625ebfec43e7ca8f22dfe4a.tar.bz2
scummvm-rg350-8f29f067a41548da7625ebfec43e7ca8f22dfe4a.zip
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic/game/transport')
-rw-r--r--engines/titanic/game/transport/service_elevator.cpp227
-rw-r--r--engines/titanic/game/transport/service_elevator.h16
2 files changed, 230 insertions, 13 deletions
diff --git a/engines/titanic/game/transport/service_elevator.cpp b/engines/titanic/game/transport/service_elevator.cpp
index 1ea8d14e36..1980825cb6 100644
--- a/engines/titanic/game/transport/service_elevator.cpp
+++ b/engines/titanic/game/transport/service_elevator.cpp
@@ -21,15 +21,27 @@
*/
#include "titanic/game/transport/service_elevator.h"
+#include "titanic/core/room_item.h"
+#include "titanic/npcs/doorbot.h"
-namespace Titanic {
+namespace Titanic {
-int CServiceElevator::_v1;
+BEGIN_MESSAGE_MAP(CServiceElevator, CTransport)
+ ON_MESSAGE(BodyInBilgeRoomMsg)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(ServiceElevatorMsg)
+ ON_MESSAGE(TimerMsg)
+ ON_MESSAGE(ServiceElevatorFloorRequestMsg)
+ ON_MESSAGE(LeaveRoomMsg)
+ ON_MESSAGE(OpeningCreditsMsg)
+END_MESSAGE_MAP()
+
+bool CServiceElevator::_v1;
int CServiceElevator::_v2;
int CServiceElevator::_v3;
CServiceElevator::CServiceElevator() : CTransport(),
- _fieldF8(0), _fieldFC(0), _field100(0), _field104(0) {
+ _fieldF8(0), _soundHandle1(0), _timerId(0), _soundHandle2(0) {
}
void CServiceElevator::save(SimpleFile *file, int indent) {
@@ -38,9 +50,9 @@ void CServiceElevator::save(SimpleFile *file, int indent) {
file->writeNumberLine(_v2, indent);
file->writeNumberLine(_v3, indent);
file->writeNumberLine(_fieldF8, indent);
- file->writeNumberLine(_fieldFC, indent);
- file->writeNumberLine(_field100, indent);
- file->writeNumberLine(_field104, indent);
+ file->writeNumberLine(_soundHandle1, indent);
+ file->writeNumberLine(_timerId, indent);
+ file->writeNumberLine(_soundHandle2, indent);
CTransport::save(file, indent);
}
@@ -51,11 +63,208 @@ void CServiceElevator::load(SimpleFile *file) {
_v2 = file->readNumber();
_v3 = file->readNumber();
_fieldF8 = file->readNumber();
- _fieldFC = file->readNumber();
- _field100 = file->readNumber();
- _field104 = file->readNumber();
+ _soundHandle1 = file->readNumber();
+ _timerId = file->readNumber();
+ _soundHandle2 = file->readNumber();
CTransport::load(file);
}
+bool CServiceElevator::BodyInBilgeRoomMsg(CBodyInBilgeRoomMsg *msg) {
+ _v2 = true;
+ _string1 = "BilgeRoomWith.Node 2.N";
+ return true;
+}
+
+bool CServiceElevator::EnterViewMsg(CEnterViewMsg *msg) {
+ petShow();
+ return true;
+}
+
+bool CServiceElevator::ServiceElevatorMsg(CServiceElevatorMsg *msg) {
+ switch (msg->_value) {
+ case 1:
+ case 2:
+ case 3: {
+ switch (msg->_value) {
+ case 1:
+ _v3 = 0;
+ break;
+ case 2:
+ _v3 = 1;
+ break;
+ case 3:
+ _v3 = 2;
+ break;
+ }
+
+ CServiceElevatorFloorRequestMsg requestMsg;
+ requestMsg.execute(this);
+ break;
+ }
+
+ case 4:
+ if (!_string1.empty()) {
+ if (_string1 == "DeepSpace") {
+ disableMouse();
+ _soundHandle1 = playSound("z#413.wav", 50);
+ _timerId = addTimer(1, 1000, 500);
+ } else {
+ changeView(_string1);
+ }
+ }
+ break;
+
+ case 5:
+ _fieldF8 = false;
+ _fieldDC = _v3;
+ loadSound("z#423.wav");
+ stopSound(_soundHandle2);
+ _soundHandle2 = playSound("z#423.wav", 80);
+
+ switch (_fieldDC) {
+ case 0:
+ _string1 = "DeepSpace";
+ _string2 = "a#2.wav";
+ queueSound("z#416.wav", _soundHandle2, 50);
+ break;
+
+ case 1:
+ _string1 = _v2 ? "BilgeRoomWith.Node 2.N" : "BilgeRoom.Node 1.N";
+ queueSound("z#421.wav", _soundHandle2, 50);
+ break;
+
+ case 2:
+ _string1 = _v1 ? "MoonEmbLobby.Node 1.NE" : "EmbLobby.Node 1.NE";
+ queueSound("z#411.wav", _soundHandle2, 50);
+ break;
+
+ default:
+ break;
+ }
+
+ enableMouse();
+ if (findRoom()->findByName("Doorbot"))
+ addTimer(3, 3000, 0);
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+bool CServiceElevator::TimerMsg(CTimerMsg *msg) {
+ CDoorbot *doorbot = dynamic_cast<CDoorbot *>(findRoom()->findByName("Doorbot"));
+
+ switch (msg->_actionVal) {
+ case 0:
+ case 1:
+ if (!isSoundActive(_soundHandle1)) {
+ stopAnimTimer(_timerId);
+ if (msg->_actionVal == 0) {
+ _fieldF8 = true;
+ CServiceElevatorFloorChangeMsg changeMsg(_fieldDC, _v3);
+ changeMsg.execute(getRoom());
+ _soundHandle2 = playSound("z#424.wav");
+
+ if (doorbot) {
+ CActMsg actMsg("DoorbotPlayerPressedTopButton");
+ actMsg.execute(doorbot);
+ }
+ } else {
+ enableMouse();
+ if (doorbot) {
+ CActMsg actMsg;
+ if (_v3 == 0)
+ actMsg._action = "DoorbotPlayerPressedBottomButton";
+ else if (_v3 == 1)
+ actMsg._action = "DoorbotPlayerPressedMiddleButton";
+
+ actMsg.execute(doorbot);
+ }
+ }
+ }
+ break;
+
+ case 3: {
+ CActMsg actMsg("DoorbotReachedEmbLobby");
+ actMsg.execute(doorbot);
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+bool CServiceElevator::ServiceElevatorFloorRequestMsg(CServiceElevatorFloorRequestMsg *msg) {
+ disableMouse();
+ CDoorbot *doorbot = dynamic_cast<CDoorbot *>(findRoom()->findByName("Doorbot"));
+
+ if (doorbot && _v3 == 0) {
+ _soundHandle1 = playSound("z#415.wav", 50);
+ addTimer(1, 1000, 500);
+ } else if (doorbot && _v3 == 1) {
+ _soundHandle1 = playSound("z#417.wav", 50);
+ addTimer(1, 1000, 500);
+ } else if (_fieldDC == _v3) {
+ switch (_v3) {
+ case 0:
+ _soundHandle1 = playSound("z#415.wav", 50);
+ break;
+ case 1:
+ _soundHandle1 = playSound("z#420.wav", 50);
+ break;
+ case 2:
+ _soundHandle1 = playSound("z#410.wav", 50);
+ break;
+ default:
+ break;
+ }
+
+ addTimer(1, 1000, 500);
+ } else {
+ switch (_v3) {
+ case 0:
+ _soundHandle1 = playSound("z#414.wav", 50);
+ break;
+ case 1:
+ _soundHandle1 = playSound(_fieldDC ? "z#419.wav" : "z#418.wav", 50);
+ break;
+ case 2:
+ _soundHandle1 = playSound("z#414.wav", 50);
+ break;
+ default:
+ break;
+ }
+
+ addTimer(0, 1000, 500);
+ }
+
+ return true;
+}
+
+bool CServiceElevator::LeaveRoomMsg(CLeaveRoomMsg *msg) {
+ CDoorbot *doorbot = dynamic_cast<CDoorbot *>(findRoom()->findByName("Doorbot"));
+
+ if (doorbot) {
+ CPutBotBackInHisBoxMsg boxMsg(0);
+ boxMsg.execute("Doorbot");
+ doorbot->performAction(false);
+ enableMouse();
+ }
+
+ return true;
+}
+
+bool CServiceElevator::OpeningCreditsMsg(COpeningCreditsMsg *msg) {
+ _v1 = false;
+ _string1 = "EmbLobby.Node 1.NE";
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/transport/service_elevator.h b/engines/titanic/game/transport/service_elevator.h
index b2c135021a..5cf1f6f0d5 100644
--- a/engines/titanic/game/transport/service_elevator.h
+++ b/engines/titanic/game/transport/service_elevator.h
@@ -28,15 +28,23 @@
namespace Titanic {
class CServiceElevator : public CTransport {
+ DECLARE_MESSAGE_MAP;
+ bool BodyInBilgeRoomMsg(CBodyInBilgeRoomMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool ServiceElevatorMsg(CServiceElevatorMsg *msg);
+ bool TimerMsg(CTimerMsg *msg);
+ bool ServiceElevatorFloorRequestMsg(CServiceElevatorFloorRequestMsg *msg);
+ bool LeaveRoomMsg(CLeaveRoomMsg *msg);
+ bool OpeningCreditsMsg(COpeningCreditsMsg *msg);
private:
- static int _v1;
+ static bool _v1;
static int _v2;
static int _v3;
int _fieldF8;
- int _fieldFC;
- int _field100;
- int _field104;
+ int _soundHandle1;
+ int _timerId;
+ int _soundHandle2;
public:
CLASSDEF;
CServiceElevator();