diff options
Diffstat (limited to 'engines/titanic/game/placeholder')
-rw-r--r-- | engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp | 36 | ||||
-rw-r--r-- | engines/titanic/game/placeholder/bar_shelf_vis_centre.h | 12 | ||||
-rw-r--r-- | engines/titanic/game/placeholder/lemon_on_bar.cpp | 21 | ||||
-rw-r--r-- | engines/titanic/game/placeholder/lemon_on_bar.h | 8 | ||||
-rw-r--r-- | engines/titanic/game/placeholder/place_holder.cpp (renamed from engines/titanic/game/placeholder/place_holder_item.cpp) | 15 | ||||
-rw-r--r-- | engines/titanic/game/placeholder/place_holder.h (renamed from engines/titanic/game/placeholder/place_holder_item.h) | 4 | ||||
-rw-r--r-- | engines/titanic/game/placeholder/tv_on_bar.cpp | 22 | ||||
-rw-r--r-- | engines/titanic/game/placeholder/tv_on_bar.h | 8 |
8 files changed, 100 insertions, 26 deletions
diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp index a8a33fe1b1..6e5037f237 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp @@ -24,16 +24,44 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CBarShelfVisCentre, CPlaceHolder) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + void CBarShelfVisCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_value, indent); - CPlaceHolderItem::save(file, indent); + file->writeNumberLine(_flag, indent); + CPlaceHolder::save(file, indent); } void CBarShelfVisCentre::load(SimpleFile *file) { file->readNumber(); - _value = file->readNumber(); - CPlaceHolderItem::load(file); + _flag = file->readNumber(); + CPlaceHolder::load(file); } +bool CBarShelfVisCentre::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_flag) { + CActMsg actMsg("ClickOnVision"); + actMsg.execute("Barbot"); + addTimer(3000); + _flag = true; + } + + return true; +} + +bool CBarShelfVisCentre::TimerMsg(CTimerMsg *msg) { + _flag = false; + return true; +} + +bool CBarShelfVisCentre::EnterViewMsg(CEnterViewMsg *msg) { + _flag = false; + return true; +} + + } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h index a53ef2633f..8ad3dcb8d1 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h @@ -23,16 +23,20 @@ #ifndef TITANIC_BAR_SHELF_VIS_CENTRE_H #define TITANIC_BAR_SHELF_VIS_CENTRE_H -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { -class CBarShelfVisCentre : public CPlaceHolderItem { +class CBarShelfVisCentre : public CPlaceHolder { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); private: - int _value; + bool _flag; public: CLASSDEF; - CBarShelfVisCentre() : CPlaceHolderItem(), _value(0) {} + CBarShelfVisCentre() : CPlaceHolder(), _flag(false) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/lemon_on_bar.cpp b/engines/titanic/game/placeholder/lemon_on_bar.cpp index 08d686e81a..e9cf6a309a 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.cpp +++ b/engines/titanic/game/placeholder/lemon_on_bar.cpp @@ -24,16 +24,29 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CLemonOnBar, CPlaceHolder) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + void CLemonOnBar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writePoint(_pos1, indent); - CPlaceHolderItem::save(file, indent); + file->writePoint(_lemonPos, indent); + CPlaceHolder::save(file, indent); } void CLemonOnBar::load(SimpleFile *file) { file->readNumber(); - _pos1 = file->readPoint(); - CPlaceHolderItem::load(file); + _lemonPos = file->readPoint(); + CPlaceHolder::load(file); +} + +bool CLemonOnBar::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + if (msg->_visible) + setPosition(_lemonPos); + else + setPosition(Point(0, 0)); + return true; } } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h index 92dd54c49b..c6512ced67 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.h +++ b/engines/titanic/game/placeholder/lemon_on_bar.h @@ -23,13 +23,15 @@ #ifndef TITANIC_LEMON_ON_BAR_H #define TITANIC_LEMON_ON_BAR_H -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { -class CLemonOnBar : public CPlaceHolderItem { +class CLemonOnBar : public CPlaceHolder { + DECLARE_MESSAGE_MAP; + bool VisibleMsg(CVisibleMsg *msg); private: - Point _pos1; + Point _lemonPos; public: CLASSDEF; diff --git a/engines/titanic/game/placeholder/place_holder_item.cpp b/engines/titanic/game/placeholder/place_holder.cpp index 365e8cbe50..ae42cabc29 100644 --- a/engines/titanic/game/placeholder/place_holder_item.cpp +++ b/engines/titanic/game/placeholder/place_holder.cpp @@ -20,18 +20,27 @@ * */ -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { -void CPlaceHolderItem::save(SimpleFile *file, int indent) { +BEGIN_MESSAGE_MAP(CPlaceHolder, CGameObject) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + +void CPlaceHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } -void CPlaceHolderItem::load(SimpleFile *file) { +void CPlaceHolder::load(SimpleFile *file) { file->readNumber(); CGameObject::load(file); } +bool CPlaceHolder::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/place_holder_item.h b/engines/titanic/game/placeholder/place_holder.h index de04a64bf7..b1aa041710 100644 --- a/engines/titanic/game/placeholder/place_holder_item.h +++ b/engines/titanic/game/placeholder/place_holder.h @@ -27,7 +27,9 @@ namespace Titanic { -class CPlaceHolderItem : public CGameObject { +class CPlaceHolder : public CGameObject { + DECLARE_MESSAGE_MAP; + bool VisibleMsg(CVisibleMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/placeholder/tv_on_bar.cpp b/engines/titanic/game/placeholder/tv_on_bar.cpp index efbbe50461..710b5a346e 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.cpp +++ b/engines/titanic/game/placeholder/tv_on_bar.cpp @@ -24,16 +24,30 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CTVOnBar, CPlaceHolder) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + void CTVOnBar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writePoint(_pos1, indent); - CPlaceHolderItem::save(file, indent); + file->writePoint(_tvPos, indent); + CPlaceHolder::save(file, indent); } void CTVOnBar::load(SimpleFile *file) { file->readNumber(); - _pos1 = file->readPoint(); - CPlaceHolderItem::load(file); + _tvPos = file->readPoint(); + CPlaceHolder::load(file); +} + +bool CTVOnBar::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + if (msg->_visible) + setPosition(_tvPos); + else + setPosition(Point(0, 0)); + + return true; } } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h index d41d972e73..0157bc8764 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.h +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -23,13 +23,15 @@ #ifndef TITANIC_TV_ON_BAR_H #define TITANIC_TV_ON_BAR_H -#include "titanic/game/placeholder/place_holder_item.h" +#include "titanic/game/placeholder/place_holder.h" namespace Titanic { -class CTVOnBar : public CPlaceHolderItem { +class CTVOnBar : public CPlaceHolder { + DECLARE_MESSAGE_MAP; + bool VisibleMsg(CVisibleMsg *msg); private: - Point _pos1; + Point _tvPos; public: CLASSDEF; |