diff options
author | Paul Gilbert | 2016-08-28 14:39:59 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-28 14:39:59 -0400 |
commit | 4933b59e8e039ae346f650c044e5fe0ba6310ead (patch) | |
tree | 805e33ea6fa6109e42d8f8b267ed2b6e5c2a00e2 /engines/titanic/game/wheel_button.cpp | |
parent | 1760fb3e0d25704685e9b44f0792536da962082d (diff) | |
download | scummvm-rg350-4933b59e8e039ae346f650c044e5fe0ba6310ead.tar.gz scummvm-rg350-4933b59e8e039ae346f650c044e5fe0ba6310ead.tar.bz2 scummvm-rg350-4933b59e8e039ae346f650c044e5fe0ba6310ead.zip |
TITANIC: Implemented remaining game classes
Diffstat (limited to 'engines/titanic/game/wheel_button.cpp')
-rw-r--r-- | engines/titanic/game/wheel_button.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/engines/titanic/game/wheel_button.cpp b/engines/titanic/game/wheel_button.cpp index 19c42a8807..d4a9f445a1 100644 --- a/engines/titanic/game/wheel_button.cpp +++ b/engines/titanic/game/wheel_button.cpp @@ -24,14 +24,20 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CWheelButton, CBackground) + ON_MESSAGE(SignalObject) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(LeaveViewMsg) +END_MESSAGE_MAP() + CWheelButton::CWheelButton() : CBackground(), - _fieldE0(0), _fieldE4(0), _fieldE8(0) { + _fieldE0(0), _timerId(0), _fieldE8(0) { } void CWheelButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); - file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_timerId, indent); file->writeNumberLine(_fieldE8, indent); CBackground::save(file, indent); @@ -40,10 +46,43 @@ void CWheelButton::save(SimpleFile *file, int indent) { void CWheelButton::load(SimpleFile *file) { file->readNumber(); _fieldE0 = file->readNumber(); - _fieldE4 = file->readNumber(); + _timerId = file->readNumber(); _fieldE8 = file->readNumber(); CBackground::load(file); } +bool CWheelButton::SignalObject(CSignalObject *msg) { + bool oldFlag = _fieldE0; + _fieldE0 = msg->_numValue != 0; + + if (oldFlag != _fieldE0) { + if (_fieldE0) { + _timerId = addTimer(500, 500); + } else { + stopAnimTimer(_timerId); + _timerId = 0; + setVisible(false); + } + } + + return true; +} + +bool CWheelButton::TimerMsg(CTimerMsg *msg) { + setVisible(!_visible); + makeDirty(); + return true; +} + +bool CWheelButton::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_timerId) { + stopAnimTimer(_timerId); + _timerId = 0; + setVisible(false); + } + + return true; +} + } // End of namespace Titanic |