aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-30 16:52:42 -0400
committerPaul Gilbert2016-07-10 16:37:47 -0400
commitb013d10d8f44e9f611ff205304f451e4e35ee14e (patch)
tree7527d6919a780c0bb920bdb8c8fc8210aa5c9019 /engines/titanic/pet_control
parentd46d3f7b0dc6f3b401860f6274ebbf04710f06ca (diff)
downloadscummvm-rg350-b013d10d8f44e9f611ff205304f451e4e35ee14e.tar.gz
scummvm-rg350-b013d10d8f44e9f611ff205304f451e4e35ee14e.tar.bz2
scummvm-rg350-b013d10d8f44e9f611ff205304f451e4e35ee14e.zip
TITANIC: Implementing PET Nav Helmet section
Diffstat (limited to 'engines/titanic/pet_control')
-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_sub5.cpp48
-rw-r--r--engines/titanic/pet_control/pet_frame.cpp2
-rw-r--r--engines/titanic/pet_control/pet_nav_helmet.cpp156
-rw-r--r--engines/titanic/pet_control/pet_nav_helmet.h (renamed from engines/titanic/pet_control/pet_control_sub5.h)59
-rw-r--r--engines/titanic/pet_control/pet_section.h2
7 files changed, 214 insertions, 69 deletions
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 6be026167a..7a5fc90828 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -51,7 +51,7 @@ CPetControl::CPetControl() : CGameObject(),
_sections[PET_REMOTE] = &_remote;
_sections[PET_ROOMS] = &_rooms;
_sections[PET_REAL_LIFE] = &_realLife;
- _sections[PET_5] = &_sub5;
+ _sections[PET_NAV_HELMET] = &_navHelmet;
_sections[PET_6] = &_sub7;
}
@@ -85,7 +85,7 @@ void CPetControl::setup() {
_rooms.setup(this);
_remote.setup(this);
_inventory.setup(this);
- _sub5.setup(this);
+ _navHelmet.setup(this);
_realLife.setup(this);
_sub7.setup(this);
_frame.setup(this);
@@ -96,7 +96,7 @@ bool CPetControl::isValid() {
_rooms.isValid(this) &&
_remote.isValid(this) &&
_inventory.isValid(this) &&
- _sub5.isValid(this) &&
+ _navHelmet.isValid(this) &&
_realLife.isValid(this) &&
_sub7.isValid(this) &&
_frame.isValid(this);
@@ -107,7 +107,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) {
_rooms.load(file, param);
_remote.load(file, param);
_inventory.load(file, param);
- _sub5.load(file, param);
+ _navHelmet.load(file, param);
_realLife.load(file, param);
_sub7.load(file, param);
_frame.load(file, param);
@@ -118,7 +118,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const {
_rooms.save(file, indent);
_remote.save(file, indent);
_inventory.save(file, indent);
- _sub5.save(file, indent);
+ _navHelmet.save(file, indent);
_realLife.save(file, indent);
_sub7.save(file, indent);
_frame.save(file, indent);
@@ -163,7 +163,7 @@ void CPetControl::loaded() {
_rooms.postLoad();
_remote.postLoad();
_inventory.postLoad();
- _sub5.postLoad();
+ _navHelmet.postLoad();
_realLife.postLoad();
_sub7.postLoad();
_frame.postLoad();
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index b4c460e8bb..96c46a6845 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -31,10 +31,10 @@
#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_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_sub5.h"
#include "titanic/pet_control/pet_control_sub7.h"
namespace Titanic {
@@ -55,10 +55,10 @@ private:
CPetSection *_sections[7];
CPetConversations _conversations;
CPetInventory _inventory;
+ CPetNavHelmet _navHelmet;
CPetRemote _remote;
CPetRooms _rooms;
CPetRealLife _realLife;
- CPetControlSub5 _sub5;
CPetControlSub7 _sub7;
CPetFrame _frame;
CString _activeNPCName;
diff --git a/engines/titanic/pet_control/pet_control_sub5.cpp b/engines/titanic/pet_control/pet_control_sub5.cpp
deleted file mode 100644
index 0b43853704..0000000000
--- a/engines/titanic/pet_control/pet_control_sub5.cpp
+++ /dev/null
@@ -1,48 +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.
- *
- */
-
-#include "titanic/pet_control/pet_control_sub5.h"
-
-namespace Titanic {
-
-CPetControlSub5::CPetControlSub5() :
- _field98(0), _field9C(0), _fieldA0(0),
- _field18C(0), _field20C(0), _field210(0) {
-}
-
-void CPetControlSub5::save(SimpleFile *file, int indent) const {
-
-}
-
-void CPetControlSub5::load(SimpleFile *file, int param) {
- if (!param) {
- _field20C = file->readNumber();
- _field210 = file->readNumber();
- }
-}
-
-bool CPetControlSub5::isValid(CPetControl *petControl) {
- // TODO
- return true;
-}
-
-} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp
index ac4b3344c7..dd2be96cd9 100644
--- a/engines/titanic/pet_control/pet_frame.cpp
+++ b/engines/titanic/pet_control/pet_frame.cpp
@@ -27,7 +27,7 @@ namespace Titanic {
static const PetArea PET_AREAS[6] = {
PET_CONVERSATION, PET_INVENTORY, PET_REMOTE,
- PET_ROOMS, PET_REAL_LIFE, PET_5
+ PET_ROOMS, PET_REAL_LIFE, PET_NAV_HELMET
};
CPetFrame::CPetFrame() : CPetSection() {
diff --git a/engines/titanic/pet_control/pet_nav_helmet.cpp b/engines/titanic/pet_control/pet_nav_helmet.cpp
new file mode 100644
index 0000000000..13f1989b64
--- /dev/null
+++ b/engines/titanic/pet_control/pet_nav_helmet.cpp
@@ -0,0 +1,156 @@
+/* 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.
+ *
+ */
+
+#include "titanic/pet_control/pet_nav_helmet.h"
+#include "titanic/pet_control/pet_control.h"
+
+namespace Titanic {
+
+CPetNavHelmet::CPetNavHelmet() :
+ _field98(0), _field9C(0), _fieldA0(0), _field18C(0),
+ _field20C(1), _field210(0), _rect1(22, 352, 598, 478) {
+}
+
+bool CPetNavHelmet::setup(CPetControl *petControl) {
+ if (petControl && setupControl(petControl))
+ return reset();
+ return false;
+}
+
+bool CPetNavHelmet::reset() {
+ if (_petControl) {
+ _val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl);
+ _val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl);
+ _val3.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl);
+ _val3.setup(MODE_SELECTED, "3PetSetDestin1", _petControl);
+ _val4.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl);
+
+ _leds[0].setup(MODE_UNSELECTED, "LEDOff1", _petControl);
+ _leds[1].setup(MODE_UNSELECTED, "LEDOn1", _petControl);
+ _leds[2].setup(MODE_UNSELECTED, "LEDOff2", _petControl);
+ _leds[3].setup(MODE_UNSELECTED, "LEDOn2", _petControl);
+ _leds[4].setup(MODE_UNSELECTED, "LEDOff3", _petControl);
+ _leds[5].setup(MODE_UNSELECTED, "LEDOn3", _petControl);
+
+ uint col = getColor(0);
+ _text.setColor(col);
+ _text.setLineColor(0, col);
+ }
+
+ return true;
+}
+
+void CPetNavHelmet::draw(CScreenManager *screenManager) {
+ _petControl->drawSquares(screenManager, 2);
+
+ if (_field20C) {
+ _val2.draw(screenManager);
+ } else {
+ _val4.draw(screenManager);
+ }
+
+ _val3.draw(screenManager);
+ drawButton(_field98, 0, screenManager);
+ drawButton(_field9C, 2, screenManager);
+ drawButton(_fieldA0, 4, screenManager);
+ _text.draw(screenManager);
+}
+
+bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ return false;
+}
+
+bool CPetNavHelmet::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+ return false;
+}
+
+bool CPetNavHelmet::isValid(CPetControl *petControl) {
+ return setupControl(petControl);
+}
+
+void CPetNavHelmet::load(SimpleFile *file, int param) {
+ if (!param) {
+ _field20C = file->readNumber();
+ _field210 = file->readNumber();
+ }
+}
+
+void CPetNavHelmet::postLoad() {
+ reset();
+}
+
+void CPetNavHelmet::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(_field20C, indent);
+ file->writeNumberLine(_field210, indent);
+}
+
+bool CPetNavHelmet::setupControl(CPetControl *petControl) {
+ if (petControl) {
+ _petControl = petControl;
+
+ Rect r(0, 0, 64, 64);
+ r.translate(_rect1.left, _rect1.top);
+
+ _val1.setBounds(r);
+ _val1.translate(15, 23);
+ _val2.setBounds(r);
+ _val2.translate(85, 23);
+ _val4.setBounds(r);
+ _val4.translate(85, 23);
+
+ r = Rect(0, 0, 34, 34);
+ r.translate(468, 396);
+ _leds[0].setBounds(r);
+ _leds[1].setBounds(r);
+
+ r.translate(36, 0);
+ _leds[2].setBounds(r);
+ _leds[3].setBounds(r);
+
+ r.translate(36, 0);
+ _leds[4].setBounds(r);
+ _leds[5].setBounds(r);
+
+ r = Rect(0, 0, 157, 51);
+ r.translate(224, 33);
+ r.translate(20, 350);
+ _val3.setBounds(r);
+
+ r = Rect(0, 0, 580, 15);
+ r.translate(32, 445);
+ _text.setBounds(r);
+ _text.setHasBorder(false);
+ }
+
+ return true;
+}
+
+void CPetNavHelmet::drawButton(int offset, int index, CScreenManager *screenManager) {
+ if (_field18C < 4 && (offset / 3) == 1)
+ --offset;
+ if (offset == 2)
+ offset = 1;
+
+ _leds[index + offset].draw(screenManager);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_nav_helmet.h
index 560803d938..f47520d548 100644
--- a/engines/titanic/pet_control/pet_control_sub5.h
+++ b/engines/titanic/pet_control/pet_nav_helmet.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef TITANIC_PET_CONTROL_SUB5_H
-#define TITANIC_PET_CONTROL_SUB5_H
+#ifndef TITANIC_PET_NAV_HELMET_H
+#define TITANIC_PET_NAV_HELMET_H
#include "titanic/pet_control/pet_section.h"
#include "titanic/pet_control/pet_text.h"
@@ -29,7 +29,7 @@
namespace Titanic {
-class CPetControlSub5 : public CPetSection {
+class CPetNavHelmet : public CPetSection {
private:
CPetGfxElement _val1;
CPetGfxElement _val2;
@@ -38,31 +38,68 @@ private:
int _field98;
int _field9C;
int _fieldA0;
- CPetGfxElement _valArray1[6];
- int _field17C;
+ CPetGfxElement _leds[6];
+ Rect _rect1;
int _field18C;
CPetText _text;
int _field20C;
int _field210;
+private:
+ /**
+ * Setup the control
+ */
+ bool setupControl(CPetControl *petControl);
+
+ /**
+ * Draw a button
+ */
+ void drawButton(int offset, int index, CScreenManager *screenManager);
public:
- CPetControlSub5();
+ CPetNavHelmet();
/**
- * Save the data for the class to file
+ * Sets up the section
*/
- virtual void save(SimpleFile *file, int indent) const;
+ virtual bool setup(CPetControl *petControl);
+
+ /**
+ * Reset the section
+ */
+ virtual bool reset();
/**
- * Load the data for the class from file
+ * Draw the section
*/
- virtual void load(SimpleFile *file, int param);
+ 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);
+ virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
/**
* Returns true if the object is in a valid state
*/
virtual bool isValid(CPetControl *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();
+
+ /**
+ * Save the data for the class to file
+ */
+ virtual void save(SimpleFile *file, int indent) const;
};
} // End of namespace Titanic
-#endif /* TITANIC_PET_CONTROL_SUB5_H */
+#endif /* TITANIC_PET_NAV_HELMET_H */
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index faefb994cc..81485ec44c 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_5 = 5, PET_6 = 6
+ PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_6 = 6
};
class CPetControl;