diff options
author | Paul Gilbert | 2016-05-04 22:02:03 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:38:21 -0400 |
commit | 6948a44ac41f3da70b0cd675e7e9eb96117c54fa (patch) | |
tree | 404186a2f8ef315e59b148e5b07c6b1771ec8184 /engines/titanic/core | |
parent | b79ed60a8eca775613ec0b36d345dd8fcb4e5f08 (diff) | |
download | scummvm-rg350-6948a44ac41f3da70b0cd675e7e9eb96117c54fa.tar.gz scummvm-rg350-6948a44ac41f3da70b0cd675e7e9eb96117c54fa.tar.bz2 scummvm-rg350-6948a44ac41f3da70b0cd675e7e9eb96117c54fa.zip |
TITANIC: Implemented stopSound
Diffstat (limited to 'engines/titanic/core')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 48 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 20 |
2 files changed, 36 insertions, 32 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d1991a4baa..1d5c974db5 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -325,18 +325,6 @@ bool CGameObject::soundFn1(int val) { return false; } -void CGameObject::soundFn2(int val, int val2) { - if (val != 0 && val != -1) { - CGameManager *gameManager = getGameManager(); - if (gameManager) { - if (val2) - gameManager->_sound.fn3(val, 0, val2); - else - gameManager->_sound.fn2(val); - } - } -} - void CGameObject::setVisible(bool val) { if (val != _visible) { _visible = val; @@ -456,7 +444,16 @@ void CGameObject::sound8(bool flag) const { getGameManager()->_sound.managerProc8(flag ? 3 : 0); } -bool CGameObject::playSound(const CString &name, int val2, int val3, int val4) { +void CGameObject::loadSound(const CString &name) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + g_vm->_filesManager.preload(name); + if (!name.empty()) + gameManager->_sound.loadSound(name); + } +} + +int CGameObject::playSound(const CString &name, int val2, int val3, int val4) { CProximity prox; prox._field8 = val2; prox._fieldC = val3; @@ -464,12 +461,24 @@ bool CGameObject::playSound(const CString &name, int val2, int val3, int val4) { return playSound(name, prox); } -bool CGameObject::playSound(const CString &name, CProximity &prox) { +int CGameObject::playSound(const CString &name, CProximity &prox) { if (prox._field28 == 2) { // TODO } - return false; + return 0; +} + +void CGameObject::stopSound(int handle, int val2) { + if (handle != 0 && handle != -1) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + if (val2) + gameManager->_sound.fn3(handle, 0, val2); + else + gameManager->_sound.fn2(handle); + } + } } int CGameObject::addTimer(int endVal, uint firstDuration, uint duration) { @@ -749,13 +758,4 @@ void CGameObject::checkPlayMovie(const CString &name, int flags) { } } -void CGameObject::loadSound(const CString &name) { - CGameManager *gameManager = getGameManager(); - if (gameManager) { - g_vm->_filesManager.preload(name); - if (!name.empty()) - gameManager->_sound.loadSound(name); - } -} - } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 5bcba778f4..01fe503005 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -123,20 +123,29 @@ protected: CViewItem * parseView(const CString &viewString); bool soundFn1(int val); - void soundFn2(int val, int val2); void petFn2(int val); void petFn3(CTreeItem *item); void incState38(); /** + * Load a sound + */ + void loadSound(const CString &name); + + /** * Plays a sound */ - bool playSound(const CString &name, int val2, int val3, int val4); + int playSound(const CString &name, int val2, int val3, int val4); /** * Plays a sound */ - bool playSound(const CString &name, CProximity &prox); + int playSound(const CString &name, CProximity &prox); + + /** + * Stop a sound + */ + void stopSound(int handle, int val2); /** * Adds a timer @@ -220,11 +229,6 @@ protected: * Support function for drag moving */ void dragMove(const Point &pt); - - /** - * Load a sound - */ - void loadSound(const CString &name); public: int _field60; CursorId _cursorId; |