aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-30 17:50:19 -0400
committerPaul Gilbert2016-07-10 16:37:49 -0400
commita15e299a06c8049cf4332ea2bf4b77ad0bd845e1 (patch)
treed8b875295dd665f56af3d1c245d5cd22f5fea21a /engines/titanic
parentecb14e9bc235df216fdcb8426688b455043f2ad0 (diff)
downloadscummvm-rg350-a15e299a06c8049cf4332ea2bf4b77ad0bd845e1.tar.gz
scummvm-rg350-a15e299a06c8049cf4332ea2bf4b77ad0bd845e1.tar.bz2
scummvm-rg350-a15e299a06c8049cf4332ea2bf4b77ad0bd845e1.zip
TITANIC: Implement messages PET section
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/module.mk2
-rw-r--r--engines/titanic/pet_control/pet_control.cpp12
-rw-r--r--engines/titanic/pet_control/pet_control.h4
-rw-r--r--engines/titanic/pet_control/pet_control_sub7.h44
-rw-r--r--engines/titanic/pet_control/pet_frame.cpp2
-rw-r--r--engines/titanic/pet_control/pet_message.cpp (renamed from engines/titanic/pet_control/pet_control_sub7.cpp)31
-rw-r--r--engines/titanic/pet_control/pet_message.h96
-rw-r--r--engines/titanic/pet_control/pet_section.h2
8 files changed, 135 insertions, 58 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 80041d80af..a9d758b57f 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -362,13 +362,13 @@ MODULE_OBJS := \
pet_control/pet_gfx_element.o \
pet_control/pet_inventory.o \
pet_control/pet_inventory_glyphs.o \
+ pet_control/pet_message.o \
pet_control/pet_nav_helmet.o \
pet_control/pet_rooms.o \
pet_control/pet_rooms_glyphs.o \
pet_control/pet_remote.o \
pet_control/pet_real_life.o \
pet_control/pet_section.o \
- pet_control/pet_control_sub7.o \
pet_control/pet_drag_chev.o \
pet_control/pet_graphic2.o \
pet_control/pet_graphic.o \
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 7a5fc90828..2bd8864998 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -52,7 +52,7 @@ CPetControl::CPetControl() : CGameObject(),
_sections[PET_ROOMS] = &_rooms;
_sections[PET_REAL_LIFE] = &_realLife;
_sections[PET_NAV_HELMET] = &_navHelmet;
- _sections[PET_6] = &_sub7;
+ _sections[PET_MESSAGE] = &_message;
}
void CPetControl::save(SimpleFile *file, int indent) const {
@@ -87,7 +87,7 @@ void CPetControl::setup() {
_inventory.setup(this);
_navHelmet.setup(this);
_realLife.setup(this);
- _sub7.setup(this);
+ _message.setup(this);
_frame.setup(this);
}
@@ -98,7 +98,7 @@ bool CPetControl::isValid() {
_inventory.isValid(this) &&
_navHelmet.isValid(this) &&
_realLife.isValid(this) &&
- _sub7.isValid(this) &&
+ _message.isValid(this) &&
_frame.isValid(this);
}
@@ -109,7 +109,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) {
_inventory.load(file, param);
_navHelmet.load(file, param);
_realLife.load(file, param);
- _sub7.load(file, param);
+ _message.load(file, param);
_frame.load(file, param);
}
@@ -120,7 +120,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const {
_inventory.save(file, indent);
_navHelmet.save(file, indent);
_realLife.save(file, indent);
- _sub7.save(file, indent);
+ _message.save(file, indent);
_frame.save(file, indent);
}
@@ -165,7 +165,7 @@ void CPetControl::loaded() {
_inventory.postLoad();
_navHelmet.postLoad();
_realLife.postLoad();
- _sub7.postLoad();
+ _message.postLoad();
_frame.postLoad();
}
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 7ebdbbdfa2..2c706397ea 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -31,11 +31,11 @@
#include "titanic/pet_control/pet_conversations.h"
#include "titanic/pet_control/pet_frame.h"
#include "titanic/pet_control/pet_inventory.h"
+#include "titanic/pet_control/pet_message.h"
#include "titanic/pet_control/pet_nav_helmet.h"
#include "titanic/pet_control/pet_real_life.h"
#include "titanic/pet_control/pet_remote.h"
#include "titanic/pet_control/pet_rooms.h"
-#include "titanic/pet_control/pet_control_sub7.h"
namespace Titanic {
@@ -59,7 +59,7 @@ private:
CPetRemote _remote;
CPetRooms _rooms;
CPetRealLife _realLife;
- CPetControlSub7 _sub7;
+ CPetMessage _message;
CPetFrame _frame;
CString _activeNPCName;
CString _string2;
diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h
deleted file mode 100644
index 367ce840fc..0000000000
--- a/engines/titanic/pet_control/pet_control_sub7.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef TITANIC_PET_CONTROL_SUB7_H
-#define TITANIC_PET_CONTROL_SUB7_H
-
-#include "titanic/pet_control/pet_section.h"
-#include "titanic/pet_control/pet_text.h"
-
-namespace Titanic {
-
-class CPetControlSub7 : public CPetSection {
-private:
- CPetText _text1;
- CPetText _text2;
-public:
- /**
- * Returns true if the object is in a valid state
- */
- virtual bool isValid(CPetControl *petControl);
-};
-
-} // End of namespace Titanic
-
-#endif /* TITANIC_PET_CONTROL_SUB7_H */
diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp
index dd2be96cd9..4c3c518962 100644
--- a/engines/titanic/pet_control/pet_frame.cpp
+++ b/engines/titanic/pet_control/pet_frame.cpp
@@ -126,7 +126,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) {
void CPetFrame::setArea(PetArea newArea) {
resetArea();
- if (newArea < PET_6)
+ if (newArea < PET_MESSAGE)
_modeButtons[PET_AREAS[newArea]].setMode(MODE_SELECTED);
}
diff --git a/engines/titanic/pet_control/pet_control_sub7.cpp b/engines/titanic/pet_control/pet_message.cpp
index 5b033220c7..783c9019e2 100644
--- a/engines/titanic/pet_control/pet_control_sub7.cpp
+++ b/engines/titanic/pet_control/pet_message.cpp
@@ -20,12 +20,37 @@
*
*/
-#include "titanic/pet_control/pet_control_sub7.h"
+#include "titanic/pet_control/pet_message.h"
namespace Titanic {
-bool CPetControlSub7::isValid(CPetControl *petControl) {
- // TODO
+CPetMessage::CPetMessage() {
+ Rect rect1(0, 0, 580, 70);
+ rect1.translate(32, 368);
+ _message.setBounds(rect1);
+ _message.resize(50);
+ _message.setHasBorder(false);
+
+ Rect rect2(0, 0, 580, 15);
+ rect2.translate(32, 445);
+ _tooltip.setBounds(rect2);
+ _tooltip.setHasBorder(false);
+}
+
+bool CPetMessage::setup(CPetControl *petControl) {
+ if (petControl && setupControl(petControl))
+ return reset();
+ return false;
+}
+
+void CPetMessage::draw(CScreenManager *screenManager) {
+ _message.draw(screenManager);
+ _tooltip.draw(screenManager);
+}
+
+bool CPetMessage::setupControl(CPetControl *petControl) {
+ if (petControl)
+ _petControl = petControl;
return true;
}
diff --git a/engines/titanic/pet_control/pet_message.h b/engines/titanic/pet_control/pet_message.h
new file mode 100644
index 0000000000..1ad031da65
--- /dev/null
+++ b/engines/titanic/pet_control/pet_message.h
@@ -0,0 +1,96 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_PET_MESSAGE_H
+#define TITANIC_PET_MESSAGE_H
+
+#include "titanic/pet_control/pet_section.h"
+#include "titanic/pet_control/pet_text.h"
+
+namespace Titanic {
+
+class CPetMessage : public CPetSection {
+private:
+ CPetText _message;
+ CPetText _tooltip;
+private:
+ /**
+ * Setup the control
+ */
+ bool setupControl(CPetControl *petControl);
+public:
+ CPetMessage();
+
+ /**
+ * Sets up the section
+ */
+ virtual bool setup(CPetControl *petControl);
+
+ /**
+ * Reset the section
+ */
+ virtual bool reset() { return true; }
+
+ /**
+ * Draw the section
+ */
+ virtual void draw(CScreenManager *screenManager);
+
+ /**
+ * Following are handlers for the various messages that the PET can
+ * pass onto the currently active section/area
+ */
+ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; }
+ virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; }
+
+ /**
+ * Returns true if the object is in a valid state
+ */
+ virtual bool isValid(CPetControl *petControl) {
+ return setupControl(petControl);
+ }
+
+ /**
+ * Load the data for the class from file
+ */
+ virtual void load(SimpleFile *file, int param) {}
+
+ /**
+ * Called after a game has been loaded
+ */
+ virtual void postLoad() { reset(); }
+
+ /**
+ * Save the data for the class to file
+ */
+ virtual void save(SimpleFile *file, int indent) const {}
+
+ /**
+ * Get a reference to the tooltip text associated with the section
+ */
+ virtual CPetText *getText() { return &_tooltip; }
+
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_PET_MESSAGE_H */
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index 81485ec44c..0d7ede6230 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -30,7 +30,7 @@ namespace Titanic {
enum PetArea {
PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2,
- PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_6 = 6
+ PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_MESSAGE = 6
};
class CPetControl;