diff options
Diffstat (limited to 'engines/titanic/pet_control')
-rw-r--r-- | engines/titanic/pet_control/pet_remote.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_remote_glyphs.cpp | 94 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_remote_glyphs.h | 80 |
3 files changed, 185 insertions, 3 deletions
diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 6dc7a1a12f..f2062aff25 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -51,7 +51,8 @@ static const byte REMOTE_DATA[] = { 0x09, 0x01, GLYPH_SUCCUBUS_DELIVERY, 0x0A, 0x02, GLYPH_SUMMON_ELEVATOR, GLYPH_SUCCUBUS_DELIVERY, - 0x0B, 0x01, 0x11, + 0x0B, 0x01, + GLYPH_NAVIGATION_CONTROLLER, 0x0C, 0x01, GLYPH_SUCCUBUS_DELIVERY, 0x0D, 0x01, @@ -59,7 +60,8 @@ static const byte REMOTE_DATA[] = { 0x0E, 0x00, 0x0F, 0x01, GLYPH_TELEVISION_CONTROL, - 0x10, 0x03, 0x12, 0x14, 0x13, + 0x10, 0x03, + GLYPH_BOTTOM_OF_WELL, 0x14, 0x13, 0x11, 0x01, GLYPH_SUCCUBUS_DELIVERY, 0x12, 0x00, @@ -390,6 +392,14 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new CSuccubusDeliveryGlyph(); break; + case GLYPH_NAVIGATION_CONTROLLER: + glyph = new CNavigationControllerGlyph(); + break; + + case GLYPH_BOTTOM_OF_WELL: + glyph = new CBottomOfWellGlyph(); + break; + default: break; } diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index 460907a99c..00ddf421cf 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -24,6 +24,7 @@ #include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_control.h" #include "titanic/messages/pet_messages.h" +#include "titanic/titanic.h" namespace Titanic { @@ -118,6 +119,47 @@ bool CToggleRemoteGlyph::elementMouseButtonUpMsg(const Point &pt, int petNum) { /*------------------------------------------------------------------------*/ +bool CRemoteGotoGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + + if (owner) + _gfxElement = getElement(7); + + return true; +} + +void CRemoteGotoGlyph::draw2(CScreenManager *screenManager) { + if (_gfxElement) + _gfxElement->draw(screenManager); +} + +bool CRemoteGotoGlyph::MouseButtonDownMsg(const Point &pt) { + return _gfxElement && _gfxElement->MouseButtonDownMsg(pt); +} + +bool CRemoteGotoGlyph::MouseButtonUpMsg(const Point &pt) { + if (!_gfxElement || !_gfxElement->MouseButtonUpMsg(pt)) + return false; + + CPetControl *petControl = getPetControl(); + if (petControl) { + CGameManager *gameManager = petControl->getGameManager(); + + if (gameManager) { + CRoomItem *room = gameManager->getRoom(); + + if (room) { + CTransportMsg msg(g_vm->_roomNames[_roomIndex], 1, 0); + msg.execute(room); + } + } + } + + return true; +} + +/*------------------------------------------------------------------------*/ + bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetRemoteGlyph::setup(petControl, owner); setDefaults("3PetTV", petControl); @@ -471,4 +513,56 @@ void CSuccubusDeliveryGlyph::getTooltip(CPetText *text) { text->setText("Succ-U-Bus delivery system control"); } +/*------------------------------------------------------------------------*/ + +bool CNavigationControllerGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + setDefaults("3PetStarField", petControl); + + if (owner) + _gfxElement = getElement(0); + + return true; +} + +void CNavigationControllerGlyph::draw2(CScreenManager *screenManager) { + _gfxElement->setMode(_flag ? MODE_SELECTED : MODE_UNSELECTED); + _gfxElement->draw(screenManager); +} + +bool CNavigationControllerGlyph::MouseButtonDownMsg(const Point &pt) { + return _gfxElement->MouseButtonDownMsg(pt); +} + +bool CNavigationControllerGlyph::MouseButtonUpMsg(const Point &pt) { + if (!_gfxElement->MouseButtonUpMsg(pt)) + return false; + + _flag = !_flag; + CTreeItem *target = getPetControl()->_remoteTarget; + if (target) { + CPETHelmetOnOffMsg msg; + msg.execute(target); + } + + return true; +} + +void CNavigationControllerGlyph::getTooltip(CPetText *text) { + text->setText("Navigation controller"); +} + +/*------------------------------------------------------------------------*/ + +bool CBottomOfWellGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + setDefaults("3PetBotOfWell", petControl); + + return true; +} + +void CBottomOfWellGlyph::getTooltip(CPetText *text) { + text->setText("Go to the Bottom of the Well"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index 0043ea97d8..e6dfc115c0 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -37,7 +37,8 @@ enum RemoteGlyph { GLYPH_INFLATE_RELAXATION = 10, GLYPH_DEPLOY_MAINTENANCE = 11, GLYPH_DEPLOY_WORK_SURFACE = 12, GLYPH_DEPLOY_MINOR_RELAXATION = 13, GLYPH_DEPLOY_SINK = 14, GLYPH_DEPLOY_MAJOR_STORAGE = 15, - GLYPH_SUCCUBUS_DELIVERY = 16 + GLYPH_SUCCUBUS_DELIVERY = 16, GLYPH_NAVIGATION_CONTROLLER = 17, + GLYPH_BOTTOM_OF_WELL = 18 }; enum RemoteMessage { @@ -143,6 +144,34 @@ public: bool elementMouseButtonUpMsg(const Point &pt, int petNum); }; +class CRemoteGotoGlyph : public CPetRemoteGlyph { +protected: + int _roomIndex; + CPetGfxElement *_gfxElement; +public: + CRemoteGotoGlyph() : CPetRemoteGlyph(), _gfxElement(nullptr), _roomIndex(21) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); +}; + class CSummonElevatorGlyph : public CBasicRemoteGlyph { public: CSummonElevatorGlyph() : CBasicRemoteGlyph( @@ -587,6 +616,55 @@ public: virtual void getTooltip(CPetText *text); }; +class CNavigationControllerGlyph : public CPetRemoteGlyph { +private: + bool _flag; + CPetGfxElement *_gfxElement; +public: + CNavigationControllerGlyph() : CPetRemoteGlyph(), + _flag(false), _gfxElement(nullptr) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CBottomOfWellGlyph : public CRemoteGotoGlyph { +public: + CBottomOfWellGlyph() : CRemoteGotoGlyph() {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + } // End of namespace Titanic #endif /* TITANIC_PET_REMOTE_GLYPHS_H */ |