aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-11 19:40:36 -0400
committerPaul Gilbert2016-07-10 16:10:55 -0400
commit54b055bcf58e8cbcf472ea6838f3ed7ecf377e37 (patch)
tree2aca74e928a44774146043fd0d357e4ca8348112 /engines/titanic
parent7e1f802abdab1442bd49f1c398c0aab6d81d452b (diff)
downloadscummvm-rg350-54b055bcf58e8cbcf472ea6838f3ed7ecf377e37.tar.gz
scummvm-rg350-54b055bcf58e8cbcf472ea6838f3ed7ecf377e37.tar.bz2
scummvm-rg350-54b055bcf58e8cbcf472ea6838f3ed7ecf377e37.zip
TITANIC: Implementing CCarry drag end handler
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/carry/carry.cpp29
-rw-r--r--engines/titanic/carry/carry.h5
-rw-r--r--engines/titanic/core/saveable_object.cpp4
-rw-r--r--engines/titanic/messages/messages.h8
4 files changed, 40 insertions, 6 deletions
diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp
index eefb13f462..dbb7189781 100644
--- a/engines/titanic/carry/carry.cpp
+++ b/engines/titanic/carry/carry.cpp
@@ -21,6 +21,8 @@
*/
#include "titanic/carry/carry.h"
+#include "titanic/messages/messages.h"
+#include "titanic/npcs/character.h"
namespace Titanic {
@@ -118,9 +120,30 @@ bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) {
bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) {
if (msg->_dropTarget) {
- // TODO
+ if (msg->_dropTarget->isPet()) {
+ dropOnPet();
+ return true;
+ }
+
+ CCharacter *npc = static_cast<CCharacter *>(msg->_dropTarget);
+ if (npc) {
+ CUseWithCharMsg charMsg(npc);
+ charMsg.execute(this, nullptr, 0);
+ return true;
+ }
+
+ CDropObjectMsg dropMsg(this);
+ if (dropMsg.execute(msg->_dropTarget))
+ return true;
+
+ // Fall back on a use with other message
+ CUseWithOtherMsg otherMsg(msg->_dropTarget);
+ if (otherMsg.execute(this, nullptr, 0))
+ return true;
}
+ // TODO
+
return true;
}
@@ -160,4 +183,8 @@ bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
return true;
}
+void CCarry::dropOnPet() {
+ warning("TODO: dropOnPet");
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h
index b98a7bedea..33e3ac369d 100644
--- a/engines/titanic/carry/carry.h
+++ b/engines/titanic/carry/carry.h
@@ -61,6 +61,11 @@ private:
int _field120;
int _field124;
int _field128;
+protected:
+ /**
+ * Called when an item is dropped onto the PET
+ */
+ void dropOnPet();
public:
CLASSDEF
CCarry();
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index 4ef6a4a766..5b0453732b 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -778,7 +778,7 @@ DEFFN(CDonNavHelmet)
DEFFN(CDoorAutoSoundEvent)
DEFFN(CDoorbotNeededInElevatorMsg)
DEFFN(CDoorbotNeededInHomeMsg)
-DEFFN(CDropobjectMsg)
+DEFFN(CDropObjectMsg)
DEFFN(CDropZoneGotObjectMsg)
DEFFN(CDropZoneLostObjectMsg)
DEFFN(CEditControlMsg)
@@ -1363,7 +1363,7 @@ void CSaveableObject::initClassList() {
ADDFN(CDoorAutoSoundEvent, CAutoSoundEvent);
ADDFN(CDoorbotNeededInElevatorMsg, CMessage);
ADDFN(CDoorbotNeededInHomeMsg, CMessage);
- ADDFN(CDropobjectMsg, CMessage);
+ ADDFN(CDropObjectMsg, CMessage);
ADDFN(CDropZoneGotObjectMsg, CMessage);
ADDFN(CDropZoneLostObjectMsg, CMessage);
ADDFN(CEditControlMsg, CMessage);
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index e74c26fd97..474565a69c 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -79,6 +79,8 @@ enum MessageFlag {
return supports(item, _type); } \
}
+class CCarry;
+class CCharacter;
class CGameObject;
class CRoomItem;
class CNodeItem;
@@ -267,7 +269,7 @@ MESSAGE0(CDoffNavHelmet);
MESSAGE0(CDonNavHelmet);
MESSAGE1(CDoorbotNeededInElevatorMsg, int, value, 0);
MESSAGE0(CDoorbotNeededInHomeMsg);
-MESSAGE1(CDropobjectMsg, int, value, 0);
+MESSAGE1(CDropObjectMsg, CCarry *, item, nullptr);
MESSAGE1(CDropZoneGotObjectMsg, int, value, 0);
MESSAGE1(CDropZoneLostObjectMsg, int, value, 0);
MESSAGE1(CEjectCylinderMsg, int, value, 0);
@@ -389,8 +391,8 @@ MESSAGE3(CTrueTalkTriggerActionMsg, int, value1, 0, int, value2, 0, int, value3,
MESSAGE0(CTurnOff);
MESSAGE0(CTurnOn);
MESSAGE1(CUse, int, value, 0);
-MESSAGE1(CUseWithCharMsg, int, value, 0);
-MESSAGE1(CUseWithOtherMsg, int, value, 0);
+MESSAGE1(CUseWithCharMsg, CCharacter *, character, nullptr);
+MESSAGE1(CUseWithOtherMsg, CGameObject *, other, 0);
MESSAGE1(CVirtualKeyCharMsg, Common::KeyState, keyState, Common::KeyState());
MESSAGE1(CVisibleMsg, bool, visible, true);