diff options
author | whiterandrek | 2018-03-29 22:31:11 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 5db9a454581ff9b3f5e8160e401c0c741f321e9c (patch) | |
tree | b50d45981d1e82955f9427d818b818eb6142a0b4 /engines/pink | |
parent | 1a2bd666b0830ac2daa7a1b8778091b259c7021a (diff) | |
download | scummvm-rg350-5db9a454581ff9b3f5e8160e401c0c741f321e9c.tar.gz scummvm-rg350-5db9a454581ff9b3f5e8160e401c0c741f321e9c.tar.bz2 scummvm-rg350-5db9a454581ff9b3f5e8160e401c0c741f321e9c.zip |
PINK: added ActionTalk implementation
Diffstat (limited to 'engines/pink')
-rw-r--r-- | engines/pink/objects/actions/action_play_with_sfx.cpp | 5 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_play_with_sfx.h | 3 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_sound.cpp | 2 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_sound.h | 1 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_talk.cpp | 21 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_talk.h | 9 |
6 files changed, 38 insertions, 3 deletions
diff --git a/engines/pink/objects/actions/action_play_with_sfx.cpp b/engines/pink/objects/actions/action_play_with_sfx.cpp index a28a06768c..8c41176cdb 100644 --- a/engines/pink/objects/actions/action_play_with_sfx.cpp +++ b/engines/pink/objects/actions/action_play_with_sfx.cpp @@ -68,6 +68,11 @@ void ActionPlayWithSfx::updateSound() { } ActionPlayWithSfx::~ActionPlayWithSfx() { + end(); +} + +void ActionPlayWithSfx::end() { + ActionPlay::end(); for (int i = 0; i < _sfxArray.size(); ++i) { delete _sfxArray[i]; } diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h index 7782e913e2..7e4448abbb 100644 --- a/engines/pink/objects/actions/action_play_with_sfx.h +++ b/engines/pink/objects/actions/action_play_with_sfx.h @@ -36,6 +36,9 @@ class ActionPlayWithSfx : public ActionPlay { virtual void toConsole(); virtual void update(); +public: + virtual void end(); + protected: virtual void onStart(); diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp index 44dfda45c7..f1829a1f19 100644 --- a/engines/pink/objects/actions/action_sound.cpp +++ b/engines/pink/objects/actions/action_sound.cpp @@ -32,7 +32,7 @@ namespace Pink { ActionSound::ActionSound() - : _sound(nullptr), _isStopped(1) + : _sound(nullptr) {} ActionSound::~ActionSound(){ diff --git a/engines/pink/objects/actions/action_sound.h b/engines/pink/objects/actions/action_sound.h index 3c71da454e..b13481cb65 100644 --- a/engines/pink/objects/actions/action_sound.h +++ b/engines/pink/objects/actions/action_sound.h @@ -48,7 +48,6 @@ private: uint32 _volume; bool _isLoop; bool _isBackground; - bool _isStopped; }; } // End of namespace Pink diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp index da37204e5d..b9743005c4 100644 --- a/engines/pink/objects/actions/action_talk.cpp +++ b/engines/pink/objects/actions/action_talk.cpp @@ -22,7 +22,9 @@ #include "action_talk.h" #include <pink/archive.h> -#include <common/debug.h> +#include <pink/objects/actors/actor.h> +#include <pink/objects/pages/game_page.h> +#include <pink/sound.h> namespace Pink { @@ -37,4 +39,21 @@ void ActionTalk::toConsole() { _name.c_str(), _fileName.c_str(), _z, _startFrame, _stopFrame, _intro, _style, _vox.c_str()); } +void ActionTalk::onStart() { + ActionPlay::onStart(); + _sound = _actor->getPage()->loadSound(_vox); + _sound->play(Audio::Mixer::SoundType::kSpeechSoundType, 100, 0); +} + +void ActionTalk::update() { + ActionLoop::update(); + if (!_sound->isPlaying()) + _actor->endAction(); +} + +void ActionTalk::end() { + ActionPlay::end(); + delete _sound; +} + } // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/actions/action_talk.h b/engines/pink/objects/actions/action_talk.h index 4c28a6f545..9b6d26fe32 100644 --- a/engines/pink/objects/actions/action_talk.h +++ b/engines/pink/objects/actions/action_talk.h @@ -27,12 +27,21 @@ namespace Pink { +class Sound; + class ActionTalk : public ActionLoop { public: virtual void deserialize(Archive &archive); virtual void toConsole(); + virtual void update(); + + virtual void end(); + +protected: + virtual void onStart(); private: + Sound *_sound; Common::String _vox; }; |