ScummVM API documentation
sequence.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef PINK_SEQUENCE_H
23 #define PINK_SEQUENCE_H
24 
25 #include "pink/sound.h"
26 #include "pink/objects/sequences/sequence_item.h"
27 
28 namespace Pink {
29 
30 class Sequencer;
31 class SequenceItem;
32 class SequenceContext;
33 
34 class Sequence : public NamedObject {
35 public:
36  Sequence();
37  ~Sequence() override;
38 
39  void deserialize(Archive &archive) override ;
40  void toConsole() const override;
41 
42 public:
43  virtual void init(bool loadingSave);
44 
45  virtual void start(bool loadingSave);
46  virtual void end();
47  virtual void restart();
48 
49  void forceEnd();
50 
51  virtual void update();
52 
53  virtual void skipSubSequence();
54  virtual void skip();
55 
56  void allowSkipping() { _canBeSkipped = true; }
57  bool isSkippingAllowed() { return _canBeSkipped; }
58 
59  SequenceContext *getContext() const { return _context; }
60  Sequencer *getSequencer() const { return _sequencer; }
61  Common::Array<SequenceItem *> &getItems() { return _items; }
62 
63  void setContext(SequenceContext *context) { _context = context; }
64 
65 protected:
66  SequenceContext *_context;
67  Sequencer *_sequencer;
68  Array<SequenceItem *> _items;
69  bool _canBeSkipped;
70 };
71 
72 class SequenceAudio : public Sequence {
73 public:
75  : _leader(nullptr) {}
76 
77  void deserialize(Archive &archive) override;
78  void toConsole() const override;
79 
80  void init(bool loadingSave) override;
81  void start(bool loadingSave) override;
82  void end() override;
83 
84  void update() override;
85  void restart() override;
86 
87  void skipSubSequence() override {}
88  void skip() override;
89 
90 private:
91  SequenceItemLeaderAudio *_leader;
92  Common::String _soundName;
93  Sound _sound;
94 };
95 
96 } // End of namespace Pink
97 
98 #endif
Definition: archive.h:39
Definition: str.h:59
Definition: sound.h:34
Definition: sequence_context.h:45
Definition: sequencer.h:36
Definition: array.h:52
Definition: object.h:40
Definition: archive.h:35
Definition: sequence.h:72
Definition: sequence_item.h:54
Definition: utils.h:30
Definition: sequence.h:34