diff options
author | Paul Gilbert | 2016-08-19 23:41:19 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-19 23:41:19 -0400 |
commit | 3c2c82fcd593e7b358f359de69070b6dd0e92150 (patch) | |
tree | 53251f5642b35626c606633cfe7baa1ce87b1fea /engines/titanic/game/empty_nut_bowl.cpp | |
parent | 449d8a02e05754e889e13ff721ff2c0cb995c486 (diff) | |
download | scummvm-rg350-3c2c82fcd593e7b358f359de69070b6dd0e92150.tar.gz scummvm-rg350-3c2c82fcd593e7b358f359de69070b6dd0e92150.tar.bz2 scummvm-rg350-3c2c82fcd593e7b358f359de69070b6dd0e92150.zip |
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic/game/empty_nut_bowl.cpp')
-rw-r--r-- | engines/titanic/game/empty_nut_bowl.cpp | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/engines/titanic/game/empty_nut_bowl.cpp b/engines/titanic/game/empty_nut_bowl.cpp index ae9cb35e4d..adee2589f6 100644 --- a/engines/titanic/game/empty_nut_bowl.cpp +++ b/engines/titanic/game/empty_nut_bowl.cpp @@ -21,19 +21,58 @@ */ #include "titanic/game/empty_nut_bowl.h" +#include "titanic/core/room_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CEmptyNutBowl, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ReplaceBowlAndNutsMsg) + ON_MESSAGE(NutPuzzleMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + void CEmptyNutBowl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_value, indent); + file->writeNumberLine(_flag, indent); CGameObject::save(file, indent); } void CEmptyNutBowl::load(SimpleFile *file) { file->readNumber(); - _value = file->readNumber(); + _flag = file->readNumber(); CGameObject::load(file); } +bool CEmptyNutBowl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_flag) { + CNutPuzzleMsg nutMsg("UnlockBowl"); + nutMsg.execute(getRoom(), nullptr, MSGFLAG_SCAN); + _flag = false; + } + + return true; +} + +bool CEmptyNutBowl::ReplaceBowlAndNutsMsg(CReplaceBowlAndNutsMsg *msg) { + setVisible(false); + _flag = true; + return true; +} + +bool CEmptyNutBowl::NutPuzzleMsg(CNutPuzzleMsg *msg) { + if (msg->_value == "NutsGone") + setVisible(true); + return true; +} + +bool CEmptyNutBowl::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!_flag) { + msg->execute("Ear1"); + setVisible(false); + } + + return true; +} + } // End of namespace Titanic |