diff options
Diffstat (limited to 'engines/pink/objects/sequences')
-rw-r--r-- | engines/pink/objects/sequences/seq_timer.cpp | 2 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence.cpp | 18 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence.h | 4 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence_context.cpp | 7 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequence_item.cpp | 3 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequencer.cpp | 11 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequencer.h | 6 |
7 files changed, 24 insertions, 27 deletions
diff --git a/engines/pink/objects/sequences/seq_timer.cpp b/engines/pink/objects/sequences/seq_timer.cpp index 9f8ee31a4c..5026051b33 100644 --- a/engines/pink/objects/sequences/seq_timer.cpp +++ b/engines/pink/objects/sequences/seq_timer.cpp @@ -53,7 +53,7 @@ void SeqTimer::update() { _updatesToMessage = _range ? _period + rnd.getRandomNumber(_range) : _period; SupportingActor *actor = static_cast<SupportingActor*>(_sequencer->_page->findActor(_actor)); - if (actor && !_sequencer->findSequenceActorState(actor->getName())){ + if (actor && !_sequencer->findSequenceActorState(actor->getName())) { actor->onTimerMessage(); } } diff --git a/engines/pink/objects/sequences/sequence.cpp b/engines/pink/objects/sequences/sequence.cpp index f388b7cd66..8e2f38c549 100644 --- a/engines/pink/objects/sequences/sequence.cpp +++ b/engines/pink/objects/sequences/sequence.cpp @@ -34,8 +34,8 @@ namespace Pink { Sequence::Sequence() - : _unk(0), _context(nullptr), - _sequencer(nullptr) {} + : _unk(0), _context(nullptr), + _sequencer(nullptr) {} Sequence::~Sequence() { for (uint i = 0; i < _items.size(); ++i) { @@ -72,7 +72,8 @@ void Sequence::init(int unk) { } void Sequence::start(int unk) { - if (_context->_nextItemIndex >= _items.size() || !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)){ + if (_context->_nextItemIndex >= _items.size() || + !_items[_context->_nextItemIndex]->execute(_context->_index, this, unk)) { debug("Sequence %s ended", _name.c_str()); end(); return; @@ -95,7 +96,7 @@ void Sequence::start(int unk) { } void Sequence::update() { - if (!_context->_actor->isPlaying()){ + if (!_context->_actor->isPlaying()) { debug("Sequence step ended"); start(0); } @@ -114,9 +115,9 @@ void Sequence::restart() { } void Sequence::skipToLastSubSequence() { - if (_unk && _context->getNextItemIndex() < _items.size()){ + if (_unk && _context->getNextItemIndex() < _items.size()) { int i = _items.size() - 1; - while(i >= 0 && !_items[--i]->isLeader()); + while (i >= 0 && !_items[--i]->isLeader()) {}; assert(i >= 0); _context->setNextItemIndex(i); _context->clearActionsFromActorStates(); @@ -126,7 +127,7 @@ void Sequence::skipToLastSubSequence() { } void Sequence::skipItemsTo(int index) { - for(int i = 0; i < index; ++i){ + for (int i = 0; i < index; ++i) { _items[i]->skip(this); } } @@ -167,9 +168,8 @@ void SequenceAudio::end() { void SequenceAudio::update() { if (!_sound->isPlaying()) end(); - else if (_sample <= _sound->getCurrentSample()){ + else if (_sample <= _sound->getCurrentSample()) start(0); - } } void SequenceAudio::init(int unk) { diff --git a/engines/pink/objects/sequences/sequence.h b/engines/pink/objects/sequences/sequence.h index f4c6c5a1b3..34863256f2 100644 --- a/engines/pink/objects/sequences/sequence.h +++ b/engines/pink/objects/sequences/sequence.h @@ -39,7 +39,7 @@ public: virtual void toConsole(); - Common::Array<SequenceItem*> &getItems(); + Common::Array<SequenceItem *> &getItems(); void setContext(SequenceContext *context); virtual void init(int unk); @@ -56,7 +56,7 @@ public: public: SequenceContext *_context; Sequencer *_sequencer; - Array<SequenceItem*> _items; + Array<SequenceItem *> _items; int _unk; }; diff --git a/engines/pink/objects/sequences/sequence_context.cpp b/engines/pink/objects/sequences/sequence_context.cpp index 65911ec832..200fcb416a 100644 --- a/engines/pink/objects/sequences/sequence_context.cpp +++ b/engines/pink/objects/sequences/sequence_context.cpp @@ -32,8 +32,7 @@ namespace Pink { SequenceActorState::SequenceActorState(const Common::String &name) - :_actorName(name), _index(0) -{} + :_actorName(name), _index(0) {} const Common::String &SequenceActorState::getActor() const { return _actorName; @@ -42,7 +41,7 @@ const Common::String &SequenceActorState::getActor() const { void SequenceActorState::check(int index, Sequence *sequence, bool unk) { Actor *actor = sequence->_sequencer->_page->findActor(_actorName); debug("%s %s", _actorName.c_str(), _actionName.c_str()); - if (_index != index && !_actionName.empty()){ + if (_index != index && !_actionName.empty()) { Action *action = actor->findAction(_actionName); if (actor->getAction() != action) actor->setAction(action, unk); @@ -60,7 +59,7 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer) for (uint i = 0; i < items.size(); ++i) { bool found = 0; for (uint j = 0; j < _states.size(); ++j) { - if (items[i]->getActor() == _states[j].getActor()){ + if (items[i]->getActor() == _states[j].getActor()) { found = 1; break; } diff --git a/engines/pink/objects/sequences/sequence_item.cpp b/engines/pink/objects/sequences/sequence_item.cpp index 7cc3f1b153..2d048b0b08 100644 --- a/engines/pink/objects/sequences/sequence_item.cpp +++ b/engines/pink/objects/sequences/sequence_item.cpp @@ -54,9 +54,8 @@ bool SequenceItem::execute(int index, Sequence *sequence, bool unk2) { Actor *actor; Action *action; if (!(actor = sequence->_sequencer->_page->findActor(_actor)) || - !(action = actor->findAction(_action))) { + !(action = actor->findAction(_action))) return false; - } actor->setAction(action, unk2); diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp index 430c8c2da0..37947d6e4b 100644 --- a/engines/pink/objects/sequences/sequencer.cpp +++ b/engines/pink/objects/sequences/sequencer.cpp @@ -34,8 +34,7 @@ namespace Pink { Sequencer::Sequencer(GamePage *page) - : _context(nullptr), _page(page), _time(0) -{} + : _context(nullptr), _page(page), _time(0) {} Sequencer::~Sequencer() { for (uint i = 0; i < _sequences.size(); ++i) { @@ -57,17 +56,17 @@ Sequence *Sequencer::findSequence(const Common::String &name) { } void Sequencer::authorSequence(Sequence *sequence, bool unk) { - if (_context){ + if (_context) { } - if (sequence){ + if (sequence) { _context = new SequenceContext(sequence, this); //unload array of unknown objects _currentSequenceName = sequence->getName(); sequence->init(unk); - } - else _currentSequenceName.clear(); + } else + _currentSequenceName.clear(); } void Sequencer::toConsole() { diff --git a/engines/pink/objects/sequences/sequencer.h b/engines/pink/objects/sequences/sequencer.h index c1b957b995..5f4bebde9c 100644 --- a/engines/pink/objects/sequences/sequencer.h +++ b/engines/pink/objects/sequences/sequencer.h @@ -41,7 +41,7 @@ public: virtual void toConsole(); virtual void deserialize(Archive &archive); - Sequence* findSequence(const Common::String &name); + Sequence *findSequence(const Common::String &name); SequenceActorState *findSequenceActorState(const Common::String &name); void authorSequence(Sequence *sequence, bool unk); @@ -60,8 +60,8 @@ public: SequenceContext *_context; // context array - Array<Sequence*> _sequences; - Array<SeqTimer*> _timers; + Array<Sequence *> _sequences; + Array<SeqTimer *> _timers; Common::String _currentSequenceName; GamePage *_page; uint _time; |