aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/empty_nut_bowl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/game/empty_nut_bowl.cpp')
-rw-r--r--engines/titanic/game/empty_nut_bowl.cpp43
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