aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-06-26 17:20:33 -0400
committerPaul Gilbert2016-07-15 19:25:14 -0400
commitbe9a05f8b54e77a04c92aa766233bb8908b50c92 (patch)
tree570e56dd1718ad42bb173f6d32a924218a2c77e8 /engines
parentad873455cf29622e52c15ac48e608d385a744be2 (diff)
downloadscummvm-rg350-be9a05f8b54e77a04c92aa766233bb8908b50c92.tar.gz
scummvm-rg350-be9a05f8b54e77a04c92aa766233bb8908b50c92.tar.bz2
scummvm-rg350-be9a05f8b54e77a04c92aa766233bb8908b50c92.zip
TITANIC: Added CPetStarfield methods
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/core/game_object.h12
-rw-r--r--engines/titanic/module.mk2
-rw-r--r--engines/titanic/pet_control/pet_control.cpp2
-rw-r--r--engines/titanic/pet_control/pet_control.h4
-rw-r--r--engines/titanic/pet_control/pet_frame.cpp2
-rw-r--r--engines/titanic/pet_control/pet_quit.h5
-rw-r--r--engines/titanic/pet_control/pet_section.h2
-rw-r--r--engines/titanic/pet_control/pet_starfield.cpp (renamed from engines/titanic/pet_control/pet_nav_helmet.cpp)116
-rw-r--r--engines/titanic/pet_control/pet_starfield.h (renamed from engines/titanic/pet_control/pet_nav_helmet.h)33
-rw-r--r--engines/titanic/star_control/star_control.cpp4
-rw-r--r--engines/titanic/star_control/star_control.h2
11 files changed, 144 insertions, 40 deletions
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index c43d73f73d..d372b40f88 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -285,11 +285,6 @@ protected:
CMailMan *getMailMan() const;
/**
- * Returns the star control
- */
- CStarControl *getStarControl() const;
-
- /**
* Returns a child of the Dont Save area of the project of the given class
*/
CTreeItem *getDontSaveChild(ClassDef *classDef) const;
@@ -612,6 +607,13 @@ public:
*/
void petOnSummonBot(const CString &name, int val);
+ /*--- CStarControl Methods ---*/
+
+ /**
+ * Returns the star control
+ */
+ CStarControl *getStarControl() const;
+
/*--- CTrueTalkManager Methods ---*/
/**
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index a204c7cc5a..881aa025ef 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -364,7 +364,7 @@ MODULE_OBJS := \
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_starfield.o \
pet_control/pet_real_life.o \
pet_control/pet_remote.o \
pet_control/pet_remote_glyphs.o \
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 7d35eb31f2..b6648b9661 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_NAV_HELMET] = &_navHelmet;
+ _sections[PET_STARFIELD] = &_navHelmet;
_sections[PET_MESSAGE] = &_message;
}
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 07a4ffa680..d03f1c5efb 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -32,7 +32,7 @@
#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_starfield.h"
#include "titanic/pet_control/pet_real_life.h"
#include "titanic/pet_control/pet_remote.h"
#include "titanic/pet_control/pet_rooms.h"
@@ -56,7 +56,7 @@ private:
CPetSection *_sections[7];
CPetConversations _conversations;
CPetInventory _inventory;
- CPetNavHelmet _navHelmet;
+ CPetStarfield _navHelmet;
CPetRemote _remote;
CPetRooms _rooms;
CPetRealLife _realLife;
diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp
index 4c3c518962..bc1a8e93b6 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_NAV_HELMET
+ PET_ROOMS, PET_REAL_LIFE, PET_STARFIELD
};
CPetFrame::CPetFrame() : CPetSection() {
diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h
index 7d22690ff8..87d8aefbbf 100644
--- a/engines/titanic/pet_control/pet_quit.h
+++ b/engines/titanic/pet_control/pet_quit.h
@@ -63,6 +63,11 @@ public:
* Returns the tooltip text for when the glyph is selected
*/
virtual void getTooltip(CPetText *text);
+
+ /**
+ * Get a reference to the tooltip text associated with the section
+ */
+ virtual CPetText *getText() { return &_text; }
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index 58938c56c0..3673d4dfcc 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_MESSAGE = 6
+ PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_STARFIELD = 5, PET_MESSAGE = 6
};
class CPetControl;
diff --git a/engines/titanic/pet_control/pet_nav_helmet.cpp b/engines/titanic/pet_control/pet_starfield.cpp
index b995786b97..f657d9b4ff 100644
--- a/engines/titanic/pet_control/pet_nav_helmet.cpp
+++ b/engines/titanic/pet_control/pet_starfield.cpp
@@ -20,24 +20,25 @@
*
*/
-#include "titanic/pet_control/pet_nav_helmet.h"
+#include "titanic/pet_control/pet_starfield.h"
#include "titanic/pet_control/pet_control.h"
#include "titanic/messages/pet_messages.h"
+#include "titanic/star_control/star_control.h"
namespace Titanic {
-CPetNavHelmet::CPetNavHelmet() :
- _field98(0), _field9C(0), _fieldA0(0), _field18C(0),
- _photoOn(true), _field210(0), _rect1(22, 352, 598, 478) {
+CPetStarfield::CPetStarfield() : _field18C(0), _photoOn(true),
+ _field210(0), _rect1(22, 352, 598, 478) {
+ _btnOffsets[0] = _btnOffsets[1] = _btnOffsets[2] = 0;
}
-bool CPetNavHelmet::setup(CPetControl *petControl) {
+bool CPetStarfield::setup(CPetControl *petControl) {
if (petControl && setupControl(petControl))
return reset();
return false;
}
-bool CPetNavHelmet::reset() {
+bool CPetStarfield::reset() {
if (_petControl) {
_val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl);
_val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl);
@@ -60,7 +61,7 @@ bool CPetNavHelmet::reset() {
return true;
}
-void CPetNavHelmet::draw(CScreenManager *screenManager) {
+void CPetStarfield::draw(CScreenManager *screenManager) {
_petControl->drawSquares(screenManager, 2);
if (_photoOn) {
@@ -70,13 +71,13 @@ void CPetNavHelmet::draw(CScreenManager *screenManager) {
}
_setDestination.draw(screenManager);
- drawButton(_field98, 0, screenManager);
- drawButton(_field9C, 2, screenManager);
- drawButton(_fieldA0, 4, screenManager);
+ drawButton(_btnOffsets[0], 0, screenManager);
+ drawButton(_btnOffsets[1], 2, screenManager);
+ drawButton(_btnOffsets[2], 4, screenManager);
_text.draw(screenManager);
}
-bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (!_petControl->_remoteTarget)
return false;
@@ -91,45 +92,51 @@ bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
} else {
_petControl->displayMessage("Please supply Galactic reference material.");
}
- } else if (_setDestination.MouseButtonDownMsg(msg->_mousePos)) {
- warning("TODO: CPetNavHelmet::MouseButtonDownMsg");
+ } else if (!_setDestination.MouseButtonDownMsg(msg->_mousePos)) {
+ return elementsMouseDown(msg);
}
return true;
}
-bool CPetNavHelmet::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
+bool CPetStarfield::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
if (!_petControl->_remoteTarget || !_setDestination.MouseButtonUpMsg(msg->_mousePos))
return false;
if (_petControl) {
- warning("TODO: CPetNavHelmet::MouseButtonUpMsg");
+ CStarControl *starControl = _petControl->getStarControl();
+
+ if (starControl) {
+ CPETSetStarDestinationMsg starfieldMsg;
+ starfieldMsg.execute(_petControl->_remoteTarget);
+ starControl->fn3();
+ }
}
return true;
}
-bool CPetNavHelmet::isValid(CPetControl *petControl) {
+bool CPetStarfield::isValid(CPetControl *petControl) {
return setupControl(petControl);
}
-void CPetNavHelmet::load(SimpleFile *file, int param) {
+void CPetStarfield::load(SimpleFile *file, int param) {
if (!param) {
_photoOn = file->readNumber();
_field210 = file->readNumber();
}
}
-void CPetNavHelmet::postLoad() {
+void CPetStarfield::postLoad() {
reset();
}
-void CPetNavHelmet::save(SimpleFile *file, int indent) const {
+void CPetStarfield::save(SimpleFile *file, int indent) const {
file->writeNumberLine(_photoOn, indent);
file->writeNumberLine(_field210, indent);
}
-bool CPetNavHelmet::setupControl(CPetControl *petControl) {
+bool CPetStarfield::setupControl(CPetControl *petControl) {
if (petControl) {
_petControl = petControl;
@@ -170,7 +177,7 @@ bool CPetNavHelmet::setupControl(CPetControl *petControl) {
return true;
}
-void CPetNavHelmet::drawButton(int offset, int index, CScreenManager *screenManager) {
+void CPetStarfield::drawButton(int offset, int index, CScreenManager *screenManager) {
if (_field18C < 4 && (offset / 3) == 1)
--offset;
if (offset == 2)
@@ -179,4 +186,71 @@ void CPetNavHelmet::drawButton(int offset, int index, CScreenManager *screenMana
_leds[index + offset].draw(screenManager);
}
+void CPetStarfield::setButtons(int val1, int val2) {
+ _btnOffsets[0] = 0;
+ _btnOffsets[1] = 0;
+ _btnOffsets[2] = 0;
+
+ if (val1 >= 0)
+ _btnOffsets[0] = 2;
+ if (val1 >= 1)
+ _btnOffsets[1] = 2;
+ if (val1 >= 2)
+ _btnOffsets[2] = 2;
+
+ if (val2) {
+ if (val1 == -1)
+ _btnOffsets[0] = 1;
+ if (val1 == 0)
+ _btnOffsets[1] = 1;
+ if (val1 == 1)
+ _btnOffsets[2] = 1;
+ }
+
+ _field18C = (_field18C + 1) % 8;
+}
+
+void CPetStarfield::makePetDirty() {
+ _petControl->makeDirty();
+}
+
+bool CPetStarfield::elementsMouseDown(CMouseButtonDownMsg *msg) {
+ if (elementMouseButton(0, msg, _leds[0].getBounds()))
+ return true;
+ if (elementMouseButton(1, msg, _leds[2].getBounds()))
+ return true;
+ if (elementMouseButton(2, msg, _leds[4].getBounds()))
+ return true;
+
+ return false;
+}
+
+bool CPetStarfield::elementMouseButton(int index, CMouseButtonDownMsg *msg, const Rect &rect) {
+ if (!rect.contains(msg->_mousePos))
+ return false;
+
+ switch (_btnOffsets[index]) {
+ case 1:
+ if (_petControl->_remoteTarget) {
+ CPETStarFieldLockMsg lockMsg(1);
+ lockMsg.execute(_petControl->_remoteTarget);
+ }
+ break;
+
+ case 2:
+ if (index < 2 && _btnOffsets[index] >= 2) {
+ if (_petControl->_remoteTarget) {
+ CPETStarFieldLockMsg lockMsg(1);
+ lockMsg.execute(_petControl->_remoteTarget);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_nav_helmet.h b/engines/titanic/pet_control/pet_starfield.h
index 09504a1b27..30766b3d82 100644
--- a/engines/titanic/pet_control/pet_nav_helmet.h
+++ b/engines/titanic/pet_control/pet_starfield.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef TITANIC_PET_NAV_HELMET_H
-#define TITANIC_PET_NAV_HELMET_H
+#ifndef TITANIC_PET_STARFIELD_H
+#define TITANIC_PET_STARFIELD_H
#include "titanic/pet_control/pet_section.h"
#include "titanic/pet_control/pet_text.h"
@@ -29,15 +29,13 @@
namespace Titanic {
-class CPetNavHelmet : public CPetSection {
+class CPetStarfield : public CPetSection {
private:
CPetGfxElement _val1;
CPetGfxElement _val2;
CPetGfxElement _setDestination;
CPetGfxElement _val4;
- int _field98;
- int _field9C;
- int _fieldA0;
+ int _btnOffsets[3];
CPetGfxElement _leds[6];
Rect _rect1;
int _field18C;
@@ -54,8 +52,27 @@ private:
* Draw a button
*/
void drawButton(int offset, int index, CScreenManager *screenManager);
+
+ void set210(int val) { _field210 = val; }
+
+ /**
+ * Sets the offsets for each of the buttons
+ */
+ void setButtons(int val1, int val2);
+
+ /**
+ * Make the PET as dirty, requiring a redraw
+ */
+ void makePetDirty();
+
+ /**
+ * Mouse down handling for Nav elements
+ */
+ bool elementsMouseDown(CMouseButtonDownMsg *msg);
+
+ bool elementMouseButton(int index, CMouseButtonDownMsg *msg, const Rect &rect);
public:
- CPetNavHelmet();
+ CPetStarfield();
/**
* Sets up the section
@@ -102,4 +119,4 @@ public:
} // End of namespace Titanic
-#endif /* TITANIC_PET_NAV_HELMET_H */
+#endif /* TITANIC_PET_STARFIELD_H */
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index 446579855a..3f84a947f3 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -53,4 +53,8 @@ void CStarControl::load(SimpleFile *file) {
CGameObject::load(file);
}
+void CStarControl::fn3() {
+ warning("CStarControl::fn3");
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h
index 9462cee559..3e53db11bf 100644
--- a/engines/titanic/star_control/star_control.h
+++ b/engines/titanic/star_control/star_control.h
@@ -52,6 +52,8 @@ public:
* Load the data for the class from file
*/
virtual void load(SimpleFile *file);
+
+ void fn3();
};
} // End of namespace Titanic