From 440f0927570d30ab61fb640df22394296efbb265 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Aug 2016 22:19:06 -0400 Subject: TITANIC: Implemented more game classes --- engines/titanic/game/sgt/basin.cpp | 41 ++++++++++++++++ engines/titanic/game/sgt/basin.h | 4 ++ engines/titanic/game/sgt/bedfoot.cpp | 92 ++++++++++++++++++++++++++++++++++++ engines/titanic/game/sgt/bedfoot.h | 3 ++ engines/titanic/game/sgt/bedhead.cpp | 15 ++++++ engines/titanic/game/sgt/bedhead.h | 3 ++ 6 files changed, 158 insertions(+) (limited to 'engines/titanic/game/sgt') diff --git a/engines/titanic/game/sgt/basin.cpp b/engines/titanic/game/sgt/basin.cpp index 1eb1d161c9..3f85edc4ca 100644 --- a/engines/titanic/game/sgt/basin.cpp +++ b/engines/titanic/game/sgt/basin.cpp @@ -24,6 +24,12 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CBasin, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CBasin::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); @@ -34,4 +40,39 @@ void CBasin::load(SimpleFile *file) { CSGTStateRoom::load(file); } +bool CBasin::TurnOn(CTurnOn *msg) { + if (_statics->_v10 == "Open" && _statics->_v11 == "Closed" + || _statics->_v2 == "Closed") { + setVisible(true); + _statics->_v11 = "Open"; + _fieldE0 = 0; + _startFrame = 0; + _endFrame = 6; + playMovie(0, 6, MOVIE_GAMESTATE); + playSound("b#13.wav"); + } + + return true; +} + +bool CBasin::TurnOff(CTurnOff *msg) { + if (_statics->_v11 == "Open") { + _statics->_v11 = "Closed"; + _fieldE0 = 1; + _startFrame = 8; + _endFrame = 14; + playMovie(8, 14, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#13.wav"); + } + + return true; +} + +bool CBasin::MovieEndMsg(CMovieEndMsg *msg) { + if (_statics->_v11 == "Closed") + setVisible(false); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/basin.h b/engines/titanic/game/sgt/basin.h index e4a36eb841..1fcb469824 100644 --- a/engines/titanic/game/sgt/basin.h +++ b/engines/titanic/game/sgt/basin.h @@ -28,6 +28,10 @@ namespace Titanic { class CBasin : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/sgt/bedfoot.cpp b/engines/titanic/game/sgt/bedfoot.cpp index 18ea07aca0..b1837b15f6 100644 --- a/engines/titanic/game/sgt/bedfoot.cpp +++ b/engines/titanic/game/sgt/bedfoot.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CBedfoot, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + void CBedfoot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); @@ -34,4 +39,91 @@ void CBedfoot::load(SimpleFile *file) { CSGTStateRoom::load(file); } +bool CBedfoot::TurnOn(CTurnOn *msg) { + if (_statics->_v2 == "Closed" && _statics->_v11 == "Closed") { + _fieldE0 = 0; + _startFrame = 0; + if (_statics->_v10 == "Open") { + _endFrame = 13; + _statics->_v2 = "Open"; + playSound("b#7.wav"); + } else { + _endFrame = 17; + _statics->_v2 = "NotOnWashstand"; + playSound("b#4.wav"); + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + } else if (_statics->_v2 == "RestingUnderTV") { + _fieldE0; + _startFrame = 8; + if (_statics->_v10 == "Open") { + _statics->_v2 = "Open"; + playSound("189_436_bed down 1.wav"); + } else { + _statics->_v2 = "NotOnWashstand"; + playSound("192_436_bed hits floor.wav"); + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + } + + if (_statics->_v2 == "Open") + _statics->_v1 = "Closed"; + else if (_statics->_v2 == "NotOnWashstand") + _statics->_v1 = "ClosedWrong"; + + return true; +} + +bool CBedfoot::TurnOff(CTurnOff *msg) { + if (_statics->_v1 == "Closed" || _statics->_v1 == "ClosedWrong") { + setVisible(true); + CVisibleMsg visibleMsg(false); + visibleMsg.execute("Bedhead"); + } + + if (_statics->_v2 == "Open" && _statics->_v1 == "Closed") { + _fieldE0 = 0; + _startFrame = 20; + if (_statics->_v4 == "Closed") { + _statics->_v2 = "Closed"; + _endFrame = 30; + } else { + _statics->_v2 = "RestingUnderTV"; + _endFrame = 25; + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playSound("b#7.wav"); + + } else if (_statics->_v2 == "NotOnWashstand" && _statics->_v1 == "ClosedWrong") { + _fieldE0 = 0; + _startFrame = 17; + + if (_statics->_v4 == "Closed") { + _statics->_v2 = "Closed"; + _endFrame = 30; + } else { + _statics->_v2 = "RestingUnderTV"; + _endFrame = 25; + } + + playMovie(_startFrame, _endFrame, MOVIE_GAMESTATE); + playSound("b#7.wav"); + + } else if (_statics->_v2 == "RestingUTV" && _statics->_v4 == "Closed") { + _statics->_v2 = "Closed"; + _startFrame = 25; + _endFrame = 30; + playMovie(25, 30, MOVIE_GAMESTATE); + playSound("b#7.wav"); + } + + if (_statics->_v2 == "Closed") + _statics->_v1 = "Closed"; + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/bedfoot.h b/engines/titanic/game/sgt/bedfoot.h index df3db42d6d..cc7b82b075 100644 --- a/engines/titanic/game/sgt/bedfoot.h +++ b/engines/titanic/game/sgt/bedfoot.h @@ -28,6 +28,9 @@ namespace Titanic { class CBedfoot : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); public: CLASSDEF; diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp index fad7272f3a..6f427ab625 100644 --- a/engines/titanic/game/sgt/bedhead.cpp +++ b/engines/titanic/game/sgt/bedhead.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CBedhead, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + void CBedhead::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); @@ -34,4 +39,14 @@ void CBedhead::load(SimpleFile *file) { CSGTStateRoom::load(file); } +bool CBedhead::TurnOn(CTurnOn *msg) { + // TODO + return true; +} + +bool CBedhead::TurnOff(CTurnOff *msg) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/bedhead.h b/engines/titanic/game/sgt/bedhead.h index f1ba31786c..665dec021c 100644 --- a/engines/titanic/game/sgt/bedhead.h +++ b/engines/titanic/game/sgt/bedhead.h @@ -28,6 +28,9 @@ namespace Titanic { class CBedhead : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); public: CLASSDEF; -- cgit v1.2.3