From be9a05f8b54e77a04c92aa766233bb8908b50c92 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jun 2016 17:20:33 -0400 Subject: TITANIC: Added CPetStarfield methods --- engines/titanic/core/game_object.h | 12 +- engines/titanic/module.mk | 2 +- engines/titanic/pet_control/pet_control.cpp | 2 +- engines/titanic/pet_control/pet_control.h | 4 +- engines/titanic/pet_control/pet_frame.cpp | 2 +- engines/titanic/pet_control/pet_nav_helmet.cpp | 182 ------------------ engines/titanic/pet_control/pet_nav_helmet.h | 105 ---------- engines/titanic/pet_control/pet_quit.h | 5 + engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/pet_control/pet_starfield.cpp | 256 +++++++++++++++++++++++++ engines/titanic/pet_control/pet_starfield.h | 122 ++++++++++++ engines/titanic/star_control/star_control.cpp | 4 + engines/titanic/star_control/star_control.h | 2 + 13 files changed, 402 insertions(+), 298 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_nav_helmet.cpp delete mode 100644 engines/titanic/pet_control/pet_nav_helmet.h create mode 100644 engines/titanic/pet_control/pet_starfield.cpp create mode 100644 engines/titanic/pet_control/pet_starfield.h 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 @@ -284,11 +284,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 */ @@ -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_nav_helmet.cpp b/engines/titanic/pet_control/pet_nav_helmet.cpp deleted file mode 100644 index b995786b97..0000000000 --- a/engines/titanic/pet_control/pet_nav_helmet.cpp +++ /dev/null @@ -1,182 +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_nav_helmet.h" -#include "titanic/pet_control/pet_control.h" -#include "titanic/messages/pet_messages.h" - -namespace Titanic { - -CPetNavHelmet::CPetNavHelmet() : - _field98(0), _field9C(0), _fieldA0(0), _field18C(0), - _photoOn(true), _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); - _setDestination.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); - _setDestination.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 (_photoOn) { - _val2.draw(screenManager); - } else { - _val4.draw(screenManager); - } - - _setDestination.draw(screenManager); - drawButton(_field98, 0, screenManager); - drawButton(_field9C, 2, screenManager); - drawButton(_fieldA0, 4, screenManager); - _text.draw(screenManager); -} - -bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (!_petControl->_remoteTarget) - return false; - - if (_val1.MouseButtonDownMsg(msg->_mousePos)) { - CPETHelmetOnOffMsg helmetMsg; - helmetMsg.execute(_petControl->_remoteTarget); - } else if (_val2.MouseButtonDownMsg(msg->_mousePos)) { - if (_field210) { - _photoOn = !_photoOn; - CPETPhotoOnOffMsg photoMsg; - photoMsg.execute(_petControl->_remoteTarget); - } else { - _petControl->displayMessage("Please supply Galactic reference material."); - } - } else if (_setDestination.MouseButtonDownMsg(msg->_mousePos)) { - warning("TODO: CPetNavHelmet::MouseButtonDownMsg"); - } - - return true; -} - -bool CPetNavHelmet::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - if (!_petControl->_remoteTarget || !_setDestination.MouseButtonUpMsg(msg->_mousePos)) - return false; - - if (_petControl) { - warning("TODO: CPetNavHelmet::MouseButtonUpMsg"); - } - - return true; -} - -bool CPetNavHelmet::isValid(CPetControl *petControl) { - return setupControl(petControl); -} - -void CPetNavHelmet::load(SimpleFile *file, int param) { - if (!param) { - _photoOn = file->readNumber(); - _field210 = file->readNumber(); - } -} - -void CPetNavHelmet::postLoad() { - reset(); -} - -void CPetNavHelmet::save(SimpleFile *file, int indent) const { - file->writeNumberLine(_photoOn, 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); - _setDestination.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_nav_helmet.h b/engines/titanic/pet_control/pet_nav_helmet.h deleted file mode 100644 index 09504a1b27..0000000000 --- a/engines/titanic/pet_control/pet_nav_helmet.h +++ /dev/null @@ -1,105 +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_NAV_HELMET_H -#define TITANIC_PET_NAV_HELMET_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_text.h" -#include "titanic/pet_control/pet_gfx_element.h" - -namespace Titanic { - -class CPetNavHelmet : public CPetSection { -private: - CPetGfxElement _val1; - CPetGfxElement _val2; - CPetGfxElement _setDestination; - CPetGfxElement _val4; - int _field98; - int _field9C; - int _fieldA0; - CPetGfxElement _leds[6]; - Rect _rect1; - int _field18C; - CPetText _text; - bool _photoOn; - int _field210; -private: - /** - * Setup the control - */ - bool setupControl(CPetControl *petControl); - - /** - * Draw a button - */ - void drawButton(int offset, int index, CScreenManager *screenManager); -public: - CPetNavHelmet(); - - /** - * Sets up the section - */ - virtual bool setup(CPetControl *petControl); - - /** - * Reset the section - */ - virtual bool reset(); - - /** - * 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); - 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_NAV_HELMET_H */ 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_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp new file mode 100644 index 0000000000..f657d9b4ff --- /dev/null +++ b/engines/titanic/pet_control/pet_starfield.cpp @@ -0,0 +1,256 @@ +/* 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_starfield.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/messages/pet_messages.h" +#include "titanic/star_control/star_control.h" + +namespace Titanic { + +CPetStarfield::CPetStarfield() : _field18C(0), _photoOn(true), + _field210(0), _rect1(22, 352, 598, 478) { + _btnOffsets[0] = _btnOffsets[1] = _btnOffsets[2] = 0; +} + +bool CPetStarfield::setup(CPetControl *petControl) { + if (petControl && setupControl(petControl)) + return reset(); + return false; +} + +bool CPetStarfield::reset() { + if (_petControl) { + _val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl); + _val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl); + _setDestination.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); + _setDestination.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 CPetStarfield::draw(CScreenManager *screenManager) { + _petControl->drawSquares(screenManager, 2); + + if (_photoOn) { + _val2.draw(screenManager); + } else { + _val4.draw(screenManager); + } + + _setDestination.draw(screenManager); + drawButton(_btnOffsets[0], 0, screenManager); + drawButton(_btnOffsets[1], 2, screenManager); + drawButton(_btnOffsets[2], 4, screenManager); + _text.draw(screenManager); +} + +bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_petControl->_remoteTarget) + return false; + + if (_val1.MouseButtonDownMsg(msg->_mousePos)) { + CPETHelmetOnOffMsg helmetMsg; + helmetMsg.execute(_petControl->_remoteTarget); + } else if (_val2.MouseButtonDownMsg(msg->_mousePos)) { + if (_field210) { + _photoOn = !_photoOn; + CPETPhotoOnOffMsg photoMsg; + photoMsg.execute(_petControl->_remoteTarget); + } else { + _petControl->displayMessage("Please supply Galactic reference material."); + } + } else if (!_setDestination.MouseButtonDownMsg(msg->_mousePos)) { + return elementsMouseDown(msg); + } + + return true; +} + +bool CPetStarfield::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (!_petControl->_remoteTarget || !_setDestination.MouseButtonUpMsg(msg->_mousePos)) + return false; + + if (_petControl) { + CStarControl *starControl = _petControl->getStarControl(); + + if (starControl) { + CPETSetStarDestinationMsg starfieldMsg; + starfieldMsg.execute(_petControl->_remoteTarget); + starControl->fn3(); + } + } + + return true; +} + +bool CPetStarfield::isValid(CPetControl *petControl) { + return setupControl(petControl); +} + +void CPetStarfield::load(SimpleFile *file, int param) { + if (!param) { + _photoOn = file->readNumber(); + _field210 = file->readNumber(); + } +} + +void CPetStarfield::postLoad() { + reset(); +} + +void CPetStarfield::save(SimpleFile *file, int indent) const { + file->writeNumberLine(_photoOn, indent); + file->writeNumberLine(_field210, indent); +} + +bool CPetStarfield::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); + _setDestination.setBounds(r); + + r = Rect(0, 0, 580, 15); + r.translate(32, 445); + _text.setBounds(r); + _text.setHasBorder(false); + } + + return true; +} + +void CPetStarfield::drawButton(int offset, int index, CScreenManager *screenManager) { + if (_field18C < 4 && (offset / 3) == 1) + --offset; + if (offset == 2) + offset = 1; + + _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_starfield.h b/engines/titanic/pet_control/pet_starfield.h new file mode 100644 index 0000000000..30766b3d82 --- /dev/null +++ b/engines/titanic/pet_control/pet_starfield.h @@ -0,0 +1,122 @@ +/* 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_STARFIELD_H +#define TITANIC_PET_STARFIELD_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_text.h" +#include "titanic/pet_control/pet_gfx_element.h" + +namespace Titanic { + +class CPetStarfield : public CPetSection { +private: + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _setDestination; + CPetGfxElement _val4; + int _btnOffsets[3]; + CPetGfxElement _leds[6]; + Rect _rect1; + int _field18C; + CPetText _text; + bool _photoOn; + int _field210; +private: + /** + * Setup the control + */ + bool setupControl(CPetControl *petControl); + + /** + * 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: + CPetStarfield(); + + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Reset the section + */ + virtual bool reset(); + + /** + * 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); + 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_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 -- cgit v1.2.3