aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Prykhodko2018-08-16 06:32:56 +0300
committerAndrei Prykhodko2018-08-16 06:33:53 +0300
commitd6f2a8948810ed8c7f6d241b7ef194f2ef095d09 (patch)
tree812e669c2588b7d3b7f16cb4a17dc82e83f83738
parent486a63d14f4e93759ded3e1c1506a575224601bf (diff)
downloadscummvm-rg350-d6f2a8948810ed8c7f6d241b7ef194f2ef095d09.tar.gz
scummvm-rg350-d6f2a8948810ed8c7f6d241b7ef194f2ef095d09.tar.bz2
scummvm-rg350-d6f2a8948810ed8c7f6d241b7ef194f2ef095d09.zip
PINK: fixed original bug when ActionSfx continues to play when it should stop
-rw-r--r--engines/pink/objects/actions/action_play_with_sfx.cpp12
-rw-r--r--engines/pink/objects/actions/action_play_with_sfx.h3
-rw-r--r--engines/pink/objects/sequences/sequencer.cpp16
3 files changed, 28 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 0c8aa94c2c..3064215fd3 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.cpp
+++ b/engines/pink/objects/actions/action_play_with_sfx.cpp
@@ -29,6 +29,8 @@
namespace Pink {
+bool g_skipping = false; // FIXME: non-const global var
+
ActionPlayWithSfx::~ActionPlayWithSfx() {
ActionPlay::end();
for (uint i = 0; i < _sfxArray.size(); ++i) {
@@ -74,6 +76,12 @@ void ActionPlayWithSfx::onStart() {
void ActionPlayWithSfx::end() {
ActionCEL::end();
debugC(6, kPinkDebugActions, "ActionPlayWithSfx %s of Actor %s is ended", _name.c_str(), _actor->getName().c_str());
+ // original bug fix
+ if (g_skipping) {
+ for (uint i = 0; i < _sfxArray.size(); ++i) {
+ _sfxArray[i]->end();
+ }
+ }
}
void ActionSfx::deserialize(Pink::Archive &archive) {
@@ -97,4 +105,8 @@ void ActionSfx::play() {
}
}
+void ActionSfx::end() {
+ _sound.stop();
+}
+
} // End of namespace Pink
diff --git a/engines/pink/objects/actions/action_play_with_sfx.h b/engines/pink/objects/actions/action_play_with_sfx.h
index 2797604671..16d1855584 100644
--- a/engines/pink/objects/actions/action_play_with_sfx.h
+++ b/engines/pink/objects/actions/action_play_with_sfx.h
@@ -28,6 +28,8 @@
namespace Pink {
+extern bool g_skipping;
+
class ActionSfx;
class ActionPlayWithSfx : public ActionPlay {
@@ -61,6 +63,7 @@ public:
void toConsole() override;
void play();
+ void end();
int32 getFrame() { return _frame; }
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 8885fdc213..df5522de54 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -24,6 +24,7 @@
#include "pink/archive.h"
#include "pink/pink.h"
+#include "pink/objects/actions/action_play_with_sfx.h"
#include "pink/objects/actors/lead_actor.h"
#include "pink/objects/pages/game_page.h"
#include "pink/objects/sequences/sequencer.h"
@@ -143,18 +144,27 @@ void Sequencer::removeContext(SequenceContext *context) {
}
void Sequencer::skipSubSequence() {
- if (_context)
+ if (_context) {
+ g_skipping = true;
_context->getSequence()->skipSubSequence();
+ g_skipping = false;
+ }
}
void Sequencer::restartSequence() {
- if (_context)
+ if (_context) {
+ g_skipping = true;
_context->getSequence()->restart();
+ g_skipping = false;
+ }
}
void Sequencer::skipSequence() {
- if (_context && _context->getSequence()->isSkippingAllowed())
+ if (_context && _context->getSequence()->isSkippingAllowed()) {
+ g_skipping = true;
_context->getSequence()->skip();
+ g_skipping = false;
+ }
}
void Sequencer::loadState(Archive &archive) {