aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorwhitertandrek2018-03-19 11:36:24 +0200
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commitb4d44d8ffc5c5d7e97d717c1d3f00d246ce3b9a8 (patch)
tree7be4096763fedd51561b68703d036bbfe652ac6f /engines
parent3e2106a1c087b2c27f961ce918ad6459670b99fa (diff)
downloadscummvm-rg350-b4d44d8ffc5c5d7e97d717c1d3f00d246ce3b9a8.tar.gz
scummvm-rg350-b4d44d8ffc5c5d7e97d717c1d3f00d246ce3b9a8.tar.bz2
scummvm-rg350-b4d44d8ffc5c5d7e97d717c1d3f00d246ce3b9a8.zip
PINK: Added SequenceActorState and SequenceContext
Diffstat (limited to 'engines')
-rw-r--r--engines/pink/handlers/handler_sequences.cpp3
-rw-r--r--engines/pink/items/sequence_item.cpp8
-rw-r--r--engines/pink/items/sequence_item.h3
-rw-r--r--engines/pink/page.cpp2
-rw-r--r--engines/pink/sequences/sequence.cpp32
-rw-r--r--engines/pink/sequences/sequence.h24
-rw-r--r--engines/pink/sequences/sequencer.cpp12
-rw-r--r--engines/pink/sequences/sequencer.h5
8 files changed, 84 insertions, 5 deletions
diff --git a/engines/pink/handlers/handler_sequences.cpp b/engines/pink/handlers/handler_sequences.cpp
index 52c9254d03..c785883210 100644
--- a/engines/pink/handlers/handler_sequences.cpp
+++ b/engines/pink/handlers/handler_sequences.cpp
@@ -34,9 +34,10 @@ void HandlerSequences::deserialize(Archive &archive) {
void HandlerSequences::initSequence(LeadActor *actor) {
initSideEffects(actor);
+
Sequencer *sequencer = actor->getSequencer();
Sequence *sequence = sequencer->findSequence(_sequences[0]); //actually we must pick random sequence
- //sequencer->authorSequence(sequence, 0);
+ sequencer->authorSequence(sequence, 0);
}
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/items/sequence_item.cpp b/engines/pink/items/sequence_item.cpp
index c0213616f3..050e1d0d4b 100644
--- a/engines/pink/items/sequence_item.cpp
+++ b/engines/pink/items/sequence_item.cpp
@@ -30,4 +30,12 @@ void SequenceItem::deserialize(Archive &archive) {
archive >> _actor >> _action;
}
+const Common::String &SequenceItem::getActor() const {
+ return _actor;
+}
+
+const Common::String &SequenceItem::getAction() const {
+ return _action;
+}
+
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/items/sequence_item.h b/engines/pink/items/sequence_item.h
index 76c81b5ab7..5cf622e115 100644
--- a/engines/pink/items/sequence_item.h
+++ b/engines/pink/items/sequence_item.h
@@ -31,6 +31,9 @@ class SequenceItem : public Object {
public:
virtual void deserialize(Archive &archive);
+ const Common::String &getActor() const;
+ const Common::String &getAction() const;
+
protected:
Common::String _actor;
Common::String _action;
diff --git a/engines/pink/page.cpp b/engines/pink/page.cpp
index 77e3bb3c06..f0bdf32ba0 100644
--- a/engines/pink/page.cpp
+++ b/engines/pink/page.cpp
@@ -68,7 +68,7 @@ void GamePage::init(bool isLoadingSave) {
//init actor which inits actions
if (!isLoadingSave) {
- for (int i = 0; i < _handlers.size(); ++i) {
+ for (uint i = 0; i < _handlers.size(); ++i) {
if (_handlers[i]->initConditions(_leadActor)){
HandlerSequences *handlerSequences = dynamic_cast<HandlerSequences*>(_handlers[i]);
assert(handlerSequences);
diff --git a/engines/pink/sequences/sequence.cpp b/engines/pink/sequences/sequence.cpp
index 54a293d391..73f1194c3c 100644
--- a/engines/pink/sequences/sequence.cpp
+++ b/engines/pink/sequences/sequence.cpp
@@ -24,6 +24,7 @@
#include "sequence.h"
#include "sequencer.h"
#include "../archive.h"
+#include "../items/sequence_item.h"
namespace Pink {
@@ -34,4 +35,35 @@ void Sequence::deserialize(Archive &archive) {
archive >> _items;
}
+Common::Array<SequenceItem*> &Sequence::getItems() {
+ return _items;
+}
+
+SequenceContext::SequenceContext(Sequence *sequence, Sequencer *sequencer)
+ : _sequence(sequence), _sequencer(sequencer)
+{
+ Common::Array<SequenceItem*> &items = sequence->getItems();
+ for (uint i = 0; i < items.size(); ++i) {
+ for (uint j = 0; j < _states.size(); ++j) {
+ if (items[i]->getActor() != _states[j].getActor()){
+ break;
+ }
+ else assert(0); // can it be ?
+ }
+ _states.push_back({items[i]->getActor()});
+ }
+}
+
+SequenceContext::~SequenceContext() {
+
+}
+
+SequenceActorState::SequenceActorState(const Common::String &name)
+ :_actor(name)
+{}
+
+const Common::String &SequenceActorState::getActor() const {
+ return _actor;
+}
+
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/sequences/sequence.h b/engines/pink/sequences/sequence.h
index 61714593db..0360f28147 100644
--- a/engines/pink/sequences/sequence.h
+++ b/engines/pink/sequences/sequence.h
@@ -30,10 +30,12 @@ namespace Pink {
class Sequencer;
class SequenceItem;
+class SequenceContext;
class Sequence : public NamedObject {
public:
virtual void deserialize(Archive &archive);
+ Common::Array<SequenceItem*> &getItems();
private:
Sequencer *_sequencer;
@@ -41,6 +43,28 @@ private:
//context
};
+class SequenceActorState {
+public:
+ SequenceActorState(const Common::String &name);
+
+ const Common::String &getActor() const;
+
+private:
+ Common::String _actor;
+ Common::String _unk; // ?state
+};
+
+
+class SequenceContext {
+public:
+ SequenceContext(Sequence *sequence, Sequencer* sequencer);
+ ~SequenceContext();
+private:
+ Sequence *_sequence;
+ Sequencer *_sequencer;
+ Common::Array<SequenceActorState> _states;
+};
+
} // End of namespace Pink
#endif
diff --git a/engines/pink/sequences/sequencer.cpp b/engines/pink/sequences/sequencer.cpp
index 5de9c8c709..4f7099fdfc 100644
--- a/engines/pink/sequences/sequencer.cpp
+++ b/engines/pink/sequences/sequencer.cpp
@@ -29,7 +29,7 @@
namespace Pink {
Sequencer::Sequencer(GamePage *page)
- : _page(page)
+ : _context(nullptr), _page(page)
{}
void Sequencer::deserialize(Archive &archive) {
@@ -47,4 +47,14 @@ Sequence *Sequencer::findSequence(const Common::String &name) {
});
}
+void Sequencer::authorSequence(Sequence *sequence, bool unk) {
+ if (_context){
+
+ }
+
+ if (sequence){
+ _context = new SequenceContext(sequence, this);
+ }
+}
+
} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/sequences/sequencer.h b/engines/pink/sequences/sequencer.h
index 93a156fa54..255f2c63ed 100644
--- a/engines/pink/sequences/sequencer.h
+++ b/engines/pink/sequences/sequencer.h
@@ -30,6 +30,7 @@
namespace Pink {
class Sequence;
+class SequenceContext;
class GamePage;
class Sequencer : public Object {
@@ -38,10 +39,10 @@ public:
virtual void deserialize(Archive &archive);
Sequence* findSequence(const Common::String &name);
- void authorSequence(Sequence *sequence, bool isFromSave);
+ void authorSequence(Sequence *sequence, bool unk);
private:
- //context
+ SequenceContext *_context;
// unknown objects array
Common::Array<Sequence*> _sequences;
//timers