aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/hammer_clip.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-22 19:25:36 -0400
committerPaul Gilbert2016-08-22 19:25:36 -0400
commit65bc8cb83c01cc1e7e6c8c093b8f42080800718d (patch)
tree2b53d3e66b85ea775ab5131f2971764d93232183 /engines/titanic/game/hammer_clip.cpp
parentf238ed18ec24debf7f1b8713abf1ce3ebbeeaec3 (diff)
downloadscummvm-rg350-65bc8cb83c01cc1e7e6c8c093b8f42080800718d.tar.gz
scummvm-rg350-65bc8cb83c01cc1e7e6c8c093b8f42080800718d.tar.bz2
scummvm-rg350-65bc8cb83c01cc1e7e6c8c093b8f42080800718d.zip
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic/game/hammer_clip.cpp')
-rw-r--r--engines/titanic/game/hammer_clip.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/engines/titanic/game/hammer_clip.cpp b/engines/titanic/game/hammer_clip.cpp
index e3f3a09a90..7fb64350af 100644
--- a/engines/titanic/game/hammer_clip.cpp
+++ b/engines/titanic/game/hammer_clip.cpp
@@ -21,9 +21,16 @@
*/
#include "titanic/game/hammer_clip.h"
+#include "titanic/core/project_item.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CHammerClip, CGameObject)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(StatusChangeMsg)
+ ON_MESSAGE(MouseDragStartMsg)
+END_MESSAGE_MAP()
+
void CHammerClip::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
file->writeNumberLine(_value, indent);
@@ -36,4 +43,41 @@ void CHammerClip::load(SimpleFile *file) {
CGameObject::load(file);
}
+bool CHammerClip::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ return true;
+}
+
+bool CHammerClip::StatusChangeMsg(CStatusChangeMsg *msg) {
+ _value = msg->_newStatus == 1;
+ if (_value) {
+ CPuzzleSolvedMsg solvedMsg;
+ solvedMsg.execute("BigHammer");
+ _cursorId = CURSOR_HAND;
+ }
+
+ return true;
+}
+
+bool CHammerClip::MouseDragStartMsg(CMouseDragStartMsg *msg) {
+ if (!checkStartDragging(msg))
+ return false;
+
+ if (_value) {
+ CVisibleMsg visibleMsg(true);
+ visibleMsg.execute("BigHammer");
+ CPassOnDragStartMsg passMsg(msg->_mousePos, 1);
+ passMsg.execute("BigHammer");
+
+ msg->_dragItem = getRoot()->findByName("BigHammer");
+
+ CActMsg actMsg("HammerTaken");
+ actMsg.execute("HammerDispensor");
+ actMsg.execute("HammerDispensorButton");
+ _cursorId = CURSOR_ARROW;
+ _value = 0;
+ }
+
+ return true;
+}
+
} // End of namespace Titanic