diff options
author | Paul Gilbert | 2016-08-17 22:15:05 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-17 22:15:05 -0400 |
commit | bf5835b0dcd8134a82221804be0eb6c415adeeb5 (patch) | |
tree | 5c20cb3f28fc1b4c68f1138aa3969028366bb34b /engines/titanic/game/sgt | |
parent | 41dab514e1f7dc4bbf9ff9bab21c5dc5cad7812f (diff) | |
download | scummvm-rg350-bf5835b0dcd8134a82221804be0eb6c415adeeb5.tar.gz scummvm-rg350-bf5835b0dcd8134a82221804be0eb6c415adeeb5.tar.bz2 scummvm-rg350-bf5835b0dcd8134a82221804be0eb6c415adeeb5.zip |
TITANIC: Implementing game logic classes
Diffstat (limited to 'engines/titanic/game/sgt')
-rw-r--r-- | engines/titanic/game/sgt/chest_of_drawers.cpp | 43 | ||||
-rw-r--r-- | engines/titanic/game/sgt/chest_of_drawers.h | 4 |
2 files changed, 47 insertions, 0 deletions
diff --git a/engines/titanic/game/sgt/chest_of_drawers.cpp b/engines/titanic/game/sgt/chest_of_drawers.cpp index be62e12c8e..d9c72d3021 100644 --- a/engines/titanic/game/sgt/chest_of_drawers.cpp +++ b/engines/titanic/game/sgt/chest_of_drawers.cpp @@ -24,6 +24,12 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CChestOfDrawers, CSGTStateRoom) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CChestOfDrawers::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); @@ -34,4 +40,41 @@ void CChestOfDrawers::load(SimpleFile *file) { CSGTStateRoom::load(file); } +bool CChestOfDrawers::TurnOn(CTurnOn *msg) { + if (_statics->_v6 == "Closed" && _statics->_v5 == "Open") { + _fieldE0 = false; + _statics->_v6 = "Open"; + _startFrame = 1; + _endFrame = 14; + playSound("b#11.wav"); + } + + return true; +} + +bool CChestOfDrawers::TurnOff(CTurnOff *msg) { + if (_statics->_v6 == "Open" && _statics->_v5 == "Closed") { + CVisibleMsg visibleMsg; + visibleMsg.execute("Drawer"); + _statics->_v6 = "Closed"; + _fieldE0 = true; + + _startFrame = 14; + _endFrame = 27; + playMovie(14, 27, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + playSound("b#11.wav"); + } + + return true; +} + +bool CChestOfDrawers::MovieEndMsg(CMovieEndMsg *msg) { + if (_statics->_v6 == "Open") { + CVisibleMsg visibleMsg; + visibleMsg.execute("Drawer"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/chest_of_drawers.h b/engines/titanic/game/sgt/chest_of_drawers.h index 16a1bf8fea..5bf852902b 100644 --- a/engines/titanic/game/sgt/chest_of_drawers.h +++ b/engines/titanic/game/sgt/chest_of_drawers.h @@ -28,6 +28,10 @@ namespace Titanic { class CChestOfDrawers : public CSGTStateRoom { + DECLARE_MESSAGE_MAP; + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool MovieEndMsg(CMovieEndMsg *msg); public: CLASSDEF; |