Skip to content

Commit

Permalink
PINK: Continue to develop Sequencer::authorSequence method
Browse files Browse the repository at this point in the history
  • Loading branch information
whitertandrek authored and sev- committed Jun 28, 2018
1 parent b4d44d8 commit d95e327
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions engines/pink/items/sequence_item.cpp
Expand Up @@ -23,11 +23,15 @@
#include <common/debug.h>
#include "sequence_item.h"
#include "../archive.h"
#include "sequence_item_leader.h"
#include "sequence_item_default_action.h"

namespace Pink {

void SequenceItem::deserialize(Archive &archive) {
archive >> _actor >> _action;
if (!dynamic_cast<SequenceItemLeader*>(this) && !dynamic_cast<SequenceItemDefaultAction*>(this))
debug("\t\tSequenceItem: _actor = %s, _action = %s", _actor.c_str(), _action.c_str());
}

const Common::String &SequenceItem::getActor() const {
Expand Down
10 changes: 7 additions & 3 deletions engines/pink/sequences/sequence.cpp
Expand Up @@ -44,13 +44,17 @@ SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
{
Common::Array<SequenceItem*> &items = sequence->getItems();
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;
}
else assert(0); // can it be ?
}
_states.push_back({items[i]->getActor()});
if (!found) {
debug(items[i]->getActor().c_str());
_states.push_back({items[i]->getActor()});
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions engines/pink/sequences/sequencer.cpp
Expand Up @@ -54,7 +54,11 @@ void Sequencer::authorSequence(Sequence *sequence, bool unk) {

if (sequence){
_context = new SequenceContext(sequence, this);
//unload array of unknown objects
_currentSequenceName = sequence->getName();

}
else _currentSequenceName.clear();
}

} // End of namespace Pink
1 change: 1 addition & 0 deletions engines/pink/sequences/sequencer.h
Expand Up @@ -45,6 +45,7 @@ class Sequencer : public Object {
SequenceContext *_context;
// unknown objects array
Common::Array<Sequence*> _sequences;
Common::String _currentSequenceName;
//timers
GamePage *_page;
};
Expand Down

0 comments on commit d95e327

Please sign in to comment.