PINK: returned HandlerStartPage HandlerTimerSequences

This commit is contained in:
Andrei Prykhodko 2020-06-05 19:31:50 +03:00
parent 66f880812a
commit 480d7fddbe
3 changed files with 26 additions and 15 deletions

View File

@ -147,12 +147,12 @@ static Object *createObject(int objectId) {
case kHandlerLeftClick:
return new HandlerLeftClick;
case kHandlerStartPage:
return new HandlerSequences(true, false);
return new HandlerStartPage;
case kHandlerTimer:
case kHandlerTimerActions:
return new HandlerTimerActions; // hack for Peril, but behavior is correct
case kHandlerTimerSequences:
return new HandlerSequences(false, true);
return new HandlerTimerSequences;
case kHandlerUseClick:
return new HandlerUseClick;
case kInventoryActor:

View File

@ -81,18 +81,12 @@ void HandlerSequences::handle(Actor *actor) {
Sequence *sequence = sequencer->findSequence(_sequences[index]);
assert(sequence);
if (_parallel)
sequencer->authorParallelSequence(sequence, false);
else
sequencer->authorSequence(sequence, false);
if (_startPage)
sequence->allowSkipping();
authorSequence(sequencer, sequence);
}
HandlerSequences::HandlerSequences(bool startPage, bool parallel) {
_startPage = startPage;
_parallel = parallel;
void HandlerSequences::authorSequence(Sequencer *sequencer, Sequence *sequence) {
sequencer->authorSequence(sequence, false);
}
void HandlerLeftClick::toConsole() const {
@ -173,4 +167,13 @@ void HandlerTimerActions::handle(Actor *actor) {
}
}
void HandlerStartPage::authorSequence(Sequencer *sequencer, Sequence *sequence) {
HandlerSequences::authorSequence(sequencer, sequence);
sequence->allowSkipping();
}
void HandlerTimerSequences::authorSequence(Sequencer *sequencer, Sequence *sequence) {
sequencer->authorParallelSequence(sequence, false);
}
} // End of namespace Pink

View File

@ -49,18 +49,22 @@ protected:
};
class Sequence;
class Sequencer;
class HandlerSequences : public Handler {
public:
HandlerSequences(bool startPage = false, bool parallel = false);
void deserialize(Archive &archive) override;
void handle(Actor *actor) override;
protected:
virtual void authorSequence(Sequencer *sequencer, Sequence *sequence);
protected:
StringArray _sequences;
bool _startPage;
bool _parallel;
};
class HandlerStartPage : public HandlerSequences {
void authorSequence(Sequencer *sequencer, Sequence *sequence) override;
};
class HandlerLeftClick : public HandlerSequences {
@ -91,6 +95,10 @@ private:
StringArray _actions;
};
class HandlerTimerSequences : public HandlerSequences {
void authorSequence(Sequencer *sequencer, Sequence *sequence) override;
};
} // End of namespace Pink
#endif