aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/sgt/toilet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/game/sgt/toilet.cpp')
-rw-r--r--engines/titanic/game/sgt/toilet.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/engines/titanic/game/sgt/toilet.cpp b/engines/titanic/game/sgt/toilet.cpp
index 799abd6c76..b8e87b645a 100644
--- a/engines/titanic/game/sgt/toilet.cpp
+++ b/engines/titanic/game/sgt/toilet.cpp
@@ -24,6 +24,12 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CToilet, CSGTStateRoom)
+ ON_MESSAGE(TurnOn)
+ ON_MESSAGE(TurnOff)
+ ON_MESSAGE(MovieEndMsg)
+END_MESSAGE_MAP()
+
void CToilet::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
CSGTStateRoom::save(file, indent);
@@ -34,4 +40,42 @@ void CToilet::load(SimpleFile *file) {
CSGTStateRoom::load(file);
}
+bool CToilet::TurnOn(CTurnOn *msg) {
+ if (CSGTStateRoom::_statics->_v12 == "Closed"
+ && CSGTStateRoom::_statics->_v10 == "Open"
+ && CSGTStateRoom::_statics->_v8 == "Closed") {
+ setVisible(true);
+ CSGTStateRoom::_statics->_v12 = "Open";
+
+ _fieldE0 = false;
+ _startFrame = 0;
+ _endFrame = 11;
+ playMovie(0, 11, MOVIE_GAMESTATE);
+ playSound("b#1.wav");
+ }
+
+ return true;
+}
+
+bool CToilet::TurnOff(CTurnOff *msg) {
+ if (CSGTStateRoom::_statics->_v12 == "Open") {
+ CSGTStateRoom::_statics->_v12 = "Closed";
+
+ _fieldE0 = true;
+ _startFrame = 11;
+ _endFrame = 18;
+ playMovie(11, 18, MOVIE_GAMESTATE);
+ playSound("b#1.wav");
+ }
+
+ return true;
+}
+
+bool CToilet::MovieEndMsg(CMovieEndMsg *msg) {
+ if (CSGTStateRoom::_statics->_v12 == "Closed")
+ setVisible(false);
+
+ return true;
+}
+
} // End of namespace Titanic