From 947d9e344c2e51c7ad8e4fe1f78fb131cafc921a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 08:32:25 -0400 Subject: TITANIC: Implement toggle remote glyph base class --- engines/titanic/pet_control/pet_remote_glyphs.cpp | 26 ++++++++++++++++ engines/titanic/pet_control/pet_remote_glyphs.h | 37 +++++++++++++++++++++++ 2 files changed, 63 insertions(+) (limited to 'engines/titanic') diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index 9db3b66c3d..85c4fb8889 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -83,6 +83,20 @@ void CBasicRemoteGlyph::getTooltip(CPetText *text) { /*------------------------------------------------------------------------*/ +bool CToggleRemoteGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetGlyph::setup(petControl, owner); + if (owner) + _gfxElement = getElement(0); + return true; +} + +void CToggleRemoteGlyph::draw2(CScreenManager *screenManager) { + _gfxElement->setMode(_flag ? MODE_SELECTED : MODE_UNSELECTED); + _gfxElement->draw(screenManager); +} + +/*------------------------------------------------------------------------*/ + bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetRemoteGlyph::setup(petControl, owner); setDefaults("3PetTV", petControl); @@ -137,4 +151,16 @@ void CTelevisionControlGlyph::getTooltip(CPetText *text) { text->setText("Television control"); } +/*------------------------------------------------------------------------*/ + +bool CEntertainmentDeviceGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + if (owner) { + _gfxElement2 = getElement(1); + _gfxElement3 = getElement(2); + } + + return true; +} + } // 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 1a4ee28f12..8a9cb88e99 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -108,6 +108,29 @@ public: virtual void getTooltip(CPetText *text); }; +class CToggleRemoteGlyph : public CPetRemoteGlyph { +protected: + CPetGfxElement *_gfxElement; + bool _flag; +public: + CToggleRemoteGlyph() : CPetRemoteGlyph(), _gfxElement(nullptr), _flag(false) {} + + /** + * 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); +}; + class CSummonElevatorGlyph : public CBasicRemoteGlyph { public: CSummonElevatorGlyph() : CBasicRemoteGlyph( @@ -154,6 +177,20 @@ public: virtual void getTooltip(CPetText *text); }; +class CEntertainmentDeviceGlyph : public CToggleRemoteGlyph { +public: + int _field3C; + CPetGfxElement *_gfxElement2, *_gfxElement3; +public: + CEntertainmentDeviceGlyph() : CToggleRemoteGlyph(), + _field3C(0), _gfxElement2(nullptr), _gfxElement3(nullptr) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + +}; } // End of namespace Titanic -- cgit v1.2.3