aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/sgt
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-28 09:14:30 -0400
committerPaul Gilbert2016-08-28 09:14:30 -0400
commit1dcfe25808164c5f2540662028862ac8a0e56831 (patch)
tree4fb480db39f98010c91ad1283fa66eb77abfb810 /engines/titanic/game/sgt
parent9e5ddfee1d3741af0a5e8ad4c39aeb9c86aea22a (diff)
downloadscummvm-rg350-1dcfe25808164c5f2540662028862ac8a0e56831.tar.gz
scummvm-rg350-1dcfe25808164c5f2540662028862ac8a0e56831.tar.bz2
scummvm-rg350-1dcfe25808164c5f2540662028862ac8a0e56831.zip
TITANIC: Implemented SGT game classes
Diffstat (limited to 'engines/titanic/game/sgt')
-rw-r--r--engines/titanic/game/sgt/sgt_doors.cpp61
-rw-r--r--engines/titanic/game/sgt/sgt_doors.h10
-rw-r--r--engines/titanic/game/sgt/sgt_navigation.cpp79
-rw-r--r--engines/titanic/game/sgt/sgt_navigation.h6
-rw-r--r--engines/titanic/game/sgt/sgt_restaurant_doors.cpp10
-rw-r--r--engines/titanic/game/sgt/sgt_restaurant_doors.h2
-rw-r--r--engines/titanic/game/sgt/sgt_state_control.cpp47
-rw-r--r--engines/titanic/game/sgt/sgt_state_control.h11
-rw-r--r--engines/titanic/game/sgt/sgt_tv.cpp37
-rw-r--r--engines/titanic/game/sgt/sgt_tv.h4
10 files changed, 256 insertions, 11 deletions
diff --git a/engines/titanic/game/sgt/sgt_doors.cpp b/engines/titanic/game/sgt/sgt_doors.cpp
index 516b0f1351..71eae9800c 100644
--- a/engines/titanic/game/sgt/sgt_doors.cpp
+++ b/engines/titanic/game/sgt/sgt_doors.cpp
@@ -21,13 +21,21 @@
*/
#include "titanic/game/sgt/sgt_doors.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSGTDoors, CGameObject)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(LeaveViewMsg)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(LeaveRoomMsg)
+END_MESSAGE_MAP()
+
void CSGTDoors::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_value1, indent);
- file->writeNumberLine(_value2, indent);
+ file->writeNumberLine(_open, indent);
CGameObject::save(file, indent);
}
@@ -35,9 +43,58 @@ void CSGTDoors::save(SimpleFile *file, int indent) {
void CSGTDoors::load(SimpleFile *file) {
file->readNumber();
_value1 = file->readNumber();
- _value2 = file->readNumber();
+ _open = file->readNumber();
CGameObject::load(file);
}
+bool CSGTDoors::EnterViewMsg(CEnterViewMsg *msg) {
+ setVisible(true);
+ _open = true;
+ CPetControl *pet = getPetControl();
+
+ if (pet) {
+ int roomNum = pet->getRoomsRoomNum();
+ static const int START_FRAMES[7] = { 0, 26, 30, 34, 38, 42, 46 };
+ static const int END_FRAMES[7] = { 12, 29, 33, 37, 41, 45, 49 };
+
+ if (pet->getRooms1CC() == 1)
+ playMovie(START_FRAMES[roomNum], END_FRAMES[roomNum],
+ MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ else
+ playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ }
+
+ return true;
+}
+
+bool CSGTDoors::LeaveViewMsg(CLeaveViewMsg *msg) {
+ return true;
+}
+
+bool CSGTDoors::MovieEndMsg(CMovieEndMsg *msg) {
+ setVisible(!_open);
+ return true;
+}
+
+bool CSGTDoors::LeaveRoomMsg(CLeaveRoomMsg *msg) {
+ setVisible(true);
+ _open = false;
+ CPetControl *pet = getPetControl();
+
+ if (pet) {
+ int roomNum = pet->getRoomsRoomNum();
+ static const int START_FRAMES[7] = { 12, 69, 65, 61, 57, 53, 49 };
+ static const int END_FRAMES[7] = { 25, 72, 68, 64, 60, 56, 52 };
+
+ if (pet->getRooms1CC() == 1)
+ playMovie(START_FRAMES[roomNum], END_FRAMES[roomNum],
+ MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ else
+ playMovie(12, 25, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sgt/sgt_doors.h b/engines/titanic/game/sgt/sgt_doors.h
index 4b4f4a3153..b19c5860af 100644
--- a/engines/titanic/game/sgt/sgt_doors.h
+++ b/engines/titanic/game/sgt/sgt_doors.h
@@ -28,11 +28,17 @@
namespace Titanic {
class CSGTDoors : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
+ bool LeaveRoomMsg(CLeaveRoomMsg *msg);
public:
- int _value1, _value2;
+ int _value1;
+ bool _open;
public:
CLASSDEF;
- CSGTDoors() : CGameObject(), _value1(0), _value2(0) {}
+ CSGTDoors() : CGameObject(), _value1(0), _open(false) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/sgt/sgt_navigation.cpp b/engines/titanic/game/sgt/sgt_navigation.cpp
index 7bb64f934d..031226226f 100644
--- a/engines/titanic/game/sgt/sgt_navigation.cpp
+++ b/engines/titanic/game/sgt/sgt_navigation.cpp
@@ -21,9 +21,16 @@
*/
#include "titanic/game/sgt/sgt_navigation.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSGTNavigation, CGameObject)
+ ON_MESSAGE(StatusChangeMsg)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(EnterViewMsg)
+END_MESSAGE_MAP()
+
CSGTNavigationStatics *CSGTNavigation::_statics;
void CSGTNavigation::init() {
@@ -36,7 +43,7 @@ void CSGTNavigation::deinit() {
void CSGTNavigation::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_statics->_changeViewFlag, indent);
+ file->writeNumberLine(_statics->_changeViewNum, indent);
file->writeQuotedLine(_statics->_destView, indent);
file->writeQuotedLine(_statics->_destRoom, indent);
@@ -45,11 +52,79 @@ void CSGTNavigation::save(SimpleFile *file, int indent) {
void CSGTNavigation::load(SimpleFile *file) {
file->readNumber();
- _statics->_changeViewFlag = file->readNumber();
+ _statics->_changeViewNum = file->readNumber();
_statics->_destView = file->readString();
_statics->_destRoom = file->readString();
CGameObject::load(file);
}
+bool CSGTNavigation::StatusChangeMsg(CStatusChangeMsg *msg) {
+ CPetControl *pet = getPetControl();
+
+ if (isEquals("SGTLL")) {
+ static const int FRAMES[7] = { 0, 149, 112, 74, 0, 36, 74 };
+ _statics->_changeViewNum = msg->_newStatus;
+ if (pet->getRooms1CC() != _statics->_changeViewNum) {
+ changeView("SGTLittleLift.Node 1.N");
+ }
+
+ int startVal = pet->getRooms1CC();
+ if (startVal > _statics->_changeViewNum)
+ playMovie(FRAMES[startVal], FRAMES[_statics->_changeViewNum], MOVIE_GAMESTATE);
+ else
+ playMovie(FRAMES[startVal + 3], FRAMES[_statics->_changeViewNum + 3], MOVIE_GAMESTATE);
+
+ _cursorId = _statics->_changeViewNum != 1 ? CURSOR_MOVE_FORWARD : CURSOR_INVALID;
+
+ pet->setRooms1CC(_statics->_changeViewNum);
+ pet->resetRoomsHighlight();
+ }
+
+ return true;
+}
+
+bool CSGTNavigation::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (compareRoomNameTo("SgtLobby")) {
+ _statics->_destView = getRoomNodeName();
+ _statics->_destRoom = "SgtLobby";
+ changeView("SGTState.Node 1.S");
+ } else if (compareRoomNameTo("SGTLittleLift")) {
+ if (_statics->_changeViewNum != 1) {
+ _statics->_destRoom = "SGTLittleLift";
+ changeView("SGTState.Node 1.S");
+ }
+ } else if (compareRoomNameTo("SGTState")) {
+ if (_statics->_destRoom == "SgtLobby") {
+ if (compareViewNameTo("SGTState.Node 2.N")) {
+ changeView("SGTState.Node 1.N");
+ _statics->_destView += ".S";
+ } else {
+ _statics->_destView += ".N";
+ }
+
+ changeView(_statics->_destView);
+ } else if (_statics->_destRoom == "SGTLittleLift") {
+ if (compareViewNameTo("SGTState.Node 1.S")) {
+ changeView("SGTLittleLift.Node 1.N");
+ } else {
+ changeView("SGTState.Node 1.N");
+ changeView("SGTLittleLift.Node 1.S");
+ }
+ }
+ }
+
+ return true;
+}
+
+bool CSGTNavigation::EnterViewMsg(CEnterViewMsg *msg) {
+ if (isEquals("SGTLL")) {
+ static const int FRAMES[3] = { 0, 36, 74 };
+ CPetControl *pet = getPetControl();
+ loadFrame(FRAMES[pet->getRooms1CC() - 1]);
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sgt/sgt_navigation.h b/engines/titanic/game/sgt/sgt_navigation.h
index ed58d918e9..69ecd1267a 100644
--- a/engines/titanic/game/sgt/sgt_navigation.h
+++ b/engines/titanic/game/sgt/sgt_navigation.h
@@ -28,12 +28,16 @@
namespace Titanic {
struct CSGTNavigationStatics {
- bool _changeViewFlag;
+ int _changeViewNum;
CString _destView;
CString _destRoom;
};
class CSGTNavigation : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool StatusChangeMsg(CStatusChangeMsg *msg);
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
protected:
static CSGTNavigationStatics *_statics;
public:
diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.cpp b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp
index 74a71e75b2..5c36ceb0ff 100644
--- a/engines/titanic/game/sgt/sgt_restaurant_doors.cpp
+++ b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp
@@ -24,6 +24,10 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSGTRestaurantDoors, CGameObject)
+ ON_MESSAGE(MouseButtonDownMsg)
+END_MESSAGE_MAP()
+
void CSGTRestaurantDoors::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_fieldBC, indent);
@@ -36,4 +40,10 @@ void CSGTRestaurantDoors::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CSGTRestaurantDoors::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ CTurnOff offMsg;
+ offMsg.execute("ChickenDispenser");
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.h b/engines/titanic/game/sgt/sgt_restaurant_doors.h
index 2a10d8f059..bcaaa71014 100644
--- a/engines/titanic/game/sgt/sgt_restaurant_doors.h
+++ b/engines/titanic/game/sgt/sgt_restaurant_doors.h
@@ -28,6 +28,8 @@
namespace Titanic {
class CSGTRestaurantDoors : public CGameObject {
+ DECLARE_MESSAGE_MAP;
+ bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
private:
int _fieldBC;
public:
diff --git a/engines/titanic/game/sgt/sgt_state_control.cpp b/engines/titanic/game/sgt/sgt_state_control.cpp
index 07c1f5efc0..9617f2f127 100644
--- a/engines/titanic/game/sgt/sgt_state_control.cpp
+++ b/engines/titanic/game/sgt/sgt_state_control.cpp
@@ -24,16 +24,59 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSGTStateControl, CBackground)
+ ON_MESSAGE(PETUpMsg)
+ ON_MESSAGE(PETDownMsg)
+ ON_MESSAGE(PETActivateMsg)
+ ON_MESSAGE(EnterViewMsg)
+ ON_MESSAGE(LeaveViewMsg)
+END_MESSAGE_MAP()
+
void CSGTStateControl::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldE0, indent);
+ file->writeNumberLine(_state, indent);
CBackground::save(file, indent);
}
void CSGTStateControl::load(SimpleFile *file) {
file->readNumber();
- _fieldE0 = file->readNumber();
+ _state = file->readNumber();
CBackground::load(file);
}
+bool CSGTStateControl::PETUpMsg(CPETUpMsg *msg) {
+ // WORKAROUND: Redundant code in original not included
+ return true;
+}
+
+bool CSGTStateControl::PETDownMsg(CPETDownMsg *msg) {
+ // WORKAROUND: Redundant code in original not included
+ return true;
+}
+
+bool CSGTStateControl::PETActivateMsg(CPETActivateMsg *msg) {
+ if (msg->_name == "SGTSelector") {
+ static const char *const TARGETS[] = {
+ "Vase", "Bedfoot", "Toilet", "Drawer", "SGTTV", "Armchair", "BedHead",
+ "WashStand", "Desk", "DeskChair", "Basin", "ChestOfDrawers"
+ };
+ _state = msg->_numValue;
+ CActMsg actMsg;
+ actMsg.execute(TARGETS[_state]);
+ }
+
+ return true;
+}
+
+bool CSGTStateControl::EnterViewMsg(CEnterViewMsg *msg) {
+ _state = 1;
+ petSetRemoteTarget();
+ return true;
+}
+
+bool CSGTStateControl::LeaveViewMsg(CLeaveViewMsg *msg) {
+ petClear();
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sgt/sgt_state_control.h b/engines/titanic/game/sgt/sgt_state_control.h
index 49fd5113cd..6f96359761 100644
--- a/engines/titanic/game/sgt/sgt_state_control.h
+++ b/engines/titanic/game/sgt/sgt_state_control.h
@@ -24,15 +24,22 @@
#define TITANIC_SGT_STATE_CONTROL_H
#include "titanic/core/background.h"
+#include "titanic/messages/pet_messages.h"
namespace Titanic {
class CSGTStateControl : public CBackground {
+ DECLARE_MESSAGE_MAP;
+ bool PETUpMsg(CPETUpMsg *msg);
+ bool PETDownMsg(CPETDownMsg *msg);
+ bool PETActivateMsg(CPETActivateMsg *msg);
+ bool EnterViewMsg(CEnterViewMsg *msg);
+ bool LeaveViewMsg(CLeaveViewMsg *msg);
private:
- int _fieldE0;
+ int _state;
public:
CLASSDEF;
- CSGTStateControl() : CBackground(), _fieldE0(1) {}
+ CSGTStateControl() : CBackground(), _state(1) {}
/**
* Save the data for the class to file
diff --git a/engines/titanic/game/sgt/sgt_tv.cpp b/engines/titanic/game/sgt/sgt_tv.cpp
index ae4c59e2f9..08ed381b2b 100644
--- a/engines/titanic/game/sgt/sgt_tv.cpp
+++ b/engines/titanic/game/sgt/sgt_tv.cpp
@@ -24,6 +24,12 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CSGTTV, CSGTStateRoom)
+ ON_MESSAGE(TurnOff)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
void CSGTTV::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CSGTStateRoom::save(file, indent);
@@ -34,4 +40,35 @@ void CSGTTV::load(SimpleFile *file) {
CSGTStateRoom::load(file);
}
+bool CSGTTV::TurnOff(CTurnOff *msg) {
+ if (CSGTStateRoom::_statics->_v4 == "Open") {
+ CSGTStateRoom::_statics->_v4 = "Closed";
+ _fieldE0 = true;
+ _startFrame = 6;
+ _endFrame = 12;
+ playMovie(6, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE);
+ }
+
+ return true;
+}
+
+bool CSGTTV::TurnOn(CTurnOn *msg) {
+ if (CSGTStateRoom::_statics->_v4 == "Closed" &&
+ CSGTStateRoom::_statics->_v2 == "Closed") {
+ CSGTStateRoom::_statics->_v4 = "Open";
+ setVisible(true);
+ _fieldE0 = false;
+ _startFrame = 1;
+ _endFrame = 6;
+ playMovie(1, 6, MOVIE_GAMESTATE);
+ }
+
+ return true;
+}
+
+bool CSGTTV::MovieEndMsg(CMovieEndMsg *msg) {
+ setVisible(false);
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/game/sgt/sgt_tv.h b/engines/titanic/game/sgt/sgt_tv.h
index 90fed90efe..e5de38e84b 100644
--- a/engines/titanic/game/sgt/sgt_tv.h
+++ b/engines/titanic/game/sgt/sgt_tv.h
@@ -28,6 +28,10 @@
namespace Titanic {
class CSGTTV : public CSGTStateRoom {
+ DECLARE_MESSAGE_MAP;
+ bool TurnOff(CTurnOff *msg);
+ bool TurnOn(CTurnOn *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
public:
CLASSDEF;