aboutsummaryrefslogtreecommitdiff
path: root/engines/pink/objects/sequences
diff options
context:
space:
mode:
authorwhiterandrek2018-06-19 21:43:11 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commitcfc5538f95f5b642c7037eb142999f67d72ca111 (patch)
treebd31875d883878ee0a7f9098876111e90b60cf95 /engines/pink/objects/sequences
parent0835b0fee134ae5b687bb2e609d966b0692eb496 (diff)
downloadscummvm-rg350-cfc5538f95f5b642c7037eb142999f67d72ca111.tar.gz
scummvm-rg350-cfc5538f95f5b642c7037eb142999f67d72ca111.tar.bz2
scummvm-rg350-cfc5538f95f5b642c7037eb142999f67d72ca111.zip
PINK: fix skipping sequence
Diffstat (limited to 'engines/pink/objects/sequences')
-rw-r--r--engines/pink/objects/sequences/sequence.cpp23
-rw-r--r--engines/pink/objects/sequences/sequence.h4
-rw-r--r--engines/pink/objects/sequences/sequencer.cpp5
-rw-r--r--engines/pink/objects/sequences/sequencer.h2
4 files changed, 19 insertions, 15 deletions
diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp
index 35c2ef5301..7674cee416 100644
--- a/engines/pink/objects/sequences/sequence.cpp
+++ b/engines/pink/objects/sequences/sequence.cpp
@@ -106,15 +106,18 @@ void Sequence::restart() {
start(0);
}
-void Sequence::skipToLastSubSequence() {
- if (_unk && _context->getNextItemIndex() < _items.size()) {
- int i = _items.size() - 1;
- while (i >= 0 && !_items[--i]->isLeader()) {};
- assert(i >= 0);
- _context->setNextItemIndex(i);
- _context->clearActionsFromActorStates();
- skipItemsTo(i);
- start(0);
+void Sequence::skip() {
+ if (_context->getNextItemIndex() >= _items.size())
+ return;
+
+ for (int i = _items.size() - 1; i >= 0; --i) {
+ if (_items[i]->isLeader()) {
+ _context->setNextItemIndex(i);
+ _context->clearActionsFromActorStates();
+ skipItemsTo(i);
+ start(0);
+ break;
+ }
}
}
@@ -174,7 +177,7 @@ void SequenceAudio::restart() {
Sequence::restart();
}
-void SequenceAudio::skipToLastSubSequence() {
+void SequenceAudio::skip() {
end();
}
diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h
index 0e9284654e..a5e19eae6d 100644
--- a/engines/pink/objects/sequences/sequence.h
+++ b/engines/pink/objects/sequences/sequence.h
@@ -50,7 +50,7 @@ public:
virtual void update();
virtual void restart();
virtual void skipSubSequence();
- virtual void skipToLastSubSequence();
+ virtual void skip();
void skipItemsTo(int index);
@@ -79,7 +79,7 @@ public:
virtual void restart();
virtual void skipSubSequence() {};
- virtual void skipToLastSubSequence();
+ virtual void skip();
private:
Common::String _soundName;
diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp
index 9c6c7c0ada..a98512e076 100644
--- a/engines/pink/objects/sequences/sequencer.cpp
+++ b/engines/pink/objects/sequences/sequencer.cpp
@@ -159,8 +159,9 @@ void Sequencer::restartSequence() {
_context->getSequence()->restart();
}
-void Sequencer::skipToLastSubSequence() {
- _context->getSequence()->skipToLastSubSequence();
+void Sequencer::skipSequence() {
+ if (_context->getSequence()->_unk)
+ _context->getSequence()->skip();
}
void Sequencer::updateTimers() {
diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h
index d151fc0cde..3a421f7edf 100644
--- a/engines/pink/objects/sequences/sequencer.h
+++ b/engines/pink/objects/sequences/sequencer.h
@@ -54,7 +54,7 @@ public:
void skipSubSequence();
void restartSequence();
- void skipToLastSubSequence();
+ void skipSequence();
void loadState(Archive &archive);
void saveState(Archive &archive);