aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
authorPaul Gilbert2016-03-31 23:25:19 -0400
committerPaul Gilbert2016-03-31 23:25:19 -0400
commit18fabbb2d40ce9456d4673c0b7c602f50458b583 (patch)
treef8b3c54d774b89a7abe5c2c24c2a88375f3a7847 /engines/titanic/pet_control
parent5923ee5001af91d1ca9294b1fead56ec04ece7df (diff)
downloadscummvm-rg350-18fabbb2d40ce9456d4673c0b7c602f50458b583.tar.gz
scummvm-rg350-18fabbb2d40ce9456d4673c0b7c602f50458b583.tar.bz2
scummvm-rg350-18fabbb2d40ce9456d4673c0b7c602f50458b583.zip
TITANIC: Beginnings of PET event handling code
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r--engines/titanic/pet_control/pet_control.cpp99
-rw-r--r--engines/titanic/pet_control/pet_control.h25
-rw-r--r--engines/titanic/pet_control/pet_section.h8
3 files changed, 129 insertions, 3 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 6df688ef75..9d2622ffb6 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -157,7 +157,7 @@ Rect CPetControl::getBounds() {
return _sub7.getBounds();
break;
default:
- break;
+ return Rect();
}
}
@@ -342,4 +342,101 @@ bool CPetControl::containsPt(const Common::Point &pt) const {
return _drawBounds.contains(pt);
}
+bool CPetControl::getC0() const {
+ return _fieldC0 > 0;
+}
+
+bool CPetControl::handleMessage(CMouseButtonDownMsg &msg) {
+ return true;
+}
+
+bool CPetControl::handleMessage(CMouseDragStartMsg &msg) {
+ return true;
+}
+
+bool CPetControl::handleMessage(CMouseDragMoveMsg &msg) {
+ return true;
+}
+
+bool CPetControl::handleMessage(CMouseDragEndMsg &msg) {
+ return true;
+}
+
+bool CPetControl::handleMessage(CMouseButtonUpMsg &msg) {
+ return true;
+}
+
+bool CPetControl::handleMessage(CMouseDoubleClickMsg &msg) {
+ return true;
+}
+
+bool CPetControl::handleMessage(CKeyCharMsg &msg) {
+ return true;
+}
+
+bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) {
+ if (getC0())
+ return false;
+
+ bool result = false;
+ switch (_currentArea) {
+ case PET_INVENTORY:
+ result = _inventory.handleMessage(msg);
+ break;
+ case PET_CONVERSATION:
+ result = _conversations.handleMessage(msg);
+ break;
+ case PET_REMOTE:
+ result = _remote.handleMessage(msg);
+ break;
+ case PET_ROOMS:
+ result = _rooms.handleMessage(msg);
+ break;
+ case PET_SAVE:
+ result = _saves.handleMessage(msg);
+ break;
+ case PET_5:
+ result = _sub5.handleMessage(msg);
+ break;
+ case PET_6:
+ result = _sub7.handleMessage(msg);
+ break;
+ default:
+ break;
+ }
+
+ if (!result) {
+ switch (msg._keyState.keycode) {
+ case Common::KEYCODE_F1:
+ result = true;
+ setArea(PET_INVENTORY);
+ break;
+ case Common::KEYCODE_F2:
+ result = true;
+ setArea(PET_CONVERSATION);
+ break;
+ case Common::KEYCODE_F3:
+ result = true;
+ setArea(PET_REMOTE);
+ break;
+ case Common::KEYCODE_F4:
+ result = true;
+ setArea(PET_ROOMS);
+ break;
+ case Common::KEYCODE_F5:
+ result = true;
+ setArea(PET_SAVE);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return result;
+}
+
+bool CPetControl::handleMessage(CTimerMsg &msg) {
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 24ab78a963..be3b4a6118 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -26,6 +26,8 @@
#include "titanic/core/game_object.h"
#include "titanic/core/node_item.h"
#include "titanic/core/room_item.h"
+#include "titanic/messages/messages.h"
+#include "titanic/messages/mouse_messages.h"
#include "titanic/pet_control/pet_conversation_section.h"
#include "titanic/pet_control/pet_frame.h"
#include "titanic/pet_control/pet_inventory_section.h"
@@ -37,7 +39,16 @@
namespace Titanic {
-class CPetControl : public CGameObject {
+class CPetControl : public CGameObject,
+ public CMouseButtonDownMsgTarget,
+ public CMouseDragStartMsgTarget,
+ public CMouseDragMoveMsgTarget,
+ public CMouseDragEndMsgTarget,
+ public CMouseButtonUpMsgTarget,
+ public CMouseDoubleClickMsgTarget,
+ public CKeyCharMsgTarget,
+ public CVirtualKeyCharMsgTarget,
+ public CTimerMsgTarget {
private:
int _fieldC0;
int _locked;
@@ -86,6 +97,18 @@ private:
* Returns true if the draw bounds contains the specified point
*/
bool containsPt(const Common::Point &pt) const;
+
+ bool getC0() const;
+protected:
+ bool handleMessage(CMouseButtonDownMsg &msg);
+ bool handleMessage(CMouseDragStartMsg &msg);
+ bool handleMessage(CMouseDragMoveMsg &msg);
+ bool handleMessage(CMouseDragEndMsg &msg);
+ bool handleMessage(CMouseButtonUpMsg &msg);
+ bool handleMessage(CMouseDoubleClickMsg &msg);
+ bool handleMessage(CKeyCharMsg &msg);
+ bool handleMessage(CVirtualKeyCharMsg &msg);
+ bool handleMessage(CTimerMsg &msg);
public:
PetArea _currentArea;
public:
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index b08e4d6869..f81e8d0aa9 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -23,6 +23,7 @@
#ifndef TITANIC_PET_SECTION_H
#define TITANIC_PET_SECTION_H
+#include "titanic/messages/messages.h"
#include "titanic/simple_file.h"
namespace Titanic {
@@ -81,7 +82,12 @@ public:
virtual int proc10() { return 0; }
virtual int proc11() { return 0; }
virtual int proc12() { return 0; }
- virtual int proc13() { return 0; }
+
+ /**
+ * Handles special keypresses
+ */
+ virtual bool handleMessage(CVirtualKeyCharMsg &msg) { return false; }
+
virtual int proc14() { return 0; }
virtual int proc15() { return 0; }
virtual void proc16();