diff options
author | whiterandrek | 2018-03-28 13:58:06 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | ea5cb3a60e281a76dd68335b95ba6b591b71fc22 (patch) | |
tree | 5946c3ddbdf8405b6bad7cf9505c57cead949921 /engines | |
parent | 675f83256a01528cdaadd40d46bcbdc717633dd9 (diff) | |
download | scummvm-rg350-ea5cb3a60e281a76dd68335b95ba6b591b71fc22.tar.gz scummvm-rg350-ea5cb3a60e281a76dd68335b95ba6b591b71fc22.tar.bz2 scummvm-rg350-ea5cb3a60e281a76dd68335b95ba6b591b71fc22.zip |
PINK: implemented sequence restarting
Diffstat (limited to 'engines')
-rw-r--r-- | engines/pink/objects/actors/lead_actor.cpp | 3 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence.cpp | 6 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence.h | 2 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence_context.cpp | 10 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence_context.h | 4 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequencer.cpp | 4 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequencer.h | 2 |
7 files changed, 26 insertions, 5 deletions
diff --git a/engines/pink/objects/actors/lead_actor.cpp b/engines/pink/objects/actors/lead_actor.cpp index 1b38c862b2..be7dfbe879 100644 --- a/engines/pink/objects/actors/lead_actor.cpp +++ b/engines/pink/objects/actors/lead_actor.cpp @@ -22,6 +22,7 @@ #include "lead_actor.h" #include <engines/pink/objects/actions/action.h> +#include <engines/pink/objects/sequences/sequence_context.h> #include "engines/pink/objects/walk/walk_mgr.h" #include "engines/pink/cursor_mgr.h" #include "engines/pink/objects/sequences/sequencer.h" @@ -104,7 +105,7 @@ void LeadActor::OnKeyboardButtonClick(Common::KeyCode code) { _sequencer->skipToLastSubSequence(); break; case Common::KEYCODE_LEFT: - _sequencer->startSequenceAgain(); + _sequencer->restartSequence(); break; default: break; diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp index 80f5c58e5b..0ef7803988 100644 --- a/engines/pink/objects/sequences/sequence.cpp +++ b/engines/pink/objects/sequences/sequence.cpp @@ -109,6 +109,12 @@ void Sequence::end() { _sequencer->removeContext(_context); } +void Sequence::restart() { + _context->setNextItemIndex(0); + _context->clearActionsFromActorStates(); + start(0); +} + void SequenceAudio::deserialize(Archive &archive) { Sequence::deserialize(archive); archive >> _sound; diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h index 3975acf915..45d10e585a 100644 --- a/engines/pink/objects/sequences/sequence.h +++ b/engines/pink/objects/sequences/sequence.h @@ -48,7 +48,7 @@ public: void end(); void update(); - + void restart(); public: SequenceContext *_context; Sequencer *_sequencer; diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp index 62717d0595..675e567253 100644 --- a/engines/pink/objects/sequences/sequence_context.cpp +++ b/engines/pink/objects/sequences/sequence_context.cpp @@ -79,4 +79,14 @@ Sequence *SequenceContext::getSequence() const { return _sequence; } +void SequenceContext::clearActionsFromActorStates() { + for (int i = 0; i < _states.size(); ++i) { + _states[i]._actionName.clear(); + } +} + +void SequenceContext::setNextItemIndex(int index) { + _nextItemIndex = index; +} + } // End of namespace Pink
\ No newline at end of file diff --git a/engines/pink/objects/sequences/sequence_context.h b/engines/pink/objects/sequences/sequence_context.h index 47b35ee977..f35f5e4799 100644 --- a/engines/pink/objects/sequences/sequence_context.h +++ b/engines/pink/objects/sequences/sequence_context.h @@ -52,6 +52,10 @@ public: int getNextItemIndex() const; Sequence *getSequence() const; + void setNextItemIndex(int index); + + void clearActionsFromActorStates(); + public: Sequence *_sequence; Sequencer *_sequencer; diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp index 69396c2e52..c08e7fee43 100644 --- a/engines/pink/objects/sequences/sequencer.cpp +++ b/engines/pink/objects/sequences/sequencer.cpp @@ -86,8 +86,8 @@ void Sequencer::skipSubSequence() { _context->getSequence()->start(0); } -void Sequencer::startSequenceAgain() { - +void Sequencer::restartSequence() { + _context->getSequence()->restart(); } void Sequencer::skipToLastSubSequence() { diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h index 8099f2d9a5..f453ffbf22 100644 --- a/engines/pink/objects/sequences/sequencer.h +++ b/engines/pink/objects/sequences/sequencer.h @@ -50,7 +50,7 @@ public: void update(); void skipSubSequence(); - void startSequenceAgain(); + void restartSequence(); void skipToLastSubSequence(); public: |