diff options
author | Paul Gilbert | 2016-04-11 20:08:49 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:10:56 -0400 |
commit | 7ac4f7c3aa26831f771418472472735cf73bade9 (patch) | |
tree | 721c918233240d79080585bef0f9862f9e0f8291 /engines/titanic | |
parent | 54b055bcf58e8cbcf472ea6838f3ed7ecf377e37 (diff) | |
download | scummvm-rg350-7ac4f7c3aa26831f771418472472735cf73bade9.tar.gz scummvm-rg350-7ac4f7c3aa26831f771418472472735cf73bade9.tar.bz2 scummvm-rg350-7ac4f7c3aa26831f771418472472735cf73bade9.zip |
TITANIC: Implementing CComputerScreen messages
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 5 | ||||
-rw-r--r-- | engines/titanic/game/cdrom.cpp | 1 | ||||
-rw-r--r-- | engines/titanic/game/computer_screen.cpp | 38 | ||||
-rw-r--r-- | engines/titanic/game/computer_screen.h | 5 |
5 files changed, 57 insertions, 0 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index c179ed8b50..7e731bdbe7 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -459,6 +459,14 @@ bool CGameObject::playSound(const CString &name, CProximity &prox) { return false; } +int CGameObject::addTimer(int endVal, uint firstDuration, uint duration) { + CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), + duration != 0, firstDuration, duration, this, endVal, CString()); + + getGameManager()->addTimer(timer); + return timer->_id; +} + void CGameObject::gotoView(const CString &viewName, const CString &clipName) { CViewItem *newView = parseView(viewName); CGameManager *gameManager = getGameManager(); diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index a8d8513587..bc1020d03f 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -140,6 +140,11 @@ protected: * Plays a sound */ bool playSound(const CString &name, CProximity &prox); + + /** + * Adds a timer + */ + int addTimer(int endVal, uint firstDuration, uint duration); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index 0d89319a86..0fd7eb5dbd 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -65,6 +65,7 @@ bool CCDROM::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (newTray->_state && newTray->_insertedCD == "None") { CActMsg actMsg(getName()); actMsg.execute(newTray); + setVisible(false); } } diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index 04de5e50d8..f0fab26b61 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -24,6 +24,13 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CComputerScreen, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + CComputerScreen::CComputerScreen() : CGameObject() { } @@ -37,4 +44,35 @@ void CComputerScreen::load(SimpleFile *file) { CGameObject::load(file); } +bool CComputerScreen::ActMsg(CActMsg *msg) { + if (msg->_action == "newCD1" || msg->_action == "newCD2") { + playMovie(27, 53, 16); + playMovie(19, 26, 16); + } else if (msg->_action == "newSTCD") { + playMovie(0, 18, 20); + } + + return true; +} + +bool CComputerScreen::MovieEndMsg(CMovieEndMsg *msg) { + playSound("z#47.wav", 100, 0, 0); + addTimer(0, 3000, 0); + + for (int idx = 0; idx < 10; ++idx) + playMovie(0, 18, 0); + return true; +} + +bool CComputerScreen::EnterViewMsg(CEnterViewMsg *msg) { + loadFrame(26); + return true; +} + +bool CComputerScreen::TimerMsg(CTimerMsg *msg) { + // TODO + warning("TODO: CComputerScreen::TimerMsg"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h index aa47482207..fa02ef5e1a 100644 --- a/engines/titanic/game/computer_screen.h +++ b/engines/titanic/game/computer_screen.h @@ -28,6 +28,11 @@ namespace Titanic { class CComputerScreen : public CGameObject { + DECLARE_MESSAGE_MAP + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool TimerMsg(CTimerMsg *msg); public: CLASSDEF CComputerScreen(); |